blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
96f481ddd9b680288f9231bfdb4eebfb5ac0c007
Python
MirrorrorriN/leetcode
/python/leetcode_151.py
UTF-8
640
3.625
4
[]
no_license
class Solution(object): def reverseWords(self, s): """ :type s: str :rtype: str """ # can use function s.strip() instead start=0 while(s[start]==' '): start+=1 end=len(s)-1 while(s[end]==' '): end-=1 s=s[sta...
true
f1d299b3942e4b0cc02425381d105ee6e41d492f
Python
ezorfa/Programming-Concepts
/Event Driven Programming.py
UTF-8
884
4.09375
4
[ "MIT" ]
permissive
# Example of a event driven programming using a small applicaiton: Chat Bot! # Author: Mohammed Afroze class MessageBot: def __init__(self): self.callbacksDict = {} self.registerCallback("Hi", self.respond_to_hi) # Define the function self.registerCallback("Hello", self.respond_to_hello) # Define the fun...
true
f78f73cfb1a25b95a5bf0c7f9d6928a1968c7bea
Python
ZumeITInc/Shiva
/loops001.py
UTF-8
186
3.203125
3
[]
no_license
x=[1,2,3] for n1 in x: pass s1='swing' for l1 in s1: if l1=='s': continue print(l1) s2='sweet' for l2 in s2: if l2=='e': break print(l2)
true
602df01b6acbe6ec828a669a19365de28e2aee9f
Python
FC-TRONTO/raspi_FcTronto
/motorContl.py
UTF-8
24,074
2.609375
3
[]
no_license
# coding: UTF-8 from serialCom import SerialController import time from enum import Enum from debug import ERROR, WARN, INFO, DEBUG, TRACE import os import ConfigParser # ボール保持状態用列挙型 class BallStateE(Enum): HAVE_BALL = 0 NOT_HAVE_BALL = 1 # モータ制御用クラス class MotorController: #移動アルゴリズム切り替え用変数 DEBUG_SHOO...
true
1ee9b70e72095cefe57b74b959e3d3239b02d936
Python
alexZajac/muzero_experiments
/Minimax_alpha_beta/board.py
UTF-8
8,908
3.5
4
[]
no_license
import os import math from copy import deepcopy from utility import * RED = '\033[1;31;40m' RED_BG = '\033[0;31;47m' BLUE_BG = '\033[0;34;47m' YELLOW = '\033[1;33;40m' BLUE = '\033[1;34;40m' MAGENTA = '\033[1;35;40m' CYAN = '\033[1;36;40m' WHITE = '\033[1;37;40m' # make an empty board def initializeB...
true
2f9b02fb741d112553df5db19714c6c7cf2c79a3
Python
TarosGitHub/ImageProcessingLab
/Algorithm/src/test_ImageProcessing.py
UTF-8
4,310
2.84375
3
[]
no_license
import unittest import os import ImageProcessing as ip IMG_DIR = '../img' COLOR_IMAGE_PATH = '../../SIDBA/Color/Lenna.bmp' COLOR_IMAGE_HEIGHT = 256 COLOR_IMAGE_WIDTH = 256 GRAYSCALE_IMAGE_PATH = '../../SIDBA/Mono/LENNA.bmp' GRAYSCALE_IMAGE_HEIGHT = 256 GRAYSCALE_IMAGE_WIDTH = 256 class TestImage_init(unittest.TestCas...
true
937908b6270e0225d3b3f64334dbb5e08a988118
Python
davclark/mrFiles
/server_code/mrFiles_file.py
UTF-8
5,709
2.640625
3
[ "Apache-2.0" ]
permissive
# This class should never know anything about network connections, the web, etc. from tables import openFile, Leaf, Group import numpy from time import ctime class local_h5_repos: """A class to manage an actual local repository I want to guarantee that methods always return properly, but this may not be ...
true
479cd76e6b120e5bd03ad50ffab7c8535f651d2c
Python
SofiiaShumel/flask_heroku_project
/root/forms/category.py
UTF-8
326
2.578125
3
[]
no_license
from wtforms import StringField, Form, IntegerField from wtforms import validators class CategoryForm(Form): category_name = StringField('Name: ', [ validators.DataRequired(), validators.Length(min=4, max=30)]) amount = IntegerField('Amount: ', [validators.NumberRange(min=0, max=1000...
true
5831499c6eb6f4334b4791a07e34c2fedaabd2d0
Python
chenglusong/crawler
/server/strategy/commonFunction.py
UTF-8
193
3.078125
3
[]
no_license
#coding=utf-8 # 数组去重# def removeDuplicates(array): news_array=[] for m in array: if m not in news_array: news_array.append(m) return news_array
true
50a2b717a5a213c09796f2c771d3d76c6fbacaf2
Python
WhackingCheese/Kattis-Problems
/problems/hkio.py
UTF-8
309
2.953125
3
[]
no_license
n = int(input()) r = [int(x) for x in input().split()] start = 0 finish = 0 s = False v = max(r) for i in range(n): if r[i] == v: if not s: s = True start = i else: if s == True: finish = i-1 break s = False print(start, finish)
true
6b95fa58b3d9d7eb5b14b23a4d16d20b0c9a8e38
Python
kwura/python-projects
/Foundations of Programming/good_logic1.py
UTF-8
684
3.3125
3
[]
no_license
def fix_teen(n): if n ==13 or n == 14 or n == 17 or n ==18 or n ==19: n = 0 return n def no_teen_sum(a, b, c): a = fix_teen(a) b = fix_teen(b) c = fix_teen(c) return a + b +c import math, random def count_double(st): index = 0 count = 0 switch = True while(index < (len(st) - 1)): if(switc...
true
74c2ae8c4682b00c492a44481574bc98656741a4
Python
fdantas78/machine_learning
/src/IrisDataAnalysis.py
UTF-8
1,968
3.0625
3
[]
no_license
''' Created on Nov 27, 2017 @author: fernando ''' import pandas from pandas.tools.plotting import scatter_matrix import matplotlib.pyplot as plt from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score ...
true
5e0a3a3f4c19ac1570bd9ca93f732c41c8460aec
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2702/60627/238865.py
UTF-8
131
2.84375
3
[]
no_license
# 7 grid = [] grid.append(input()) grid.append(input()) grid.append(input()) grid.append(input()) grid.append(input()) print(grid)
true
f7820caed225397ef3963dbad32ca7ed205a2a6e
Python
daniel-reich/ubiquitous-fiesta
/YK9fWNBbRJ9PEc4wR_20.py
UTF-8
59
2.765625
3
[]
no_license
def tuck_in(lst, lst2): return [lst[0]]+lst2+[lst[-1]]
true
44917edc7236544be8da0f7d9c105809d99b8731
Python
salvador-dali/algorithms_math
/training/02_number-theory/07_manasa-loves-maths.py
UTF-8
1,334
3.40625
3
[]
no_license
# https://www.hackerrank.com/challenges/manasa-loves-maths # the number is divisible by 8 only if the last 3 numbers are divisible by 8 # so create a list of hashes of all possible numbers from 1 to 1000 which are divisible by 8 # then create the hash2 of the number and check whether at least one of the hashes in a lis...
true
fdd73382ada6934571f058b64184068510295f23
Python
Bunzi14/C200
/mguesspartial.py
UTF-8
1,673
3.546875
4
[]
no_license
from tkinter import * import random as rn window = Tk() window.geometry('350x350') window.title("C200") x = rn.randint(0,100) y = rn.randint(0,100) correct, incorrect = 0,0 total = 0 myLabel = Label(window, text="{0}+{1}=".format(x,y), font=("Arial Bold", 15)) myLabel.grid(column=0, row=0) myLable2 = La...
true
e03d2273472e9d370c110a666f129f77b0895a8f
Python
elpiniki/pythonista
/test3.py
UTF-8
374
3.765625
4
[]
no_license
#why it does not work? def invert(param): """This function inverts the contents of the array""" i = 1 l = len(param) while i<l: head = [param[0]] tail = param[1:l] param = tail + head i = i + 1 break return param if __name__ == "__main__": d1 = ["a", "dog", "plays", "with", "othe...
true
98bc7c27b15b813175eb24bf0dd7cf43c89ab1ff
Python
lateotw/hacker_rank
/florist.py
UTF-8
821
3.46875
3
[]
no_license
n, k = list(map(int, input().split())) # n=number of flowers, k=people cost = list(map(int, input().split())) # cost of each flower def price(n, k, cost): price = 0 cost = sorted(cost, reverse=True) # print(cost) go_around = n // k # go around the people for j in range(go_around): # for each ...
true
a69abad48e14e411be524d3e83ccbc1874bf93a8
Python
atimms/ratchet_scripts
/scripts/cherry_single_cell_hu1_test_ub60_0817.py
UTF-8
1,602
2.84375
3
[]
no_license
#!/usr/bin/env python import numpy as np import sys import os ##parameters delim = '\t' ##working dir working_dir = '/data/atimms/cherry_single_cell_0717/hu1_test' os.chdir(working_dir) def transpose_file(infile, outfile): with open(infile, 'r') as file, open(outfile, 'w') as final: #make list for each line a =...
true
3bb6649505d3902d8f8aaad8c31aa594b0bb9016
Python
zoulala/exercise
/leetcode/BT_ismirror.py
UTF-8
886
3.796875
4
[]
no_license
""" 给定一个二叉树,检查它是否是镜像对称的。 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。 1 / \ 2 2 / \ / \ 3 4 4 3 但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的: 1 / \ 2 2 \ \ 3 3 """ # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # ...
true
541f45b9a950a2a5cbdfde007792bb7da141dd50
Python
StanislavYermolenko/ITEA_HW
/ITEA_HW/hw6/hw6_4.py
UTF-8
272
3.59375
4
[]
no_license
while True: try: y = int(input('input a year: ')) except ValueError: print('its not a number') exit(1) if y % 4 != 0 or (y % 100 == 0 and y % 400 != 0): print('its not a leap year') else: print('this is leap year!')
true
38dc0769e81c00506850b6812bccc8a5ce792e44
Python
payton1004/ml_articles
/mlmastery/Develop_a_Neural_Network_for_Banknote_Authentication/kutils/analysis/boxplot.py
UTF-8
1,852
2.796875
3
[]
no_license
import math import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns import matplotlib.pyplot as plt from kutils.analysis import GeneralPlotUtils from functools import partial class Utils(GeneralPlotUtils): def __init__(self, data, figsize=(2...
true
aaf41ebd81c1a783f827d929549430a87da18ee7
Python
HaleySchuhl/hsi_toolkit_py
/signature_detectors/ace_detector.py
UTF-8
1,708
2.546875
3
[ "MIT" ]
permissive
import sys sys.path.append('../util/') from img_det import img_det import numpy as np def ace_detector(hsi_img, tgt_sig, mask = None, mu = None, sig_inv = None): """ Squared Adaptive Cosine/Coherence Estimator Inputs: hsi_image - n_row x n_col x n_band hyperspectral image tgt_sig - target ...
true
552f2ab7f34e84c161b8f52a2606c73c284a4be5
Python
Matt-Lemcke/Spotify-Buttons
/Spotify_Buttons.py
UTF-8
470
2.671875
3
[]
no_license
#Run module to use the arduino to interact with spotify import serial import time import pyautogui ArduinoSerial = serial.Serial('com3',9600) time.sleep(2) while 1: incoming = str (ArduinoSerial.readline()) print incoming if 'pause' in incoming: pyautogui.typewrite(['space'], 0.2) ...
true
530015afac06b4ad588051ef5ff4831c6dd14d52
Python
Mipanox/GPI_stuff
/codes/opt.py
UTF-8
12,176
2.578125
3
[]
no_license
""" Codes for simulator of optics. Fourier optics for APLC optical path in 4 bands: - Primary/secondary mirror - Apodizer and gratings - Focal plane mask - Lyot stop Bands: - Y band : 1.02 um - J band : 1.22 um - H band : 1.65 um - K band : 2.19 um // Note: APLC stands for "Apodized Pupil Lyot Coronagraph" ...
true
072c250af7eb694f365aad080c0dd672a9dad42a
Python
Someshwaran/Python-Basics
/python-samples/hackerrank-solved/captilized.py
UTF-8
566
3.359375
3
[]
no_license
def main_m(string): sp_stirng = string.split(' ') for st in sp_stirng: print(st,end=' -- ') #ending of the list length = len(sp_stirng) print('length ',length) print(sp_stirng[0],' end ',sp_stirng[length-1]) np_string = sp_stirng[0].capitalize() for index in range(1,len...
true
394cf4f6c1e5a70d01b62a2b052ab388c5afa763
Python
jerrycmh/leetcode
/Search/39_Combination_Sum.py
UTF-8
686
2.859375
3
[]
no_license
class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ def dfs(cur_list, res): if sum(cur_list) == target: if sorted(cur_list) not in res:...
true
261686f7d4443ed80ae986ff3d40b529e90b07aa
Python
komo-fr/AtCoder
/others/diverta2019/c/main.py
UTF-8
744
3.1875
3
[]
no_license
#!/usr/bin/env python3 N = int(input().split()[0]) s_list = [] a_list = [] b_list = [] ab_list = [] ab_count = 0 for _ in range(N): s = input() s_list.append(s) ab_count += s.count("AB") if s[0] == "B" and s[-1] == "A": ab_list.append(s) elif s[0] == "B": b_list.append(s) elif s...
true
b916aa9806eb1a6c567aef7b4708839c9700a922
Python
cadizm/euler
/euler/grid/grid.py
UTF-8
3,169
3.21875
3
[]
no_license
#!/usr/bin/env python def print_grid(N): for i in range(1, N * N + 1): print '{0:4d}'.format(i), if i % N == 0: print class Grid(): def __init__(self, N, G): self.N = N self.buf = [i for i in G] def neighbors(self, start): 'Neighbors w/ distance <= 3'...
true
ee454b1609e2fe090b76bf0383834c6e7aa800a2
Python
sudharkj/cs575
/proj04/src/analyze_results.py
UTF-8
2,647
2.9375
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # load the dataframe df = pd.read_csv('../data/results.csv') # simulation types sim_types = [ 'SIMD alone', '1 core alone', '2 core alone', '4 core alone', '8 core alone', 'SIMD + 1 core', 'SIMD + 2 core', 'SIMD ...
true
049b2931586761e0bc7c11e561433ff0ca613571
Python
findimue/hello-world
/Rochambeauifelse.py
UTF-8
1,650
3.578125
4
[]
no_license
PlayerOne = raw_input("Rock, paper, scissors? ").lower() PlayerTwo = raw_input("Rock, paper, scissors? ").lower() x = ('rock') y = ('paper') z = ('scissors') if PlayerOne == x: if PlayerTwo == x: print("Draw.") else: if PlayerOne == y: if PlayerTwo == y: pr...
true
26df285752aa4894d9c0bcae1b2b3666afe8e7fc
Python
zenrandom/waveshare-eink
/BW-2.7HAT/loader.py
UTF-8
1,089
2.96875
3
[]
no_license
## author @zenrandom # based on code: Yehui from Waveshare ## import epd2in7 import Image import ImageFont import ImageDraw import os, fnmatch def main(): epd = epd2in7.EPD() epd.init() imagefile= raw_input("Please name the file you want to draw to screen (for a list of files in the current direct...
true
5ce17c5bd9f6db884c5a58d66a3b5ee883d3e48c
Python
Darkaken/PM-Project
/Code/functions.py
UTF-8
7,183
3.375
3
[]
no_license
import os from statistics import mean ############################## Important Activity Definition ################################# los_jinetes = ["Puncture", "Guidewire install", "Remove trocar", "Advance catheter", "Remove guidewire"] los_jinetes += ["Widen pathway", "Remove syringe"] ############################...
true
24339b6a0ee9f5fd17e72d69f612568b9fb5a87c
Python
AndrewAct/DataCamp_Python
/Introduction to Deep Learning with Keras/2 Going Deeper/06_Training_on_Dart_Throwers.py
UTF-8
684
3.265625
3
[]
no_license
# # 8/9/2020 # Your model is now ready, just as your dataset. It's time to train! # The coordinates features and competitors labels you just transformed have been partitioned into coord_train,coord_test and competitors_train,competitors_test. # Your model is also loaded. Feel free to visualize your training data or m...
true
a63b1fbcf275a140311046621ab0f684933161b5
Python
rajeshnainala/Rajeshpycharrm
/letusc_chapter1/Student Marks.py
UTF-8
832
3.484375
3
[]
no_license
student_name=("enter the student name") maths=int(input("enter the marks obtained in maths")) science=int(input("enter the marks obtained in scienc")) social=int(input("enter the marks obtained in social")) english=int(input("enter the marks obtained in english")) hindi=int(input("enter the marks obtained in hindi")) ...
true
d587a103613155912226a60848dafe4de46aaa5c
Python
gary-robotics/ros_visnav_slam
/src/pub_node_py.py
UTF-8
456
2.734375
3
[]
no_license
#!/usr/bin/env python import rospy from std_msgs.msg import String def main(): pub = rospy.Publisher('py_pub_hello', String, queue_size=1000) rospy.init_node('pub_node_py', anonymous=True) rate = rospy.Rate(2) # 2hz loopCount = 0 while not rospy.is_shutdown(): loopCount += 1 hello_...
true
a4014f6121b927fabecd4c4f497f67222829aa4f
Python
nagasudhirpulla/wrldc_temp_monitoring
/tests/services/test_deviceDataFetcher.py
UTF-8
523
2.875
3
[ "MIT" ]
permissive
import unittest from src.services.deviceDataFetcher import fetchDeviceCurrentData class TestFetchDeviceData(unittest.TestCase): def test_run(self) -> None: """tests the function that fetches the current device data """ ip = '10.2.100.72' devData = fetchDeviceCurrentData(ip) ...
true
4581141b8405258f13658250ce44f340d61bef0e
Python
oscarknagg/ray
/python/ray/serve/pipeline/common.py
UTF-8
704
2.671875
3
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
permissive
from enum import Enum from pydantic import BaseModel, PositiveInt class ExecutionMode(Enum): LOCAL = 1 TASKS = 2 ACTORS = 3 def str_to_execution_mode(s: str) -> ExecutionMode: if s in ["local", "LOCAL"]: return ExecutionMode.LOCAL elif s in ["TASKS", "tasks"]: return ExecutionMo...
true
71bfa757c845f2896c6064bdd1527857e9bf30aa
Python
Greens-Theorem/Green-Pastures
/reversedarraybeginner.py
UTF-8
118
3.96875
4
[]
no_license
arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] index = len(arr) while index > 0: index -= 1 print(arr[index])
true
d498bc9733ef5919e96575cbb94d384501c2b9d1
Python
yf-z/CSCI-5525
/hw1/naiveBayesGaussian.py
UTF-8
1,885
2.734375
3
[]
no_license
import numpy as np # LDA class naiveBayesGaussian: def __init__(self, k): self.pi = np.array([]) self.mu = np.array([]) self.sigma = np.array([]) self.w_k = np.array([]) self.k = k def fit(self, X, y): self.sigma_all = np.zeros((X.shape[1], X.shape[1])) ...
true
fc01b39a1938934203653e14fbf9801756079459
Python
MasonJoran/U4L1
/Doggiedaycare.py.py
UTF-8
1,667
3.9375
4
[]
no_license
# The following is a list of dogs currently at Doggie Daycare dogs = ['Skye','Mabel','Lassie','Buttercup'] # Do not change any of the code above this line! # Write a line of below to print out the list of dogs currently at daycare print('-'*65) print() print() print('These dogs are currently at the daycare!:...
true
8d3031fbecbf8d61456c7db5397d0db9df78a071
Python
tanshaojun/tsj-soa
/pythonpro/python/my/ceshi/ceshi2.py
UTF-8
397
2.734375
3
[]
no_license
import requests from bs4 import BeautifulSoup url = 'http://www.baidu.com.cn/s?wd=区块链开发&pn=' wbdata = requests.get(url).text soup = BeautifulSoup(wbdata, 'lxml') news_titles = soup.select("div#3001") for table in news_titles: tr = table.findAll('a') for t in tr: print(t) print("----------------...
true
6cd96883da30517767db9dcbcf709540095f1d18
Python
necrop/htclassifier_build
/bayes/senseparser/keywordsfilter.py
UTF-8
3,156
2.625
3
[]
no_license
import os from stringtools import porter_stem class KeywordsFilter(object): stopwords = set() stopcitations = set() stoptitlewords = set() stoplabels = set() def __init__(self, **kwargs): for k, v in kwargs.items(): self.__dict__[k] = v def filter_keywords...
true
40232311941a7d6a6b7f4309b0d959fe15917820
Python
moonstar-x-edu/cc1002-fcfm
/Ejercicios/Semana 02/main.py
UTF-8
624
3.875
4
[]
no_license
import triangulo #importar modulo triangulo #pedir valor de lados al usuario. print "Inserte valores de los lados de su triangulo:" a = input() b = input() c = input() #calcular perimetro y area. perimetro = triangulo.perimetro(a, b, c) area = triangulo.area(a, b, c) tipo = triangulo.tipo(a, b, c) #veri...
true
4eeddb441806d070eac9b344e52a5c021b545667
Python
hussainMansoor876/Python-Work
/Chapter 2 & 3/title 2.py
UTF-8
368
3.21875
3
[]
no_license
name="mansoor" age=18 info=name+" "+str(age) print(name) print(age) print(info) print(name + " " + str(age)) print(name.title()) print(name.upper()) print(name.lower()) name2="hussain" name3="fabiha" name4="huriya" name5="sufiyan" print(name+" "+name2+" "+name3+" "+name4+" "+name5) tname= name+" "+name2+" "+name3+"...
true
255fb50f59e73eae10e7f7ee57718a86d8c4e50c
Python
airatinho/sovok
/DB.py
UTF-8
1,951
2.546875
3
[]
no_license
import sqlite3 def insert_results(address,res_url,birth_year,floor,seria, house_type,house_crash,cadastr_number, floor_type,walls_material): sql = ''' INSERT INTO mytable( address, res_url, birth_year, floor,seria, ho...
true
df5ede9267590aa62d1c288f5d365f5c1f345b40
Python
yenjenny1010/1.
/python p.85.py
UTF-8
102
2.734375
3
[]
no_license
def ctof1(degreec): degreef=degreec*1.8+32 print(degreef) tem=eval(input()) ctof1(tem)
true
ab9a0920015ff6d8577a57888e7436e9769e26c6
Python
Wwwangi/LeetCode-Competition
/Wangi/189.py
UTF-8
816
3.609375
4
[]
no_license
#整个list翻转,再分别翻转两部分 class Solution: def rotate(self, nums: List[int], k: int) -> None: """ Do not return anything, modify nums in-place instead. """ nums.reverse() def reverse(a,start,end): while(start<end): a[start],a[end]=a[end],a[start] ...
true
ed2f94a579f46b3f3ab600fb37cb4ebac0b37f6c
Python
pwn2winctf/wspr-decoy
/solver/autocut.py
UTF-8
2,190
2.71875
3
[]
no_license
#!/usr/bin/env python # This tool cuts a wav file so that it starts when the WSPR transmission starts. # Please cut all wav files before using them as input to the solver. import subprocess import tempfile import shutil import wave import sys import os import re def samples_at(infile, offset): inwav = wave.open(i...
true
6322140d127c5d2c954a69a4172c653d275bbbfc
Python
EpmakJS/Guessing-Game-on-Python
/Guessing Game.py
UTF-8
357
3.71875
4
[]
no_license
secret_word = input("Enter secret word here: ") guess = "" guess_count = 0 out_of_guess = False while guess != secret_word and not(out_of_guess): if guess_count < 3: guess = input('Enter ur guess: ') guess_count += 1 else: out_of_guess = True if out_of_guess: print('Out of guess, u...
true
b62ebbc8a56db2ce43c0f4ec8104da0838c8adb1
Python
ryanvilbrandt/personal
/decodeir.py
UTF-8
751
2.71875
3
[]
no_license
import struct, time, gc # Disable garbage collection, for the sake of verifying processing speeds gc.disable() a = 'UYUVUe\xa6eUjUUUU' def DecodeIR(ir): if (len(ir) % 2): return len(ir), len(ir) % 2 out = 0 for i in range(0,len(ir)/2): n = struct.unpack(">H",ir[i*2]+ir[i*2+1])[0] ...
true
1e2d7ee92ff9de74fe1312f59df15bb0edaed2b5
Python
USNavalResearchLaboratory/task-scheduling
/task_scheduling/base.py
UTF-8
1,718
2.921875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
"""Core package objects.""" from collections import namedtuple from datetime import datetime import numpy as np SchedulingProblem = namedtuple("SchedulingProblem", ["tasks", "ch_avail"]) SchedulingSolution = namedtuple( "SchedulingSolution", ["sch", "loss", "t_run"], defaults=(None, None) ) def get_now(): ...
true
67c137ae05048e15b56f2f8c5496ead7fbf7e639
Python
yiwen9586/mychatbot
/comedy/test.py
UTF-8
64
2.59375
3
[]
no_license
y = 6 def test1(): global y y = y + 1 test1() print(y)
true
5932a381da6e270a3fdc2a63dc049e7c91d8f30a
Python
Sluimers/glowing-wookie
/my_itertools.py
UTF-8
807
3.34375
3
[]
no_license
''' Created on May 14, 2015 @author: rogier ''' class unique_element: def __init__(self, value, occurrences): self.value = value self.occurrences = occurrences def permutations_unique(elements): eset=set(elements) listunique = [unique_element(i,elements.count(i)) for i in eset] ...
true
654cbc12e0706b3047425d95f10b28a4334c0d6a
Python
Apr17hz/textpipeliner
/textpipeliner/tests/tests.py
UTF-8
6,297
2.859375
3
[ "MIT" ]
permissive
import unittest from textpipeliner import * from textpipeliner.pipes import * import spacy # _sentence will be used throughout the all tests as it is time-consuming to create it. # The fact of time-consumption is also reason for keeping all tests in single module file _sentence = None def setUpModule(): nlp = sp...
true
7ddcba0f30b11c4f0a6a364cab116fe3171c577c
Python
SelmTalha/sinav_calisma
/FinalÇalışma(python)/Sınıflar/pdfteki örnekler/yazilimci.py
UTF-8
445
2.890625
3
[]
no_license
class Yazılımcı(): def __init__(self,isim,soyisim,numara,maas,diller): self.isim=isim self.soyisim=soyisim self.numara=numara #yazılımcı objelerinin özellikleri self.maas=maas self.diller=diller yazilimci1=Yazılımcı("Selim Talha","Çağlar","36","2500",["Python","Java","C"]) ya...
true
f50a8a56cef42751a99acde9fe934b76ef2c2c49
Python
126saransh/pythonlab
/doublespacecheck.py
UTF-8
388
4.28125
4
[]
no_license
# Q. Write a program to detect double spaces in a string string = input("Enter String: ") res = " " in string print("Does string contain spaces ? " + str(res)) # Output: Enter String: Rohit Jain //with 2 spaces # Does string contain spaces ? True # Enter String: Rohit Jain ...
true
71bf5b3f37d9cfdf8fc9d53dca333780adf0eb0d
Python
hojunee/20-fall-adv-stat-programming
/sol3/ex07-04.py
UTF-8
122
2.5625
3
[]
no_license
def eval_loop(): stdin = input() while (stdin != 'done'): eval(stdin) stdin = input() eval_loop()
true
8dab521e560044a0fb06f95a3f2b52a2e7af1a0a
Python
jamine99/Uncertainlyingdice
/agents/probabilitybot.py
UTF-8
2,421
3.390625
3
[]
no_license
import random from agents.player import Player class ProbabilityBot(Player): def __init__(self,numDice, name): super().__init__(numDice, name) self.threshold = 0.49 def takeBet(self, state): opponent_player = None if state.player1 == self: opponent_player = state.pl...
true
062175a8a8d59ee9dbe8fba7ff996d2acefc35cb
Python
x-ning/s17
/day04/装饰器练习.py
UTF-8
543
3.1875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author:X.Ning <ngx@ngx.wiki> # 身份验证功能 def auth(func): def wrapper(*args,**kwargs): name = input("name >> :") password = input("password >> :") if name == 'egon' and password == '123': print('认证通过') res=func(*args,**kwarg...
true
f86d3b6147b77b6a8f2b0211dc4496634ae25c12
Python
karolinanikolova/SoftUni-Software-Engineering
/3-Python-Advanced (May 2021)/04-Comprehensions/02_Exercises/02-Words-Lengths.py
UTF-8
357
4.71875
5
[ "MIT" ]
permissive
# 2. Words Lengths # Using a list comprehension, write a program that receives some text, separated by comma and space ", ", # and prints on the console each string with its length in the following format: # "{first_str} -> {first_str_len}, {second_str} -> {second_str_len},…" print(', '.join([f"{word} -> {len(word)}" ...
true
7599b3f2ba4f40d23209f344116af3b5e4399897
Python
tantale/intranet
/intranet/tests/model/worked_hours/test_frequency.py
UTF-8
922
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import unittest from intranet.model.planning.frequency import Frequency class TestFrequency(unittest.TestCase): def test_match_week(self): f = Frequency(u"aperiodic", u"all the year", 0, 1) self.assertTrue(all(f.match...
true
68ea6f6a596220d3e02873021ca6f4ab27db9aed
Python
LAlvarez506/Ground-Motion-Simulation
/Source.py
UTF-8
8,639
3.078125
3
[]
no_license
import numpy as np import matplotlib.pylab as plt class source: def __init__(self): pass def create_plane(self,X,Z,nx,nz): self.corners = np.array([[0.0,0.0,Z],[X,0.0,Z],[0.0,0.0,0.0],[X,0.0,0.0]]) # - Creates the vectors for the mesh self.x = np.linspace(0,X,nx+1) ...
true
89525310745e2cae8dbf22481b67878332959280
Python
Dsantoss/Boots_exposolar
/Extractor_database.py
UTF-8
3,883
2.515625
3
[]
no_license
from selenium import webdriver import time import csv import math inicio=time.clock() driver = webdriver.Firefox(executable_path='C:\Selenium\geckodriver.exe') driver.maximize_window() driver.get('https://www.linkedin.com/') user_box = driver.find_element_by_id('login-email') pass_box = driver.find_element_by_id('lo...
true
fbc9a21d1cdeac3c53e2fd100305ae3cbffadb4f
Python
rahulkp220/Algorithms-Datastructure-Refresher
/searching/linear-search/linear-search.py
UTF-8
879
2.953125
3
[ "MIT" ]
permissive
# Uses Python3 import profile def linear_search(array, key): for i in array: if i == key: return True return False if __name__ == "__main__": profile.run('linear_search(range(100000000000), 100000001)') # Benchmark # ❯ python3 linear-search.py # 5 function calls in 7.213 ...
true
7537ef3c67b34e6146c1875d86911efd817cb5fa
Python
henryleou/cs189_hw1
/py submission/hw1_3a.py
UTF-8
1,498
2.609375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from sklearn import svm from scipy import io import random import sys import sklearn.metrics from sklearn.metrics import accuracy_score from scipy.sparse import vstack import save_csv np.random.seed(418) mnist = io.loadmat("data/mnist_data.mat") num_samples = len(mnis...
true
553e19e02091816fda6b72823b0084c3690f9d6f
Python
hongloull/pyexample
/src/descriptor/descriptor.py
UTF-8
2,284
3.515625
4
[]
no_license
""" >>> class Descriptor(object): ... def __get__(self, instance, owner): ... print(self, instance, owner, sep='\n') ... ... >>> class Subject: ... attr = Descriptor() # Descriptor instance is class attr ... ... >>> X = Subject() >>> X.attr <__main__.Descriptor object at 0x0281E690> <__main__....
true
69c16d6961cbdd67d4ab11f32e8b9d127df3038c
Python
RohanGautam/googlehome-for-local-script
/api.py
UTF-8
417
2.515625
3
[]
no_license
from flask import Flask from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) class customRouteFuntionality(Resource): def get(self, var): print(f'[GET] Recieved var {var}. Do custom stuff here!') return { 'recieved': True, } api.add_resource(customRou...
true
62dab2f5b24c49838e2f454dd14a1cdced35dd9a
Python
zealfory/dive_python
/lc/912.py
UTF-8
1,075
3.59375
4
[]
no_license
# -*- encoding: utf-8 -*- # @File: 912.py # @Time: 2021/7/21 12:59 上午 # @Author: ZHANG # @Description: 912 from typing import List import random class Solution: def sortArray(self, nums: List[int]) -> List[int]: return self.quick_sort(nums, 0, len(nums)-1) def quick_sort(self, nums: List[int], ...
true
a171f146d2e9fdb5a892200a10a44a2ecdf1381b
Python
QuinnPainter/AdventOfCode2020
/Day 4/day4pt2.py
UTF-8
1,912
3.046875
3
[]
no_license
import string input = open("input", "r") inputLines = input.readlines() input.close() eyeColours = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"] passportStrings = [] passportIndex = 0 for line in inputLines: if line.rstrip() == "": passportIndex += 1 continue if len(passportStrings) <= pa...
true
a4e5e8ef9e6c1eb2d91bdbc634064ca1fc596d34
Python
demo112/1807
/regex/regex1.py
UTF-8
576
3.5625
4
[]
no_license
import re """ 共同属性都能生成match对象 """ # finditer it = re.finditer(r'\d+', '2008-2018 10年中国发生了变化') for i in it: # print(dir(i)) print(i.group()) # fullmatch() obj = re.fullmatch(r'\w+','abcdef123') print(obj.group()) try: obj = re.fullmatch(r'\w+','abcdef123#') # 返回None print(obj.group()) # 报...
true
7e989f007cc075384309ae685db0830ed74b5a55
Python
adhocindia/Facial_Identification
/src/recognizer_module/recognizer.py
UTF-8
1,880
2.96875
3
[]
no_license
#!/usr/bin/python3 # import necessary module import numpy as np import cv2 # function to identify the face # arguments -> dictionary of student_id as key and student_name as value def identify(info_dic): # create classifier object using haar cascade face_cascade = cv2.CascadeClassifier('recognizer_module/data/ha...
true
c72bcb04e2ebe33e579919286c729b52ec0345c2
Python
standardgalactic/lion
/lionapp/branches/multipleObiProjects/lion/daisylion/db/dbsession.py
UTF-8
2,136
2.828125
3
[]
no_license
import os os.sys.path.append("../") import DB.connect # Harcoded DB connection info, not stored in SVN class DBSession: """A session with the DB.""" def __init__(self, host, dbname, trace=False): self.trace = trace # trace flag self.warnings = 0 # warnings during operation ...
true
441a6ffa2a1b36f211bb8ab84d6bf08c9df0b10f
Python
abinayavarshini/python
/wordline.py
UTF-8
92
3.15625
3
[]
no_license
xd=input() counts=1 for i in xd: if i.isspace()==True: counts+=1 print(counts)
true
77683c5e835153a0fa057a03f6fd7e2ce73f9f0f
Python
Fition/McWs
/image/test.py
UTF-8
95
2.671875
3
[]
no_license
from PIL import Image img = Image.open("test.jpg").convert("P") print(img.getpixel((10,10)))
true
b29dd7ed9513f3baa4513d608434b976a9073cb1
Python
Jeevanantham13/programizprograms
/quadratic formula.py
UTF-8
280
3.578125
4
[]
no_license
#Quadratic function from math import sqrt a = int(input("enter the value of a:")) b = int(input("enter the value of b:")) c = int(input("enter the value of c:")) d = -b + math.sqrt(4ac) / 2a d1 = -b - math.sqrt(4ac) / 2a print("the values are:" "(" d,d1 ")")
true
9aa7049828e566cab337e194724b805a4190d3c4
Python
herstky/eco-sim
/ecosim/entities.py
UTF-8
18,528
3.140625
3
[]
no_license
from random import randint, uniform from copy import deepcopy from ecosim.constants import * from ecosim.neural_network import NeuralNetwork from ecosim.body import * # TODO clean up checking for valid entities and indexes # TODO plants and seeds slowing performance. calculate seed landing cell and # allow plan...
true
f86837c9673e187957d51d402b447cc3cab19a86
Python
BenjaminPeter/eems
/pipeline/pipeline/polygon.py
UTF-8
5,530
2.609375
3
[]
no_license
from shapely.geometry.polygon import Polygon from shapely.geometry import Point, MultiPoint import shapely.ops as ops import numpy as np from load import wrap_america from geoloc2 import load_countries from mpl_toolkits.basemap import Basemap def get_polygon(polygon, wrap=True): """get_polygon gets the bounda...
true
bf81a6677935fbb4d63823bb5bb0b561c8ff4cf7
Python
entn-at/asv-cm-reinforce
/utils/mats_to_numpy.py
UTF-8
1,265
3.078125
3
[ "MIT" ]
permissive
# Recursively find all .mat files (MATLAB mat files) # and replace them with a numpy file. # NOTE: Assumes each .mat file only has one key import numpy as np from scipy.io import loadmat import argparse import os parser = argparse.ArgumentParser("Walk through directories and turn .mat files into .np") parser.add_argum...
true
3df3839d1bf8947c4d3da5b8c4cdf397e2ee8133
Python
nguaki/python
/environment/pandas/19_ts_timezone/ts_timezone.py
UTF-8
604
3.46875
3
[]
no_license
import pandas as pd #Ignore the top header. #Make Date Time the index #Convert string date to object date. df = pd.read_csv("msft.csv", header=1,index_col='Date Time',parse_dates=True) print(df) print(df.index) #Set timezone df.index = df.index.tz_localize(tz='US/Eastern') print(df) print(df.index) df = df.tz_conv...
true
1b2b68554b6e60c3d7e5ea79f7ea8897b33c4ab9
Python
alexisolivo/FARO
/test/test_utils.py
UTF-8
784
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from utils import utils class UtilsTest(unittest.TestCase): def setUp(self): """ Setting up for the test """ pass def tearDown(self): """ Cleaning up after the test """ pass def test_normalize_text_v0(self): ...
true
b027f2d3bed115da5100b08ef72826e44167578b
Python
risk-salon/risk_salon_tools
/risk_salon_tools/community/topics/survey.py
UTF-8
1,060
2.609375
3
[]
no_license
import pandas as pd from risk_salon_tools.services.google_docs import SheetsClient def _get_all_responses(): sheets_client = SheetsClient() responses = sheets_client.get_df('[Risk Salon] Topics of Interest Survey (Responses)') responses_df = pd.concat([responses, responses['...
true
13577a00ebeaf2a7b4bf436ebd39ef10fb8e0964
Python
jhchiu1/book_wishlist3
/datastore.py
UTF-8
4,419
3.234375
3
[]
no_license
import os import json from book import Book DATA_DIR = 'data' BOOKS_FILE_NAME = os.path.join(DATA_DIR, 'wishlist.txt') COUNTER_FILE_NAME = os.path.join(DATA_DIR, 'counter.txt') book_list = [] counter = 0 def setup(): """ read(): Read book info from file, if file exists. """ read() def shutdown(): """...
true
e091c65da1800165127c68e418ecb09f6cddfe0f
Python
PyPhy/Python
/Parallel_Computing/tut2.py
UTF-8
440
3.140625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy import arange import time from numba import jit start_time = time.time() @jit def sum2d(arr): M, N = arr.shape result = 0.0 for i in range(M): for j in range(N): result += arr[i,j] return result a = arange(5000* 5000).resh...
true
1adbeb9cd238cc98fd6e08190e352a5916007c87
Python
CarlosGabaldon/glaze
/data.py
UTF-8
317
2.609375
3
[]
no_license
#!/usr/bin/python import MySQLdb def execute_sql(sql): try: db = MySQLdb.connect("localhost","root","","Glaze" ) cursor = db.cursor() cursor.execute(sql) return cursor.fetchall() except Exception, e: # in 3.1; except Exception as e: print e db.close()
true
9f11caaa991903b8f4b59b026eecd478d11f03ea
Python
jeffreyat/RWOV
/RWOV.py
UTF-8
8,459
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Nov 20 10:19:04 2017 @author: jthompson21 """ import re from nltk.stem.lancaster import LancasterStemmer from nltk.tokenize import sent_tokenize import string from sklearn.preprocessing import StandardScaler import numpy as np from sklearn.metrics.pairwise import euclidean...
true
5b9b0622a557fa09d66dd7f167158be35f6b11ff
Python
Therealchainman/LeetCode
/problems/repeated_dna_sequences/solution.py
UTF-8
298
2.796875
3
[]
no_license
class Solution: def findRepeatedDnaSequences(self, s): r, record = set(), set() for i in range(len(s) - 9): substring = s[i:i + 10] if substring in record: r.add(substring) record.add(substring) return list(r)
true
f1896f0329bc1681f5986396e16b515257974ef3
Python
houzhimeng/Practice
/作业1.py
UTF-8
527
3.96875
4
[]
no_license
class Tearch: def __init__(self,name,age): self.name = name self.age = age self.salary = 1000 class Course: def __init__(self,name,teacher,cost): self.name = name self.teacher = teacher self.cost = cost def class_up(self): self.teacher.salary += sel...
true
3f7c185347257d3a4e43b295668dd99b097aedba
Python
coconutjim/hseb3-ml
/2 K-nearest/Lab2_Osipov.py
UTF-8
3,181
3.046875
3
[ "MIT" ]
permissive
__author__ = 'Lev Osipov' import numpy as np import matplotlib.pyplot as plt from heapq import nsmallest def cosine(vector1, vector2): return np.dot(vector1, vector2) / (np.linalg.norm(vector1) * np.linalg.norm(vector2)) # Task 1 points = 100 dimension = 200 coordinates = [] results = [] print "Wait, please.." ...
true
9ffc143f0befb4edd1a028764fbaad4fed28d367
Python
cmarch314/PythonProjects
/q6helper/q6solution.py
UTF-8
4,139
3.59375
4
[]
no_license
import inspect import predicate from goody import irange from random import shuffle # Tree Node class and helper functions (to set up problem) class TN: def __init__(self,value,left=None,right=None): self.value = value self.left = left self.right = right def add(atree,value): if atr...
true
d318dc1607bc580346347a8a19f8ccbf06a314b8
Python
cfchou/codeinpy
/src/Cslbst.py
UTF-8
1,683
3.65625
4
[]
no_license
__author__ = 'chifeng' # https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ # Given a singly linked list where elements are sorted in ascending # order, convert it to a height balanced BST # Definition for a binary tree node class TreeNode: def __init__(self, x): self.val = x ...
true
f0f70f839d43ffcbd08c9d530c93fdedd588ef45
Python
shainamarie/assignment2
/app.py
UTF-8
1,369
2.9375
3
[]
no_license
import cgi form = b''' <html> <head> <title>Hello User!</title> </head> <body> <form method="post"> <label>First Name:</label> <input type="text" name="first_name"> <br> <label>Last Name:</label> <input type="text" name="last_name"...
true
76b490112db356b046e24bd78ba18265f5f54f51
Python
Developerrr/horoscope
/index_generator.py
UTF-8
1,231
2.921875
3
[]
no_license
# coding: utf-8 from horoscope import generate_prophecies from datetime import datetime as dt def generate_page(head, body, a): page = "<html>" + head + body + a + "</html>" return page def generate_head(title): head = "<meta charset='utf-8'>" + "<title>" + title + "</title>" return "<head>" + head + "</head>" ...
true
609c0acbd6311e1d957f929233401bd01d718265
Python
saurabhpati/python.beginner
/DataTypes/dictionary.py
UTF-8
280
3.984375
4
[ "MIT" ]
permissive
# Explains the dictionary type in python. dictionary = { 'key1': 'first value', 'key2': 'second value', 'key3': 'third value' }; # The dictionary data type in python. print(dictionary); print(dictionary['key1']); print(dictionary.keys()); print(dictionary.values());
true
3c1a3cc6f711b711dbbb5a7da862e2228b651d82
Python
DeepaMGMG/Web-Crawling-With-Scrapy
/learnings/learnings/spiders/blog.py
UTF-8
994
2.578125
3
[]
no_license
import scrapy import re class BlogSpider(scrapy.Spider): name = 'blog' allowed_domains = ['www.zyte.com'] start_urls = ['https://www.zyte.com/blog/'] def parse(self, response): for post in response.css('div.oxy-post'): # print(post) title = re.sub('\s+',' ...
true
890bfcd530d2654320f625bdb7c74dc78ebba3fd
Python
implementedrobotics/Nomad
/Hardware/Actuator/NomadBLDC/Tools/NomadBLDCGUI.py
UTF-8
37,971
2.625
3
[ "MIT" ]
permissive
from PyQt5 import QtWidgets, QtCore, uic from PyQt5.QtCore import pyqtSlot, pyqtSignal import pyqtgraph as pg import sys import time import threading import math import operator import numpy as np from NomadBLDC import NomadBLDC close_event = threading.Event() def isfloat(value): try: float(value) return...
true
256e08034654f821074bc63bdd8f23054debb925
Python
lileshp/Basic-Python-9-Aug
/operators_identifieres_DataTypes.py
UTF-8
6,167
3.84375
4
[]
no_license
#Tokens smallest unit/element of programming lang. Keywords Literals/Constants Identifier Operator Keyword Python Keyword module is used to avail the list of all the keywords. The reserved words cannot be used as a variable name. all keywords in lowercase letter e...
true
a25bf75261a2a147ca07874af0db8397aca8c821
Python
MaksimOzery/NeuralNetworkRoad
/namefiles.py
UTF-8
518
2.78125
3
[]
no_license
#Переименование файлов from PIL import Image, ImageDraw, ImageFont import struct import os # user -> name directory = r'C:\Users\user\Desktop\7' directory2=r'C:\Users\user\Desktop\image3' print( directory) files = os.listdir(directory) print( len(files)) #posetive.1. #negative.1. for i in range(len(fi...
true
73a636adfca97157691ed2b4782d91f4d912f2e0
Python
ricklixo/cursoemvideo
/ex067.py
UTF-8
442
4.34375
4
[]
no_license
# 067 - Faça um programa que mostre a tabuada de vários numeros, um de cada vez, para cada valor digitado pelo usuário. # O programa será interrompido se o valor for negativo. # MINHA SOLUÇÃO while True: num = int(input('Digite o número o qual deseja ver a tabuada: ')) if num < 0: break for cont i...
true
c481ca4d8326c6ab9142b1c4c1041be527b63577
Python
djjty/OriginalLight
/nn/initializations/Normal.py
UTF-8
416
2.765625
3
[]
no_license
from .Initializer import Initializer, np class Normal(Initializer): def __init__(self, std=0.01, mean=0.0): self.std = std self.mean = mean def call(self, shape, dtype=None): if dtype is not None: return np.random.normal(loc=self.mean, scale=self.std, size=shape).astype(dty...
true