blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
bc2af1aa722da80220037dcd14a8fe6194a41e3d
DennisHgj/PycharmProjects
/Machine_Learning/Util.py
UTF-8
4,773
2.625
3
[]
no_license
import numpy as np class DataUtil: naive_sets = { "mushroom", "balloon", "mnist", "cifar", "test" } """ 定义一个方法使其能从文件中读取数据 该方法接受五个参数: 数据集的名字、数据集的路径、训练样本数、类别所在列、是否乱打数据 """ @staticmethod def is_naive(name): for naive_dataset in DataUtil.naive_sets: if ...
true
870f561b4f9475664c0ccbfc1128c7ecac50e92f
ALSEDLAH/flocker
/flocker/provision/_digitalocean.py
UTF-8
15,468
2.53125
3
[ "Apache-2.0" ]
permissive
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ DigitalOcean provisioner. """ import time from functools import partial from ._libcloud import LibcloudProvisioner from ._install import ( provision, task_install_digitalocean_kernel, DIGITALOCEAN_KERNEL, task_open_control_firewall ) from ._...
true
22c9fd514e7bd4c6d7b3e9d8bd7970770e6c2ee5
OlivierArgentieri/api_ponyorm_test
/packages/bdd/src/db/tests/extension.py
UTF-8
4,475
2.65625
3
[]
no_license
from pony import orm from db.server.server import db from db.models.extension import Extension import unittest class TestExtension(unittest.TestCase): """TestExtension unitTest class.""" extension = None @staticmethod def clear_structure(dbo): """Drop each needed entities tables :pa...
true
438c8d0b56b475fb92c72cee4c23ebe0e93bfc10
alexFassone/modelling_genomics_masters
/label_method_v2.py
UTF-8
5,990
2.96875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 30 15:29:24 2019 @author: alexfassone1 """ import numpy as np import random no_hospitals = 2 ini_samples_per_hospital = 2 hospitals = [[] for i in range(no_hospitals)] random.seed(30) #create seed for random number generation #populate hospit...
true
52cf5ff7c70bbe9488698adebd11dca7731dc2f0
tim-win/botman-v3
/botman/context.py
UTF-8
671
2.671875
3
[]
no_license
from botman.db_mgmt import fetch_conversation def compile_context(channel, limit=600): """Compile context for new brain.""" context = '' records = list(fetch_conversation(channel)) print("this many records found:", len(records)) for record in records: print(f'adding record:\n{record[2]}:...
true
23d25d629c0ad8b82f7f69835bd5eff7349e36d6
jjy1132/source
/test/img_crawl.py
UTF-8
1,522
2.71875
3
[]
no_license
from urllib.request import urlopen import requests from urllib.parse import quote_plus from bs4 import BeautifulSoup as bs headers = {'User-Agent':'Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,like Gecko) Chrome/91.0.4472.124 Safari/537.36'} #네이버 이미지 검색사이트 urladdress1 = 'https://search.naver.com/sea...
true
ed68d8e3a66dd3be79e8b489255cb7c3e4a47fa2
bloobglob/AWG
/AWG_py3.py
UTF-8
6,944
3.5
4
[ "MIT" ]
permissive
# Author: Daniel Commins # Date: May 14, 2015 # Files: AWG_py3.py; SINGLE.TXT (dictionary words file) # Tested: python 2.61 (converted to python 3 compatibility using 2to3 lib) # Info: Akemi's Word Game: The game where you try and guess the computer's randomly # selected word! import sys import random #...
true
2981441c364d31293ef37c8e9301f98b87221038
alfi1/ezproxy-harvest
/ezproxy-test11_GITHUB_anonymised.py
UTF-8
3,262
3.046875
3
[]
no_license
# Get data from Ezproxy logs # Augment it with a user's school and department affiliation from Alma # Then save it to a MySQL database for subsequent reporting/analysis/visualisation # Tim Graves # University of Sussex Library # 15/11/2019 # This version of the script has any University of Sussex specific det...
true
c023c75fc66b76edb31fc9a7aef155a9329a721a
wilbertgeng/LintCode_exercise
/DP&Memorization/515.py
UTF-8
616
3.484375
3
[ "MIT" ]
permissive
"""515 · Paint House""" class Solution: """ @param costs: n x 3 cost matrix @return: An integer, the minimum cost to paint all houses """ def minCost(self, costs): # write your code here if not costs: return 0 m = len(costs) dp = [[0] * 3 for _ in range(m)...
true
5a401eccdd38939cc1da78793babff68495ba30d
ptrickr/pythonBotRT
/bot.py
UTF-8
1,114
2.671875
3
[]
no_license
# AutoRole by elptricko#1234 import discord from discord.ext import commands import asyncio bot = commands.Bot(command_prefix="+") user = discord.Member server = discord.Server client = discord.Client @bot.event async def on_ready(): print ("Le bot is oooon!") @bot.event async def on_member_join(member): r...
true
120edb85a4b8fedfbb33511f709bffd636e08d4f
travisMichael/unsupervisedLearning
/preprocess/cardiovascular.py
UTF-8
2,482
2.859375
3
[ "MIT" ]
permissive
import pandas as pd import pickle import numpy as np import os from sklearn.preprocessing import StandardScaler, RobustScaler, minmax_scale from sklearn.model_selection import train_test_split # def normalize_gender_attribute(x): # if x == 1: # return 0.0 # else: # return 1.0 def pre_process_...
true
36c872acf9528770aa6b78c1b2ebba1bc8ac4249
MikeCalabro/euler-everywhere
/Py-Solutions/Problem-40.py
UTF-8
157
3.5
4
[]
no_license
num = 1 strNum = "0" while len(strNum) < 1000010: strNum += str(num) num += 1 total = 1 for i in range(7): total *= int(strNum[10**i]) print(total)
true
78cdc7d804b5e036feeed8069e6a20a24cd5916a
heting-intesim/python-base
/基础语法/字符串案例-验证码.py
UTF-8
482
3.953125
4
[]
no_license
''' 1 产生随机验证码 2 用户输入验证码 3 匹配,输出提示信息 ''' import random code = '' letters = 'QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm0123456789' for i in range(4): # code += letters[random.randint(0,len(letters)-1)] code += random.choice(letters) print('验证码为:',code) answer = input('请输入验证码(不区分大小写):') if answer.lower()...
true
2a9275ef5108388e5e46816be5b640d5bd25f403
imsilence/actual_05_homework_mage
/01/daikai/guess_number.py
UTF-8
686
3.65625
4
[]
no_license
#encoding:utf-8 import random random_num = random.randint(0,100) print(random_num) total_num = 5 use_times = 1 while use_times <= total_num: num = int(input("请输入0-100之间的数字:")) if num == random_num: print("恭喜您猜对了,一共猜了%d次"%use_times) break elif num < random_num: print("猜小了,您还有%d次机会"...
true
85a46fee656df87f3966d4954ef1f9535d621965
SSelvakumari/selva
/code kata/countnumber.py
UTF-8
89
3.4375
3
[]
no_license
s=input() val=0 for i in range (len(s)): if(s[i].isdigit()): val=val+1 print(val)
true
186bad8dc213b86e1142c690bcf949f052fdbdfa
vertinskiy-oleg/python-for-seo
/code from lessons/5_less_if_elif_for/conditions.py
UTF-8
403
3.953125
4
[]
no_license
data = input('Enter data: ') if type(data) is int: print('Data in Integer') elif type(data) == str: print('You enter string') if data: print(f'You enter this data: {data}') else: quit() if data.isdigit(): print('This is digit') elif 'http' in data: print('This is URL') elif '.com' in da...
true
10a005f4ead3d6d2437000c5cf9588f042831f95
amaliestokholm/Conway-s-Game-of-Life
/life.py
UTF-8
2,729
3.796875
4
[]
no_license
""" This is my attempt to write Conway's Game of Life using numpy. # Conway's Game of Life Challenge https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life # Rules > Any live cell with fewer than two live neighbours dies, as if caused by under-population. > Any live cell with two or three live neighbours lives on ...
true
f5091abad39b73ea8e3935a53f623e947a65d98a
srs25121997/whatsapp_pygui
/auto.py
UTF-8
1,362
2.578125
3
[]
no_license
import pyautogui import time from pynput import keyboard from pynput.keyboard import Key, Listener print(pyautogui.size()) time.sleep(1) y=0 c = 0 x = 0 def on_press(key): try: global y print(y) y=y+1 if(y==1): global c global x print(key) ...
true
79548cbc5de76d6ffb45c4aba0bd10da44aacfdb
Wayne400/Engines
/display_engines.py
UTF-8
3,099
2.859375
3
[]
no_license
import sqlite3 from datetime import datetime def diff_month(d1, d2): """ :rtype: object """ months_apart = (d1.year - d2.year) * 12 + d1.month - d2.month day = 1 month = d2.month year = d2.year if months_apart > 1: print "*******************************************************...
true
c875a2f07b6af2fa55eb362fa4ed5886f8f5262c
rctorr/Curso-con-Python-082019
/Clase-07/Reto-03/webapp/imagen.py
UTF-8
2,124
3.234375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from wsgiref.util import FileWrapper from wsgiref.simple_server import make_server # Carpeta donde se encuentras las imágenes DIR_IMG = "img" # Función de inicio para nuestra aplicación y siempre lleva los # parámetros environ y start_response. def imagen_app(e...
true
2a6bb4e34eec56f99364503b0cb1e7f951f4f0b6
louity/scattering_transform
/scattering/scattering1d/scattering1d.py
UTF-8
25,203
2.53125
3
[]
no_license
import torch from torch.autograd import Variable import numpy as np import math import warnings from .utils import pad, unpad, real, subsample_fourier, modulus_complex from .utils import compute_padding, compute_border_indices from .utils import cast_psi, cast_phi from .utils import fft1d_c2c, ifft1d_c2c_normed from ...
true
855cda02c6da8767fb345e930dae02df804aa88b
ottokangjian/LearnPython
/FishC/004_wordgame_ifelse.py
UTF-8
409
4.09375
4
[]
no_license
import random secret = random.randint(1,10) print ("Welcome") print ("Let's guess a number") guess = input("input a number pls") guess_int = int(guess) while guess_int != secret: if guess_int == secret: print ("Bingo!") else: if guess_int > secret: print ("Too big") else: print ("Too small") gues...
true
1b0d3cbff0106b1d4ff74f6d681f4714aa7766ea
wncbb/trainWeb
/lib/sql/eqp.py
UTF-8
10,234
2.53125
3
[]
no_license
from connect import engine, session, BaseModel, init_db, drop_db from sqlalchemy import Column, ForeignKey, or_, func from sqlalchemy.types import String, Integer, String, DateTime from datetime import datetime from sensor import Sensor class Eqp(BaseModel): __tablename__='eqp' id=Column(Integer, primary_key=T...
true
9f1dbae59fdb499ece173e452648c40f7754daec
SaiSriNarne/BigDataAnalytics
/Lab-1/Image_SIFT_FE/Feature_extraction.py
UTF-8
3,316
2.59375
3
[]
no_license
# created by Sai Sri Narne on 02-22-2019 import cv2 import numpy as np import matplotlib.pyplot as plt import os print( 'OpenCV Version (should be 3.1.0, with nonfree packages installed, for this tutorial):') print( cv2.__version__) dataset_path = 'C:\BDA\CS5542_Lab\Lab1\output\water' img_building = cv2.imread( 'C:\B...
true
8eabfc7ce0cf747c6469a24f3403c762104f2f88
Daniel-Conte/Exercicios-de-Algoritmo
/Algoritmo(Python)/Alg_S3_1.py
UTF-8
231
3.78125
4
[ "MIT" ]
permissive
#inout minimo = int(input("Digite a quantidade do estoque mínimo: ")) maximo = int(input("Digite a quantidade do estoque máximo: ")) #process medio = ((minimo + maximo) / 2) #output print("O estoque médio é: {0}".format(medio))
true
4e34d4ad0cc4622a1fc9d77688be6f2fd3bb79b2
rafaelbaun/AnalyseStockData
/script.py
UTF-8
1,642
3.375
3
[]
no_license
from utils import * def display_as_percentage(val): return '{:.1f}%'.format(val * 100) amazon_prices = [1699.8, 1777.44, 2012.71, 2003.0, 1598.01, 1690.17, 1501.97, 1718.73, 1639.83, 1780.75, 1926.52, 1775.07, 1893.63] ebay_prices = [35.98, 33.2, 34.35, 32.77, 28.81, 29.62, 27.86, 33.39, 37.01...
true
4ae658ffea996f0bdedf3f055cf37af0f07b5dfb
anantguptadbl/python
/Algorithms/optimization/particleSwarmOptimization.py
UTF-8
2,911
3.25
3
[]
no_license
# Particle Swarm Optimization import random def lossFunction(x): total=0 for curDim in range(len(x)): total=total+x[curDim]**2 return(total) class Particle(object): def __init__(self,initData): self.numDimensions=len(initData) self.positionI=[] self.velocityI=[] ...
true
2329d83be4b09a909a76fd01ea91f631f76bd48e
werkkrew/skrizzbot
/skrizz/modules/markov.py
UTF-8
6,782
2.578125
3
[ "EFL-2.0" ]
permissive
""" markov.py - markov chain language module thing Copyright 2013, Bryan Chain, http://www.bryanchain.com Licensed under the Eiffel Forum License 2. """ import random import time import datetime import re import skrizz.module import redis from distutils.version import StrictVersion from skrizz.tools import Nick chai...
true
4ccd3c95012308e84cc0c8f7b3b2131d3b618854
JaylenZhang19/Leetcode
/1155. Number of Dice Rolls With Target Sum.py
UTF-8
669
2.703125
3
[]
no_license
class Solution: def numRollsToTarget(self, d: int, f: int, target: int) -> int: memo = {} def helper(nums, remain): if remain == 0 and nums == 0: return 1 if nums == 0: return 0 if remain == 0: return 0 ...
true
55f40856d6ff7756e61765b60cc8a8909eba80f9
isilanes/myeuler
/p132/p132.py
UTF-8
1,298
3.4375
3
[]
no_license
import timeit #------------------------------------------------------------------------------# def f0(k): '''Find first prime factors of R(k) repunit.''' print("--- f0 ---") def get_primes(nmax): # Sieve to find all primes up to nmax: composites = {} primes = [2] for mult...
true
f38db30e8edae85af5bf161f8f0c9e618a087bf6
lukecivantos/minesweeper
/board.py
UTF-8
2,679
3.28125
3
[]
no_license
import sys,pygame from random import sample class Board: def __init__(self, height, width, numBombs): self.board = {} self.visible = {} self.numBombs = numBombs self.height,self.width = height,width self.populateBoard(height,width) self.setBombs(numBombs) ...
true
dd9049467a60e80d3e1f1294bea9e2bf77cb46ce
kapiltiwari1411/python-lab
/kapil3fact.py
UTF-8
136
3.75
4
[]
no_license
#to find factiorial of any entered number n=int(input()) fact=1 while(n>0): fact=fact*n n=n-1 print("factorial=",fact)
true
184177855908173f3aa754defd7dcc3ce1e399bf
FluffyFu/Leetcode
/79_word_search/solution.py
UTF-8
896
3.40625
3
[]
no_license
def search(board, word): if not board: return False for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == word[0] and dfs(i, j, board, 1, word, {(i, j)}): return True return False def dfs(i, j, board, k, word, visited): if k == len(wor...
true
dd1cdbe66065b8648876b0c6193457e12aa5619e
fvutils/testsuite-runner
/src/tsr/messaging.py
UTF-8
607
3.078125
3
[ "Apache-2.0" ]
permissive
''' Created on Mar 7, 2020 @author: ballance ''' _verbosity = 0 def set_verbosity(verbosity): global _verbosity _verbosity = verbosity def get_verbosity(): return _verbosity def note(msg): print("Note: " + msg) def verbose_note(msg, verbosity=1): if _verbosity >= verbosity: pri...
true
fb5c9e329386c285892c35b7b7031d16f0f49f26
eeiyowei/PhyloPostprocessing
/tree_map.py
UTF-8
1,075
2.78125
3
[]
no_license
#! /usr/bin/env python Usage = """ tree_map.py <newick_tree> <mapping> """ from Bio import Phylo import sys import copy infile = sys.argv[1] infilecore = infile.split('.')[0] mapping = sys.argv[2] def get_mapping(infile): """Opens file with mapping info and returns dictionary""" w...
true
5998f8fceddd3ac0e86fde42620caf75637b2f33
beactivera/PythonWorld
/Wyklad/OOP/Animal.py
UTF-8
272
3.125
3
[ "MIT" ]
permissive
from Organism import Organism import random class Animal(Organism): def __init__(self, animal=None, position=None): super(Animal, self).__init__(animal, position) def move(self): self.position.x += random.randint(-1, 1) self.position.y += random.randint(-1, 1)
true
95614a677c8869868fc828a5fc3d36dea348891a
CaptainLazarus/Facial-Landmarks
/index.py
UTF-8
1,152
2.78125
3
[]
no_license
import numpy as np import cv2 import imutils import argparse import dlib from imutils import face_utils def initArgs(): parser = argparse.ArgumentParser() parser.add_argument("-i" , "--image" , required=True) parser.add_argument("-p" , "--shape" , required=True) return vars(parser.parse_args()) if __n...
true
9082aef6650d174a1ba2dd9744a2423eb788d4d7
Bawya1098/Hackerrank
/hackerrank/hackerrank/pattern/pattern_6.py
UTF-8
440
3.71875
4
[]
no_license
max_length = 9 for row in range(1, max_length + 1): star = row space_range = (2 * max_length) - 1 space_alloc = max_length / 2 no_space = space_range - star - 1 spaces = int(no_space - space_alloc) for column in range(0, star): print(row, end='') for space in range(1, spaces): ...
true
a227593933347bad241dad04ff6d137d557a3e95
dariabramenkova/python_training
/test/test_client_in_group.py
UTF-8
2,729
2.515625
3
[ "Apache-2.0" ]
permissive
from model.client import Client from model.group import Group from random import randrange import random from fixture.orm import ORMFixture import pytest orm=ORMFixture(host="localhost", name="addressbook", user="root", password="") def test_add_client_in_group(app, db): with pytest.allure.step('Given a group lis...
true
ff6b12e25b43b669c0037f55bc605b91194cdf7c
dogpi/StudyPython
/005_爬虫/003_模拟浏览器.py
UTF-8
612
2.875
3
[]
no_license
import urllib.request url = "http://www.baidu.com" # 请求头是字典格式 header = { "User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36" } # 设置一个请求体 req = urllib.request.Request(url,headers=header) # req = urllib.request.Request(url) ...
true
a8f8e9ec3dc3ca7b2e4811a0ef1468b2bdfdd34f
wbogocki/Advent-of-Code-2020
/day 16/part2.py
UTF-8
3,143
3.125
3
[]
no_license
def parse_rules(rules): parsed_rules = dict() for rule in rules.splitlines(): name, text = rule.split(":") ranges = [] for range_ in text.split("or"): low, high = range_.split("-") ranges.append((int(low), int(high))) parsed_rules[name] = ranges return...
true
40a03613d83eba73b1b03c7d9e21dc048f1460b0
GuoyingDong/Axolotl
/code/mShell.py
UTF-8
979
3.4375
3
[]
no_license
"""Creates a shell from a solid. Inputs: x: the solid sdf object t: thickness of the shell s: side factor (1: inside, 0.5: half/half, 0: outside) Output: d: the shell object (sdf)""" __author__ = ['Mathias Bernhard'] __copyright__ = 'Copyright 2018 / Digital Building Techno...
true
cb1f7494fef89e6cd83a3bbdc9883d1adf56e9e2
MarcelArthur/leetcode_collection
/48_Rotate_Image.py
UTF-8
714
3.421875
3
[]
no_license
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ # 解法 1:将矩阵沿对角线进行转置,之后沿中间列对折互换数据 # 解法 2:将矩阵沿反对角线进行转置,之后沿中间行对折互换数据 # Solution 2: n = len(matrix) ...
true
07f602d0a95049242d81ffed78019dc2aff3be6b
mariasintea/AI-labs
/lab5-aco-tsp-elitist/main.py
UTF-8
1,561
3.328125
3
[]
no_license
from math import sqrt from antColony import AntColony # read graph from file def read_data(): try: f = open("graph.txt", "r") except IOError: print("File reading error!") return [] f.readline() f.readline() f.readline() n = int(f.readline().strip().split()[1]) f.re...
true
a425cef15d73c9527108a1ef3a1a5865f78d75b1
G-Node/nix-odML-converter
/test/test_convert.py
UTF-8
2,909
2.515625
3
[ "BSD-3-Clause" ]
permissive
import datetime import os import shutil import tempfile import unittest import nixio as nix import odml from nixodmlconverter import convert document_attributes = ['author', 'version', 'date', 'repository'] section_attributes = ['name', 'oid', 'definition', 'type', 'reference', 'repository', # ...
true
6813d8a36b459521941ff1b76e49e43cda887a33
dimitar-daskalov/SoftUni-Courses
/python_fundamentals/labs_and_homeworks/09_regular_expressions_lab/01_match_full_name.py
UTF-8
145
3.15625
3
[]
no_license
import re list_of_names = input() regex = r"\b[A-Z][a-z]+\s[A-Z][a-z]+\b" matches = re.findall(regex, list_of_names) print(" ".join(matches))
true
f7a85c14688cae8fe843299d9c6bcd2d1e2672b9
Brandsma/LAMAS
/communication/communicator.py
UTF-8
2,289
2.546875
3
[]
no_license
from communication.sender import Sender from communication.receiver import Receiver from communication import log import config # Communicator can do both sending and receiving class Communicator(Sender, Receiver): def __init__(self, name, initiator): super().__init__(name) self.initiator = initi...
true
0ffc07a1d26f37b4f338586fe67d52594928f231
billysm64/python-games
/level_two.py
UTF-8
4,057
4.09375
4
[]
no_license
# Level 1: Three guesses # Level 2: User picks a number, computer has 3 guesses # Level 3: Computer's guesses are optimized to refine the range of guess e import random import time print("Tell me, the proctor, what number between 1 and 10 you want the computer to guess, and I will make the computer try and guess it. ...
true
6466200c5b0a1933c7221525296564f10aa6de40
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1/polart/countring_sheep.py
UTF-8
867
3.515625
4
[]
no_license
def calc(n): if n == 0: return 'INSOMNIA' else: numbers = set(range(10)) i = 1 while len(numbers) > 0: nn = str(n * i) i_numbers = set(map(int, nn)) numbers -= i_numbers i += 1 print 'I -- ', i - 1 return nn def ma...
true
b4913b6c8726e43b09514662323dafbc506ba960
MokriyYuriy/diploma
/lib/models/bi_lstm_discriminator.py
UTF-8
1,698
2.703125
3
[]
no_license
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class BiLSTMDiscriminator(nn.Module): def __init__(self, alphabet, embedding_size, hidden_size, alpha): super(BiLSTMDiscriminator, self).__init__() self.hidden_size = hidden_si...
true
78b1dcd8189539e0cb16fe8b44868758ec968aa8
jaabee/daily_code
/爬虫项目/三个小说网站排行榜爬取/save_data_mysql.py
UTF-8
569
2.609375
3
[]
no_license
import pandas as pd from sqlalchemy import create_engine engine = create_engine("mysql+pymysql://root:123456@localhost/novel_rank?charset=utf8") def save_mysql(path, table_name): df = pd.read_csv(path) df.insert(0, 'id', list(range(1, len(df) + 1))) df.to_sql(name=table_name, con=engine, if_exists='appen...
true
063bf11dadf8bfdfed2c6981c3cba10e7cdf86be
KonradJankowski/python-poczatek
/bieg.py
UTF-8
284
4.1875
4
[]
no_license
print("Cześć! Jestem Konrad i policzę prędkość Twojego biegu :)") distance = input("Ile kilometrów przebiegłeś/przebiegłaś?") time = input("Ile zajęło Ci to czasu (godzin)?") speed = int(distance) / int(time) print("Biegniesz z prędkością średnią: ", speed, "km/h")
true
29323e13343afb4813e4a852997176da73ff5748
shenxuehao/A-C-language-novice
/2021-1-10/test0.py
UTF-8
869
3.703125
4
[]
no_license
#需求:8个老师,三个办公室 #1.准备数据 # 8个老师-列表 3个办公室-列表嵌套 #2.分配老师办公室 # 2.1把老师的名字写入到办公室的列表--办公室列表追加老师的数据 #3.验证是否分配成功 # 3.1打印办公室的详细信息 import random teachers = ['A','B','C','D','E','F','G','H'] offices = [[],[],[]] for name in teachers: #列表追加数据 共有三个 append insert extand 不用指定位置 不用insert num = random.randint(0,2) offices[nu...
true
0756f00f9163a19c70b7c23cb511be1b850f407c
karimabedrabbo/Lumos
/machine_learning/Lumos_Scripts/color_range.py
UTF-8
5,296
2.9375
3
[]
no_license
import cv2 import numpy as np import color_utils from sklearn.cluster import KMeans # preload global functions for speed rgb2hsv = color_utils.rgb2hsv hsv2above_cup_low = color_utils.hsv2above_cup_low hsv2below_cup_low = color_utils.hsv2below_cup_low hsv2above_low = color_utils.hsv2above_low hsv2below_low = color_util...
true
75fbb32925bb713d55d1b419158ccb5764d6715f
rchiovaro/python-challenge
/PyBank/main.py
UTF-8
3,359
3.140625
3
[]
no_license
import os import csv csvpath = os.path.join('..', "Resources", "budget_data.csv") Months = [] Profit = [] ProfitChangeMonthly = [] with open(csvpath, newline="") as csvfile: csvreader = csv.reader(csvfile, delimiter=",") next(csvreader) for row in csvreader: Months.append(row[0]...
true
13d9ba293e4dcc87a58188fea889237498432cf0
joeljacobjoy14/joel_domain
/main_class.py
UTF-8
12,857
2.84375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 5 11:39:16 2018 @author: admaren01 """ from input_shipdata import readinputs import math from matplotlib import pyplot as plt class resistance_calc(object): def __init__(self): print("initiate") self.vol = None se...
true
ef280d8c393cadcd111d8348e609212ccdfb1657
bwbobbr/pycharm-xx
/py从零书本text/part 6/text6-2.py
UTF-8
114
3.84375
4
[]
no_license
num = 0 while num < 5: print('输出值:',num) num+=1 else: print('我出来了%d'%num) print('循环结束')
true
77688a609094d77a530a789e1e4846d26a1d4899
jhammarstedt/Benchmarking-DevOps
/src/benchmarking.py
UTF-8
1,326
4.28125
4
[]
no_license
import pytest # Here are some example functions to run, can of course be replaced by your own to test things out # Task: Create a list of N numbers in string format, then add all of these to one long string def turtle(n=1000000): """ Regular for loops This is an example of a slow running code, we start o...
true
3a9843f8efce413ecfec5f9b44698a66a2599a9f
Zhaozheng97/newmyproject
/day01/jineng01.py
UTF-8
733
4.15625
4
[]
no_license
#技能1 # if __name__ == '__main__': # name = input("输入你的姓名:") # sex = input("输入你的性别:") # age = input("输入你的年龄:") # print("我是{name},性别{sex},今年{age}了".format(name = name , sex = sex , age = age)) #技能2 # import math # if __name__ == '__main__': # ca = input("输入一个数字:") # a = int(ca) # math.sqrt(a)...
true
b6a210fddcdd1e1de84c018d7c214b424707e545
liuliqiu/study
/competition/euler/source/p137.py
UTF-8
494
3.25
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- from itertools import count from bisect import insort_left from Crazy import divisor def f(n): """5a^2-b^2=1 >>> f(1) 2 >>> f(2) 15 >>> f(3) 104 >>> f(4) 714 >>> f(10) 74049690 >>> f(15) 1120149658760 """ c, x, c...
true
29ae1fcc07b49f74a27da8bfa3a25b1e26252e47
Linfeikai/Arithmetic-1
/Check.py
UTF-8
410
3.171875
3
[]
no_license
class Check(object): def __init__(self): self.check = [] # 对二叉树进行判重 def check_tree(self, tree): if self.check == []: self.check.append(tree) return True else: for i in range(len(self.check)): if self.check[i] == tree: ...
true
0cbb55fd97ea4faa3c539fcfdecd9d3e271bc9b8
materialsvirtuallab/megnet
/megnet/data/tests/test_local_env.py
UTF-8
2,130
2.671875
3
[ "BSD-3-Clause" ]
permissive
import os import unittest from pymatgen.core import Molecule, Structure from megnet.data.local_env import ( AllAtomPairs, MinimumDistanceNNAll, deserialize, get, serialize, ) MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) def _equal(x, y): if isinstance(x, list): return all...
true
62f15c84a0d3e0bd275ae6bf65dead2e1311366c
youxinweizhi/uPyExplorer
/uPyExplorer/OptionValues.py
UTF-8
339
2.546875
3
[ "MIT" ]
permissive
import os class OptionValues(object): def __init__(self,usb_port:str='',path:str=os.getcwd(),isSilence:bool=True): self.usb_port=usb_port if path=='': path=os.getcwd() self.path=path self.isSilence=isSilence @classmethod def from_json(cls, data): ...
true
cbb9d87f5a13dc2cc225d1f12317ecf934c805b8
ShawnT21/Data_Structures_algorithms
/classes.py
UTF-8
1,797
4.25
4
[]
no_license
class Employee(object): numEmployee=0 def __init__(self,name,rate): self.owed =0 self.name=name self.rate=rate Employee.numEmployee += 1 def de1 (self): Employee.numEmployee-=1 def hours (self,numHours): self.owed += numHours*self.rate return ("%...
true
309ff1c6b219bbade167235fce858148cd0c655a
murane/PS
/Python/BOJ/1600.py
UTF-8
1,162
2.734375
3
[]
no_license
import sys from collections import deque r=sys.stdin.readline K=int(r()) W,H=map(int,r().split()) dx=[1,-1,0,0] dy=[0,0,1,-1] hx=[-2,-1,1,2,2,1,-1,-2] hy=[1,2,2,1,-1,-2,-2,-1] board=[] for _ in range(H): board.append(list(map(int,r().split()))) if W==1 and H==1: print(0) exit(0) visited=[[[False]*31 for _ i...
true
0f7bc1459680ba50e9ece36895150ceeb6d1d0f2
EricGronda/cmsc-classes
/201/Projects/proj2/proj2.py
UTF-8
9,547
4
4
[]
no_license
# File: proj2.py # Author: Eric Gronda # Date: 11/10/17 # Section: 06 # E-mail: gt32930@umbc.edu # Description: # Project 2: Game of Life has different "alive" and "dead" cells based on # the surrounding cells. Cells may die or live on to the next iteration # CONSTANTS ROW_MIN = 1 COL_MIN = 1 ROW = "ro...
true
a400c820623b64d361fd6f405677cf23dab89be3
zeus911/search_engine
/seo.py
UTF-8
1,135
2.78125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[28]: from collections import Counter from janome.tokenizer import Tokenizer import pandas as pd import bs4 import re import requests word_list=[] counts=pd.DataFrame() t = Tokenizer() dataset=[] def get_word(query): # query = 'テキスト' res = requests.get("URL"+ query) ...
true
5fc34852bc7e017967e43a39f6effeebadd3de6b
ShiuLab/Utilities
/overlap-calc_percent.py
UTF-8
1,524
2.578125
3
[]
no_license
#import modules import sys import fn def print_help(): print''' inp1 = bed-bed overlap file ''' def calc_percent_overlap(fl): d = {} inp = open(fl) out = open(fl+".per_over","w") for line in inp: if not line.startswith("#"): lineLst = line.strip().split("\t") sq = lineLst[0] st1 = i...
true
6a36da992ba7ceb3ae2fafb53a34a7504cd630b9
taext/powercasts
/newest.py
UTF-8
560
2.546875
3
[]
no_license
import json, re, sys with open(sys.argv[1]) as infile: rss_dict = json.load(infile) all_urls_3 = [] non_matches = [] for content in rss_dict.values(): m = re.findall('\"(http\S+?\.(?:mp3|mp4))[\"\?]', content, re.IGNORECASE) if m: for item in m: all_urls_3.append(item) b...
true
c44e90dc05a6e2bd3ae46283c9beefbcb241f40f
brentvollebregt/auto-py-to-exe
/tests/helpers.py
UTF-8
1,214
3.125
3
[ "MIT" ]
permissive
import os import platform import shutil import tempfile class PythonScriptAsFile: def __init__(self, filename, content): self.filename = filename self.content = content def __enter__(self): # Create a temporary directory self.directory = tempfile.mkdtemp() # Create th...
true
11b3e35af438542650f5a478bd67d843d390fa5c
JorgeGarRu/Modulo-Python
/CursoPython/CursoPython/Test.py
UTF-8
845
2.8125
3
[]
no_license
#import SucesionesVarias #from Videojuegos import Videojuegos # asi se importa una clase: from "Archivo.py" import "clase" #from Musica import Instrumento #from Musica import Piano #from Musica import Trompeta #from Musica import * -----> Esto lo importa todo from Ejercicios.Musica import * # -*- coding: utf-8 -*- ...
true
57f810f4d57e7fe74c086ebfbab66551ad7d7331
tlpss/ML-Project1
/test/test_implementations.py
UTF-8
2,935
3.140625
3
[]
no_license
import unittest import numpy as np from implementations import * class TestImplementations(unittest.TestCase): def setUp(self): self.w = np.array([1.3, 2.2, 1.8]) self.N = 1000 self.y, self.y_ridge, self.tX = TestImplementations.generate_dataset(self.w, self.N) @staticmethod def...
true
7d2a9b59b81ff63ae39c7edb761101b9631e85fe
isaias-rojas/NLC-Dino-Runner
/nlc_dino_runner/componets/obstacles/cloud.py
UTF-8
573
2.78125
3
[]
no_license
import random from nlc_dino_runner.utils.constants import SCREEN_WIDTH, CLOUD class Cloud: def __init__(self): self.x = SCREEN_WIDTH + random.randint(800, 1000) self.y = random.randint(50, 100) self.image = CLOUD self.width = self.image.get_width() def update(self, game): ...
true
ea4b9abeadbe606c7ff124bd6b8c72ad03e3e82a
rainbartown/rl4robot
/rl4robot/common/activation.py
UTF-8
827
2.65625
3
[]
no_license
from typing import Dict, Literal, Type, Union import torch.nn as nn __all__ = [ "ActivationName", "ActivationModule", "get_activation_module", ] ActivationName = Literal[ "sigmoid", "tanh", "softplus", "relu", ] ActivationModule = Union[ nn.Sigmoid, nn.Tanh, nn.Softplus, ...
true
6c542af85d2c1baf741e323fdd2958b0bd6b055d
pengsida/collections
/NMS/nms.py
UTF-8
902
3
3
[]
no_license
# reference: https://arvrjourney.com/human-pose-estimation-using-openpose-with-tensorflow-part-2-e78ab9104fc8 import numpy as np from scipy.ndimage.filters import maximum_filter def nms_2d(hough_space, wsize=40): """ Algorithm: 1. construct a window with a size of wsize x wsize 2. start in the ...
true
450af11c123fba92618cd2acb9f27ae9852104ce
tundecmd/AirBnB_clone_v3
/api/v1/views/states.py
UTF-8
1,747
2.890625
3
[]
no_license
#!/usr/bin/python3 """ View State """ from models import storage from models.state import State from api.v1.views import app_views from flask import Flask, jsonify, abort, request @app_views.route("/states", methods=["GET"]) def statesAll(): """Retrieves all states with a list of objects""" ll = [] s = st...
true
fd111e7a6eee85403702a153eeedb77d066af871
theguyoverthere/CMU15-112-Spring17
/src/Week9/Homework/testFriendOfFriends.py
UTF-8
916
3.078125
3
[]
no_license
from src.Week9.Homework.friendsOfFriends import friendsOfFriends from unittest import TestCase class TestFriendOfFriends(TestCase): def test_FriendOfFriends(self): d = dict() d["fred"] = set(["wilma", "betty", "barney", "bam-bam"]) d["wilma"] = set(["fred", "betty", "dino"]) d["bet...
true
c57c09c1f42ad3113b89da1df9c934581152da79
hyperledger/aries-cloudagent-python
/aries_cloudagent/messaging/decorators/tests/test_localization_decorator.py
UTF-8
1,336
2.671875
3
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
permissive
from ..localization_decorator import LocalizationDecorator from unittest import TestCase class TestThreadDecorator(TestCase): LOCALE = "en-ca" LOCALIZABLE = ["a", "b"] CATALOGS = ["http://192.168.56.111/my-project/catalog.json"] def test_init(self): decorator = LocalizationDecorator() ...
true
a783ef73ef92ebee18e271fd158e0b93fde088a8
TaylorCooper/A2_SyringePump
/main.py
UTF-8
5,237
3.28125
3
[]
no_license
""" Author: Taylor Cooper Description: Load a recipe file and run basic recipes for injecting and extracting. Date Created: Aug 20, 2014 2:16:50 PM Arguments and Inputs: Recipe File: cycles = int, number of cycles dia = float, in...
true
7aa750ab71176e1d6c0418b75e4c1a2633c780dd
MerajBighamain/python_projects-1
/sum_list_daul.py
UTF-8
176
3.625
4
[]
no_license
def sum_list(my_list): total=0 for i in range(0,len(my_list)): for j in range(0,len(my_list[i])): total+=my_list[i][j] return total
true
38a74473c0e9a86144f8d17bb0b98b12ff33c450
philliskiragu/hackerrank-challenges
/palindrome_index.py
UTF-8
477
3.484375
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT T = int(raw_input().strip()) def palindrome_index(word): X = len(word) while X <= 100000 + 5 and X >= 1: if word == word[::-1]: return -1 else: if word[1] == word[-1]: return 0 ...
true
81ee6afb4abd72bd748e6d6244f0952ccfa73202
webgev/bitrate
/rate/__init__.py
UTF-8
1,417
3.015625
3
[]
no_license
import urllib import json from datetime import datetime, timedelta URL = 'https://api-pub.bitfinex.com/v2/candles/trade:1D:t{currency}USD/hist?start={start}&end={end}' def get_rate(currency): """ Вернет информацию по валюте по api bitfinex """ result = [] headers = { 'content-type': ...
true
562bd653163c4b57a67f80dd1533ee9a718961c9
fetchniches/pythonStaff
/RC2020/globalvars.py
UTF-8
338
2.734375
3
[]
no_license
from typing import Any def init_vars(): global vars_dict vars_dict = {} def get_var(key: str): try: return vars_dict[key] except KeyError: return None def set_var(key: str, val: Any): try: return vars_dict[key] except KeyError: vars_dict.setdefault(key, val) ...
true
089e7498eb253075b21af5c7648e7e4527adb005
seanzhang-zhichen/fasttext_classify
/data_process/data_process.py
UTF-8
3,400
2.6875
3
[]
no_license
import os import json import pandas as pd import numpy as np from tqdm import tqdm from collections import Counter def extract_three_cls_data(data_path,save_path, txt_save_path): map_path = './base_fasttext/data/three_class/map.json' data = pd.read_csv(data_path, sep='\t') cls_data = data[(data['label'] ==...
true
52ffb47d20b9fbfd8ec86f2ea2be2694bc8b2ef5
thrastarson/algos
/search_epi.py
UTF-8
3,431
4.0625
4
[ "Apache-2.0" ]
permissive
import bisect #bisect provides binary search functions assuming input #is a sorted list. #bisect.bisect_left(a, x) returns the index of the first entry that #is greater than or equal to the targeted value x. def bin_search(A, k): ''' Binary search, iterative. Returns the index of an element with value k o...
true
2431981a1e6feaf4fdfbeee95aa5af5d3a53d6fc
jonasmzsouza/python-nano-course
/08ManipulateFiles/WriteFile.py
UTF-8
183
2.78125
3
[]
no_license
with open("./files/file-test.txt", "w") as file: file.write("Creating a file has never been easier.") with open("./files/file-test.txt", "a") as file: file.write("\n...Continue")
true
9e338bb79136225316b41147f3d8a646f1c26187
byKakayo/mineracao
/codbrucce.py
UTF-8
2,613
2.5625
3
[]
no_license
# Lendo .pdb pdb_file = {} with open('5rgk.pdb', 'r') as f: for line in f: line = line[:-1] print(len(line), line) tipo = line[:10] print(tipo) if 'HEADER' in tipo: idk = line[10:50].strip() data = line[50:62].strip() codigo = line[62:].s...
true
94c02aaf9980d9af8bf4d13705e93275ed4c884d
DrmDjo/T2A3
/temp.py
UTF-8
123
2.578125
3
[]
no_license
import google_translate text = "You are an idiot" translation = google_translate.get_translation(text) print(translation)
true
3656610ff3ab5d8160e2422d4aa1f62170641b96
wk15927041268/wk
/LAB1.py
UTF-8
2,190
2.90625
3
[]
no_license
# coding:utf-8 import os import numpy as np import matplotlib import matplotlib.pyplot as plt a0 = [] a1 = [] a2 = [] a3 = [] a4 = [] a5 = [] a6 = [] a7 = [] a8 = [] a9 = [] numb = 0#记录总个数 filename = 'magic04.txt' with open(filename, 'r') as file_to_read: while True: lines = file_to_read.readline() ...
true
1bd40ea62252728aaf6cf347d57109beb19b0e80
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
/students/Cracolici_Jon/lesson08/test_circle.py
UTF-8
2,642
4.03125
4
[]
no_license
# Jon Cracolici # UW- Python Cert # Lesson 08 - Circle Class Testing Suite # Import statements from Circle import Circle import math import unittest class Test_circle(unittest.TestCase): """The class of unittests for the Circle Class Exercise.""" # Property Tests - Tasks 1-3 def test_init(self): ...
true
41e2dd718da9f16f305b466730187aa05147ca6d
jesusmares82-hub/contador_de_palabras_python
/poligono.py
UTF-8
475
3.34375
3
[]
no_license
class Poligono: def __init__(self, numero_lados='', b='', h=''): self.numero_lados = numero_lados self.lados = [] def leer_lados(self): while True: lado = float(input(">")) self.lados.append(lado) if len(self.lados) >= self.numero_lados: ...
true
07e367dd336fede0ebcc754a8b6851a77988d2cd
Anthonina/lesson1
/hello.py
UTF-8
79
3.046875
3
[]
no_license
name = 'Антонина' print('Привет, ' + name + '! Как дела?')
true
affc157076f2848a2938ef008246cae201cd722e
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/agc028/B/3685983.py
UTF-8
426
2.953125
3
[]
no_license
n = int(input()) a = list(map(int, input().split())) ret = 0 mod = int(1e9) + 7 def inv(x): return pow(x, mod - 2, mod) inv_memo = [inv(i) for i in range(1, n+1)] cum = [0] * (n + 1) for i in range(n): cum[i + 1] = (cum[i] + inv_memo[i]) % mod for i in range(n): ret += (cum[n - i] +...
true
6d1a51aa335fd48209d7811fd082453d54eb9665
sfuphantom/phantom-dashboard
/backend/recordTypes.py
UTF-8
1,226
2.734375
3
[]
no_license
from sqlalchemy import Column, String, Integer, DateTime from sqlalchemy.dialects.postgresql import JSONB from base import Base import datetime class Dashboard_DAQ(Base): """ This class defines the schema of the record that is stored in the database id: Integer (Primary Key), Incremented index (auto-gene...
true
3f2bdddb29b9f9182c1699ead3eaae5099536a19
jadesym/interview
/leetcode/1221.split-a-string-in-balanced-strings/solution.py
UTF-8
493
2.734375
3
[]
no_license
class Solution: def balancedStringSplit(self, s: str) -> int: splitCount = 0 lCount = 0 rCount = 0 for char in s: if char == "R": rCount += 1 elif char == "L": lCount += 1 else: pass if l...
true
6935535650f7c95c7a81272da75a4b9dbdbf82c9
slochower/openforcefield
/examples/conformer_energies/conformer_energies.py
UTF-8
5,743
2.53125
3
[ "MIT" ]
permissive
import argparse from openforcefield.topology import Molecule, Topology from openforcefield.utils import RDKitToolkitWrapper from rdkit.Chem import rdMolAlign import numpy as np from simtk import openmm, unit def compute_conformer_energies_from_file(filename): # Load in the molecule and its conformers. # Note t...
true
fec89f0a2110fc135f3d208c67b582ff2999326a
s3rgiosan/HtmlValidator
/HtmlValidator.py
UTF-8
1,332
2.625
3
[]
no_license
# -*- coding: utf-8 -*- ''' W3C HTML Validator Sublime Text 2 plugin to validate HTML using the W3C Markup Validation Service. @version 1.0.0 @author Sérgio Santos @email me@s3rgiosan.com @url http://s3rgiosan.com ''' import sublime, sublime_plugin, os # Execute the HTML Validator when a file is sa...
true
1b6d09a9a89df09d05332297c77be3b17fb2e43e
mehulchopradev/divya-python-core
/math_set.py
UTF-8
140
3.03125
3
[]
no_license
m1 = [1, 3, 5, 10] m2 = [3, 6, 5, 4] # common set of pointers commons = [] for a in m1: if a in m2: commons.append(a) print(commons)
true
3b6b1eafbfa873f194fd7e6ab1517f396e39ac07
rokura-sys/MetadataTool
/ckextractor/helpers/misc.py
UTF-8
185
3.0625
3
[]
no_license
async def progress_call(current: int, total: int, message, action: str): percent = int(current/total*100) nmessg = f'{action}\nprogress = {percent}%' message.edit(nmessg)
true
3a40b6f59c1e1dff91d316599499a4e0b30ac149
APVGITHUB/TDF-SARUS
/TDF-Vision/opencv_detection/boundingbox_v2.py
UTF-8
1,721
2.640625
3
[]
no_license
import cv2 import matplotlib.pyplot as plt import numpy as np img = cv2.imread('./images/cow_dataset/thermal_imgs/left0767.jpg') #La camara RGB va adelantado 1 frame respecto a la termica cop = img.copy() original = cv2.imread('./images/cow_dataset/rgb_imgs/left0767.jpg') # cv2.imshow('image', img) # cv2.waitKey() img...
true