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
48c781d88c28a7bcd2270e6de8ce6903c00f048c
mikedefrancis/pxdebugtools
/pxdebugtools/pxdebugtools.py
UTF-8
43,559
2.765625
3
[]
no_license
#!/usr/bin/env python # @author mikedefrancis # www.github.com/mikedefrancis # a usable debug framework for python prints, juicy pdb, module-based debug integration # nicest thing: enable/disable all of your debug from a cli program. No need to remove your debug prints from your programs anymore. #####################...
true
644e4dbf350b99f4cb57eddf4e0256d308376d72
eloquentarduino/EloquentTinyML
/examples/DigitsExample/digits_model.py
UTF-8
2,029
2.703125
3
[]
no_license
import math import numpy as np from sklearn.datasets import load_digits import tensorflow as tf from tensorflow.keras import layers from tinymlgen import port def get_data(): np.random.seed(1337) x_values, y_values = load_digits(return_X_y=True) x_values /= x_values.max() # reshape to (8 x 8 x 1) ...
true
3f85dbe43d6e2a962d4832805ff3b75190fbafb5
oplatek/alex
/alex/tools/mturk/sds-evaluation/2012-12-14-cir-ruledm/www/model.py
UTF-8
2,485
2.53125
3
[ "Apache-2.0" ]
permissive
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Date, Integer, String, DateTime, Text from sqlalchemy import create_engine, ForeignKey from sqlalchemy.orm import relationship, backref from sqlalchemy.sql.expression import func, select from sqlalchemy.sql import and_, or_, not_ B...
true
4324bdf440998b40a2e8bdd7a9e531b43561e14d
weiche9835/Image_processing
/median_Filter.py
UTF-8
1,522
2.75
3
[]
no_license
import random import cv2 import numpy as np import math list2 = [] img = cv2.imread('picture/sails.png') mask = np.array([[1,1,1],[1,1,1],[1,1,1]],dtype = 'uint8') #RGB to Gray gray = np.zeros((img.shape[0],img.shape[1]),np.uint8) for a in range(img.shape[0]): for b in range(img.shape[1]): ...
true
60ef64390a38d1537fdf1f7bbf6bda245482c0f6
linwt/nowcoder-leetcode
/leetcode_Python/811.子域名访问计数.py
UTF-8
674
2.859375
3
[]
no_license
class Solution(object): def subdomainVisits(self, cpdomains): d = {} for i in cpdomains: # 先切分并保存最低一级域名与次数 res = i.split() num = int(res[0]) addr = res[1] if addr in d: d[addr] += num else: d[addr...
true
4defbad1826240fef411543d759d742fc6f0a7f1
happysmile27/Dev_pandas
/Task1.py
UTF-8
138
2.8125
3
[]
no_license
import pandas as pd import numpy as np c = np.random.randint(0, 100, size=10) a = pd.Series(c) print(a.nunique()) # print(pd.unique(a))
true
c729e0aa17871f756b9ca2105b56260b21263b8e
maelys/Brazil-2014
/build_db.py
UTF-8
2,330
2.71875
3
[]
no_license
#!/usr/bin/env python import sqlite3 def main(): conn = '' cur = '' conn = sqlite3.connect('brazil2014.sqlite') cur = conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS contestants (id integer PRIMARY KEY AUTOINCREMENT,name TEXT,points INTEGER DEFAULT 0,\ Spain INTEGER DEFAULT 0,Germany...
true
f65d867b96ccba9399d02141881a787745559aa0
art-vybor/labs
/modeling/lab1/doit.py
UTF-8
2,684
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- import math import matplotlib.pyplot as plt import numpy as np import random train_size = 0.9 bins_for_histogram = 10 def build_probability_dict(f): P = {} for x in f: if x not in P: P[x] = 0 P[x] += 1 return {k:v*1.0/len(f) for k,v in P.iteritems()} ...
true
795f7c4495040eb1f9453fede0696f86bac2d4b2
Elliot-L/comp551-a4
/stats/window_average.py
UTF-8
417
3.28125
3
[]
no_license
import numpy as np def average(arr): avg = 0.0 dimensions = arr.shape if dimensions[0] == 1: return 0 for (x, y), value in np.ndenumerate(arr): if(x == int(dimensions[0]/2)) and (y == int(dimensions[1]/2)): continue else: avg = avg+ value avg = avg/(p...
true
a6709e3079e4ecb28c10fedd7336f771780c6b94
whz920/repo
/machinelearning/20200406/rbf.py
UTF-8
1,565
3.015625
3
[]
no_license
# -*-coding:utf-8 -*- # @Time:2020/3/29 16:52 # @Author:CHM # @File: rbf.py from sklearn.datasets import make_moons import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC import numpy as np def load_data(): X, y = make_moo...
true
fa3651451a8ba5a5608c2ad8528c2a70033cb2e3
KalyaniDakhare/PythonBasics
/printF.py
UTF-8
160
3.390625
3
[]
no_license
numbers=[5,2,5,2,2] for number in numbers: # print("x"*number) output="" for count in range(number): output+="x" print(output)
true
7ddf51398113fbc29869c408b939a42bffdccb9c
msfstef/CompNet
/Networks/RESULTS.py
UTF-8
2,766
3.109375
3
[]
no_license
import kdistanalysis as kd print 'All of the figures used in the report can be reproduced using this module.' print 'However, some of the figures in the report took a relatively long time' print 'to produce, so this module reproduces them for smaller network sizes and for' print 'a smaller number of iterations, to all...
true
7081e5cf35034c2becdc9d2990ce6c66cbdcd55b
alissonmsales/speech2text
/embedding/conv-encoder.py
UTF-8
2,877
2.609375
3
[]
no_license
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, Flatten from keras.models import Model from keras.callbacks import TensorBoard import numpy as np from random import shuffle import math import os import PIL.Image as Image def get_data(): base_label = [] base_data = [] a = {} # Path to sav...
true
b7fdd8ce855ddbc2fb4c8c6f31ad612acb6aeb79
fkz/mot
/statistics.py
UTF-8
499
2.546875
3
[]
no_license
""" do some additional work in specific actions like mating etc. can be used to generate cumulative statistics or show some additional info """ class Statistics: """ is called every time an action has been executed """ def mergeAction(self, environment, creature, action): pass """ is called every time ...
true
3aaccaf9149895f74ad17a52c1ba407772b081db
ShuangLiMS/nlp
/Disorder_Classification/mental_health_forum/Disorder_Classification/mental_health_forum/spell_correct.py
UTF-8
3,607
2.96875
3
[]
no_license
import jamspell from nltk.tokenize import casual_tokenize from nltk.stem.porter import PorterStemmer from nltk.stem import WordNetLemmatizer import pandas as pd import regex as re from preprocessing import rm_punctuation def spell_tokenizer(text): """ Perform word tokenization using casual_tokenize after spel...
true
73c1d98607adc318146a8a7a1d39d03dcd95781b
woosanguk-git/python_study
/basic_sequence/sequence_slicing.py
UTF-8
328
3.5625
4
[]
no_license
def slicing_sequence(): # seq[시작] # seq[시작 : 끝] # seq[시작:끝:스텝] word = "Watch the stairs!" print(word[-1]) print(word[-2]) print(word[-2:]) print(word[:-2]) print(word[-0]) print(word[0:5]) print(word[:10:2]) if __name__ == "__main__": slicing_sequence()
true
037b775c7347c4be19b857672ad0db2bb4bfa3a2
KaluEmeKalu/python_book
/ex18.py
UTF-8
350
3.109375
3
[]
no_license
exam_grades = [80, 93, 85, 94] students = ['Eke', 'Jordan', 'Uche', 'Nnenna'] gpas = [3.8, 3.6, 3.33, 4.0] uche_grade = exam_grades[2] uche_name = students[2] uche_gpa = gpas[2] first_two_grades = exam_grades[0:2] last_two_grades = exam_grades[2:4] print(uche_grade) print(uche_name) print(uche_gpa) print(first_two_...
true
fd10c4848a1671dba3c3256382e5a75848308909
chiknahuikoatl/Redes_y_Sistemas_Complejos_2020-2
/Proyecto/Código/gráficas/main.py
UTF-8
1,104
3.640625
4
[]
no_license
import csv def parseBoolCSV(b): return b == " True" def leerPersonaje(personaje): suma = 0 with open(personaje, newline='\n') as f: reader = csv.reader(f) for row in reader: suma += int(row[1]) print(str(parseBoolCSV(row[2]) and True)) print(row) re...
true
3bb26307471b572a406f43699c6d5059e5815faf
pfehrmann/sign-detection-rpi
/sign_detection/RPI/PiCameraImageSource.py
UTF-8
1,164
2.671875
3
[]
no_license
import cv2 import picamera import picamera.array from sign_detection.model.ImageSource import ImageSource import sign_detection.tools.image_preprocessing as ip class PiCameraImageSource(ImageSource): def __init__(self, resolution=(300, 200), raw_scale_factor=None, average_value=None): # capture from came...
true
af1f0060031fd7440d527a0a357372fd086c2234
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_1/40.py
UTF-8
780
2.953125
3
[]
no_license
import sys def readline(): return sys.stdin.readline() def main(): ncase = int(readline()) for case in range(ncase): neng = int(readline()) eng = [] engmap = {} for i in range(neng): name = readline().strip() engmap[name] = len(eng) eng.a...
true
8ed93902da5c9ea2f5fb2ee73d1b35c79ce8a7eb
WillemJan/Misc
/booksearch/booksearch/queryparser.py
UTF-8
594
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#/usr/bin/python # -*- coding: utf-8 -*- # # queryparser.py # # Copyright (c) 2014-2019 WillemJan Faber # # For licence information see LICENCE.txt, # in the toplevel directory of this project. # import isbnlib def isISBN(input_str): ''' Checks if the given string is an ISBN number. ''' if isbnlib.is_isbn10...
true
91f5bb9975a2adade6a8111c5984a4840ef78c7f
rntkym/atcoder
/abc168/c.py
UTF-8
257
3.296875
3
[]
no_license
import math a, b, h, m = map(int, input().split()) angle_h = h * 30 + m * 0.5 angle_m = m * 6 diff = min(abs(angle_h - angle_m), 360 - abs(angle_h - angle_m)) cos = math.cos(math.radians(diff)) ans = a * a + b * b - 2 * a * b * cos print(math.sqrt(ans))
true
bd576a17861eef4b62f6aa78d44f02386b7150e2
Jeanselme/Search_Text
/Indexation/wordProcessing.py
UTF-8
955
3.65625
4
[]
no_license
""" Search Engine by Vincent Jeanselme and Matthieu Clin vincent.jeanselme@gmail.com """ from nltk.stem.lancaster import LancasterStemmer def extractWords(text): """ Extracts words of a text and suppress ponctuation """ res = [] for word in text.split() : newWord = "" for letter in word.lower() : # Ad...
true
5df6a2d7d170b4e802e86c9f566cfe89481125f9
gnchau/Quadris
/train_learner.py
UTF-8
3,268
2.59375
3
[]
no_license
from random import random from engine import Tetris from controller import Controller from QLearner import QNetwork from experiences import Experiences reward_maps = { "balanced": { 0: 1, 1: 10, 2: 40, 3: 90, 4: 160, }, "aggressive": { 0: 1, ...
true
89853797cce936144b7acf79f369de916f34608b
mkuzak/mean
/test_mean.py
UTF-8
232
2.828125
3
[ "Apache-2.0" ]
permissive
from mean import * def test_ints(): num_list = [1,2,3,4,5] obs = mean(num_list) exp = 3 assert obs == exp def test_zero(): num_list=[0,2,4,6] obs = mean(num_list) exp = 3 assert obs == exp
true
bf8e0ef78f8fab60a1b053dfd9a0fd6a1eab3b35
RTalha/python-programe-for-bioinformatics
/dynamic programing for global and local alignment/BIO_ASS2_Q2.py
UTF-8
1,767
2.953125
3
[]
no_license
import numpy as np flag=True row=0 column=0 row_str="" col_str="" f=open("/home/talha/Documents/sequences.txt") for W in f: if flag==True: row=len(W) row_str=W else: column=len(W) col_str=W flag=False f.close() matrix=np.zeros((row,column),np.int32) #scoring mismatch=input("...
true
a769fe8fc09dc5dfeda71e5ac4334febafdaac2c
ofkarakus/python-assignments
/Python Basics/3-Control Flow Statements/Assignment-8/Assignment - 8 (Leap Year).py
UTF-8
863
5
5
[]
no_license
# Task: # Find out if a given year is a "leap" year. # In the Gregorian calendar, three criteria must be taken into account to identify leap years: # The year must be evenly divisible by 4; # If the year can also be evenly divided by 100, it is not a leap year; unless... # The year is also evenly divisible by 400. Th...
true
83ddd0ed50a8e20ef5828e56cd30f22e8abb506c
Fondamenti18/fondamenti-di-programmazione
/students/1602302/homework03/program01.py
UTF-8
4,574
3.359375
3
[]
no_license
''' Abbiamo immagini in formato png ottenute inserendo su di uno sfondo monocolore rettangoli di vari colori i cui assi sono sempre parallei agli assi dell'immagine. Vedi ad esempio l'immagine Img1.png Per caricare e salvare immagini PNG usate le funzioni load e save che abbiamo preparato nel modulo immagini.p...
true
37e56612599669e41adcd9d354bb568f515655c4
zhaodonglin/compiler_c
/color.py
UTF-8
1,115
2.953125
3
[]
no_license
import ctypes import sys STD_INPUT_HANDLE = -10 STD_OUTPUT_HANDLE = -11 STD_ERROR_HANDLE = -12 FOREGROUND_BLACK = 0x0 FOREGROUND_BLUE = 0x01 # text color contains blue. FOREGROUND_GREEN = 0x02 # text color contains green. FOREGROUND_RED = 0x04 # text color contains red. FOREGROUND_INTENSITY = 0x08 # text color is ...
true
254ff5dcc56e7ab604313a3053793730c4187790
priasit/SentimentAnalysis_StudentReview
/readTestData.py
UTF-8
4,155
2.625
3
[]
no_license
import re import csv import array import os import msvcrt as m import sys def wait(): m.getch() count = len(sys.argv) if count == 1: print ("Need review files as arguments to process"); sys.exit(0) else: print ("Numer of files: ", count) print ('Argument List:', str(sys.argv)) arguments = l...
true
48dcbd575c389b255c8a274e7833de40af5919df
mycguo/instantpress
/languages/es-ar.py
UTF-8
22,831
2.671875
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
# coding: utf8 { '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"actualice" es una expresión opcional como "campo1=\'nuevo_valor\'". No se puede actualizar o eliminar resultados de un JOIN', '%(nrows)s records found': '%(nrows)s records found', '%Y-%...
true
ea98a9b0ea9eafd2c822470b9676b9c17ca478b6
xy1234552/pyprobml
/examples/logregXorDemo.py
UTF-8
3,155
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np from utils import util from scipy.special import logit import sklearn.linear_model as lm from sklearn.linear_model import LogisticRegressionCV, LogisticRegression from sklearn.metrics.pairwise import linear_kernel, polynomial_kernel, rbf_kernel f...
true
7dc5fe272f3e17cdaa87d4760ec41aeb5b8f28bc
chords-app/chords-app.github.io
/Python/שבוע 4/מעבדה/LAB4Q1.py
UTF-8
157
3.578125
4
[]
no_license
a = int(input('Enter pleasee number I will do for you factorial')) factorial = 1 for i in range(1, a+1): factorial = factorial*i print(i, factorial)
true
63d012fcf88116021abfe6d5918ca07c67ff7eed
shrey920/DSA-Project
/main.py
UTF-8
1,924
3.484375
3
[]
no_license
class ITNode : def __init__(self, a = None, b = None) : self.parent=None self.low = a self.high = b self.max = 0 self.leftChild = None self.rightChild = None class IntervalTree : def __init__(self, t = None) : self.root = t def insert(self,root, x=None) : if self.root == None : self.root=x ...
true
2c03f04e0786d8fa9c6a8e5bc0eedcafab3dfb1a
ABhilashscaria/AI-projects
/Mnist digit recognition.py
UTF-8
1,063
2.703125
3
[]
no_license
import tensorflow as tf import numpy as np import pandas as pd from sklearn.metrics import accuracy_score df = pd.read_csv('D:/python/Digit mnist/train.csv') df = np.array(df) m, n = df.shape data = df[0:1000].T X = df[:, 1:m] X = tf.keras.utils.normalize(X) Y = df[:, 0] Y = Y.reshape(42000, 1) X_train = ...
true
025e0b678949db516415b482d6b6a69f44a14098
bbotte/mysqlbinlog_flashback
/func.py
UTF-8
1,800
2.859375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- """ 公共函数 v0.1.1 2016/09/21 yilai 加了些参数 v0.1.0 2016/07/20 yilai created """ import logging from logging.handlers import RotatingFileHandler import traceback logger = logging.getLogger("__main__") def init_logger(name,log_level=logging.DEBUG,screen_output=True): ...
true
6fba7eb46870da4940939ffece935d2ec6dc16e7
miloshito/python_practice
/excercise5.py
UTF-8
145
3.15625
3
[]
no_license
my_height = 81 print "here is %d ",my_height, "my height." print "he is %d inches tall." %my_height print "using %r to print height." %my_height
true
4f5668a28b37798087d82315f1aa0dce515d99a0
rockvivek/web-scraping-example
/demo.py
UTF-8
907
2.828125
3
[]
no_license
import pandas as pd from bs4 import * import requests page = requests.get("https://forecast.weather.gov/MapClick.php?" "lat=33.93680995224785&lon=-118.24891999999994#.XuFT02gzbIU") soup = BeautifulSoup(page.content,"html.parser") week = soup.find_all(id = "seven-day-forecast-body") #print(we...
true
085d4d2e9ce718aea2f53d0883e2128ff6c89158
benliebersohn/ideal-octo-waffle
/workflow/conf.py
UTF-8
1,485
2.5625
3
[ "BSD-3-Clause" ]
permissive
"""Configuration""" import sys,os import numpy as np import logging import fiona import rasterio import math try: rcParams = { 'data dir' : os.path.join(os.environ['ATS_MESHING_DIR'], 'data'), 'packages data dir' : 'packages', 'epsg' : 5070, # default Albers equal area conic ...
true
a480ef777db8d3f62159d8f959fefdaa2c959830
piacontreras/MA3701
/Mejora_método_Newton.py
UTF-8
4,070
3.3125
3
[]
no_license
# -*- coding: utf-8 -*- ### importamos las librerías que usaremos ### #Pía Contreras #Parte b) import numpy as np import matplotlib.pyplot as plt import random # iniciamos la semilla para generar valores aleatorios # recuerde cambiar '1' por su RUT # es importante fijar la semilla para que los datos aleator...
true
337c38e0d6fdc3c0570ce888c8e21cc882414d0f
janiszewskipeter/AskMate
/connection.py
UTF-8
878
3.03125
3
[]
no_license
''' Common functions to read/write/append CSV files without feature specific knowledge. The layer that have access to any kind of long term data storage. In this case, we use CSV files, but later on we'll change this to SQL database. ''' import csv # ANS_FILENAME = answer.csv # QUE_FILENAME = question.csv def get_...
true
5cb9314265d6dce2bd4a561b4a726ff9089f0ac4
MichaCrivelli/PythonNetworking
/Cloud System/server.py
UTF-8
1,372
2.671875
3
[]
no_license
import socket import ServerLogic import ast import pickle from multiprocessing import Process import time print("--- SERVER STARTED ---") sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) connections = [] def readSaveFile(): with open("save.txt","r") as f: save = f.read() save = ast.literal...
true
140252031df398699de2830dfdfa771b8a0a2fc7
forrest0402/leetcode
/python/1261. Find Elements in a Contaminated Binary Tree.py
UTF-8
699
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ @Author: xiezizhe @Date: 10/8/2020 上午8:43 """ class FindElements: def __traverse(self, node, nodes): if not node: return nodes.add(node.val) if node.left: node.left.val = node.val * 2 + 1 self.__traverse(node.left, nodes) ...
true
0d2f987bd835e368c1889e1d1ee847b827265972
anuragpatilc/anu
/f_Calories_from_fat_and_carbohydrates.py
UTF-8
454
3.890625
4
[]
no_license
def main(): aa = float(input('Enter the number of calories that result from fat: ')) print('calories from fat: ', calories_from_fat(aa)) bb = float(input('Enter the number of calories that result from carbohydrate: ')) print('calories from carbohydrates: ', calories_from_carbohydrates(bb)) def ...
true
094a832720213d2f5b0f6986453075ca2345e074
epicsaeed/PYTHONPROJECTS
/Task 1/A.temp converter.py
UTF-8
2,513
4.78125
5
[]
no_license
#This app converts temperature given in Celsius to Fahrenheit. #function that converts Celsius to Fahrenheit def convertToF(t): f = t * 1.8 + 32.0 return f #function that converts Fahrenheit to Celsius def convertToC(t): ...
true
ffde214c8e7fa5a7ab53f08835c9279c93187c37
raffael-azevedo/uri-online-judge
/URI1013.py
UTF-8
175
3.265625
3
[]
no_license
line1 = input().split(" ") A, B, C = line1 maiorAB = (int(A)+int(B)+abs(int(A)-int(B)))/2 maiorABC = (maiorAB+int(C)+abs(maiorAB-int(C)))/2 print("%d eh o maior" %maiorABC)
true
3e604887adb9b763c829fadfcca875d134698053
dbasden/python-librtlsdr
/sweep.py
UTF-8
624
2.5625
3
[]
no_license
#! /usr/bin/env python from rtlsdr import RtlSDR import sys if __name__ == "__main__": if len(sys.argv) < 2: print >> sys.stderr, sys.argv[0], "<outfile>" sys.exit(1) if RtlSDR.get_device_count() < 1: raise IOError("No known devices found") s = RtlSDR(0, 105700000, 1024000) outf = open(sys.argv[1], "w")...
true
04e0a43deb03f1d380febf9db8633f7a87790849
miltonluaces/problem_solving
/DS/FeatureEngineering/FeatureTools.py
UTF-8
2,530
2.859375
3
[]
no_license
import featuretools as ft import numpy as np import pandas as pd from catboost import CatBoostRegressor from sklearn.model_selection import train_test_split # Data train = pd.read_csv("Train_UWu5bXk.csv") test = pd.read_csv("Test_u94Q5KV.csv") # Data Preparation # Saving identifiers testItemId = test['Item_Identif...
true
863ed64d02e76e8e05163c4e6faf27e4d65ffa8e
Tarun1027/MLpro
/wine_quality_with_gui.py
UTF-8
4,026
2.921875
3
[]
no_license
from tkinter import * import numpy as np def showQuality(): new = np.array([[float(e1.get()),float(e2.get()),float(e3.get()),float(e4.get()),float(e5.get()),float(e6.get()),float(e7.get()),float(e8.get()),float(e9.get()),float(e10.get()),float(e11.get())]]) Ans = RF_clf.predict(new) fin=str(Ans)[1:-1]#IT W...
true
06f580875a3c88ce9a85f211cf1ce0977ec03b71
AlistairMadden/sudoku
/test_types.py
UTF-8
19,824
3.359375
3
[]
no_license
import unittest from unittest.mock import patch from util import read_sudoku_from_file from sudoku_types import StandardSudoku, Cell, CellSubset TEST_SUDOKU_DATA = read_sudoku_from_file('sudokus_test.json') class TestCellSubset(unittest.TestCase): def setUp(self): cell_values = [None, 1, 5, None, 2, No...
true
89b5a3a985cab1917532aff45344226d855f1c4e
victor-ddu/pythonlearn
/zhuangshiqi.py
UTF-8
311
2.90625
3
[]
no_license
def zhuangshiqi(efunc): def caozuoyuan(*args, **kwargs): print("function is going to run") return efunc(*args, **kwargs) return caozuoyuan @zhuangshiqi def helloworld(): print("Hello world") if __name__ == '__main__': helloworld() print("My name is ", helloworld.__name__)
true
06986749be2b1c5a241164ec9498c6d6960b7967
n-toy/Election-Results
/PyPoll_Challenge.py
UTF-8
5,330
3.703125
4
[]
no_license
import csv import os #Path to file file_to_load = os.path.join('Resources','election_results.csv') #vote count var initalize tot_votes= 0 #Candidate list and dictionary init candidate_list = [] candidate_votes = {} #County list and dictionary init county_list = [] county_votes = {} with open(file_to_load,'r') as...
true
958049749160e71f851f99df26d2092f3f3105cb
jerhieb/pygame
/platform jump video.py
UTF-8
4,719
2.796875
3
[]
no_license
import pygame pygame.init() display_width = 800 display_height = 600 surface = pygame.display.set_mode((display_width, display_height)) running1 = pygame.image.load('Running1.png') running2 = pygame.image.load('Running2.png') standing = pygame.image.load('playerstanding.png') door = pygame.image.load('Door.png') key = ...
true
d1d6c89373f9763e1b69af510eee82481e8c5c8a
stanilevitch/python_06102018
/zjazd_2/funkcje/przerobienie_zadan_na_funkcje/zadanie_4.py
UTF-8
548
4.25
4
[]
no_license
# a = 10.0 # b = 2.5 # # c = a * b # # print(f"Należność: {c}") # # output = f"Cena: {a} \nWaga: {b} \nNależność: {c}" # print(output) def naleznosc(a, b): """ Wylicza należność: :param a: cena - numeric :param b: waga - numeric :return: """ return a * b def drukuj(a, b): output = f"C...
true
375c1f90032b920b0e9ea363bb4edd6c33a48e81
bommunagasai/musicapi
/list.py
UTF-8
1,595
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- from flask import Flask, jsonify from bs4 import BeautifulSoup import requests import json app = Flask(__name__) response = requests.get("http://www.bbc.co.uk/radio1/chart/singles/print") HTML = response.text soup = BeautifulSoup(HTML,"html.parser") table = soup.find("table", attrs={"border":"...
true
45d474dc00252b902f288a09c9d8082ee8de96e7
robkegeenen/2IMF25
/4/table.py
UTF-8
809
2.84375
3
[]
no_license
#!/usr/bin/env python import sys, re values = {} cur = () with open(sys.argv[1], "r") as file: for line in file: m = re.search('^\s*\(define-fun\s*([abctn])([0-9]*).*$', line) if m: cur = (m.group(2), m.group(1)) m = re.search('^\s*([0-9]*|true|false)\)$', line) if m and cur: if cur[0] i...
true
6ffd2a8eb0bb952c677cd733cbd5a265fc3e737e
dustin/snippets
/python/misc/anagram.py
UTF-8
675
3.328125
3
[]
no_license
#!/usr/bin/env python """ Copyright (c) 2006 Dustin Sallings <dustin@spy.net> """ import sys import sets def doletters(w): rv={} for l in w: rv[l] = rv.get(l, 0) + 1 return rv def matches(w, letters): c=letters.copy() for l in w: if c.get(l, 0) > 0: c[l] = c[l] - 1 ...
true
5bff974090b4a2e09ddebdac09fe44b6195e5f95
Artuom/ml
/fifth_task.py
UTF-8
986
2.75
3
[]
no_license
import pandas import numpy as np from sklearn.linear_model import Perceptron from sklearn.metrics import accuracy_score from sklearn.preprocessing import StandardScaler df_train = pandas.read_csv('perceptron-train.csv', header=None) df_test = pandas.read_csv('perceptron-test.csv', header=None) train_aim_vars = df_tra...
true
2b98500d4439f6c27e02220293104da6731edf0c
GustavoEmmel/python_first_blood
/variables.py
UTF-8
207
3.109375
3
[]
no_license
import math perc = 1/3 coco_wt = 1450 macaw_wt = 900 macaw_limit = macaw_wt * perc print(macaw_limit) num_macaws = coco_wt / macaw_limit # round up to get full number of birds print(math.ceil(num_macaws))
true
7b0c1f3f98907abb123ae4c7ac1b7cc38351a33f
LilMarc0/SnakeAI
/Env.py
UTF-8
5,455
2.921875
3
[]
no_license
import numpy as np import pygame as pg from pygame.locals import * from Snake import Snake from Food import Food from random import randint import sys np.set_printoptions(threshold=sys.maxsize) class Env: ''' player - 'bot' for simulation and training - 'human' for hu...
true
29d5636a10027c97d74f861a70dca186b03e9041
997Yi/Python-Course-Practice
/作业06/作业06-02.py
UTF-8
241
3.171875
3
[]
no_license
from operator import itemgetter n = int(input()) a = [] for i in range(n): a.append(input().split()) x = sorted(a, key=lambda x: x[1],reverse=True) for i in range(n): print("{:>15s}{:>5d}".format(x[i][0], int(x[i][1])))
true
e8eee120b3c906108a6af5270c9b650f841a7d09
AdamVangster/CSE
/Program.py
UTF-8
1,071
4.25
4
[]
no_license
class Person(object): def __init__(self, name, age): self.name = name self.age = age def work(self): print("%s goes to work" % self.name) def birthday(self): print("It's you birthday, you just turned %s today" % self.age) class Employee(Person): def __init__(self, nam...
true
da0110b2038b624db6aad3946906af9320d195e7
ingrevelo/miPlaticAPP-api
/main.py
UTF-8
3,168
2.546875
3
[]
no_license
from db.user_db import UserInDB from db.user_db import update_user, get_user from db.movement_db import MovementInDB from db.movement_db import save_movement from db.movement_db import get_movement from models.user_models import UserIn, UserOut from models.movement_models import MovementIn, MovementOut, ConsultaIn, Con...
true
36be8d2ff054b4a5a7366388d5116d41df26c14c
rohrawat/UNET-Implementation
/UNET.py
UTF-8
2,127
2.859375
3
[]
no_license
import tensorflow as tf from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv2DTranspose, concatenate from tensorflow.keras.models import Sequential def conv_layer(output_ch, input_shape): conv = Sequential() conv.add(Conv2D(output_ch,kernel_size=3, activation = 'relu', input_shape = input_shape...
true
62e8548cafb0b663ab5bbf12e3e1e142d4c070fc
aayishaa/aayisha
/armstro.py
UTF-8
131
2.875
3
[]
no_license
m=int(input()) lll=list(map(int,str(m))) bbb=list(map(lambda x:x**3,lll)) if(sum(bbb)==n): print("yes") else: print("no")
true
e69453887a1b2513b01b3f85a8a7399cf6611b2b
Esri/raster-functions
/functions/BasicChuckClose.py
UTF-8
6,003
2.78125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import numpy as np import math class BasicChuckClose(): def __init__(self): self.name = "Basic Chuck Close" self.description = ("This python raster function is the first of which I " "plan to create that will transform imagery into artwork reminiscent of " "Chuck Close.") ...
true
4149b00abc0094797952e66671e96c5f5eae7304
TheozZeng/Leetcode
/Top_Interview_Q/Medium/Back_tracking/Letter Combinations of a Phone Number.py
UTF-8
790
3.59375
4
[]
no_license
class Solution: def __init__(self): self.L = [] self.M = {"2":["a","b","c"],"3":["d","e","f"],"4":["g","h","i"],"5":["j","k","l"], "6":["m","n","o"],"7":["p","q","r","s"],"8":["t","u","v"],"9":["w","x","y","z"]} def back_tracking(self, digits, string): ...
true
732485045095cbdcc06f9adc21c1659b711c0c13
Chriszhangmw/ChatBots
/chatbot_MedicalGraph/data/script2.py
UTF-8
1,352
2.640625
3
[]
no_license
####alias word proposing with open('alias_vocab.txt','r',encoding='utf-8') as f: alias = f.readlines() f.close() alias_vocab = open('./new_data/alias.txt','w',encoding='utf-8') words = [] for word in alias: word = word.strip() words.append(word) words = list(set(words)) for i in range(len(words)): ...
true
21de6e15ac04e077465247e756870b55b0af65e2
curiousTauseef/TilePuzzelSolver-App
/solver/tile_puzzle_solver.py
UTF-8
9,983
3.765625
4
[]
no_license
""" # ------------------------------------------------------------------------------------------------ # # Project :-> 8 Tile Puzzle solver # Authors :-> Sudharsan # E-mail :-> sudharsansci@gmail.com # ------------------------------------------------------------------------------------------------ # """ # ------...
true
3f446dafad70f75b2c1e92d51edd9dd7be5ca1ac
ArtDu/DA
/labs/lab_6/test_code/test_gen.py
UTF-8
3,362
3.0625
3
[]
no_license
#!usr/bin/python import string import sys from random import * def get_random_num(): return ''.join(choice(string.digits) for _ in range(randint(1, 100))) def get_num_pow_num(): return ''.join(choice(string.digits) for _ in range(randint(1, 1))) # <count of tests> <count of nums in test> if __name__ ==...
true
0939c2c5652263a186208410e1faf23d8ea63410
zizhuoliu2013/EPI
/6/6.11.py
UTF-8
69
2.546875
3
[]
no_license
def snake_string_pythonic(s): return s[1::4] + s[0::2] + s[3::4]
true
b0914c454791230a6ccc5391aba63ad37e85d94e
nod/databag
/src/databag/orm/field.py
UTF-8
2,290
2.78125
3
[ "MIT" ]
permissive
import json from datetime import datetime, timedelta, timezone parse_date = lambda x: datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%f%z") class Field: _default = None _field_type = None _to_json = None _from_json = None _value = None _field_name = None def __init__(self, field_t...
true
c73acc2cc09bc292d4fa7ba5b4b80942881a8aa2
danieled01/python
/myapps/test_scripts/sort_list.py
UTF-8
208
3.53125
4
[]
no_license
mylist = [0.1,2,3,0.5] def smallestnumber(list): list.sort() return list[0] print(smallestnumber(mylist)) def largestnumber(list): list.sort() return list[-1] print(largestnumber(mylist))
true
f320d6bff3745ef3fdc29aba921acd571d8b1b8c
DamsRoxxx/TafOutils
/AGSAPI/data/AGSAPIProvider/src/FormatToJSON.py
UTF-8
595
2.859375
3
[]
no_license
#!/usr/bin/python # coding: utf-8 import json from Logger import log def format_to_dict(data_list): ignored_keys = ["ack"] data_dict = dict() for i in range(len(data_list)): data_dict[str(i)] = dict() for line in data_list[i].strip().splitlines(): line_split = line.strip().spli...
true
559f505a500562473ddc3a44cb39fad70b713867
mayankkushal/python_sdp
/day_one/free_fall.py
UTF-8
364
4.09375
4
[]
no_license
''' Compute speed of an object when it hits the ground after being dropped ''' from math import sqrt #Define constant for accelearion due to gravity GRAVITY = 9.8 #Read the height from which the object is dropped d = float(input("height from which the object is dropped(in meters): ")) vf = sqrt(2 * GRAVITY *d) prin...
true
ac8c6f5682ca19e009cd5770799cc69531f7b9e6
nocturnalBadger/piece-of-that
/twitter.py
UTF-8
577
2.671875
3
[]
no_license
""" Authenticates to Twitter API and tweets a jingle """ import logging import tweepy import rhyming from credentials import (consumer_key, consumer_secret, token, secret) if __name__ == "__main__": logging.basicConfig(format='%(filename)s: %(message)s', level=logging.DEBUG) auth = tweepy.OAuthHandler(cons...
true
f34a14388e213f2d582ad4149ddef1992bdbd7a9
RQDYGSN/MyMiniPyLib
/test_py/test_graph.py
UTF-8
379
2.8125
3
[ "MIT" ]
permissive
from .. import MyMiniPy as py adj = [ [0, 2, 6, 4], [float("inf"), 0, 3, float("inf")], [7, float("inf"), 0, 1], [5, float("inf"), 12, 0] ] g = py.graph(adj) g.print_adjacency() gg = py.shortestPathClass(g) class TestGraph: def test_graph(self): assert gg.shortestPath(1, 0) =...
true
aaf2cfd88535ab1fcc7150907543d739ac2e8c43
algorithm005-class01/algorithm005-class01
/Week_08/G20190343020166/LeetCode_300_0166.py
UTF-8
739
3.234375
3
[]
no_license
"""300. 最长上升子序列 给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例: 输入: [10,9,2,5,3,7,101,18] 输出: 4 解释: 最长的上升子序列是 [2,3,7,101],它的长度是 4。 说明: 可能会有多种最长上升子序列的组合,你只需要输出对应的长度即可。 你算法的时间复杂度应该为 O(n2) 。 """ class Solution(object): def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ ...
true
15c249719073a1c8db60d41010134634e33b30ea
WAWLixiong/collectors
/learn_python/lixiong/type_programmer/learn_orm1.py
UTF-8
3,966
3.5625
4
[]
no_license
# 定义一个 # 复习属性描述符 import numbers class Fields: pass class IntField(Fields): """注意一下init的参数检查与set的参数检查是不一样的,set是设置值时候的参数检查""" def __init__(self, db_column, min_value, max_value): self._value = None self.db_column = db_column self.min_value = min_value self.max_value = max_v...
true
0f9eb5b2e0f306946d651e4d2647d386efdeeadb
IhorTarkhan/sorting-algorithms-visualisation
/entity/StatisticSortingResponse.py
UTF-8
1,061
2.96875
3
[]
no_license
from entity.SortAlgorithmEnum import SortAlgorithmEnum class StatisticSortingResponse: """ Statistic data transfer object (DTO), contains - sorting type (Bubble, Merge, etc) - size of array that was sorted in this way - three times of this sort (in 'best', 'avg', 'worst...
true
fb266e38160e9190e598606d78b01073d1edad57
padack/Practice
/Practice_0810.py
UTF-8
555
3.171875
3
[]
no_license
print('==================') print('\t /)/)') print('\t ( ..)') print('\t ( >♡') print(' Have a Good Time') print('==================') print() print('\t\t####회비목록####') print('{:=^42}'.format('=')) print('이름\t\t나이\t전화번호\t\t회비목록') print('{:-^72}'.format('-')) print('홍길동\t\t"16"\t010-123-1234\t\t\\20,000') print(...
true
e38165c534c8ff337aedcae0cfb2de1253a0d2e3
H2O-2/LeetCode
/4Sum.py
UTF-8
1,557
3.203125
3
[]
no_license
class Solution(object): def fourSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[List[int]] """ nums.sort() num_len = len(nums) nums_out = [] for i in range(num_len - 3): if i > 0 and nums[i] == nu...
true
bb12ef7cf885cfdd097ca20c7f749b59fe24a027
appukuttan-shailesh/morphounit
/morphounit/scores/score_RangeScore.py
UTF-8
1,503
3.390625
3
[]
permissive
import math import sciunit import quantities #============================================================================== class RangeScore(sciunit.Score): """ Checks if value is within specified range Approach: Returns 0 if within range, the difference otherwise """ _allowed_types = (float,) ...
true
f06aeef2322d8e351c83c56758dc14c48e3a5e40
Journera/glutil
/glutil/serverless_function.py
UTF-8
1,382
2.53125
3
[ "BSD-3-Clause" ]
permissive
from .partitioner import Partitioner from .utils import print_batch_errors import sys def create_found_partitions(partitioner, limit_days=0, prefix_partitions=[], dry_run=False): print(f"Running Partitioner for {partitioner.database}.{partitioner.table}") print(f"\tLooking for partitions in s3://{partitioner....
true
013fea9f080699dcf0e9cd4652043349dec85bae
nkersting/Code
/count.py
UTF-8
244
3
3
[]
no_license
#!/usr/bin/env python import csv Reader = csv.reader(open('key-word-freq-sorted3.txt','rb'), delimiter=' ') count = 0 total = 0 for line in Reader: count += 1 total += int(line[2]) print "%s lines totalling %s " % (count, total)
true
f9a979b4d6b87af60f323916d9512b0000a34c22
prakashatul1/interview_prep
/dsa/stack/04_nearest_smaller_to_right.py
UTF-8
676
3.546875
4
[]
no_license
from stack import Stack def find(arr, n): result = [] s = Stack() for i in range(n)[::-1]: if s.is_empty(): result.append(-1) elif (s.is_empty() == False and s.peek() < arr[i]): result.append(s.peek()) elif (s.is_empty() == False and s.peek() >= arr[i]): ...
true
9629e337adc75c2851cd6988165466f6701dff40
mnlescobar/paramonte
/src/interface/Python/paramonte/_Version.py
UTF-8
6,690
2.53125
3
[ "MIT" ]
permissive
#################################################################################################################################### #################################################################################################################################### #### #### MIT License #### #### ParaMonte: plain p...
true
54ff14dfe1d610726de7b46260becdbb6f2c4654
mindspore-ai/mindspore
/mindspore/python/mindspore/mindrecord/shardreader.py
UTF-8
3,580
2.515625
3
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
permissive
# Copyright 2019 Huawei Technologies Co., Ltd # # 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...
true
c3bb0df109465031136ae669e36135fb27ff62c7
Bch91/Glassy-physics-simulations
/Volume.py
UTF-8
1,501
2.984375
3
[]
no_license
#!/usr/bin/env python # Read in data files in order to measure the mean squared displacement as a function of time for each temperature # Import libraries import getopt, sys, os import numpy as np import pylab as pl import matplotlib as plt # Path for tools pizza_tools = ['/Users/Dan/Documents/packages/pizza-8D...
true
c622b2977a9697f416a1fc318a9eb57817a80735
TechInTech/algorithmsAnddataStructure
/stringOperation/interview58b.py
UTF-8
1,156
3.9375
4
[]
no_license
# -*- coding:utf-8 -*- """左旋转字符串 """ class Solution_58b(object): def left_rotate_str(self, s, n): if not s or len(s) <= 0 or n < 0: return None length = len(s) str_ls = list(s) if length > 0 and n < length and n > 0: firststart, firstend = 0, n - 1 ...
true
61def8104e0cf5d8e87deed722c35f656bb74a69
dongxn20/UCI-CS273a-Machine-Learning
/HW3-code/HW3.py
UTF-8
2,514
3.171875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import mltools as ml import mltools.logistic2 as lc2 from numpy import asmatrix as arr from imp import reload np.random.seed(0) ''' Problem 1: Perceptrons and Logistic Regression ''' # a iris = np.genfromtxt("data/iris.txt",delimiter=None) X, Y = iris[:,0:2], iris[:...
true
ecdcaa25ddc9b3c39b487be0816944f0ab91b986
neduchal/io_classification_experiment
/classification_scripts/print_results.py
UTF-8
224
3.625
4
[ "MIT" ]
permissive
data = open("results.txt").read().split("\n") good = 0 for row in data: if len(row) == 0: continue items = row.split(" ") if int(items[0]) == int(items[1]): good += 1 print(good / len(data))
true
2f18e1aaa2214f93aac4a581a21cb08fa58e38cf
ultrabug/py3status
/py3status/exceptions.py
UTF-8
1,174
3.09375
3
[]
permissive
class Py3Exception(Exception): """ Base Py3 exception class. All custom Py3 exceptions derive from this class. """ class CommandError(Py3Exception): """ An error occurred running the given command. This exception provides some additional attributes ``error_code``: The error code ret...
true
915759b79986db92b4f0259637e67e4cd2aa99bf
fake-name/ReadableWebProxy
/common/util/rewalk_epoch.py
UTF-8
1,576
2.921875
3
[ "BSD-3-Clause" ]
permissive
import functools import datetime import xxhash starttime = datetime.datetime(2020, 1, 1) def hash_netloc(netloc): m = xxhash.xxh32() m.update(netloc.encode("utf-8")) nlhash = m.intdigest() return nlhash def get_epoch_from_netloc_interval(netloc, interval_days): ''' from a netloc and a rewalk interval, retur...
true
f25eb056f4e292e29622d0dd381bf074bfc10546
samyak24jain/sudoku
/SudokuGame.py
UTF-8
4,421
3.734375
4
[]
no_license
from random import randint from sys import exit #Logic to check if a particular number can be placed in a particular position. def logic(i,j,r,sudoku1): flag = 0 for n in range(0,4): #checking if r is already present on the ith row if(n != j): if(sudoku1[i][n] == r): flag = 1 break if(flag == 0): for...
true
09b168a6d01674780e07d068a42a039ae7c3fd11
chrisjdavie/compsci_basics
/dynamic_programming/pick_from_top_or_bottom/recursive.py
UTF-8
1,073
3.53125
4
[ "MIT" ]
permissive
import unittest from parameterized import parameterized class Test(unittest.TestCase): @parameterized.expand([ ("provided example 0", [5, 3, 7, 10], 15), ("provided example 1", [8, 15, 3, 7], 22), ("one number", [1], 1), ("two numbers highest", [1, 2], 2), ("three numbers",...
true
5dd62cf1250a5752db7d68312f67d55acd6fd53a
thaReal/MasterChef
/leetcode/palindrome.py
UTF-8
624
3.53125
4
[]
no_license
#!/usr/bin/python3 def expand(s: str, start: int, end: int) -> str: while start >= 0 and end <= len(s) - 1: if s[start] != s[end]: break start -= 1 end += 1 return s[start+1:end] def longestPalindrome(s: str) -> str: lp = "" n = len(s) if n == 0: return "" elif n == 1: return s for i in range...
true
30fa5056e9c4616ff225cf446784b40f13e407fa
NaNdalal-dev/hacker-rank-problems
/programs/unique_order.py
UTF-8
351
3.6875
4
[]
no_license
''' Link: https://www.codewars.com/kata/54e6533c92449cc251001667/train/python ''' def unique_in_order(string): if string: unique = [string[0]] i = 0 for val in string[1:]: if val == unique[i]: pass else: unique.append(val) i+=1 return unique else: return [] #pri...
true
9ebe2d1aa22b3aa760c049cd6b0e7fbf29b29de2
SeolHuiGwan9478/Django_BLOG
/tistory/users/forms.py
UTF-8
1,898
2.6875
3
[]
no_license
from django import forms from .models import User from django.contrib.auth.hashers import check_password class RegisterForm(forms.Form): username = forms.CharField(label='사용자 이름', error_messages={'required': "이름을 입력하세요."}) email = forms.EmailField(label='이메일', error_messages={'required': "이메일을 입력하세요."}) pas...
true
be58af206b3b6ac257a2eb8dad99fdbf75b76425
SanderKit/Turtle
/PythonTurtleÜl4SKK.py
UTF-8
420
2.96875
3
[]
no_license
#Sander Kulma #18.01.2021 #IT20 from tkinter import * #akna seaded aken = Tk() aken.title('Sander Kulma') aken.configure(background='black') aken.iconbitmap('favicon.ico') aken.resizable(0, 0) #tekst lorem = 'Sander Kulma\nIT20\n2021' tekst = Label(aken, text=lorem, justify=CENTER, foreground="red", b...
true