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
65c10a2bcbe7683556f3bed81ddeb2b91e192b18
algorithm005-class02/algorithm005-class02
/Week_07/G20190343020235/leetcode_146_0235.py
UTF-8
3,971
3.6875
4
[]
no_license
class ListNode(object): def __init__(self,key=None,val=None,next=None,prev=None): self.key = key self.val = val self.next = next sel...
true
274e1401ae6a515f9b0bd4674169f4acb1e871cc
ezztomizeh/functions
/python functions/extract_data.py
UTF-8
263
3.5625
4
[]
no_license
def extract_data(filename): infile = open(filename,'r') infile.readline() # Skip the first line numbers = [] for line in infile: words = line.split() num = words[1] numbers.append(num) infile.close() return numbers
true
122e34c461403b9e9cda2521797eb806c2843376
scubbo/xkcd-reddit-bot
/tst/test_utils.py
UTF-8
679
2.71875
3
[]
no_license
import src.utils from collections import namedtuple FakeComment = namedtuple('FakeComment', ['body']) def test_fails(): for test_case in [ ('', None), ('a', None), ('xkcd.com', None), ('xkcd.com/must-be-numeric', None), ('xkcd.com/123', '123'), ('www.xkcd.com/234',...
true
9f99d5397c55a75cdb037be486197f0c807875ef
HackGT/ctf-problems
/2017/forensics/design-team/solution/obfu.py
UTF-8
323
2.921875
3
[ "MIT" ]
permissive
from PIL import Image import numpy img = Image.open('lmao.png') pix = img.load() width = img.size[0] height = img.size[1] for i in range(0, height): for j in range(0, width): arr = pix[j, i][:-1] poly = numpy.poly1d(arr, True) print "{0}x^3 + {1}x^2 + {2}x + {3}".format(poly[3], poly[2], poly[1], poly[...
true
8c53addddab80529b000313d907298a11e4ebff0
robifis/Python-Password-Generator
/pwg.py
UTF-8
1,216
3.703125
4
[ "MIT" ]
permissive
#!/usr/bin/python3 import random, string, pyperclip ## User Input for length of password between 8 - 40 characters ✅ def main(): while True: pwd_length = input('How long would you like the password to be?\n(Mut be between 8-40 characters long): ') ## DONE Generate password ✅ while int(pwd_len...
true
ed65f40b216971c02a350ec92f449d0578a23644
vinidixit/elements-of-programming
/sorting/mergeIntervals.py
UTF-8
1,367
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 15 15:53:50 2018 @author: I309535 """ # Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def is_overlapping(self,cur_s,cur_e,newInterval): ...
true
d84229b859645698dde34458e36369e24af6170d
daniel-reich/ubiquitous-fiesta
/kD2CfnakBqfNpBHnX_1.py
UTF-8
289
2.859375
3
[]
no_license
def islands_perimeter(grid): a = sum(grid[0]) + sum(grid[-1]) b = sum(x[0] + x[-1] for x in grid) c = sum(row[x] != row[x+1] for row in grid for x in range(len(row)-1)) d = sum(grid[x][y] != grid[x+1][y] for x in range(len(grid)-1) for y in range(len(grid[x]))) return a+b+c+d
true
51b63c8c41ba9826a662a3887f4e1fa9dc429ac1
graciegordon/MPRA
/getSequences.py
UTF-8
2,325
2.65625
3
[]
no_license
''' This script will take in the log2foldchange result file and get the gene sequence from the reference folder and then make the mutations in the sequence. This script assumes that there are 20 bp added to the begining and end of the gene, causing the mutation location to be off by 20bp. This is refered to as the temp...
true
052974a8d8a98afc82f45c5ab905ccf4c08a8730
h-aldarmaki/sentence_eval
/scripts/evaluation.py
UTF-8
11,224
2.546875
3
[ "Apache-2.0" ]
permissive
# Evaluation.py import numpy as np import scipy as sp from sklearn import svm from sklearn.model_selection import cross_validate from sklearn.model_selection import RepeatedKFold from sklearn.model_selection import GridSearchCV from sklearn.model_selection import KFold, StratifiedKFold from sklearn.linear_model import ...
true
4629e73f57ca6bb34a94d388ed30d06214c994c3
brucehzhai/Python-JiangHong
/源码/Python课后上机实践源代码/ch3-程序流程控制/P3-prg-5-闰年leapyear.py
UTF-8
897
4.3125
4
[]
no_license
import calendar for y in range (2000,3001): #方法一。使用一个逻辑表达式包含所有的闰年条件 if ((y % 4 == 0 and y % 100 != 0) or y % 400 == 0): print(y,end=' ') #方法二。使用嵌套的if语句,相关语句如下: #if (y % 400 == 0): print("是闰年") #else: # if (y % 4 == 0): # if (y % 100 == 0): print("不是闰年") # ...
true
0b50c4a5af2ef129473172cac6851c6f9ccd0674
GauChoob/musyx
/extract_data_from_rom/example_parse.py
UTF-8
746
2.515625
3
[]
no_license
import musyx.song, musyx.macro, musyx.adsr, musyx.sample, musyx.sfx, musyx.utils musyxpos = 0x30*0x4000 #(MusyX is located at bank 0x30) romfile = r"C:\example.gbc" macronames = ["SomeMacro","SomeOtherMacro","etc"] #You can also leave this undefined musyx.macro.macro2mxm(romfile,musyxpos,macronames) songnames = ["So...
true
379ce64ad8d3a24aacbb6c320fcf245fe8d55d02
Dwalker1000/GameDesign
/Unit 1/Game2WordGameFinal.py
UTF-8
7,943
4.0625
4
[]
no_license
import random import time import sys import os def menu (): print("***************************************************") print("* Random Words *") print("* *") print("* Instructions: A word will be randomly *") ...
true
b3677b8c7b9373c196acd5926a761073c2fd07b0
JusticeBoi/newton_raphson_trials
/newton_raphson_py/newton_ralphson.py
UTF-8
4,038
3.109375
3
[]
no_license
from sympy import diff from sympy import lambdify from sympy.core.add import Add from sympy.abc import x from sympy.abc import t from numpy import array as np_array from numpy import linalg as la import timeit from builtins import isinstance def wrapper(func, a_list): def wrapped(): if (len(a_list)==5): ...
true
1d7163a3b40e388f42da1746660a3300b3b971d7
tureaadrian/loggerbuilder
/loggerbuilder/build/lib/loggerbuilder/loggerbuilder.py
UTF-8
641
2.90625
3
[]
no_license
import json class LogMessage: current = {} def __init__(self, logMessageBuilder): self.json = None if not isinstance(logMessageBuilder, self.LogMessageBuilder): return None self.current = str(logMessageBuilder.data) def toJson(self): self.json = json.dumps(self...
true
f885e3e578e2aa32a4182651ed09b23a27f30293
milson389/metode-numerik
/pertemuan3/535180021_AudieMilson_Latihan1.py
UTF-8
2,554
3.84375
4
[]
no_license
# Audie Milson (535180021) # Nomor 1 for i in range(1, 101): if((i % 3 == 0) and (i % 5 == 0)): print("FizzBuzz") elif(i % 3 == 0): print("Fizz") elif(i % 5 == 0): print("Buzz") else: print(i) # Nomor 2 kalimatInput = input('Masukkan contoh kalimat Input: ').lower() kat...
true
d2ab835d737b7267235f65ae1dbd7c21fcc0d9d0
alphabet0/LINUX-2019
/161403104徐开义/rl/mydqn.py
UTF-8
3,725
2.625
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from config import ACTION_SIZE BATCH_SIZE = 128 LR = 0.01 GAMMA = 0.90 EPISILO = 0.9 MEMORY_CAPACITY = 500 Q_NETWORK_ITERATION = 300 NUM_ACTIONS = ACTION_SIZE + 2 # 原为431 NUM_STATES = 33 device = torch.device('cuda...
true
4d8c716a2f966180469e87fea4c08b1fdb23b544
candi-project/Selenium
/SeleniumWDTutorial/Waits/ExplicitWait.py
UTF-8
1,261
3.046875
3
[]
no_license
""" ExplicitWait: ExplicitWait is defined as maximum time to wait for a given condition before throws an error. Example : If you declare ExplicitWait with a condition presence_of_element_located and time 25 seconds , if WebElement is visible less than 25 seconds then it will click or do the respective operation on tha...
true
4c633660a421d4ac278ae7dec2d83fabff3f855a
terranigmark/python-crash-course-projects
/chapter_04/e4-6_odd_numbers.py
UTF-8
162
3.640625
4
[]
no_license
def main(): odd_numbers = [number for number in range(1, 20, 2)] for number in odd_numbers: print(number) if __name__ == "__main__": main()
true
357cc3b962e78bc5b622e5c84258a3453409b496
martinzosr/PiRepro
/classification.py
UTF-8
2,668
2.75
3
[]
no_license
from pydub import AudioSegment import numpy as np # https://github.com/jiaaro/pydub file = open("output.csv", 'w') class Song: def __init__(self, filename): sound = AudioSegment.from_wav(filename) self.data = sound.get_array_of_samples() self.frame_rate = sound.frame_rate def fft(self...
true
53a921c79ce56c486f5dbfef9565d54e839a5ee2
plotnick/dim
/dim/icon.py
UTF-8
5,811
2.59375
3
[]
no_license
# -*- mode: Python; coding: utf-8 -*- from xcb.xproto import * from client import Client from geometry import Geometry, Position, origin, empty_geometry from widget import Widget from xutil import get_geometry __all__ = ["Icon"] class Icon(Widget): """A widget with a pixmap that represents a client.""" def...
true
9fe1989629883eee5076ecddc4427476aa4d5cbc
non117/yukari
/lib.py
UTF-8
1,120
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- import csv class Vector(): def __init__(self, t, x, y, z): self.t = float(t) self.x = float(x) self.y = float(y) self.z = float(z) JOINT_NAMES = { 0:'Head', 1:'Neck', 2:'Torso',3:'LeftShoulder', 4:'LeftElbow', 5:'LeftHand', 6:'RightShoulder', 7:'Righ...
true
14be0bfc23487d48f47058c7c6b9f935c603abc8
dkqyqyt/Programmers
/Python/level_2/카펫.py
UTF-8
189
3.0625
3
[]
no_license
from math import sqrt def solution(b, y): return [((b+4)/2+sqrt(pow((b+4)/2,2)-4*(b+y)))/2,((b+4)/2-sqrt(pow((b+4)/2,2)-4*(b+y)))/2] brown = 10 yellow = 2 print(solution(brown,yellow))
true
458d01f9e097711fb5358756355a71247e174fbe
heitoranjos15/cloudia_challenge
/src/builders/user.py
UTF-8
425
2.765625
3
[]
no_license
def build_user(data): return __validate_user_data(data.get('name'), data.get('plataform')) def __validate_user_data(name, plataform): if not name: raise AttributeError('name has to informed') if not plataform: raise AttributeError('plataform has to informed') if plataform not in ['twitt...
true
331aa36354e3050c5171d7a091213dd9f5adb138
Aasthaengg/IBMdataset
/Python_codes/p03109/s265622328.py
UTF-8
175
2.78125
3
[]
no_license
s=str(input()) ans="TBD" if int(s[:4])>2019: ans="Heisei" elif int(s[:4])==2019: if int(s[5:7])<=4: if int(s[8:])<=30: ans="Heisei" print(ans)
true
6daf5290f37cb6f7d2ba88c882b67b0e1911dd11
mcanthony/jam-image-filter
/jam_image_filter/blur.py
UTF-8
817
2.71875
3
[ "MIT" ]
permissive
import sys import math import scipy.ndimage as ndimage import scipy import Image import ImageFilter import numpy as np import util def blur(original, sigma=10, darken=True): original = util.resize_jam_background(original) original = original.convert('RGB') if darken: original = original.point(lamb...
true
087ae34a3781ee207a5aeb049b056aca982da576
bueler/sia-fve
/petsc/shadesurf.py
UTF-8
2,826
2.53125
3
[]
no_license
#!/usr/bin/env python # (C) 2015 Ed Bueler # example from http://matplotlib.org/1.4.2/examples/pylab_examples/shading_example.html import sys import numpy as np import numpy.ma as ma import matplotlib.pyplot as plt from matplotlib.colors import LightSource from mpl_toolkits.axes_grid1.inset_locator import zoomed_ins...
true
d5a1b521a68c36e8da311f0dde316b1227211458
l-vincent-l/mistune-contrib
/mistune_contrib/container.py
UTF-8
1,493
2.875
3
[]
no_license
#coding: utf8 import re from mistune import BlockLexer, Renderer, Markdown class ContainerBlockMixin(object): def enable_container(self): self.rules.block_container = re.compile('^::: ([^\n]*?)\n(.*):::', re.DOTALL) self.default_rules.insert(0, 'block_container') def parse_block_container(self...
true
2f25e57775919d05e7171ad441db614b4b86d5da
JasonGuo1/CompareNet_FakeNewsDetection
/models/layer.py
UTF-8
8,278
2.546875
3
[]
no_license
import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn.functional as F from torch import nn class GraphConvolution(Module): def __init__(self, in_features, out_features, bias=True): super(GraphConvolution, self).__init__() self....
true
52a464b2aa93d54c59d18a95d085c91d9d1deda0
jacanterbury/psychopy_utils
/psychopy_kent_lib/Code/kent_psylog.py
UTF-8
967
3.046875
3
[]
no_license
# Copyright (C) 2019 John A. Allen # Distributed under the terms of the GNU General Public License (GPL). """Designed for debugging use, this logs messages into memory and only writes them to disk when close() is called (ie at a 'safe' time that does not jeopordise the experiment operation) """ class Logger: """Wr...
true
71d3abf69ee8cf925cc699da059cdc2e7641bf6f
AK-1121/code_extraction
/python/python_8441.py
UTF-8
133
3.1875
3
[]
no_license
# In dictionary, converting the value from string to integer dict_with_ints = dict((k,int(v)) for k,v in dict_with_strs.iteritems())
true
4e52483b5558ff2ce4bac0a1e3e1f3f98995d339
swarthyPig/Algorithm-training-and-SQL-query
/Algorithm_problems/Python/level1/나누어_떨어지는_숫자_배열.py
UHC
313
3.5
4
[]
no_license
def solution(arr, divisor): answer = [] for i in arr: if i % divisor == 0: # ־ ڿ answer.append(i) # list ߰ answer.sort() # list return answer if len(answer) != 0 else [-1] # list -1
true
66d29d9b5efe004a4a47f41ea4a0dd3d9889810e
hieunq95/my-rl
/animation/pytorch_tutorial.py
UTF-8
1,230
2.828125
3
[]
no_license
import numpy as np import torch dtype = torch.float device = torch.device("cpu") # N is batch size, D_in is input dimension # H is hidden dimension, D_out is output dimension N, D_in, H, D_out = 64, 1000, 100, 10 # input, output data x = torch.rand(N, D_in) y = torch.rand(N, D_out) # initialize weights w1 = torch.r...
true
46c5a6c2265addc10b77b6492ee1f7c45ee932ed
CarterKekoa/NaiveBayes
/test_myclassifiers.py
UTF-8
14,582
3.3125
3
[]
no_license
import numpy as np import scipy.stats as stats import mysklearn.myutils as myutils from mysklearn.myclassifiers import MySimpleLinearRegressor, MyKNeighborsClassifier, MyNaiveBayesClassifier, MyZeroRClassifier, MyRandomClassifier # note: order is actual/received student value, expected/solution def test_simple_linea...
true
f7998df7263d11f9672033e479d65290585dc168
hyungjik/section4
/my_4-6-2.py
UTF-8
697
3.328125
3
[]
no_license
import pandas as pd df = pd.read_excel('d:/inflearn/crawling/section4/excel_s1.xlsx', header=0) # print(df) # 컬럼 값 수정 # df['State'] = df['State'].str.replace(" ", '|') # 정규표현식 활용 가능 # print(df) # 평균 컬럼 추가 df['Avg'] = df[['2003', '2004', '2005']].mean(axis=1).round(2) # print(df) # 합계 컬럼 추가 df['Sum'] = df[['2003', ...
true
ed6bf34c790d345ec4e325143a04b05fe1d6d45a
wagaman/MachineLearning
/Enviorenment--TimeSeries/Merge_Con_roon_and_people.py
UTF-8
3,418
2.625
3
[]
no_license
import pandas as pd import numpy as np import os import math from datetime import datetime print(os.getcwd()) def JoinRoom(): EndDate = '2017-8-9' # 读取数据 SaveOriginDataPath = "D:/Programma/Environmentaltest" DirPath = SaveOriginDataPath + '/' + 'combined_enviorenment' + '/' + EndDate #o...
true
8b7b3afe93f2a9c0c35063832d09ed6465ad6420
jlin22/algorithms_python
/HashTable.py
UTF-8
1,048
4.0625
4
[]
no_license
class HashTable: def __init__(self): """Creates an empty array with 1000 values""" self.table = [None] * 10000 def calculate_hash_value(self, string): """Calculates the hash value from the string""" return ord(string[0]) * 100 + ord(string[1]) def store(self, string): ...
true
575709fa0fe7813fdd7d8c8c30822770e293cf86
Gosiaf98/MFSG_Benchmark
/MFSG/Benchmark/views/site/form.py
UTF-8
3,675
2.625
3
[]
no_license
from django import forms from django.contrib.messages.views import SuccessMessageMixin from django.utils.translation import ugettext_lazy as _ from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from ...models import Site class Form(SuccessMessageMixin, forms.ModelForm): driv...
true
269897058640ce9c34b5573da6bbb57bbd7b0f80
DadosAbertosDeFeira/maria-quiteria
/web/datasets/tests/test_services.py
UTF-8
3,700
2.546875
3
[ "MIT" ]
permissive
import os from pathlib import Path from django.conf import settings from web.datasets.services import get_s3_client client = get_s3_client(settings) class TestS3Client: def test_upload_file(self): relative_path = "TestModel/2020/10/23/" s3_url, bucket_file_path = client.upload_file( ...
true
27fa68dc144940aaa9aab6624d3467851c5740ab
dipenrathod/Multi_Control_RC_Car_Project
/WEB_New_ClickPi_RC/clickpirc/clickpirc/rccontrol.py
UTF-8
3,841
2.71875
3
[ "CC-BY-4.0" ]
permissive
from clickpirc.Motor import Motor class MultipiRCControl: CAR_MOTOR_FRONTREAR=1 CAR_MOTOR_REAR2WHEEL=2 def __init__(self, CAR_MOTOR_MODE=CAR_MOTOR_REAR2WHEEL, M1_A=4, M1_B=17, M2_A=27, M2_B=22): self.CAR_MOTOR_MODE = CAR_MOTOR_MODE self.M1_A = M1_A; self.M1_B = M1_B; ...
true
b7c92f181e219811cefea127f1afab469f6249d7
EshaanDhavala/CS421
/assignment_12.py
UTF-8
1,425
3.953125
4
[]
no_license
#A12: Halloween Candy # Your code should only be between BEGIN and END. # Please do not touch or change any other code. # See the sample output your should try to get after your implementation. # prints a dictionary; Prints both the keys and values # try to sort the dictionary by keys # output will be user friendly de...
true
3b809a3e1e3e3276b24944339bfafcadb730350c
beingveera/whole-python
/python/python-base/turtle/border.py
UTF-8
277
3
3
[]
no_license
import turtle as t t.color("red") t.hideturtle() t.width(5) #t.speed(0.01) t.penup() t.goto(-233,404) t.pendown() for i in range(1,5): t.forward(464) t.right(90) t.forward(804) t.right(90) else: t.goto(0,0) for I in range(1,100): t.circle(45,steps=5) t.exitonclick()
true
3e3418e6b05707debc9dab2ab97957ad0300cd96
buganini/checkio-task-send-more-money
/verification/tests.py
UTF-8
1,642
3.078125
3
[]
no_license
""" TESTS is a dict with all you tests. Keys for this will be categories' names. Each test is dict with "input" -- input data for user function "answer" -- your right answer "explanation" -- not necessary key, it's using for additional info in animation. """ TESTS = { "Basics": [ { ...
true
7ac4be96e73e35345601bc2715e5bd5d7b3fd388
NishTewari/CP-164
/CP164 Labs/tewa4430_l05/src/t06.py
UTF-8
414
2.765625
3
[]
no_license
''' ----------------------------------------------- ----------------------------------------------- Author: Nishant Tewari ID: 190684430 Email: tewa4430@mylaurier.ca __updated__ = "2020-02-13" ----------------------------------------------- ''' # Imports from functions import bag_to_set bag = [1, 2, 3,...
true
051d04214bf06235ece149499eecf269cfa128ef
orybkin/Autonomous-turtle
/src/dev/masking_debug.py
UTF-8
3,787
2.796875
3
[]
no_license
#!/usr/bin/env python # Script for analysis of the turtlebot behaviour: # find out frequency of the main cycle # find out odometry measure # check odometry and SfM correctness # check the script correctness (optional) from b3m33aro import Turtlebot import numpy as np import cv2 import time MOVE = 1 ...
true
502dafe3d7605113585e8e08c3ffcca94db2d8e1
z2trillion/cpp-testing
/class_test.py
UTF-8
325
3.703125
4
[]
no_license
def multiply(x, y): return x * y class incrementer(): def __init__(self): print 'i exist!' self.counter = 0 def __iter__(self): return self def next(self): self.counter += 1 print 'i = %i' %self.counter return self.counter if __name__ == "__main__": for i in incrementer(): print i if i > 20: b...
true
68e361093aac22b6bd7b7887273e7697fce81c5e
InfiniteWing/Solves
/zerojudge.tw/find_keywords.py
UTF-8
380
2.5625
3
[]
no_license
import os, sys def main(): find = 'gcd' dirs = os.listdir() for filename in dirs: if('.py' in filename): file = open(filename,'r',encoding='utf8') for line in file.readlines(): if(find in line): print(filename) print(lin...
true
717feec28f1e65e02573f7153fbf85686380e3d1
lva123/python101-sinh-vien
/Code buoi hoc/Buoi 6/ex1.py
UTF-8
220
3.1875
3
[]
no_license
d = {"a": 1, "b": 2, "c": 5, "f": 10} c = input("nhap vao 1 chu cai: ") ## kiem tra input if value := d.get(c): #neu value khac None print(f"gia tri cua key {c} la: {value}") else: print(f"key {c} khong ton tai")
true
b3d8e3a5302e3e6e43827bc41010bc5e1556c452
alex75311/acmp.ru-solution
/out.py
UTF-8
85
3.453125
3
[]
no_license
def out(l): res = '' for el in l: res += str(el) + ' ' return res
true
e604a1ed05954bb680d1f48a60aed04518ed6be4
roman807/HU
/CISC601_ScientificComputingII/abc_anomaly_detection/models/DNN.py
UTF-8
1,751
2.890625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Roman Moser, 10/5/19 """ Implementation of dense neural network (DNN) """ from keras.models import Sequential from keras.layers import Dense from keras.callbacks import ModelCheckpoint from sklearn.model_selection import train_test_split # input parameters: EPOCHS =...
true
2ff6fd41a2c6339a2fe2d5c439811daded36cceb
tangcongyuan/WPICS585Spring2015
/Project2/query5/reducerjoin.py
UTF-8
835
3.015625
3
[]
no_license
#!/usr/bin/env python import sys #initial value of current customer & count currentCount = 0 currentCust = "-1" # input comes from STDIN for line in sys.stdin: # remove leading and trailing whitespace line = line.strip() try: # parse the input we got from mapperjoin.py custID,custName,cc,transID = l...
true
51d944e07699b0c6ba723040bf7e3e49f78f14ba
GabrielJar/Python
/8a semana/remove_repetidos.py
UTF-8
628
4.09375
4
[]
no_license
''' lista = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 2, 4, 43, 5, 676, 45, 76, 768, 34, 768, 676, 43] print("Lista completa/original: " + str(lista)) print() ''' def remove_repetidos(lista): nova_lista = [] # Onde colocar os itens unicos for item in lista: if item not in nova_lista: nova_lista.ap...
true
c88a3312265eda10dc5f71dd1e277345575f5969
9thbitio/link
/link/wrappers/yahoowrapper.py
UTF-8
2,115
2.59375
3
[ "Apache-2.0" ]
permissive
from link.common import APIResponse from link.wrappers import APIRequestWrapper, APIResponseWrapper from requests.auth import AuthBase import json import requests class YahooAuth(AuthBase): def __init__(self, token): self.token = token def __call__(self, req): req.headers['Content-Type...
true
ff3ca4765edafc9aa0c1b87ce140e0fb79e6a902
sdsalazar/ejercicio_en_clase
/Hola_Mundo.py
UTF-8
673
3.390625
3
[]
no_license
# coding: utf-8 # In[1]: print "Hola_Mundo" # $$f(x)=li(x) - \sum_{p}{li}(x^p)-log(2) + \int_\chi^\infty \frac{dt}{t(t^2-1)log(t)}$$ # In[2]: 2+4*6/8.0-3 # In[3]: 3/2 # In[6]: (3+5j)-(1-1j) # # SANDRAAAA _:P # In[7]: 5**3 # In[12]: abs(3+5j) # In[14]: int(_12) # In[15]: float(_14) # In[20]: ...
true
206f17a097c1751e3c0955a3b912daec3ad4682c
kingkk31/BOJ
/source code/8595_히든 넘버.py
UTF-8
227
3.421875
3
[]
no_license
n = int(input()) str = input() number = "0" sum = 0 for i in range(n) : if str[i] >= '0' and str[i] <= '9' : number += str[i] else : sum += int(number) number = "0" sum += int(number) print(sum)
true
469eff47481f9c2504accc8976cf7e1a59595e13
ghosalya/kaggle-landmark-recog
/img_extract/extract.py
UTF-8
745
2.78125
3
[]
no_license
""" PURPOSE: extract image from the links given in the dataset. """ import helper import pandas as pd import sys def main(file, dir, start=0): dataset = pd.read_csv("./data/%s" % file, dtype="str") print("########## START SCRIPT ##########") n = dataset.shape[0] size = 0 for i in range(start,n): imgId = datase...
true
345588e7f6e117680769f7bb9357cc5bada193f1
ravigupta19/HackerRank-DataStructure
/Stack/poisnous-plant.py
UTF-8
423
2.796875
3
[]
no_license
_ = input() no_of_days = 0 stack = [] maxDays = 0 plants = list(map(int,input().split())) for i in range(len(plants)): plant = plants[i] mdays = 0 while len(stack) != 0 and stack[len(stack) - 1][0] >= plant: otherPlant = stack.pop() mdays = max(otherPlant[1], mdays) days = mdays + 1 if l...
true
3ad94e85f0853d03d0a8600dbe433b6a03dfba43
dzruyk/spam
/tweetgather/monitor_tweets.py
UTF-8
670
2.6875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import time import twitter api = twitter.Api(consumer_key="lalEaBNzKZdUmK2JNc3EVg", consumer_secret="your-secret-here", access_token_key="your-token-here", access_token_secret="your-token-secret") delay=60 def main(): lastid = api.GetHomeTimeline(...
true
30e53f97c47d64bf50e1e4a4b08944d94e89f3f2
yizhong120110/UniPayment
/utils/redisCon.py
UTF-8
2,788
2.765625
3
[]
no_license
# -*-coding:utf8-*- import redis from redlock import RedLock CONSTR = dict( host = '192.168.10.206' , port = 6379 , password = 'redisfesb', db = 0 ) class RedisCon(object): def __init__(self): if not hasattr(RedisCon, 'pool'): RedisCon.getRedisCon() # 创建redis连接 #self.con = red...
true
31067376f4fd96be10427abde309587ac09f4686
aishwat/loan_approval
/models.py
UTF-8
1,106
2.5625
3
[]
no_license
from pydantic import BaseModel, ValidationError, validator from typing import Optional class Customer(BaseModel): customerID: int dob: str income: int bureauScore: int applicationScore: int maxDelL12M: int allowedFoir: int existingEMI: int loanTenure: int currentAddress: str ...
true
0d2a35a91a45b186d95170fc4324ef9928d370ae
myspark02/Python-Algorithm
/sort_algorithms.py
UTF-8
15,103
3.28125
3
[]
no_license
import random, time from typing import BinaryIO def checkSort(arr, n, asc=True) : isSorted = True if asc==True : for i in range(1, n) : if arr[i] > arr[i+1] : isSorted = False break else : for i in range(1, n) : if arr[i] < arr[i+1] ...
true
85d66d3a20f79d265626067e460c91809f79d2df
nachande/PythonPrograms
/AssignmentOperator_10.py
UTF-8
301
4.03125
4
[]
no_license
a,x=10,2 b=20 print("Addition of ",a,b,"is =",a+b) print("Subtraction of ",a,b,"is =",a-b) print("Multiplication of",a,b,"is =",a*b) print("Division of ",a,b,"is =",a/b) print("Modulus of ",a,b,"is=",a%b) print(a,"to the power of ",x," is =",a**x) print("Floor Division of",a,b,"is=",a//b)
true
30e8f35b5854c1fcff6f4ba981033e8baa5e1504
numb3r33/kedro_example
/src/wids2021/pipelines/data_engineering/nodes.py
UTF-8
591
2.828125
3
[]
no_license
import pandas as pd def preprocess_train(train: pd.DataFrame) -> pd.DataFrame: obj_cols = train.select_dtypes(include='object').columns for col in obj_cols: train.loc[:, col] = pd.factorize(train.loc[:, col], sort=True)[0] train = train.drop('Unnamed: 0', axis=1) return train def preprocess...
true
ed45b1ce7d0cda7d896ea3e0413cd2dc5dde7252
loveleen-kaur21/fundamentals-of-programming-pt-1-unit-project-loveleen-hardaway
/main_unit_project.py
UTF-8
5,716
3.71875
4
[]
no_license
import random import inputValidation import time print("\nWhat's up everybody! Welcome to MagicCheck") spacebar = input("\nHit enter to proceed. ") print("\nHere, you will enter tasks needed to be done in a Magic 8-ball.") spacebar = input("\nHit enter to proceed. ") print("\nShake the Magic 8-ball to randomly pick...
true
017bbbdbea7e148bd494911e14217947f31b460c
korwipha/tcp
/tcpclient.py
UTF-8
298
2.71875
3
[]
no_license
import socket host ="127.0.0.1" port= 5000 server = socket.socket() server.connect((host,port)) data =raw_input("Number for fac : ") while data!='' : server.send(data) data=server.recv(1024) print("fac is : "+data) data = raw_input("Number for fac : ") server.close()
true
26b7bfdd8d07de9c8e1946fcc2039c60ea2cf8cf
kevinahuber/hackdanceville6
/beat_bump.py
UTF-8
1,542
2.8125
3
[]
no_license
""" Install pyaudio here: http://people.csail.mit.edu/hubert/pyaudio/ """ import argparse import pyaudio import wave from subscriber import Subscriber CHUNK = 1024 class Bumper(Subscriber): """Simple object that listens to beat output and hits the bass, yo""" def __init__(self, bass_path, channels=None, *...
true
266904cbd4383be7818e4fe64f2e24cd0f831df6
sallowdish/ProjectEuler
/12. Highly divisible triangular number/HDTNSmart.py
UTF-8
860
2.84375
3
[]
no_license
__author__ = 'Ray' import HDTNBruteFocus class HDTNSmart(HDTNBruteFocus.HDTNBruteFocus): @staticmethod def search(upperBound): """ based on the observation that n and n+1 have no common factor except 1. similar to {n, (n+1)/2} or {n/2, n+1} so we can time the count of both par...
true
feadd317def9a966c0d17a352401cf855ea5c521
sturzl/keyboardControlSocket
/testClient.py
UTF-8
1,325
3.3125
3
[ "Apache-2.0" ]
permissive
import socket import sys from thread import * def start_socket(): #begins socket connection to client and returns the socket instance HOST = '192.168.8.103' # Symbolic name meaning all available interfaces PORT = 5005 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREA...
true
72696ba9baf86e85763c887033219d8f40e6ae11
Granoia/Thesis
/code/ILP/halp/algorithms/directed_random_walk.py
UTF-8
5,272
3.21875
3
[]
no_license
""" .. module:: directed_random_walk :synopsis: Defines several functions for performing a random walk on a directed hypergraph and finding its corresponding stationary distribution. """ import numpy as np from scipy import sparse from scipy.sparse import linalg import random from...
true
e6e3ccd40bc360d70cd6f91437fa49e744214e27
sonuishaq67/py
/dms/graphs.py
UTF-8
181
2.640625
3
[]
no_license
import networkx as nx P=nx.path_graph(5) Q=nx.path_graph(8) R=nx.disjoint_union(P, Q) #nx.draw(R) print(nx.is_connected(R)) S=nx.star_graph(8) nx.draw(S) print(nx.is_connected(S))
true
6e24232a55c5c2d59c1980ffe8c75f9c8872dcc7
qazvv1/NeuronNetwork_test
/test/20200426_save/mnist_train.py
UTF-8
3,713
2.640625
3
[]
no_license
from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf # mnist = input_data.read_data_sets("./mnist_data", one_hot=True) # print("training data size: ", mnist.train.num_examples) # print("validating data size: ", mnist.validation.num_examples) # print("testing data size: ", mnist.test.num_e...
true
d830026680ec2288180c82b2103da1075879282b
kenito2050/Python-Page-Object-Framework-Example
/pages/producer_center/saw/ouststanding_subjectivities.py
UTF-8
648
2.53125
3
[]
no_license
from selenium.webdriver.common.by import By import time class Outstanding_Subjectivities(): def __init__(self, driver): self.driver = driver def PageElements(self): # Submit Button self.submit_button = self.driver.find_element(By.XPATH, "//form[@id='binding']/div[1]/div[2]/a/span[2]/...
true
8be1b979983f23b64726cd945b45e26ed7c58b6a
nfynt/OpenCV_DL
/5.Object-Detection/custom_seed_watershed.py
UTF-8
1,657
2.8125
3
[]
no_license
import numpy as np import cv2 import matplotlib.pyplot as plt # %matplotlib inline from matplotlib import cm def create_color(i): x = np.array(cm.tab10(i))[:3]*255 return tuple(x) colors=[] n_markers=10 curr_marker=1 marker_updated=False for i in range(n_markers): colors.append(create_color(i)) # p...
true
4f5faaf4cadddbf11cc096809b1de910522ac6bc
dusanerdeljan/beacon
/beacon/nn/module.py
UTF-8
2,668
3.0625
3
[ "MIT" ]
permissive
from beacon.nn.parameter import Parameter from beacon.tensor import functions as fn from abc import ABC, abstractmethod from inspect import getmembers import pickle class Module(ABC): def __init__(self): """ Represents abstract module in a neural network. """ super().__init__() ...
true
d586a753d44b41ead5ea3aa62c68a47f86da8deb
terrapower/armi
/armi/utils/customExceptions.py
UTF-8
4,573
2.703125
3
[ "Apache-2.0", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
# Copyright 2021 TerraPower, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
true
cdb6dbf4b02bdb465ec1112eb05a2ff632e87e62
ABCmoxun/AA
/AB/linux2/day15/code/myyield.py
UTF-8
312
3.640625
4
[]
no_license
# myyield.py def myyield(): yield 2 yield 3 yield 5 yield 7 print("生成器函数调用结束") gen = myyield() print(gen) # gen绑定生成器对象,此对象为可迭代对象 for x in gen: print(x) # it = iter(gen) # 返回迭代器 # x = next(it) # print(x) # print(next(it))
true
90f681063c51cd5d073c4e0f433bca1a5defd333
tudo-astroparticlephysics/pydisteval
/disteval/visualization/comparison_plotter/functions/calc_funcs.py
UTF-8
26,216
3
3
[ "MIT" ]
permissive
import numpy as np import scipy.stats.distributions as sc_dist from itertools import compress def aggarwal_limits(mu, alpha=0.68268949): """Get Poissonian limits for specified contour levels Parameters ---------- pdfs : array_like The expected number of events (Poisson mean) in each observabl...
true
c41991107f37145a0b928fa58e109f064538a76c
pkopy/python_tests
/utils.py
UTF-8
147
3.21875
3
[]
no_license
def graph(x, y): points = list((a, b) for a in range(x + 1) for b in range(y + 1)) return points def multi(a, b): result = a * b return result
true
355605ece28ae0c307a411a090fb53aa0819dd0e
nick-singh/UTT-AdvanceInternetTech-2017
/week3/geocode.py
UTF-8
492
2.75
3
[]
no_license
import httplib2 import json google_geocode_id = "AIzaSyAvnFnZSiMNLeXX3eGh5kf9NEySf-zjkHY" google_initial_url = """https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s""" def get_geocode_location(input_string): location_string = input_string.replace(" ", "+") url = google_initial_url%(location_string...
true
445993bca0b981e51dd5d6dca62c291869491f10
warriormaster12/gdc-bot
/bot/cogs/git.py
UTF-8
7,084
2.734375
3
[ "MIT" ]
permissive
from discord.ext import commands class ManMessage: def __init__(self, name, synopsis, options=[], short_desc='', long_desc=[], examples=[]): self.name = name self.synopsis = synopsis self.options = options self.short_desc = short_desc self.long_desc = long_desc self...
true
254927f54e89721afc56eb468d60f26521ee38bf
anujuw080/NaiveBayesClassifier
/Classifier.py
UTF-8
4,601
3.171875
3
[]
no_license
import csv import math def getDataFromCsv(fileName): tempRowList = [] finalData = [] # Retrieve data from CSV data = list(csv.reader(open(fileName))) rowsNumber = len(data) colNumber = len(data[0]) for i in range(0, rowsNumber): for j in range(0, colNumber): tempRowLis...
true
c0114e9fa4855f58286b030a7c61cc5465856170
daniel-reich/turbo-robot
/CjXamaNRmKxwkmBxq_3.py
UTF-8
415
3.59375
4
[]
no_license
""" Fix the code in the code tab to pass this challenge (only syntax errors). Look at the examples below to get an idea of what the function should do. ### Examples cubes(3) ➞ 27 cubes(5) ➞ 125 cubes(10) ➞ 1000 ### Notes * **READ EVERY WORD CAREFULLY, CHARACTER BY CHARACTER!** * Don't ...
true
5b3e3310f6efdb001f505afcf6285df81f38d3dc
Ashw0rld/Machine-Learning
/BostonHouse_Regression.py
UTF-8
1,196
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 12 08:07:32 2020 @author: KIIT """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.da...
true
d2717415f635674e0db349a88338ce017f5fc17d
Aasthaengg/IBMdataset
/Python_codes/p03289/s091336896.py
UTF-8
300
3.234375
3
[]
no_license
s = input() if s[0] == 'A' and s[2:-1].count('C') == 1: for n in s[1:]: if n.islower(): continue else: if n == 'C': continue else: print('WA') exit() else: print('WA') exit() print('AC')
true
76dd00ddcffb636afe2a03685304234b55ca96ff
hyeinkim1305/Algorithm
/Programmers/Level2/Programmers_Level2_타겟넘버.py
UTF-8
817
3.46875
3
[]
no_license
# 푸는데 시간이 좀 걸렸음! def dfs(idx, numbers, target, total): global cnt if idx == len(numbers): if total == target: cnt += 1 return else: dfs(idx+1, numbers, target, total+numbers[idx]) dfs(idx+1, numbers, target, total-numbers[idx]) # 여기로 올 땐 다시 idx로 돌아오니까 idx+1...
true
a0481cea68829e7cc5e84541220192d671a1555d
ay2306/Competitive-Programming
/google/codejam2019/qualifiers/c.py
UTF-8
1,166
3.046875
3
[]
no_license
import math def gcd(a,b): if(b==0): return a else: return gcd(b,a%b) def solve(t): arr = [int(e) for e in input().split()] arr1 = [] arr2 = [] for i in range(len(arr)): if arr[i] != arr[i-1]: if i-2 >= 0: arr1 = arr[0:i-1] arr2...
true
30f86c0f0d55322f89aad55ff9a284e562966594
Kacyk27/python-unittest-learning
/100+ Exercises course/051.py
UTF-8
465
2.9375
3
[]
no_license
import unittest from notebook import Notebook class TestNotebook(unittest.TestCase): def setUp(self): self.notebook = Notebook() self.notebook.new_note('Big Data') self.notebook.new_note('Data Science') self.notebook.new_note('Machine Learning') def test_notebook_search_metho...
true
9d96807774ad56f8bdcdb975f71d1c6bc38c331a
HuangYongBo/Messy
/learn_python/show_me_code/0001/0001.py
UTF-8
443
3.328125
3
[]
no_license
#!/usr/bin/python2.7 #coding:utf-8 import random,string field = string.letters+string.digits #if in python3 :field = string.ascii_letters+string.digits def get_activation_code(l,n): """ l(length):the length of code n(number):how many code would you want """ ret = [] for i in range(n): tmp ="".join(random.sam...
true
c80da9856a5fb38a7fa8ffffec2fac69f122b1f5
caje731/eating-disorder
/scanner/spiders/asklailaCrawlSpider.py
UTF-8
2,381
2.53125
3
[]
no_license
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.loader import ItemLoader from scrapy.contrib.linkextractors import LinkExtractor from scanner.items import BusinessInfoItem from HTMLParser import HTMLParser #DONE. #Asklaila #User Input: location= "Bandra", location1="West" , city="Mumbai" , q...
true
b2d0eb462bc3497120e3b15034b3556c82b710fe
Dewald928/Alarm-System
/PythonCode/lcd-master/pirtest.py
UTF-8
665
2.890625
3
[]
no_license
import RPi.GPIO as GPIO import time import lcddriver display = lcddriver.lcd() GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.IN) #Read output from PIR motion sensor GPIO.setup(17, GPIO.OUT) #LED output pin while True: print("No intruders") i=GPIO.input(4) if i==0: ...
true
2c6a1589d052dd55741219ab075fc2061b4b2a98
ryanfitch/SQL-Python
/sqlite_drill_2.py
UTF-8
576
3
3
[]
no_license
# sqlite_drill_2.py by Ryan Fitch [http://ryan-fitch.com/] # Python2 # tutorial drill from https://pythonprogramming.net/sql-database-python-part-1-inserting-database/ # Python: Reading data from a data base import sqlite3 import time import datetime conn = sqlite3.connect('tutorial.db') c = conn.cursor() sql = "SEL...
true
1f54a86d1004aaa8f21f6f00fd3477c5128efd54
ed-word/Linkedin-Scraper
/urls.py
UTF-8
1,047
2.625
3
[]
no_license
from selenium import webdriver import time from bs4 import BeautifulSoup from tqdm import tqdm query_keyword = "" no_of_pages = 1 email = "" password = "" driver = webdriver.Chrome() driver.get('https://www.linkedin.com/') email_box = driver.find_element_by_id('login-email') email_box.send_keys(email) pass_box = dr...
true
ecbade959d6e55d40d745b8a222c6e76097a4e13
hujianli94/Python-code
/8.面对对象编程初探/面向对象程序学习/为属性添加安全保护机制/封装性,私有方法和私有属性.py
UTF-8
686
3.53125
4
[]
no_license
# !/usr/bin/env python # -*- coding:utf8 -*- # auther; 18793 # Date:2019/5/18 7:38 # filename: 封装性,私有方法和私有属性.py class Animal(object): def __init__(self, age, sex=1, weight=0.0): self.age = age self.sex = sex self.__weight = weight def eat(self): self.__weight += 0.5 self...
true
2370146312a606ba627b418fd32ea02f74b9afc0
jakubwida/Projekt1
/DungeonGameEngine/Menu/MenuButton.py
UTF-8
507
2.953125
3
[]
no_license
from GameEngine.GraphicsEngine.GraphicsObject import GraphicsObject import curses class MenuButton(GraphicsObject): def __init__(self,coords,text,callabl): super().__init__(coords) self.text = text self.color = None self.callabl = callabl def highlight(self): self.color = curses.A_STANDOUT def un_highli...
true
b4e6caad9adea5ef0a225d367b8b007860333d77
sandyUni/P900
/listports.py
UTF-8
753
2.546875
3
[]
no_license
''' Author: Lai Jun E-mail: laijun@nudt.edu.cn LastEditors: Lai Jun LastEditTime: 2022-06-09 12:16:14 ''' # -*- code: utf-8 -*- import sys import serial from serial.tools.list_ports import comports if __name__ =='__main__': devices = comports() if sys.platform == 'win32': for device in devi...
true
f40d4a60d6a5c169ee78437d8641e06178a7472d
catapult-project/catapult
/telemetry/telemetry/core/exceptions.py
UTF-8
6,169
2.625
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import absolute_import import logging import sys class Error(Exception): """Base class for Telemetry exceptions.""" def __init__(self, ...
true
dadf94cdd14660087dc4a2f026165f01adf6aa44
dserj/hosting-ml-as-microservice
/part3/testFunction/handler.py
UTF-8
1,499
2.75
3
[]
no_license
import json import nltk nltk.data.path=['.data'] from nltk.corpus import stopwords from string import punctuation stopwords_eng = stopwords.words('english') def bag_of_words(words): bag = {} for w in words: bag[w] = bag.get(w,0)+1 return bag from nltk.stem import WordNetLemmatizer from nltk.tok...
true
219ba5a1e0b3ce70f3708ac5d218b51193d7c76e
Abezzam10/SSW555
/test/test_us16.py
UTF-8
1,256
2.71875
3
[ "MIT" ]
permissive
""" US16: male_last_name Javer, Mar 3, 2019 To check each male has the last name within each family """ import unittest from gedcom_ajry import Gedcom from mongo_db import MongoDB class test_us16(unittest.TestCase): """ Test cases for US16""" def test_same_lastname(self): """ Positive test, ma...
true
12249bd07219bc0ae6934428e10ebd318b79bcb7
aec3675/bcg_proj
/temp_plotting.py
UTF-8
13,501
2.5625
3
[]
no_license
import numpy as np import math import astropy.io.fits as fits import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from matplotlib import patches import skimage from skimage.measure import * from skimage.transform import downscale_local_mean from astropy.modeling import models import photutils import t...
true
12f04b7b35aac34c1e40d9c066332cc67d0b82c5
IHCC-cohorts/GECKO
/src/scripts/sort_csv.py
UTF-8
1,313
2.953125
3
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import csv import json from argparse import ArgumentParser def sort_terms(node, parent_children, hierarchy): """Recursively create a list of nodes grouped by category.""" for c in parent_children.get(node, []): hierarchy.append(c) sort_terms(c, parent_children, hierarchy) return hierarchy...
true
70464783f802a3a0222af30444606421732f8c25
kienpt/subwayrouting
/data/diff.py
UTF-8
286
2.796875
3
[]
no_license
import sys from sets import Set f1 = sys.argv[1] f2 = sys.argv[2] node1 = Set([]) node2 = Set([]) with open(f1) as lines: for line in lines: node2.add(line.strip("\n")) with open(f2) as lines: for line in lines: if line.strip("\n") not in node2: print line.strip("\n")
true