blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
5ffbda1c6bcfee5e74206e767190147e3db2098e
Python
kevinzen/learning
/two_sum_data_structure/two_sum.py
UTF-8
1,193
4
4
[ "MIT" ]
permissive
from sortedcontainers.sortedlist import SortedList class TwoSum: # Your TwoSum object will be instantiated and called as such: # obj = TwoSum() # obj.add(number) # param_2 = obj.find(value) def __init__(self): """ Initialize your data structure here. """ self.dat...
true
075fd2dd4aecf6d4bee6f63b2961a813a2fd17bb
Python
LukaszMaruszak/Python
/zestaw11/insertion_sort.py
UTF-8
476
3.640625
4
[]
no_license
from animate import Plot def cmp(x, y): if x > y: return 1 if x == y: return 0 return -1 def insertsort(L, left, right, cmpfunc = cmp): for i in range(left+1, right+1): # L[left] jest posortowany item = L[i] j = i while cmpfunc(j, left) == 1 and...
true
4b7c18e793ef1afefc26bda5219852a549e0672f
Python
zhikunhuo/lpython
/numpy/math_func/Arithmetic_operations/fmod.py
UTF-8
248
3.15625
3
[]
no_license
import numpy as np print("fmod [-3, -2, -1, 1, 2, 3], 2: ", np.fmod([-3, -2, -1, 1, 2, 3], 2)) print("fmod[5, 3], [2, 2.]: ", np.fmod([5, 3], [2, 2.])) a = np.arange(-3, 3).reshape(3, 2) print("a: ", a) print("fmod a, [2,2]: ", np.fmod(a, [2,2]))
true
f8d046ef9493355011eed35a00b55144acd2ffb8
Python
HoiDam/Python_EncryptMathsCheat
/shank.py
UTF-8
1,504
3.6875
4
[]
no_license
import os def func_bs(): bs_array=[] print("baby step = a * b ^ r mod c") print("a:") a=int(input()) print("b:") b=int(input()) print("r:") r=int(input())+1 print("c:") c=int(input()) for i in range(r): ans=((a*pow(b,i))%c) print(i,"\t",ans) bs_array...
true
d350331cb77596834dbeeb4d036695e0c3f033b5
Python
asyrul21/recode-beginner-python
/materials/week-3/src/solveTogether-bmi.py
UTF-8
627
4.3125
4
[]
no_license
# The formula is BMI = weight(kg) / height (m) ^ 2 # - Underweight: < 18.5 # - Normal: 18.5 - 24.9 # - Overweight: 25 - 29.9 # - Obese: > 30 userHeight = input("Please insert your height in meters: ") userHeight = float(userHeight) userWeight = input("Please insert your weight in KG: ") userWeight = float(userWeight)...
true
17ccc47ac3d62a563a06e28cd55f0100917800bd
Python
F4r1n/dataScience
/processing/cinema.py
UTF-8
2,416
2.890625
3
[]
no_license
import requests import json import os #using the omdbapi, turned out that the year taken from the script page (IMSDB.com) was not always correct and we eneded up with bad data. Data was corrected manually def getMovieInfo(name, year, api): url = "http://www.omdbapi.com/?t=%s&y=%s&apikey=%s" % (name.replace(" ",...
true
d7425406162bc6932f7cab19859bcab9d1e2e35d
Python
AJJStepien/PythonExampleScripts
/Collatz.py
UTF-8
233
3.8125
4
[]
no_license
num=int(input("Podaj nieujemną i niezerową dla problemu Collatza: ")) step = 0 while num != 1: if num % 2 == 0: num = int(num/2) else: num = int(3 * num + 1) step += 1 print(step,". " ,num, sep="")
true
a11f307dbf23f656aa5413e77585f55f7e5c27e2
Python
RomChig/Repo_1
/array.py
UTF-8
244
2.96875
3
[]
no_license
a=int(input()) while a<0: a = int(input("Введите заново,строго >0")) x=int(input()) def a_1(x): x**=x print(x) print(a) a_1(x) if x.isnotdigit(): print("ergerg")
true
fd8538ed756118946865c16ec8a23b32034ba898
Python
PaddlePaddle/Paddle
/python/paddle/distributed/auto_parallel/static/tuner/tunable_variable.py
UTF-8
7,977
2.8125
3
[ "Apache-2.0" ]
permissive
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 app...
true
ec67b41c9f1b3dd529f088b1e3390dcac80030ca
Python
baixiaoustc/tensorflow_tsc
/tsc_1.0_softmax.py
UTF-8
4,151
2.546875
3
[]
no_license
# -*- coding:utf-8 -*- __author__ = 'baixiao' import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf import zipfile import argparse # import skimage # from skimage import transform # from skimage import data import matplotlib.pyplot as plt # from PIL import Ima...
true
ec8a173bdce96fdf3c7196b92f343493104b067e
Python
SauravRai/Algorithm-assignments-in-python
/Assignment3/redblack_tree.py
UTF-8
7,153
3.28125
3
[ "MIT" ]
permissive
''' Created on 19-Sep-2017 @author: sauravrai ''' RED="RED" BLACK="BLACK" class NilNode(object): def __init__(self): self.colour = BLACK """We define NIL to be the leaf sentinel of our tree.""" NIL = NilNode() class Node(object): def __init__(self, key): self.key = key self...
true
8c3a854536e1c834c28fde9f7ec81e47485055fe
Python
shoang5011/Calculator-App
/main.py
UTF-8
1,734
3.234375
3
[]
no_license
from tkinter import * root = Tk() root.title('Calculator') e = Entry(root,width=50,borderwidth=25) e.grid(row=0,column=0,columnspan=3,padx=10,pady=10) # # e.pack() def button_add(): return # myButton = Button(root,text='Enter Your Name',command=myClick ) # myButton.pack() button_1 = Bu...
true
54dd9f446cf061b34e4c2d170f04ee1daf5abc46
Python
dhicks1982/crawler
/test_crawler.py
UTF-8
652
3.140625
3
[]
no_license
import unittest import crawler class CrawlerTest(unittest.TestCase): def test_get_links_from_text(self): text = '<html><a href="http://abc.com">link</a><a href="https://cdf.com"</a><a href="http:/invalid"</a></html>' results = crawler.get_links_from_text(text) self.assertListEqual(["http:/...
true
f38405fd33f6d34a9463e4257c89b382230e7bd7
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_200/3619.py
UTF-8
363
3.5625
4
[]
no_license
t=int(raw_input()) for cas in xrange(1,t+1): n=int(raw_input()) while '0' in str(n): for i in xrange(0, len(str(n))): if str(n)[i]=='0': a=int(''.join(str(n)[i:])) n=n-a-1; break while str(n) !=''.join(sorted(str(n))): n-=...
true
60dca34f1e0a55f191438d77f1ce67c268f02ecb
Python
vikulovm5/Homeworks
/4_task_7.py
UTF-8
312
3.8125
4
[]
no_license
from math import factorial def fact(n): for i in range(1, n + 1): yield factorial(i) if __name__ == '__main__': try: value = int(input('Введите число: ')) except ValueError: print('Введено не число') for el in fact(value): print(el)
true
cf99738e36670e2573fa0246b9fe5faed21e2701
Python
stevestar888/leetcode-problems
/284-peeking_iterator.py
UTF-8
2,543
4.46875
4
[]
no_license
""" https://leetcode.com/problems/peeking-iterator/ Strat: Store (cache) the next element we should return, along with if we have an additional element to return. Have to ensure we turn our iterator into Stats: O(n) / linear time, O(n) / linear space Runtime: 16 ms, faster than 94.98% of Python onlin...
true
932302fdb0cec8ee157f580d63eaa33646490297
Python
MariaZork/Coursera-Python-Course
/week8 - Функциональное программирование/week8 - Произведение пятых степеней.py
UTF-8
1,093
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 24 00:03:36 2017 author: Maria Zorkaltseva """ # На вход подаётся последовательность натуральных чисел длины n≤1000. # Посчитайте произведение пятых степеней чисел в последовательности. # Формат ввода # Вводится последовательность чисел # Формат вывода # Выведите ответ н...
true
7073f526be9ff3c1573e34ce762f9d5ddacc8c72
Python
kamit17/Python
/Think_Python/Chp7/Exercise/even_digits_in_n.py
UTF-8
508
3.78125
4
[]
no_license
# Write a program that counts the number of even digits in n. def countEvenOdd(n): even_count = 0 odd_count = 0 while (n > 0): rem = n % 10 if (rem % 2 == 0): even_count += 1 #else: # odd_count += 1 n = int(n / 10) return even_count # Driverc...
true
4a3e596f9febc32b36a5a327ec1f7d75ba6b146a
Python
AlenaMuravyeva/clien_server
/client_server/database.py
UTF-8
2,192
3.1875
3
[]
no_license
""" The database, in which stored users logins and passwords""" import sys import sqlite3 import client_server.log class DataBase(object): """Initializes database.""" def __init__(self, name_database): """Initializes database.""" self.database = name_database self.created_db() def...
true
3eb4af0c9bca15e04774a3522dbcf6ee1f39572f
Python
sevenry/my_data
/LintCode_by_me/easy_part_1.py
UTF-8
16,921
3.953125
4
[]
no_license
#####容易 #1 a+b no answer #2 尾部的0 class Solution: # @param n a integer # @return ans a integer def trailingZeros(self, n): s=0 while n>=5: n=int(n/5) s+=n return s #6 合并排序数组 class Solution: #@param A and B: sorted integer array ...
true
d027f0c89854ebb12c1c52514a4f0c5f66e46ad2
Python
nonchris/edvWS2021-extra-tutorium
/src/strings/05-task_palindorme.py
UTF-8
721
4.53125
5
[]
no_license
def is_palindrome(val: int) -> bool: """ Checks if word is the same forwards and backwards Takes an integer Returns bool """ s = str(val) # returns the boolean value of that expression return s == s[::-1] greatest = 0 factor1 = 0 factor2 = 0 # using tow for loops to cover each multipl...
true
45a785862f512767b5b24689694ba87611ba76fb
Python
Zigelzi/SiteSurveyApp
/sitesurvey/user/forms.py
UTF-8
5,976
2.53125
3
[]
no_license
from flask_wtf import FlaskForm from flask_login import current_user from wtforms import StringField, SelectField, PasswordField, SubmitField, TextAreaField from wtforms.validators import DataRequired, Email, Length, EqualTo, ValidationError from sitesurvey import data_req_msg from sitesurvey.user.models import User, ...
true
256dcb7333d1cef1c19e7ad8a033bf9a39c42131
Python
ftczohaib/python_Assignments
/Assignment_8/Assignment8_2.py
UTF-8
982
3.859375
4
[]
no_license
import threading import array def AddEvenFactor(value): evenArr = array.array('i',[]); addEven = 0 for i in range(1,int(value/2)+1,1): #print("even: ",i) if value % i == 0: if i % 2 == 0: evenArr.append(i) addEven += i print(value,"'s Even Fac...
true
867265b2bae42fa5c5be75e6a72212315e15544e
Python
krylatov-pavel/aibolit-ECG
/datasets/utils/name_generator.py
UTF-8
985
2.8125
3
[]
no_license
import re from datasets.utils.data_structures import ExampleMetadata class NameGenerator(object): def __init__(self, file_extension): self.file_extension = file_extension def generate_name(self, label, source_id, start, end): template = "{}_{}_{}-{}{}" return template.format(label, sou...
true
e5c7399dc3c929313565bce79ae66d16ea55c962
Python
hectorrdz98/ia
/BackUps/ComeSolo - Basic Structure.py
UTF-8
4,161
3.578125
4
[]
no_license
wins = 0 def isValidPos(game, pos): if pos[0] >= 0 and pos[1] >= 0: try: game[pos[0]][pos[1]] # print('Valid pos ({}, {})'.format(pos[0], pos[1])) return True except: pass # print('Invalid pos ({}, {})'.format(pos[0], pos[1])) else: ...
true
41320c962f4934c66f29e9fed64ffef69caf6eb3
Python
xpli1987/git-repository
/fishC-homework/Lesson_19_function/count_str.py
UTF-8
873
3.578125
4
[]
no_license
#!/usr/bin/env python #_*_ coding:utf-8 _*_ #__author__:ThunderRuss_XPLI ''' 统计下边路径文件中的长字符串中各个字符出现的次数并找到小甲鱼送给大家的一句话 path = r'F:\学习资料\python\function\string1.txt' ''' def count_str(string): tmp = list(set(string)) str_dict = dict() str_list = [] #统计各个字符出现的次数 for each in tmp: str_dict[each] =...
true
bc0f346b0bc72b63d9e9e70dcd06f946b3d97fdf
Python
TurboFreeze/whitenoise-core
/bindings-python/code_generation.py
UTF-8
4,320
2.578125
3
[]
no_license
import json import os if os.name != 'nt': # auto-update the protos import subprocess # protoc must be installed and on path package_dir = os.path.join(os.getcwd(), 'yarrow') subprocess.call(f"protoc --python_out={package_dir} *.proto", shell=True, cwd=os.path.abspath('../prototypes/')) subproc...
true
a229aa3b1324a1f0a3dec93dcd83f81bac2ba5b6
Python
KenMan79/execution-specs
/src/ethereum/frontier/vm/precompiled_contracts/identity.py
UTF-8
1,166
2.5625
3
[ "LicenseRef-scancode-unknown-license-reference", "CC0-1.0" ]
permissive
""" Ethereum Virtual Machine (EVM) IDENTITY PRECOMPILED CONTRACT ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ..contents:: Table of Contents :backlinks: none :local: Introduction ------------ Implementation of the `IDENTITY` precompiled contract. """ from ethereum.base_types import Uint from ...
true
20fec6a3307c79ef1dff702792925888044acc6b
Python
mbish/TurnWars
/game/tests/unit_tests/tile_factory_test.py
UTF-8
2,363
2.921875
3
[]
no_license
from game.factories.tile_factory import TileFactory from game.exceptions import BadFactoryData, BadFactoryRequest from nose.tools import assert_raises class MockTile: def __init__(self, name, cover, non_passable, events): self.name = name self.cover = cover self.non_passable = non_passabl...
true
4dcc7baf41b5930985bab64bda3004b0403fd0af
Python
santosh-potu/python-test
/tp/time_module.py
UTF-8
330
3.28125
3
[]
no_license
import time,calendar; ticks = time.time() print ("Number of ticks since 12:00am, January 1, 1970:", ticks) localtime = time.localtime(time.time()) print ("Local current time :", localtime) localtime = time.asctime(time.localtime(time.time())) print ("Local current time :", localtime) cal = calendar.month(2008,1) p...
true
b59de9f947c3275b1dd1c60c8247000d5b6e85ee
Python
AK-1121/code_extraction
/python/python_2421.py
UTF-8
111
2.8125
3
[]
no_license
# Python - from file to data structure? with open('myfile', 'r') as f: data = [line.split() for line in f]
true
c286e91b79816ad8b78fd24f4ffe3d1b2b6995f6
Python
seoseokbeom/leetcode
/programmerspriority.py
UTF-8
524
3.09375
3
[]
no_license
def solution(priorities, location): arr = [] for i, v in enumerate(priorities): arr.append((v, i)) for i in range(0, len(priorities)): j = i+1 while j < len(priorities): if arr[i][0] < arr[j][0]: tmp = arr.pop(i) arr.append(tmp) ...
true
ad7b7cd8cbec7e382b9daba1f57e013e96997365
Python
samuroi/SamuROI
/samuroi/plugins/baseline.py
UTF-8
6,475
3.125
3
[ "MIT" ]
permissive
import numpy import scipy import scipy.signal def F0(data, mode, **kwargs): if mode == "stdv": return stdv_F0(data, **kwargs) if mode == "median": return median_F0(data) if mode == "linear_bleech": return linbleeched_F0(data) raise Exception("Unknown mode: " + mode) def delta...
true
44305003a06d07d602be0d5023b0b7cdeb19b82b
Python
William-King977/eng84_python_plane_project
/person/person_test.py
UTF-8
1,328
2.78125
3
[]
no_license
import unittest import pytest from passenger import Passenger from staff import Staff # Test passenger class PassengerTest(unittest.TestCase): first_name = "Bob" last_name = "Davis" ticket_number = "1233" passport_number = "0123" manage = Passenger(first_name, last_name, ticket_number, passport_nu...
true
a8a6584d9890afad99e88c733f6b085cb66635b8
Python
akxl/adventofcode2018
/day5/part1.py
UTF-8
1,241
3.53125
4
[]
no_license
# Advent of Code 2018 Day 5 Part 1 # Author: Aaron Leong def processString(string): listOfLetters = list(string) currentLength = len(string) possible = True while possible: print("Current length: " + str(currentLength)) print(listOfLetters[-5:]) for i in range(0, len(listOfLetters) - 1): curr = listOfLett...
true
a00c6702fef8d327d65f323db629f938b617fcc7
Python
darrenyaoyao/KoalaPhotographer
/vec_query.py
UTF-8
2,131
2.53125
3
[]
no_license
import sys import re import nltk import json import codecs import operator from gensim import corpora, models, similarities #load the dictionary and corpus dictionary = corpora.Dictionary.load('database.dict') corpus = corpora.MmCorpus('database.mm') # define a multi-dimensional LSI space lsi = models.LsiModel(corpus...
true
d925f7fbbbf65759829fcc6866beb3e500c70bf3
Python
mgrube/pbsim
/testfixpitchblack.py
UTF-8
5,450
2.609375
3
[]
no_license
#!/usr/bin/env python """Testing the fix to the pitch black attack following Oskar Sandberg's fix. Taken from thesnarks solution: https://emu.freenetproject.org/pipermail/devl/2013-January/036774.html """ import pynetsim from pynetsim import * from networkx import * from pylab import * from DataStore import DataStor...
true
87861faff7167d0df32975d4d9c37ab793a7eec3
Python
karansinghneu/CS-6200-IR
/IR-Final-Project/Phase1/__init__.py
UTF-8
7,757
2.609375
3
[]
no_license
from Phase1.Indexer import Indexer from Phase1.Cleaner import Cleaner from Phase1.TF_IDF import TF_IDF from Phase1.BM25 import BM25 from Phase1.DMSmoothing import DMSmoothing from Phase1.PseudoRelevance import PseudoRelevance from Phase1.SemanticQueryExpansion import SemanticQueryExpansion from Phase1.Stopper import St...
true
3b354ef4c7bae998dd0f4d986d209450507888b0
Python
daksh-git/Turtle_Codes
/Self/Main syntax.py
UTF-8
67
3.328125
3
[]
no_license
import turtle tt = turtle.Turtle() tt.forward(100) turtle.done()
true
dbf9e9e8a333ec64badfdc906c6c5335f54f9c93
Python
quanaimaxiansheng/1805python
/15day/7-课题三.py
UTF-8
523
3.46875
3
[]
no_license
''' riqi = "20180622" year = riqi[0:4] month = riqi[4:6] day = riqi[6:8] ''' def p_qiqi(year,month,day): d_month=[1,3,5,7,8,10,12] x_month=[4,6,9,11] sum_day=0 for i in range(1,month): if i in d_month: sum_day+=31 elif i in x_month: sum_day+=30 elif i ==2: if (i%4==0 and i%100!=0) or i%400==0: s...
true
de5d74e38f5808e41fccd4464c97719355b5ed8e
Python
kurisufriend/dwass
/dwas.py
UTF-8
1,394
2.953125
3
[]
no_license
#!/usr/bin/env python3 # # TODO: use map counters to avoid max() + .count # import sys import random #print(sys.argv, sys.argv.index("--debug")); sys.exit() #no point in doing anything fancy for 2 flags if not("--debug" in sys.argv): sys.tracebacklimit = 0 else: sys.argv.remove("--debug") best = False if "--best" in s...
true
b1bd53188df54cebfecfae31d276fa2cef8cd0fc
Python
vkaliteevsky/Bet-Parsing-Software
/Bet Parsing Software/William Hill/main/whill/main.py
UTF-8
9,494
2.515625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from subprocess import Popen import subprocess import datetime import time from datetime import timedelta import os import sys # инициализирует парсер # input: # state_file - имя файла-состояния (путь к нему) # amount_of_pages - количество страниц, необходимых для инициал...
true
547754cba77d5565318fada67585e1d94ab26214
Python
KleyLima/interfatec2019
/source/bochas.py
UTF-8
3,318
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- from math import sqrt class Bochas: """Classe que carrega os atributos necessários para a abstração do jogo de Bochas""" def __init__(self, balls, turns): """Inicia a classe com seus atributos com valor default""" self.max_h = 4000 self.max_l = 25000 ...
true
ce8232724dda967f95085ed16203a2dd66ebdd4c
Python
TristanKalloniatis/gun-fight
/Tristan.py
UTF-8
125
2.734375
3
[]
no_license
import Player class Tristan(Player.Player): def __init__(self): self.name = 'Tristan' print("Created")
true
0d625c1af4067a6f0d0bee80224d25556eb8120b
Python
lionheart1022/contextionary_latest
/InputTextKeywords.py
UTF-8
6,169
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Aug 16 12:27:09 2018 @author: estam """ class InputTextKeywords(object): def __init__(self, tableName = "input_text_keywords", copy = False): from contextionaryDatabase import Table self.tableName = tableName s...
true
14ef576d09f2225f5509c1962325eec5487102ad
Python
startitfonds/startit-masinmacisanas
/vizualizacijas.py
UTF-8
2,120
3.046875
3
[ "MIT" ]
permissive
import pandas as pd # datu apstrāde from termcolor import colored as cl # teksta izvade import matplotlib.pyplot as plt # vizualizācija import seaborn as sb # vizualizācija # vizualizaciju pamata konfigurācija sb.set_style('whitegrid') # plot style plt.rcParams['figure.figsize'] = (15, 10) # plot size # Karstuma kar...
true
4ff5a9d3505df898eb5ad931e5b23a1371e2a818
Python
Glowingspy/Tic-Tac-Toe3.0
/Tictactoegame.py
UTF-8
23,987
3.109375
3
[]
no_license
import pygame,sys #it initilizes pygame. #i think initialize means to make it able to start pygame.init() #i did this so that i dont have to repeat myself when i am coding below board = [0, 0, 0, 0, 0, 0, 0, 0, 0] blue = [0,0,255] red = [255 ,0, 0] black = [0, 0, 0] bg_color = [192, 192, 192] #fonts or texts that are ...
true
24375b9f0e51e888a2521b84135a462a6deef7f7
Python
aahooo/DeepWebserver
/notfound.py
UTF-8
352
2.578125
3
[ "MIT" ]
permissive
def main(args , details): message = "<title>404 Error</title>" message += "<H1>If You're not Me , Then You are Probably Lost </H1>" message += "<H3><a href=\"/\">Get Back Home</a></H3>" if details.get("Referer"): message += "<H5><a href=\"{}\">Or Where You Came From</a></H5>".format(details.get("Referer")) ...
true
f4da162dca92e3b7850744940e28e6fe90f6fda9
Python
FabianCaceresH/Ejercicios_sesion_03
/Ejercicio_02.py
UTF-8
1,868
4.5625
5
[]
no_license
# Condicionales [Python] # Ejercicios de práctica # Autor: Inove Coding School # Version: 2.0 # IMPORTANTE: NO borrar los comentarios # que aparecen en verde con el hashtag "#" # Ejemplos variables de texto # Comparadores # Ingrese dos palabras cualesquiera y realice las sigueintes # comparaciones entr...
true
2c67603c747ec0f35c9b28bdb647f28918284636
Python
aitchslash/lahman-updater
/lahman_update/scraper.py
UTF-8
12,156
2.796875
3
[ "MIT" ]
permissive
"""Grab bbref data with spynner. Get csv and html data, store in file and move to correct location. Depending on your d/l speed and the speed of baseball-reference's server you may wish to change the wait_load values. More time is slower but you're more likely to get the data. """ import spynner import os import ti...
true
a6e254e7f936edbc2449edeb1945c2557c20094b
Python
hian18/python_click
/main.py
UTF-8
1,190
2.921875
3
[]
no_license
import click import os import shutil # @click.command() # @click.option('--count', default=1, help='Number of greetings.') # @click.option('--name', prompt='Your name', # help='The person to greet.') # def hello(count, name): # """Simple program that greets NAME for a total of COUNT times.""" # fo...
true
e3a87e2a929c63cf26afe98d108d4e7bc1196ab4
Python
kevinparre/Web-scrapping
/selenium-webscrapping.py
UTF-8
2,724
2.75
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import warnings from bs4 import BeautifulSoup import pandas as pd import das...
true
328c66871c196f2624be025772e6c4e8d82f5675
Python
jillo-abdullahi/python-codes
/AndelaCodeReviewInterviewQuestions/longerWord/longestWord.py
UTF-8
374
4.40625
4
[]
no_license
"""Longer word function""" def longer_word(str1, str2): """Function to test two strings using length""" if not isinstance(str1, str) or not isinstance(str2, str): return "All inputs must be string" if len(str1) == len(str2): return str1 + "\n" + str2 return str1 if len(str1) > len(str2...
true
7e6cc34c0d3907d931b3a1039c5a10d6a65f5631
Python
SeanCCarter/SoftDesSp15
/web_scraper/sentiment_grapher.py
UTF-8
733
3.34375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches from pickle import dump, load sentiments = open("Sentiments.txt", 'r') data = load(sentiments) #Creates lists with the correct sentiment data positive_sentiments = [] negative_sentiments = [] x = np.linspace(0, 31, len(data)) for...
true
7d2beba8951d3f799ebd1bdfce8cc7fc5dceac65
Python
NataliVynnychuk/Python_Hillel_Vynnychuk
/Lesson/Lesson 9 - 17.07.py
UTF-8
1,655
3.90625
4
[]
no_license
# Стандартные библиотеки python # Функции, область видимости, параметры, параметры по умолчанию, типизация import string import random # import random as rnd # print(string.ascii_lowercase) value = random.randint(10, 20) my_list = [1, 2, 3, 10, 20, 30] # my_list = [True, False] my_str = 'qwerty' choice_from_list = r...
true
e2cb245e581c27255fb378c13e23fbc4d8fdd213
Python
anubeig/python-material
/MyTraining_latest/MyTraining/Regular_Expressions/Repetition.py
UTF-8
923
4.1875
4
[]
no_license
""" Things get more interesting when you use + and * to specify repetition in the pattern + -- 1 or more occurrences of the pattern to its left, e.g. 'i+' = one or more i's * -- 0 or more occurrences of the pattern to its left ? -- match 0 or 1 occurrences of the pattern to its left Leftmost & Largest First the searc...
true
b21684252d2b1654de638756d31a051fb6126d56
Python
milin1912/PythonCoding
/FindMissingData.py
UTF-8
995
2.671875
3
[]
no_license
import glob import os.path1 # how to reach at actual path of directory script_dir = os.path.dirname(os.path.realpath('__file__')) # fatch the root folder of the file path1 = os.path.join(script_dir[0:-3],'results/MissingData.out') # Open a folder in file where output will be stored path = os.path.join...
true
3763bdb7d8d15047b3da7e81902d06ab6fbd78cb
Python
mrkkollo/evkk-api
/helpers.py
UTF-8
2,125
3.546875
4
[]
no_license
import string from typing import List class Token: def __init__(self, original: str, corrected: str): """ Helper class for everything related to tokens. :param original: String value of the original token. :param corrected: String value of the original tokens correction. "...
true
554226a1c7a1404accfdeb6511cc6cf0c9e11440
Python
NEUBob/PyAzul
/azul/BoardConverter.py
UTF-8
2,031
3.265625
3
[ "MIT" ]
permissive
from .AzulLogic import AzulBoard from .TileCollection import TileCollection from .Player import Player import numpy as np class BoardConverter: # This will be ugly... We need to convert the entirety of the board into an array. Yikes. @staticmethod def createArrayFromBoard(board: AzulBoard): arr = ...
true
864a030968bb7da67f27aea200393f2e5187e2da
Python
Hyoutan-tokyo-504/class-of-analysis
/Report1.py
UTF-8
13,080
3.15625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # 問題1(モンテカルロ法) # In[27]: import numpy as np import random import statistics import collections import time import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[28]: #外部から持ってきた関数 def has_duplicates(seq): return len(seq) != len(set(s...
true
94e4e6d54fdfbf86077c4473da90328f2aef7c3d
Python
LinardJeremy/Python_Parcours_fundamental
/basic_operator.py
UTF-8
419
3.453125
3
[]
no_license
a = 10 b = 20 add = a + b print(add) division = b / a print(division) sub = b - a print(sub) multi = a * b print(multi) floordiv = b // a print(floordiv) modulus = b % a print(modulus) modulus_second = 21%2 print(modulus_second) exp = a**2 print(exp) print(a==b) print(a==10) a+=10 name = 'Jeremy' print(name) print(a) ...
true
b0d42f21d49cf019032db9dfafcb00860f257763
Python
wisdomtohe/CompetitiveProgramming
/Forks/uvapy-master/lib/numbers.py
UTF-8
539
3.390625
3
[ "MIT" ]
permissive
import math def divisorGenerator(n): large_divisors = [] for i in range(1, int(math.sqrt(n) + 1)): if n % i == 0: yield i if i*i != n: large_divisors.append(n // i) for divisor in reversed(large_divisors): yield divisor def fast_sieve_for_primes_to(n): size = n//2 sieve = [1]*siz...
true
dec3cb4d207218c14d1f8ef3d4bd0ca75e3e6ae6
Python
evan-gordon/pycritters
/bush.py
UTF-8
1,672
3.1875
3
[]
no_license
import pygame, random class Bush(pygame.sprite.Sprite): def __init__(self, image_info, currday, x=0, y=0): pygame.sprite.Sprite.__init__(self) self.ripeness = min(max(0.3, random.random()), 1.0) self.nextgrowth = currday + 1 self.original_image, self.original_rect = self.setup_sprite(image_info) ...
true
2e63c9a46c45079f4678b2ad3d5a444abe1fff52
Python
czhao39/soc414-educationmapping
/data_processing/convertLEA.py
UTF-8
1,353
2.953125
3
[]
no_license
""" convert the LEA id to NCES ID """ import os import numpy as np import pandas as pd import shutil LEA_dataset_path = "" # dataset indexed by LEA ID conversion_dataset_path = "" # download the data lea_data = pd.read_csv(LEA_dataset_path) convert_data = pd.read_csv(conversion_dataset_path) # add new column le...
true
01c6540aca2a963a793bf8d9d28fd648563cb121
Python
TimothyBui/CustomGameHistory
/main.py
UTF-8
6,060
2.75
3
[]
no_license
import json import requests import time request_header = { "User-Agent": "[INSERT HERE]", "Accept-Language": "en-US,en;q=0.5", "Accept-Charset": "application/x-www-form-urlencoded; charset=UTF-8", "Origin": "https://developer.riotgames.com", "X-Riot-Token": "[INSERT RIOT API DEV KEY HERE]" } def p...
true
6e9b30d8194d230289266c332aff63e34685a74a
Python
learningequality/sushi-chef-engageny
/translation.py
UTF-8
1,728
2.625
3
[ "MIT" ]
permissive
from google.cloud import translate class CachingClient: def __init__(self, translator, cache): self.translator = translator self.cache = cache def translate(self, values): found, translation = self.cache.get(values) if found: return translation translated = ...
true
f257be2b3ecfc223be242d4f50d452e435c4c1ed
Python
nikhiilll/Data-Structures-and-Algorithms-Prep
/Arrays/LeetCode/FinalPricesSpecialDiscount_1475.py
UTF-8
558
3.75
4
[]
no_license
def finalPrices(prices): final_prices = prices.copy() n = len(prices) for i in range(n - 1): for j in range(i + 1, n): if prices[j] <= prices[i]: final_prices[i] -= prices[j] break return final_prices prices = [8,4,6,2,3] print(finalPrices(...
true
b29fcf8408fead3fcee039cf5346556784b7dde2
Python
lhcxnqm/MySite
/otherutils/12306main.py
UTF-8
1,318
2.53125
3
[]
no_license
import requests import time import re headers = { "User-Agent": "Mozilla/5.0" } class Main: def __init__(self): self.session = requests.session() def verifyCheck(self): url = 'https://kyfw.12306.cn/passport/captcha/captcha-image?login_site=E&module=login&rand=sjrand' result = sel...
true
33520eaadc15b034d4b0fab0900c29bc34992d62
Python
sids07/Disease-Prediction
/src/disease_predict.py
UTF-8
1,892
2.828125
3
[]
no_license
from preprocessing import preprocessing, remove_least_frequent_disease import numpy as np import pandas as pd import re import pickle from sklearn.naive_bayes import MultinomialNB def make_dataset(frame): frame = frame.reset_index() data = pd.get_dummies(frame,columns=['Symptom'],prefix='',prefix_sep=''...
true
fba0eeb18c0e3173332cf05c1fb3b1da732d344e
Python
hughwin/hughpython
/widgets.py
UTF-8
332
3.5625
4
[]
no_license
# Functions and return variables def widgets(a, b): return a / b x = widgets(30, 2) print x tuple = ("a", "b", "c", "d", "e", "f", "g", "h") print tuple[3] print tuple list = ["a", "b", "c", "d",] print list list.append("e") print list list[0] = "1" print list dict = {"404": "clueless", "405": "what"} print...
true
bf1c750923ff1d479cad9df555c0c62cf89d6d3f
Python
LaMavia/4lang-scrapers-python
/main.py
UTF-8
1,634
2.9375
3
[]
no_license
#!/usr/bin/env python3 from bs4 import BeautifulSoup import requests import random import os import re import string import multiprocessing as mp def getHTML(url): print("----- Starting %s -----" % url) req = requests.get(url) return req.text def getUrls(html): soup = BeautifulSoup(html, features='html5lib') img...
true
16fd9cf5ec308b9f69a3b8747b9946814bdcf702
Python
JunhuaLin/PictureCollection
/start/download_model.py
UTF-8
2,081
2.8125
3
[ "Apache-2.0" ]
permissive
# encoding = utf-8 import os import platform import urlparse import requests class Download(object): this_download = None def __init__(self): self.root_dir = "D:\\images" if platform.system() == 'Windows' else "/home/junhua/Pictures/" self.chunk_size = 1024 self.proxies = {"http": "h...
true
7a6df419d5b8fff05a75a7dced01b528f99b32fa
Python
sprax/1337
/python3/test_l0078_subsets.py
UTF-8
490
2.859375
3
[]
no_license
import unittest from l0078_subsets import Solution class Test(unittest.TestCase): def test_solution(self): self.assertEqual( sorted([[1], []]), sorted(Solution().subsets([1]))) self.assertEqual( sorted([[1], [2], [1, 2], []]), sorted(Solution()....
true
a9b4c57326c601c22aa3d1b5f55fdf9cc45e2366
Python
kubp/Python-game
/logika.py
UTF-8
9,041
2.640625
3
[]
no_license
#Jakub Dolezal V2C #importy import random from tkinter import * import tkinter.messagebox import time import winsound import urllib.request #Pro zapis do MySQL databaze pres GET import tkinter.simpledialog import re import nastaveni import main_menu import nastaveni_menu import logika import threading class Logik...
true
6e2ae9b3f0e42845f622044c0d02b8f55033904a
Python
ShawnZhong/CS759-Spring-2020-Final-Project
/cutensor/main.py
UTF-8
1,961
2.59375
3
[]
no_license
import cupy from cupy import cutensor import time import torch import os from pathlib import Path import matplotlib.pyplot as plt from cupy.cuda import stream # 'abcd,aefd->aefbc' batch_dim = 200 def einsum_cutensor(n): st = stream.Stream() a = cupy.random.rand(batch_dim, n, n, n) b = cupy.random.rand(ba...
true
3236a5425b6ca304830191bad6452737868fbcaa
Python
nabeel-ds/Car_Price_Prediction_Web_App
/plots.py
UTF-8
2,901
3.5
4
[]
no_license
# Import necessary modules import streamlit as st import matplotlib.pyplot as plt import seaborn as sns # Define a function 'app()' which accepts 'car_df' as an input. def app(car_df): st.header('Visualise data') # Remove deprecation warning. st.set_option('deprecation.showPyplotGlobalUse', False...
true
47060099231ae12d5559e970cc4b54a24b687a56
Python
duncandc/simulations
/processed/Bolshoi/trees/index_haloes.py
UTF-8
3,244
2.890625
3
[]
no_license
#Duncan Campbell #March 2017 #Yale University #load packages from __future__ import print_function, division import numpy as np import string import os import fnmatch """ make an array that stores the sub-volume and index of each halo """ def main(): result = id_generator('./', ndivs=5) np.save('./halo_...
true
89024ae9d479c722e9e644dc3865c73ded8d4c4e
Python
wengellen/cs36
/removeEvens.py
UTF-8
132
2.53125
3
[]
no_license
# Write a function that removes the even numbers from the given array and returns the resulting array. def removeEvens(numbers):
true
39a037902f30b3c0f2ec9e98a4ec648e510bd558
Python
finfinley/leetCodeGrind
/Arrays101/ReplaceElementswithGreatestElementonRightSide.py
UTF-8
323
3.515625
4
[]
no_license
arr = [17,18,5,4,6,1] N = len(arr) ans=[] for i in range(N-1): arr_r = max(arr[i+1:]) # Working through the array, finding the max as it goes and putting it into var arr_r ans.append(arr_r) # adds the max number from the right to the new array, ans ans.append(-1) # at the end of list, adds the -1 print(ans) ...
true
da07996a003eac9a5499efef17ee95ac828dc82b
Python
Pancinator/hacker_rank_practise
/largest_connected_region_DFS.py
UTF-8
1,110
3.171875
3
[]
no_license
def get_biggest_region(matrix): max_cell_counter = 0 for row in range(len(matrix)): for col in range(len(matrix[row])): if matrix[row][col] == 1: size = _get_biggest_region(matrix, row, col) #pass the currnet location to recursive function max_cell_cou...
true
e3336622c4007030d1af659ca2f59cce371c0221
Python
TGITS/programming-workouts
/erri/python/lesson_2/somme.py
UTF-8
222
3.703125
4
[ "MIT" ]
permissive
liste = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] somme = 0 for element in liste : print("element : " + str(element)) somme = somme + element print("somme intermédiaire : " + str(somme)) print("somme : " + str(somme) )
true
e4cc1609dfd532c5859ec65d5d5d3df179dddf51
Python
KratosMultiphysics/Kratos
/applications/StatisticsApplication/python_scripts/temporal_utilities.py
UTF-8
2,254
2.78125
3
[ "BSD-3-Clause" ]
permissive
import KratosMultiphysics.StatisticsApplication as Statistics def GetItemContainer(item_container_name): item_container_types = [ [ "nodal_historical_historical", Statistics.TemporalMethods.Historical.HistoricalOutput ], [ "nodal_historical_non_historical...
true
618c351cf46c03b693a91d9c286cb46d07669a71
Python
argriffing/xgcode
/20100920b.py
UTF-8
1,874
2.625
3
[]
no_license
""" Do some analysis of variance. This uses the R software. Also google for a pdf called Using R for an Analysis of Variance. """ from StringIO import StringIO import argparse from SnippetUtil import HandlingError import Form import FormOut import Util import RUtil import Carbone import const g_tags = ['pca:compute...
true
50a1c4ee71147205462b2857dde3db280f49e163
Python
chongyangshi/AoC2016
/day1.py
UTF-8
2,394
3.65625
4
[ "MIT" ]
permissive
################################### # Such Christmas # # Much WoW # # Very Doge # ################################### # By C Shi <icydoge@gmail.com> # ################################### DIRECTIONS = ['N', 'E', 'S', 'W'] NORTHINGS = ['S', None, 'N'] # -, 0...
true
70c2f27e9c2d295e6f4837f619da14460ca32dd6
Python
pacchiano/heur-search
/heuristic-search/experiments_engine.py
UTF-8
5,448
2.671875
3
[]
no_license
from os import listdir from os.path import isfile, join from random import random, randint, sample, choice from Tkinter import * from time import time import math from matplotlib import pyplot as plt ### local imports from track_extract_final import extract_track from landscape import structuredSpace def analyze_lrta...
true
b09c335e825a8de20b731b37a8d7f9dbecf163ed
Python
bianafranco/dw_fb_Python
/pageFacebook.py
UTF-8
450
2.78125
3
[]
no_license
import urllib, json from pprint import pprint token = 'CAAG9SwJw5O4BAAxh20YiMgARnPQwiqrtcqW7PQU0MyzfXZBD1Pghv8XbO9vMONuXGnxd7EOybB5VsSq50p6pAUkSwSP9zuskOqoSFEZAvPGLiOrb6zXftXnR4hBtWBSdCJLiPBCs8d3tIAZBswqtAkyXUKonhzmfAVFA3sHmaQKwG2EKMtgPyJM3dZCKYx2NC8YtZChitFuc6vkZBpiO3E' textos = ['OcupeEstelita','ResisteEstelit...
true
5f93dc41e49b032dd0450fe33f879e1327d46022
Python
varmasr/flask_app_boilerplate
/resources/movie.py
UTF-8
751
2.5625
3
[]
no_license
from flask import Blueprint, request, Response from database.models import Movie movies = Blueprint('movies', __name__) @movies.route('/movies') def get_movies(): movies = Movie.objects().to_json() return Response(movies, mimetype="application/json", status=200) @movies.route('/movies', methods=['POST']) def...
true
59152deaa7ec80e69e387c0099ff649d4711275b
Python
LuisOre24/sistema_escolar_nosql
/repository/repo_alumno.py
UTF-8
3,826
2.703125
3
[]
no_license
from bson.objectid import ObjectId from pymongo import collection from config.connection import Connection class AlumnoRepo: def __init__(self): self.conn = Connection('test') self.collection = 'alumnos' def all_alumnos(self): try: records = self.conn.get_all(self.collecti...
true
327b13083f53e74bfc2e6245cab3cf699975846d
Python
atifkarim/image_py
/37_low_pass_filter.py
UTF-8
661
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- import cv2 import matplotlib.pyplot as plt def main(): img_path="/home/atif/spyder_project/youtube_ashwin_tutorial/leon.jpg" img=cv2.imread(img_path,1) img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB) box=cv2.boxFilter(img,-1,(50,50)) blur=cv2.blur(img,(20,20)) ...
true
555e5f2947cdb78d41ef4abcffa772430f1de148
Python
NickYxy/LeetCode
/Algorithms/563_Binary Tree Tilt.py
UTF-8
2,131
3.875
4
[]
no_license
__author__ = 'nickyuan' ''' Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree node values. Null node has tilt 0. The tilt of the whole tree is defined as the sum of al...
true
13c9010d5f7cd4693a0d3f902254c911a9fc7cee
Python
daniel-reich/ubiquitous-fiesta
/r6ywkSJHWqA7EK5fG_13.py
UTF-8
140
3.15625
3
[]
no_license
def printgrid(rows, cols): r = [] for i in range(1,rows+1): r.append([j for j in range(i,rows*cols+1,rows)]) return r
true
4989796d609e5a4a90d011c5cbfbeecfabb85abd
Python
Adancurusul/For-fun
/复变函数.py
UTF-8
430
2.921875
3
[]
no_license
def leng (s): start= -1 dic = { } max = 0 for i in range(len(s)): print(dic) if s[i] in dic and start<dic[s[i]]: start = dic[s[i]] print("start"+str(start)+"ddd"+str(i)) dic[s[i]] = i else : dic[s[i]] = i if i-start...
true
3d4dcebb23cd70ccff1c22bdb8586a0ba694dbfc
Python
Fotoon1992/Programming-for-Digital-Media
/chapter6/the conditional, if.py
UTF-8
262
2.546875
3
[]
no_license
#%% def secret(word): if word == 'please': return True else: return False #%% def yesno(word): if word == 'yes': return True if word == 'no': return False #%% def secret(word): return (word == 'please') #%%
true
214d06f6022f8a55cad74759579d977a31a74bc4
Python
ppipee/ros_homework
/twist_sim/src/twist.py
UTF-8
2,257
2.71875
3
[]
no_license
#!/usr/bin/python2 from std_msgs.msg import Float64, Bool import rospy from geometry_msgs.msg import Twist import math # linear=Twist().linear # angular=Twist().angular # print('linear');print(linear) /fix/rel/yaw # print('angular');print(angular) class Autorun: global linears global angulars global ...
true
9f8505a3e9a539929a973b78bb55cc387bc0aafb
Python
SongPengcheng/QASYSTEM
/PathGenerateModule/SearchQuery.py
UTF-8
4,246
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2021/4/26 9:20 上午 # @Author : SPC # @FileName: SearchQuery.py # @Software: PyCharm # @Desn : 定义查询图类 class SearchQuery(object): def __init__(self,query,path,entity_score,predicate_list,mention_list,enum,ans): self.query = query self.pat...
true
d27a74b8285e4d617679aaccfbacbade91619bb7
Python
kozec/unit2openrc
/unit2openrc/main.py
UTF-8
3,854
2.609375
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python2 """ Unit2OpenRC - main Converts systemd unit files into OpenRC scripts """ from __future__ import unicode_literals from unitfile import UnitFile from rcfile import RCFile from convert import convert from consts import * import sys, os, argparse HELP = """ Converts systemd unit files into OpenRC...
true
f1699bd4541a7e72ada112e2229b600617b87b4c
Python
MartinFSchmitz/machine_learning
/ML_Ass_1_Python27/Node.py
UTF-8
548
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Nov 5 12:24:13 2017 @author: marti """ class Node(object): def __init__(self, used_atts = [], examples = None, leaf = False, label = None): self.used_atts = used_atts self.examples = examples self.left = None self.right ...
true
e15d25dd14b8ab5470fce6a887b2a9df88043c85
Python
julyzergcn/ThinkBlog
/blog/utils.py
UTF-8
7,350
2.53125
3
[]
no_license
# coding=utf-8 """ custom class and function """ import HTMLParser import os import time import re from datetime import datetime from functools import wraps import markdown import mistune import requests from django.conf import settings from django.shortcuts import HttpResponse, render_to_response, Http404 from pygmen...
true
e574ccf7eeb39c92beaeded21d5f8c8e5451de7b
Python
niems/-Vienna-Channels-Item-locator
/practice.py
UTF-8
24,844
2.78125
3
[]
no_license
import tkinter from tkinter import ttk from tkinter import Image from tkinter import messagebox from tkinter import filedialog from tkinter import font import sys import random #from StyleConfig import StyleConfig as Styles #styles = StyleConfig.StyleConfig() #file.Class() is the format. No one class, one file rule in...
true
e21b93f377e44ed3ca5c340a7b992cf6567ece9b
Python
ScottRMalley/intro-programming
/examples/math_command_line_example.py
UTF-8
249
3.640625
4
[]
no_license
import sys arguments = sys.argv if len(arguments) > 3: if arguments[1] == 'add': print(int(arguments[2]) + int(arguments[3])) if arguments[1] == 'multiply': print(int(arguments[2]) * int(arguments[3])) else: print("List not long enough")
true