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
45d6838d90505ce944d6773796b53452b1df3d53
terryjbates/head_first_design_patterns
/ch3_the_decorator_pattern/Beverage.py
UTF-8
628
3.515625
4
[ "MIT" ]
permissive
import abc class Beverage(object): __metaclass__ = abc.ABCMeta def __init__(self): self._description = "Unknown beverage" self._cost = 0 @property def description(self): return self._description @description.setter def description(self, input_description): if...
true
b87b713ca8880fba86e9217619fb1310948a3454
adityasurana3/Python-Programs
/sum.py
UTF-8
156
3.96875
4
[]
no_license
print("Enter the 1st number") num1 = input() print("Enter the 2st number") num2 = input() sum = int(num1)+int(num2) print("The sum of two number is", sum)
true
14939d4ebad9316619bf77c8981430b558b1c46c
Gecazo/conways-game-of-life
/main.py
UTF-8
1,465
3.40625
3
[]
no_license
from random import choice # Size of our field MAX_SIZE = 10 DEAD_CELL = " " LIVE_CELL = "*" def neighbor_xy(x, y): for dx, dy in ( (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1) ): yield x + dx, y + dy def show_fi...
true
137490215713661f108d5a5d28fac06ebaefb415
psathyanarayan/Data-Structure-Lab
/Sorting/heap.py
UTF-8
658
3.453125
3
[]
no_license
def heapify(ls, n, i): largest = i l = 2 * i + 1 r = 2 * i + 2 if l < n and ls[l] > ls[largest]: largest = l if r < n and ls[r] > ls[largest]: largest = r if largest != i: ls[i], ls[largest] = ls[largest], ls[i] heapify(ls,n,largest) def heapSort(ls, n): ...
true
15a7dc4aca22c97e895595ffc0ed50bd9a73872d
dvp-git/Python-Crash-Course
/userinput_loop-7.4.py
UTF-8
330
3.8125
4
[]
no_license
## Exercise 7.4 Pizza toppings Order = True prompt = ("Good evening Sir! Please select your choice of toppings!") prompt += ("Enter finish when done") while Order : message = input(prompt) if message != 'finish': print("Select the next topping") else: break ...
true
89898c903fbfdabc6815f192da134ba53185b4e2
will-snavely/city-scrapers-core
/city_scrapers_core/pipelines/meeting.py
UTF-8
611
2.640625
3
[ "MIT" ]
permissive
from datetime import datetime, timedelta from city_scrapers_core.decorators import ignore_processed class MeetingPipeline: @ignore_processed def process_item(self, item, spider): item["title"] = spider._clean_title(item["title"]) # Set default end time of two hours later if end time is not pr...
true
8d89bdaca4e6e890edc9f6cb08c672040b8c11e5
RuasGAR/ex-algProg
/ex4.py
UTF-8
703
4.1875
4
[]
no_license
""" Calcular o determinante de uma matriz quadrada A de tamanho máximo n=3. Fazer 3 funções: uma para cada tamanho da matriz. """ #Calcular o determinante de matrizes até a ordem 3 matrixA = eval(input()); def order_one(a): return a[0]; def order_two(a): return a[0][0]*a[1][1] - a[0][1]*a[1][0]; def order_t...
true
3cd8e784396ce9fee7e93550eba913340ee57de7
fagan2888/BlockChain-2
/miner.py
UTF-8
4,009
2.65625
3
[]
no_license
import socket import sys from json.encoder import JSONEncoder from json.decoder import JSONDecoder # Passer les params de creation de process : Port, Parent Node (Port nullable) # If Parent Node != null # Create websocket connection with parent # Start to listen and send events with parent / children ...
true
4ec84b677637d4904997282f9636004459f54cb4
corbinenterline1/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/2-matrix_divided.py
UTF-8
1,822
4
4
[]
no_license
#!/usr/bin/python3 """Matrix division module""" def matrix_divided(matrix, div): """Divides items of matrix by div. matrix must be a list of lists of integers or floats, otherwise raise a TypeError exception each row of the matrix must be of the same size, otherwise raise a TypeError exception ...
true
9bb2e4bbd312389d59540dd74bbf53921949b5f6
govza/quran
/backend/helpers/recitation/convert_recitation_csv.py
UTF-8
3,558
3.09375
3
[]
no_license
'''Convert recitername.csv to django fixtures file''' import json from os import path import csv from collections import defaultdict import ast def structure_recitation_dict(data): '''Parse raw csv data and build structured dict''' recitation_dict = defaultdict(lambda: defaultdict(list)) for surah, ayah, ...
true
50b54e9dca651451068b7435c351cec1260c430e
bokkuru/Leet_Code
/Algorithms/53/53.py
UTF-8
346
2.671875
3
[]
no_license
class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ dp = [] dp.append(nums[0]) for i in nums[1:]: if dp[-1] < 0: dp.append(i) else: dp.append(dp[-1]+...
true
dc27e9faf1b1f765f1597e5f2e3059733870d07c
Chary1729/guvi-practice
/alphanum.py
UTF-8
82
2.75
3
[]
no_license
my_string=input() try: s =int(my_string) print("No") except: print("Yes")
true
00b2d8fafdb08d88a8472da79acc92bbb0874508
chaoannricardo/StudyNotes
/WebDevelopment/2105_Industry_Websample/TeachingMaterials/SQL/MySQL/MySQL/MySQL.py
UTF-8
1,572
2.984375
3
[ "Apache-2.0" ]
permissive
import pymysql #連線至資料庫 conn = pymysql.connect(host="localhost", user="root", password="hua0202", database="Demo_DB"); print("Succesfully Connect to Database using pyMySQL"); #建立資料庫操作指標 mycursor = conn.cursor(); #執行語法 mycursor.execute("Create Database Demo_DB"); #mycursor.execute("Show databases"); #mycursor.execute("...
true
eaed710943e116b101ca8b9e29dc924e63ca04c4
juraj-kajaba/HackerTeam
/tests/test_prime_num.py
UTF-8
286
2.75
3
[]
no_license
""" Day 25: Running Time and Complexity test """ from hackT import prime_num def test_1(): assert prime_num.isPrime2(1223) == True assert prime_num.isPrime2(1224) == False assert prime_num.isPrime2(13459) == False assert prime_num.isPrime2(13457) == True
true
37f12c451bf64d3d11817a080fa1f4f3e509a472
jtkrohm/migone
/py/load_products.py
UTF-8
5,499
2.578125
3
[]
no_license
list = ["Bananas", "Bluggoes", "Breadfruit", "Butternut Squash", "Cabbages", "Callaloo", "Cantaloupe", "Carrots", "Celery", "Chive & thyme", "Christophene", "Coconut", "Coconut Water", "Cucumbers", "Dasheen", "Eggs", "Ginger", "Honey", "Kale", "Lettuce", "Limes", "Nutmegs", "Ochroes", "Oranges", "Patchoi", "Parsley", "...
true
4d02f9a4c9da692606f17c7d6ad9560c96bf22df
Mmaniya/kidney_prediction
/chronic_kidney_disease.py
UTF-8
2,161
2.6875
3
[]
no_license
import glob from keras.models import Sequential, load_model import numpy as np import pandas as pd from keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder, MinMaxScaler import matplotlib.pyplot as plt import keras as k #uploaded = files.upload...
true
841139d8de578e6de657600585c63522aa5bdcf2
mjz9054/tvm
/tests/python/unittest/test_arith_detect_linear_equation.py
UTF-8
526
2.5625
3
[ "Apache-2.0" ]
permissive
import tvm def test_basic(): a = tvm.var("a") b = tvm.var("b") m = tvm.arith.DetectLinearEquation(a * 4 + b * 6 + 7, a) assert m[1].value == 4 assert tvm.ir_pass.Simplify(m[0] - (b * 6 + 7)).value == 0 m = tvm.arith.DetectLinearEquation(a * 4 * (a+1) + b * 6 + 7, a) assert len(m) == 0 ...
true
0ce955d3ebd7f0c27a87ddef3ac24908750f36fd
lawun330/Python_Basics
/find shortest string.py
UTF-8
221
3.78125
4
[]
no_license
#defining function, using it and putting arguments #return and len() functions def shorterString(x,y): print('the shorter String -') if len(x)<=len(y): return x else : return y
true
19de1e8c0d39401b605498e2b2d4f73e14ba9019
waiemwor/18731-dynamic-policies
/devices/set_status.py
UTF-8
523
2.90625
3
[]
no_license
# A helper program to send a http request to the policy server to simulate # a device update. import sys import urllib.request if len(sys.argv) != 4: print('Usage: set_status.py <device> <status name> <status value>') exit() device = sys.argv[1] sname = sys.argv[2] svalue = sys.argv[3] query = { 'devic...
true
6a85256b52078861263dc858d10eb9b16fdce642
checor/python-clases
/sesion02/ejemplo05/funciones.py
UTF-8
372
3.71875
4
[]
no_license
def hola(): print("Hola mundo!") hola() def hola(nombre): print("Hola {}".format(nombre)) hola("Bedu") def cuadrado(a): return a ** 2 a = cuadrado(5) ...
true
777104b633d483d553283d003fea74f83f2faebb
JPula/Multi-Label-Model-Development
/scripts/preprocessing.py
UTF-8
482
2.890625
3
[]
no_license
import pandas as pd import re class DefaultPreprocessor(): def __init__(self): pass def _clean(self, text: str) -> str: text = re.sub(r'[^0-9a-zA-Z ]+', ' ', text) text = re.sub(r'\s+', ' ', text) text = text.strip() text = text.lower() return text if text ...
true
c19153e1d2fbd6e22fbd94c68f6a0903790c36d1
zbo/zbodo
/wxPythonCode/wxPythonCode/Atom Clinet Code/SqliteDataAccess.py
UTF-8
516
2.59375
3
[]
no_license
__author__ = 'bobzh' import sqlite3 class SqliteDataAccessHelper: conn=None def OpenDataBase(self,dbName): self.conn=sqlite3.connect(dbName) def CloseDataBase(self): self.conn.close() def RetriveDataByQuery(self,query): cur=self.conn.cursor() cur.execute(query) ...
true
6b3e56d452c29e6ed9aa4e750845cc0d4b90a10e
osteinnes/covid-dashapp
/data/owid_covid.py
UTF-8
2,538
2.6875
3
[]
no_license
# Import data analysis dependencies import pandas as pd # Import OWID covid data to Pandas dataframe df = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv') #df = pd.read_csv("data/owid-covid-data_2020-10-19.csv") df = df[~df['location'].isin(["World"])] # Convert time to datetime. df["date"] = ...
true
03e3278b694064366953bb1ee2f477c6a6068be7
begemot57/RpiRepo
/RpiPythonProject/rpi/cam/FindBallThread.py
UTF-8
2,986
3.25
3
[]
no_license
''' Created on Jul 10, 2014 @author: Leo ''' import threading import time from PIL import Image from numpy import array findBallThread = None class FindBallThread(threading.Thread): def run(self): self.red_lb = 100 self.red_ub = 255 self.green_lb = 0 self.green_ub = 50 se...
true
b0e31e394c772a61be249a704a0ed74a1df368d9
PaulWendt96/BasicFileTransferServer
/tar.py
UTF-8
561
2.984375
3
[ "MIT" ]
permissive
import tarfile import os from io import BytesIO def get_tar_bytes(path): ''' ''' if not os.path.exists(path): raise FileNotFoundError file_obj = BytesIO() with tarfile.TarFile(mode = 'w', fileobj=file_obj) as tar: tar.add(path, arcname=os.path.basename(path)) fil...
true
e984ee61b899d6eddf7dcc12958fe582d2302a4d
vedantlok02/PPL-Assignments
/Assignment1/2.py
UTF-8
286
3.546875
4
[]
no_license
import random min = 1 max = 6 roll_again = "Y" while(roll_again == "Y"): roll_again = input("Do you want to roll again ? [Y/n]?") if(roll_again == "Y"): print(random.randint(min, max)) elif(roll_again == "n"): break else : print("Please enter a valid input !!")
true
d104553366d3210cdf5d809cd290a88905c45bfa
google/grr
/grr/server/grr_response_server/flows/general/read_low_level.py
UTF-8
4,772
2.625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python """Flow that reads data low level.""" import logging from grr_response_core.lib.rdfvalues import read_low_level as rdf_read_low_level from grr_response_server import data_store from grr_response_server import file_store from grr_response_server import flow_base from grr_response_server import ser...
true
5ef3b75c0120e036f229de9ea4f449d3b998e88d
yuchnw/EmbeddedLinux
/hw04/encodeMatrix.py
UTF-8
1,858
2.75
3
[]
no_license
#!/usr/bin/env python3 import time import smbus import Adafruit_BBIO.GPIO as GPIO import rcpy import rcpy.encoder as encoder print("Welcome to Etch-A-Sketch!") print("Here are the instructions:\n"); print("BTN1->up BTN2->down BTN3->left BTN4->right\n"); rcpy.set_state(rcpy.RUNNING) #Setup initials bus=smbus.SMBu...
true
4cab5f3a011338f332c4df739dbb286026d1584f
qiburger/Games-and-Algo
/invert_dictionary.py
UTF-8
329
3.078125
3
[]
no_license
__author__ = 'qi' def invert_dict(d): inverse = {} for key, val in d.iteritems(): inverse.setdefault(val, []).append(key) return inverse if __name__ == '__main__': d = dict(a=1, b=2, c=3, z=1) inverse = invert_dict(d) for val, keys in inverse.iteritems(): print val, keys prin...
true
06be37252693d803b12e8508484ab8c979a0ff43
huanglaoxie0503/top_spider
/top_spider/utils/tools.py
UTF-8
1,067
3.15625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # @Time : 2020/11/26 16:03 # @Author : Oscar import datetime from dateutil.parser import parse def get_n_day_list(n): before_n_days = [] for i in range(1, n + 1)[::-1]: before_n_days.append(str(datetime.date.today() - datetime.timedelta(days=i))) retur...
true
37a4c52ad8451da0fa65aeed0cf830c95bf93521
camboya/bucles_python-1
/ejercicios_practica.py
UTF-8
16,608
4.15625
4
[]
no_license
#!/usr/bin/env python ''' Bucles [Python] Ejercicios de práctica --------------------------- Autor: Inove Coding School Version: 1.1 Descripcion: Programa creado para que practiquen los conocimietos adquiridos durante la semana ''' __author__ = "Inove Coding School" __email__ = "alumnos@inove.com.ar" _...
true
7da552148af408a6af439c56c5777b2493d8cb56
EnReich/ProKlaue
/scripts/axesToAnimated_horses.py
UTF-8
4,525
2.546875
3
[]
no_license
# script to export axes from a ct scene, where the axes are positioned along the bones # to an animated scene, while keeping the relative position of the axis w.r.t. the bone # this script operates on multiple files but with the same configuration for the bones # first specify a base dir # then specify the bones names ...
true
0004d75ae005ed691aa932a722f899cf4235eb14
liyihangaaa/bayeso-benchmarks
/benchmarks/two_dim_eggholder.py
UTF-8
917
2.65625
3
[ "MIT" ]
permissive
import numpy as np from benchmarks.benchmark_base import Function def fun_target(bx, dim_bx): assert len(bx.shape) == 1 assert bx.shape[0] == dim_bx y = -1.0 * (bx[1] + 47.0) * np.sin(np.sqrt(np.abs(bx[1] + bx[0] / 2.0 + 47.0))) - bx[0] * np.sin(np.sqrt(np.abs(bx[0] - (bx[1] + 47.0)))) return y cl...
true
4c45dad00347627dbd036a8e723e274c3f3959e7
TyjChristy/ALL-CNN-on-CIFAR10
/models/BasicModule.py
UTF-8
1,678
2.6875
3
[]
no_license
import torch class BasicModule(torch.nn.Module): def __init__(self): super(BasicModule, self).__init__() self.model_name = str(type(self)) self.epoch = 0 self.lr_pre_epoch = [] self.loss_pre_epoch = [] self.valacc_pre_epoch = [] self.testacc_pre_epo...
true
9dba5959bbbc4b1fb834a038efceef2345e79b20
JaneySlinger/Witch_Game_01
/source/main.py
UTF-8
6,244
2.953125
3
[]
no_license
import arcade import random from area import Area from inventory import InventoryView from interior import InteriorView from quest import Quest SCREEN_WIDTH = 1024 SCREEN_HEIGHT = 640 MOVEMENT_SPEED = 5 TILE_SCALING = 1 RED = 0 BLACK = 1 GREEN = 2 PURPLE = 3 BOOK = 4 YELLOW = 5 BLUE = 6 class WitchGame(arcade.View)...
true
a154cd648d28d38f36ffa74786c3395d036646be
p4radoks/yeni
/09Dictionary.py
UTF-8
521
3.609375
4
[]
no_license
Aile={"baba":"Ahmet","anne":"Yasemin","kardes":"Mehmet"} #İlk değer anahtar kelime. İkincisi ise bu anahtar kelimeye bağlı değer. print(Aile["baba"]) #Print ile anahtar kelimeyi yazdığımda ona bağlı değer ekrana yazdırılır. yas={"baba":42,"anne":65} print(yas["baba"]) yas1=yas.copy() # yas sözlüğün...
true
8aa335ab7fe778b2ca760e64242d071e374ea262
VaibhavBiturwar/Auto-Gate-Online
/entry.py
UTF-8
2,777
2.734375
3
[]
no_license
from tkinter import * from tkinter import messagebox import pymysql from firebase import firebase firebase = firebase.FirebaseApplication("https://fastgate-d2d06.firebaseio.com/",None) def exit(): window.destroy() def click(): oname = t1.get() mob = t2.get() block = t3.get() block = block...
true
0c4e4cafa66b8dbba53f3c661d45946a3c273de8
WonSang98/sw-proj-2-2017-team2
/week4/20171654원상연.py
UTF-8
731
3.3125
3
[]
no_license
#20171654 #WonSang98 원상연 #Week4 Assignment #Fatorial fuction & Combine factorial ver, recursive ver def fac(n):#Fatorial Recursive if n == 1 or n == 0: return 1 else: return n*fac(n-1) def combine_fac(n, m):#Combine Factorial ver return fac(n)/(fac(m)*fac(n-m)) def combine_rec(n, m):#Comb...
true
3a1aa03b6183667d6ed4698dcf1b7a9bde81d5e6
gabriellaec/desoft-analise-exercicios
/backup/user_215/ch16_2019_09_02_19_17_07_640044.py
UTF-8
105
2.890625
3
[]
no_license
import math def distancia_euclidiana(x1, y1, x2, y2): return math.sqrt((x2 - x1)**2 - (y2 - y1)**2)
true
80f233901b67cbc3fb481792091c39e3e76220de
xm4dn355x/specialist_python3_2nd_lvl
/Module6/practice/LinkedList.py
UTF-8
4,666
4
4
[ "MIT" ]
permissive
class Node: """Класс для узла списка. Хранит значение и указатель на следующий узел.""" def __init__(self, value=None, next=None): self.value = value self.next = next def __str__(self): return f'Node: {self.value}' class LinkedList: def __init__(self, *args): self.fir...
true
09854cfe62dcc0ed8a821a5d55c84e368f6c017f
Mdzmx/beadosprog1
/4.feladat.py
UTF-8
606
3.1875
3
[]
no_license
lista =[] while len(lista) != 16: szo = input("Adj meg egy szót: ") if szo == "": break else: lista.append(szo) print(lista) lista2 = [] for i in range(0, len(lista)): for j in range(len(lista[i])+1): for k in range(j,len(lista[i])+1): if lista[i][j:k] == "": ...
true
ec33b9ce6ccceb1a17c899f847f3befd528fae3d
sts-sadr/RNN
/RNN_basic_rnn_gru_lstm_tf.py
UTF-8
4,661
2.8125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: zehao """ # Descriptions: This is the structure for Basic RNN Unit, GRU, and LSTM(basic) # test are based on XOR logic gate: dataset # which is Used for detection of the error message in communication system(case 1) # Method: RNN: 1.Basic ...
true
569aa17377252ba7a7c9b457c664053f096bbe35
secondhandhero/prog1
/venv/12_16_4.py
UTF-8
438
3.46875
3
[]
no_license
class TSzyfrant: def __init__(self,klucz): self.klucz=klucz def szyfruj(self, liczba): return (liczba + self.klucz) % 256 def odszyfruj(self, liczba): return (256 + liczba - self.klucz) % 256 szyfrant=TSzyfrant(89) wiadomosc = int(input('Podaj dodatnią liczbę do zaszyfrowania: '...
true
f46813b16b36bb224017b856cd35be3402ad571d
Aditya-aot/Tic-Tac-Toe-Python-
/tic-tac-toe.py
UTF-8
2,424
3.890625
4
[]
no_license
import numpy as np def Board(Array) : Array = Array.reshape(3, 3) print(Array) Array=np.array([['1', '2', '3'] , ['4','5','6'] , ['7','8','9'] ]) Array =Array.flatten() b='start' print('----> TIC TAC TOE <----') print('') Board(Array) while b=='st...
true
4247aa33b0ce208e5c449db94d8656f26cd57cff
imperfectskillz/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/tests/test_models/test_base.py
UTF-8
626
3.203125
3
[]
no_license
#!/usr/bin/python3 """Unittest for Base Class""" import unittest from models.base import Base class TestBase(unittest.TestCase): def test_id(self): """ tests id """ a = Base() self.assertEqual(a.id, 1) b = Base() self.assertEqual(b.id, 5) c = Base()...
true
69509a20c9abab23e4e4b6f8d87d82729cef74c3
MuCephei/advent2020
/day_11/a.py
UTF-8
2,731
3.421875
3
[]
no_license
class seat: def __init__(self, value): self.floor = value == "." self.occupied = value == "#" self.adjacent = [] self.future_occupied = False def add_adjacent(self, other): self.adjacent.append(other) other.adjacent.append(self) def __str__(self): i...
true
68f5fe6a3e35a7c45b3e9decae3a0eb2ee238db0
ryzingTitan/C463
/midterm1.py
UTF-8
1,769
2.8125
3
[]
no_license
from pybrain.tools.shortcuts import buildNetwork from pybrain.datasets import SupervisedDataSet from pybrain.supervised.trainers import BackpropTrainer from math import fabs type = {'Irissetosa': -1, 'Irisversicolor': 0, 'Irisvirginica': 1} traindata = {} testdata = {} net = buildNetwork(4, 10, 1) ds = SupervisedDat...
true
cf51cd441c14f601fbd5802fced110f607202339
ttaa9/Policy-Tree-Planner
/SeqData.py
UTF-8
4,833
2.75
3
[]
no_license
from SimpleTask import SimpleGridTask import numpy as np, numpy.random as npr, random as r, SimpleTask from TransportTask import TransportTask from NavTask import NavigationTask class SingDiscSeqData(): def __init__(self,dataFile,env): import pickle with open(dataFile,'rb') as inFile: ...
true
170bb5c904f77b142b6268988f0b783f16f355b7
Liz-Lin/Search_Engine
/data_base.py
UTF-8
2,148
2.53125
3
[]
no_license
import json import re, os import sys import collections import operator import pymongo from pymongo import MongoClient from pymongo import UpdateOne #beautiful soup and nltk from bs4 import BeautifulSoup import nltk import pprint nltk.download('wordnet') from nltk.stem.wordnet import WordNetLemmatizer lmtzr = WordNe...
true
837bd9a486bb006fd5ac86d35f907a30878a1f2e
volkir31/university
/lab4/10_task.py
UTF-8
61
2.65625
3
[]
no_license
input_str = list(input().lower()) print(len(set(input_str)))
true
aab66522cbffbf40c3c515de9cac054a32ab1ecd
sheiun/ptt-chatbot
/match.py
UTF-8
2,727
3
3
[ "MIT" ]
permissive
import json import os import random from matcher import bestMatchingMatcher, FuzzyMatcher, WordWeightMatcher from responsesEvaluate import Evaluator def main(): matcherTesting("bm25", removeStopWords=False) def getMatcher(matcherType, removeStopWords=False): """ 回傳初始完畢的 Matcher Args: - ma...
true
c1ce198c1a567fde939ab9ef3cd3ff6d9393487f
shakesun/leetcode
/HOT100/swapPairs.py
UTF-8
1,409
3.859375
4
[]
no_license
""" 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 """ from leetcode.DataStructure.LList import LList import copy # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): # TODO 这里有问题,需要经一步解决 ...
true
06ad71520d2ff737097b5d48c7a5a6429782975b
justalittlenoob/AN24
/AN24/OpenCsv.py
UTF-8
1,003
2.71875
3
[]
no_license
# coding: utf-8 #import csv import time import datetime import data def OpenCsv(): #file=open(path,'r') #reader=csv.reader(file) data.start_data_thread() cache = data.data_cache ''' for line in reader: if line[0]!='Time': data=[5, 5, 5, 5, 5, 5] data[0...
true
93677252861daab9a2da1711ca44767ea41f7109
Aasthaengg/IBMdataset
/Python_codes/p02615/s853486783.py
UTF-8
281
2.75
3
[]
no_license
n=int(input()) lst=list(map(int,input().split())) lst=sorted(lst) if(n>2): sm=0 sm+=lst[-1] k=0 i=2 num=2 while(num<n): k+=1 sm+=lst[-i] if(k==2): k=0 i+=1 num+=1 elif(n==2): sm=lst[-1] print(sm)
true
0aff495809485c3e7067d9f0e49da9c69dec464c
FrankHorrigan/CS112-Spring2012
/hw09/tron.py
UTF-8
3,786
3.71875
4
[]
no_license
#!/usr/bin/env python """ tron.py The simple game of tron with two players. Press the space bar to start the game. Player 1 (red) is controlled with WSAD and player 2 (blue) is controlled with the arrow keys. Once the game is over, press space to reset and then again to restart. Escape quits the program. """ #FYI...
true
f0a7d47be3f592f89844c8978c08810ebe15e630
nskadam02/python-programs
/MaxList.py
UTF-8
456
3.859375
4
[]
no_license
def MaxList(): no=int(input("Enter the no of element in list:")); arr=list(); sumation=0; for i in range(no): no1=int(input("Enter number to add in list:")); arr.append(no1); print(arr); print("Max from ist using inbuilt function:",max(arr)); maximum=arr[0]; for i in ...
true
e9b8ddede182292fcb7505adb807b15e6a014a6b
Jon-Ting/UH-DA-with-PY-summer-2019
/part06-e08_explained_variance/src/explained_variance.py
UTF-8
1,024
3.125
3
[]
no_license
#!/usr/bin/env python3 import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA def explained_variance(): X = pd.read_csv("src/data.tsv", sep="\t") pca = PCA(n_components=10) pca.fit(X) variance = list(X.var()) # variance = X.var(axis=0).values ...
true
989cd956b836558dd8abd93ace232f263b64df71
VidyaJames/AdventOfCode2017
/14/14-1.py
UTF-8
1,112
2.671875
3
[]
no_license
f1 = open('input.txt', 'r') key = f1.readline()[:-1] count = 0 for f in range (0, 128): sequence = list(xrange(256)) skipSize = 0 position = 0 row = key + '-' + str(f) asciiInputs = [] for g in row: asciiInputs.append(ord(str(g))) asciiInputs.extend([17, 31, 73, 47, 23]) for h in range(0,64): for i i...
true
4ccf8635237f122649a410446cd818de51665a2c
Wonder0Maker/parsing-kafka
/consumer-item.py
UTF-8
432
2.59375
3
[]
no_license
from kafka import KafkaConsumer import csv import pandas as pd def consumer_items(): consumer = KafkaConsumer(bootstrap_servers='localhost:9092') consumer.subscribe(['meal']) for message in consumer: print(message) ingredients = pd.DataFrame([message.value.decode('utf-8')], columns=['Ing...
true
5bb629ea4b3689aaeab2ba8ae6c9e52f03f00e39
alltheplaces/alltheplaces
/locations/spiders/da_nl.py
UTF-8
1,147
2.5625
3
[ "CC0-1.0", "MIT" ]
permissive
import scrapy from locations.dict_parser import DictParser from locations.hours import OpeningHours, sanitise_day class DaNLSpider(scrapy.Spider): name = "da_nl" start_urls = ["https://www.da.nl/rd/pickup/index"] item_attributes = {"brand": "DA Drogisterij", "brand_wikidata": "Q4899756"} def parse(...
true
40115f475a204b82944a11e0ffaa25a35d0fb901
minghaoM/pycode_demo
/third_party/openpyxl/deal_excel.py
GB18030
667
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- __author__ = "minghao.mamh@alibaba-inc.com" import openpyxl def demo1(source_excel): book = openpyxl.load_workbook(source_excel) # ӡsheetname print(book.get_sheet_names()) sheet = book[book.get_sheet_names()[0]] # ʾ row_count = sheet.max_row print("row count:{0}".f...
true
af09eb14ef4fe0ce4026e738142fdb69089ce7cc
AdamZhouSE/pythonHomework
/Code/CodeRecords/2739/60755/271133.py
UTF-8
648
3.015625
3
[]
no_license
def judge(num,target): s = list(str(num)) al = 0 for i in s: if i=="0": return False al = al + int(i) if s.count(i)!=1: return False if al == target: return True else: return False s = input() k = s[0] n = s[-1] res = "" m = "" result...
true
a4719fa2560727e867014c9592d4ae63c88ad92d
niryariv/opentaba-server
/Tests/functional_tests/test_feed.py
UTF-8
2,031
2.5625
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- import os from flask import * from app import app from nose.tools import eq_, assert_true from nose import with_setup from lxml import etree # get the test client for communicating with our flask app testapp = app.test_client() def setup_module(module): app.config['TES...
true
51213bde63fe557609996335f721cbb2f9789c44
gtmanfred/Euler
/testp.py
UTF-8
472
2.625
3
[]
no_license
from script.primes import isPrime as ip #from script.maths import isprime2 from script.isprime import isprime from time import time from script.maths import nextprime from script.prime import is_prime x = 1000 t = time() for i in range(1,x): a = ip(i) print(time()-t) ''' t = time() for i in range(1,x): a = ispr...
true
7fb58e51a6698571f7282b7eccd02459bd97fd1c
indraastra/icfp
/2006/python/old_um.py
UTF-8
8,006
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- import psyco import struct import sys import logging # set up logging logging.basicConfig(level=logging.CRITICAL, format="%(asctime)s %(levelname)-8s %(message)s", filename="um.log", filemode="w") # how many registers t...
true
1a05492f765fe6ebc3751ff8b13a580d23a3e74d
fish-face/door-restorer
/src/tutorial.py
UTF-8
3,950
3.078125
3
[]
no_license
from game import Game, RIGHT class Tutorial(Game): pass class TutorialOne(Tutorial): def pickup(self, direction): success = Game.pickup(self, direction) if not success: return False if not self.picked_up_door: self.display_message('Picked up', 'OK, now THROW t...
true
73d482f093d60af110dad51de738c055a98d4ee8
JhonveraDev/python_test
/pruebas_estudio/ahorcado.py
UTF-8
1,067
3.25
3
[]
no_license
import random IMAGES = [''' +---+ | | | | | | =========''', ''' +---+ | | O | | | | =========''', ''' +---+ | | O | | | | | =========''', ''' +---+ | | O | /| | | | =========''', ''' +---+ | | O | /|...
true
8ee133449a2520d8eb5b3038b17a9cc4e05ce132
tina0430/Python_examples
/begining/hw/example05.py
UTF-8
709
3.234375
3
[]
no_license
import pandas as pd table = pd.read_csv('./theater.csv', encoding='utf-8', header=None) table.columns = ['id','theater', 'cnt'] #극장별 theater_table = table.set_index('theater') theater_table = theater_table.groupby('theater') table1 = theater_table.sum() table2 = theater_table.mean() table3 = theater_table...
true
bd004e85072a65cce16e2509fe19aabcd2b6c7d7
lmishra92/General-Codes
/exp6.py
UTF-8
693
3.625
4
[]
no_license
from sys import argv script = argv print "We are going to erase the contents of a file today" print "Give a file to delete" file_name = raw_input() print "Are you sure to delete it ?" print "Press ctrl-C (^C) to change your opinion" print "If you still want the same, press return" raw_input("?") target =...
true
d8090fe067b3f020942f08e80a83d04761dcfa45
ywx980615/fracture_identification
/core/dataloader.py
UTF-8
2,897
2.890625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.image as mpimg class DataLoader_for_training(): def __init__(self, original_picture, labled_picture, sample_size_x = 5,sample_size_y = 5,data_type = 'uint16'): self.original_data = mpimg.imread(original_picture) self.labled_data = mpimg.imre...
true
743d71c1ecffb8ab0d4c456f3a5d23c008dd3f0c
Dylkln/Projet_AIOI
/aioi/graphique/plot.py
UTF-8
3,095
3.125
3
[]
no_license
""" Ce module permet de réaliser des graphiques. """ from keras.utils.vis_utils import plot_model import matplotlib.pyplot as plt import sys def summarize_learning_rate(fit_out): """ Permet d'afficher la val_loss & la loss de chaque modèle. Et ceux pour les différents decay rates de la learning rate uti...
true
035bda11027ba1a465779a54fc32070bbc05c3c7
cjstudioz/backtester
/backtester/utils/pandas.py
UTF-8
495
3.28125
3
[]
no_license
import pandas as pd def checkForNulls(df): nulls = df.isnull() if nulls.values.any(): raise RuntimeError(f'found unexpected nulls \n{nulls}') def generateHolidays(timeSeries): """ Generates a list of weekday holes (holidays) from a timeseries """ busdaytimeseries = pd.Series(timeSeri...
true
33d572aa91194c5e5d34014af5c544cc7e2469c3
mikusk1104/miklop
/src_new/parseAccounting.py
UTF-8
661
2.53125
3
[]
no_license
import json, dateParser, re from datetime import datetime def parseAccounting(message, lastTime): lineParsedLine = json.loads(message) lineDate = dateParser.dateParser(lineParsedLine['time']) if lineDate < lastTime: return '' lineParsedMsg = lineParsedLine["msg"].strip().split(';') lineHostName ...
true
4410f909550b35d3f5c2944f261d7130b72b7a51
GlassWall/leetcode
/graphs/number_of_islands.py
UTF-8
953
3.515625
4
[]
no_license
from typing import List class Solution: def sink_islands(self,grid,i,j,m,n): if i < 0 or i >= m or j < 0 or j >= n or grid[i][j] != '1': return grid[i][j] = "0" self.sink_islands(grid,i-1,j,m,n) self.sink_islands(grid,i+1,j,m,n) self.sink_islands(grid,i,j-...
true
85c97f973a569fc8e5a1f08703b526d82ab8b8fb
robinklaassen/aoc2020
/day04/solution.py
UTF-8
2,804
3.15625
3
[]
no_license
from dataclasses import dataclass from typing import Optional, List @dataclass class Passport: byr: Optional[str] = None iyr: Optional[str] = None eyr: Optional[str] = None hgt: Optional[str] = None hcl: Optional[str] = None ecl: Optional[str] = None pid: Optional[str] = None cid: Opti...
true
4755e79c0c85a08c8de79b687f2896fd077023da
white2029/leetcode_python
/418.sentence-screen-fitting.py
UTF-8
2,263
3.296875
3
[]
no_license
# # @lc app=leetcode id=418 lang=python3 # # [418] Sentence Screen Fitting # # https://leetcode.com/problems/sentence-screen-fitting/description/ # # algorithms # Medium (32.52%) # Likes: 444 # Dislikes: 217 # Total Accepted: 43K # Total Submissions: 131.9K # Testcase Example: '["hello","world"]\n2\n8' # # Given...
true
da3b3a0732850219ec9b2a05329560e9435d63fe
AndyCyberSec/pychain
/blockchain.py
UTF-8
2,493
3.265625
3
[]
no_license
import hashlib import time import json class Block(object): def __init__(self, difficulty, index, data, previous_hash=''): self.difficulty = difficulty self.nonce = 0 self.index = index self.previous_hash = previous_hash self.data = data self.timestamp = time.time...
true
dc7730b82fa7102a9001e166fa9c64dca0f62719
ISISComputingGroup/EPICS-DbUnitChecker
/utils/loader.py
UTF-8
2,353
2.734375
3
[]
no_license
from os.path import join from .db_parser import parse_db import os DIRECTORIES_TO_ALWAYS_IGNORE = [ ".git", "O.Common", "O.windows-x64", "O.win32-x86", "bin", "lib", "include", ".project", ".ci", "areaDetector", # Has some huge DBs which take forever to parse. ".vs" ] cl...
true
d1a109a87fdaba2aeffb5375e348af73752f0194
pkaleta/Codeforces
/30/b/b.py
UTF-8
1,290
3.125
3
[]
no_license
import sys ad = sys.stdin.readline()[:-1] bd = sys.stdin.readline()[:-1] a = map(int, ad.split(".")) b = map(int, bd.split(".")) def is_valid(date): d = date[0] m = date[1] y = date[2] isleap = y % 4 == 0 if m > 12: return False if m == 2: if isleap: if d > 29: ...
true
ce243f8868d85153d816f9a0c5c9e376ba181765
kenect4/Python-INFO1-CE9990
/floatdemo.py
UTF-8
507
3.953125
4
[]
no_license
""" floatdemo.py Demonstrate the generator float.range. """ import sys import float #This is the float.py we wrote. #The built-in range: print the integers from 0 to 10 inclusive. for i in range(10 + 1): print(i) print() #The range we wrote: print 11 equally spaced numbers from 0.0 to 10.0 inclusive. for f in...
true
91219ae8e17ce751707111e708ad716ec47d5669
dianatibre/University
/Year1Sem1/FundamentalsOfProgramming/Battleship/service.py
UTF-8
581
3.203125
3
[]
no_license
class Service: def __init__(self,user,computer,validations): self.__user = user self.__computer = computer self.__validations= validations def get_user(self): return self.__user def get_computer(self): return self.__computer def place_ship(self,ship): ...
true
8e0de970bb195f14ab6af1ad2d0bdc23cc64ca40
bwegge/Applied_ML_Fundamentals
/06_python/optim/gradient_descent.py
UTF-8
2,308
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Nov 5 12:13:03 2020 @author: Daniel Wehner """ # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import numpy as np # ---------------------------------...
true
52f487adb81f05fafd40a4f392f13879be0d5930
LizaShengelia/100-Days-of-Code--Python
/Day3.Exercise2.py
UTF-8
540
4.03125
4
[]
no_license
height = float(input("enter your height in m: ")) weight = float(input("enter your weight in kg: ")) old_number = weight / height ** 2 number = (round(old_number)) if number < 18.5: print(f"Your BMI is {number}, you are underweight.") elif number < 25: print(f"Your BMI is {number}, you have a normal weight."...
true
0dea798f2b526083bdcdb246255744a821afb9c8
SinPatrones/proyectoarquitectura
/reconocer.py
UTF-8
1,644
2.546875
3
[]
no_license
import cv2 import os def reconocer(): dataPath = 'E:\\Projects\\S3\\Arquitectura\\DeteccionRostro_v1.0\\Data' imagePaths = os.listdir(dataPath) print('imagePaths=', imagePaths) face_recognizer = cv2.face.LBPHFaceRecognizer_create() face_recognizer.read('modeloLBPHFace.xml') cap...
true
3faf20fcfa012f893a0dfdef54aaa75bfc199317
Dagiman007/Python-exercise
/FibonnaciGenerator.py
UTF-8
259
4.25
4
[]
no_license
def fib(limit): a, b = 0, 1 while a < limit: yield a a, b = b, a + b x = fib(5) print(next(x)) print(next(x)) print(next(x)) print(next(x)) print(next(x)) print('\nUsing for loop') for i in fib(5): print(i)
true
f16a751cfeb48e425a4b2dee2037186a315dccce
hakimi-laji/ITT440-FTP
/separate functions/list.py
UTF-8
432
2.609375
3
[]
no_license
from ftplib import FTP import os # allows me to use os.chdir port=21 ip="192.168.1.10" password='ftp' os.chdir("/home/nox") #changes the active dir - this is where downloaded files will be saved to ftp = FTP("192.168.1.10") ftp.login('ftp',password) print ('Files in the directory:\n----------------------------------...
true
b8b3e75b0a3d2994210c7673b8108a30e8225756
saminsakur/RegexPy
/email.py
UTF-8
299
2.6875
3
[]
no_license
import re emails = """ saminsakur@bangladesh.com samin.sakur@myschool.edu samin820@bangla.com.bd samin-29-2016@my-work.net """ # pattern = re.compile(r"[a-zA-Z.0-9-]+@[a-zA-Z-]+\.[a-zA-Z0-9-.]+") # this can also be used pattern = re.compile(r"[a-zA-Z.0-9-]+@[a-zA-Z-]+\.(com|net|edu)(\.bd)?") matches = re.finditer(...
true
71f4ac1cb21c9593a1194b6cf650b196702a2f6c
gabrielsalesls/curso-em-video-python
/ex047.py
UTF-8
250
3.90625
4
[]
no_license
# Mostrar numeros pares entre 1 e 50 from time import sleep print('Os numeros pares entre 1 e 50 são:') for c in range(2, 51, 2): print (c, end=' ') # Outra forma de resolver '''if c % 2 == 0: print(c, end=' ') sleep(0.2)'''
true
a6e39536b1a1c11e93b0124cf952e8c9f9a486e9
bruno-53/key_holder
/src/model/key.py
UTF-8
1,597
2.8125
3
[]
no_license
import sqlite3 from tkinter import Tk connection = sqlite3.connect('key_holder.db') c = connection.cursor() # CREATE OBJECT KEY class Key: # KEY FEATURES def __init__(self,id,category,service,username,password,annotations): self.id = id self.category = category self.service = service self.username = userna...
true
84a2257ae9d5a39545874f2f438eb33fea361387
masleeper/osurandomdl
/APICaller.py
UTF-8
4,735
2.6875
3
[]
no_license
from click import option import requests import time import datetime import concurrent.futures import threading import Cache from Beatmap import Beatmap from random import random, seed from random import randint def getBeatMaps(options): # todo: don't put api key in code, store it somewhere secure in final versio...
true
9d1c69b5ac45a004a92904565d2648f8bdee4649
caionaweb/numb
/14/uri-master/solutions/1 - Iniciante/1018.py
UTF-8
409
3.5
4
[]
no_license
n = int(input()) print(n) x, n = divmod(n, 100) print(x, "nota(s) de R$ 100,00") x, n = divmod(n, 50) print(x, "nota(s) de R$ 50,00") x, n = divmod(n, 20) print(x, "nota(s) de R$ 20,00") x, n = divmod(n, 10) print(x, "nota(s) de R$ 10,00") x, n = divmod(n, 5) print(x, "nota(s) de R$ 5,00") x, n = divmod(n, ...
true
d823ca544d1e4d891e044d9390492b40bcde07ce
PiotrGrzybowski/ProbabilisticMachineLearning
/Lab4/task4.py
UTF-8
2,743
3.0625
3
[ "MIT" ]
permissive
from functools import partial from Lab4.bayesian import likelihoods, posteriors, maximum_a_posteriori_estimator, maximum_likelihood_estimator from Lab4.concept import is_even, is_odd, is_divisible_by_n, does_data_satisfy_concept from Lab4.settings import START, STOP import matplotlib.pyplot as plt import numpy as np ...
true
2ca39758560ba66cea318e9232c0c82343a0361b
daniel-reich/ubiquitous-fiesta
/NYEaXXCnSj9jteNWA_24.py
UTF-8
103
3.265625
3
[]
no_license
def ave_spd(up_time, up_spd, down_spd): d=(up_time/60)*up_spd return d*2/(up_time/60+d/down_spd)
true
3574c9447b75a3ddf853139cd62489e6772c24eb
Tobulus/cpu
/assembler/ops/op_shift.py
UTF-8
893
2.640625
3
[]
no_license
from ops.op import op class op_shift(op): MODE_LEFT = 1 MODE_RIGHT = 2 def __init__(self, mode): self.mode = mode def get_op(self): if self.mode == op_shift.MODE_LEFT: return "shiftl" else: return "shiftr" def invoke(self, params, labels, pos...
true
e548ba09f22a63bd29e60d913f66d6054061c8b4
anden3/Python
/Project Euler/Problem 56 - Powerful digit sum.py
UTF-8
379
3.59375
4
[]
no_license
from time import clock def largest_digital_sum(limit): largest_sum = 0 for a in range(limit): for b in range(limit): num_sum = sum(map(int, str(a**b))) if num_sum > largest_sum: largest_sum = num_sum return largest_sum t1 = clock() print(largest_digital_...
true
ebe21154af0c7af1d9660507ebf35a1dee7fcaa1
Achimeir/interviews
/planck/aggregation_service/json2sql.py
UTF-8
1,568
2.8125
3
[]
no_license
import json import pandas as pd from datetime import datetime from flask import Flask from flask_sqlalchemy import SQLAlchemy fn = r'data.json' app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' db = SQLAlchemy(app) class Entry(db.Model): id = db.Column(db.Intege...
true
48964b6bdea0a7b5212a2dc12536cc95260ec859
iamjoshbinder/gamechanger-ml
/gamechangerml/src/search/query_expansion/word_wt.py
UTF-8
917
2.5625
3
[ "MIT" ]
permissive
import logging import os from gamechangerml.src.search.query_expansion import AUX_DATA_PATH logger = logging.getLogger(__name__) def get_word_weight(weight_file_path, a=1e-3): if a <= 0.0: a = 1.0 #weight_file_path = os.path.join(AUX_DATA_PATH, weight_file) word2weight = dict() try: ...
true
bccc6a1767ba1bb1cc9461dbe7a6904431098003
JCalebBR/BarcodeExtract
/main.py
UTF-8
537
2.578125
3
[]
no_license
from extract import Extract, OCRFailed import keyboard class Main: def __init__(self, filename=None): self.extract = Extract() def paste(self): try: self.extract.clipboardToImage() self.extract.imageToText() self.extract.textToClipboard() except OCR...
true
bbd29d7fc7473b87c1d03777062a8d653f1f436e
RobertoGianfelice/ManipolaImmagini
/immagini_1/immagini_1.pyde
UTF-8
161
2.8125
3
[]
no_license
def setup(): global img size(600,400) img=loadImage("LogoScuola.png") def draw(): background(0,0,0) image(img,mouseX,mouseY)
true
ea16478d028040f03caf7bcbd97acc99edf8c277
drakipovic/SmartNinjaPredavanja
/Predavanje10/geo_game.py
UTF-8
1,034
3.90625
4
[]
no_license
from random import randint capital_cities = { 'Croatia': 'Zagreb', 'United Kingdom': 'London', 'Ireland': 'Dublin', 'France': 'Paris', 'Spain': 'Madrid', 'Sweden': 'Stockholm', 'Hungary': 'Budapest' } countries = capital_cities.keys() def check_user_guess_correct(user_guess, country_name...
true