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
5a786bde7205ff72a29922e690d7f33f54fc5b80
Nayef-Abou-Tayoun/Reducing_waiting_time_for_patients_in_Hospital
/Q_Value_Agent_withWaitingHours.py
UTF-8
8,545
2.6875
3
[]
no_license
""" Created on Mar 19 2020 @author: Jerry """ import numpy as np import random import pandas as pd from typing import Dict import state from state import State from hospital_env_withWaitingHours import env import json models = ['fixed_policy', 'random_policy', 'max_qValue_policy'] class agent()...
true
c9b55d2dd7fdb75cc7e38254d8edac87c7aaef7e
godats7/PythonPractice
/practice21.py
UTF-8
722
4.28125
4
[]
no_license
# 세트(set) # 중복이 안됨 순서가 없음 my_set = {1,2,3,3,3} print(my_set) my_set2 = (1,2,3,3,3) print(my_set2) java={"유재석","김태호","양세형"} python=set(["유재석","박명수"]) # 교집합( java와 python 을 모두 하는 사람) print(java & python) print(java.intersection(python)) #합집합( java도 python도 할 수 있는 사람) print(java | python) print(java.u...
true
fbc1a3068b802e0aedecffc03c218849cdd459e8
Maximus0000/ImageToLines
/game.py
UTF-8
1,584
2.640625
3
[]
no_license
import pygame import main pygame.init() window = pygame.display.set_mode((600, 600)) val1 ,val2, val3 = 200,150,60 factor = 2 amount = 100 run = True while run: for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if event.type == pygame.KEYDOWN: if eve...
true
db70030c0a4090bbba2a84cd9a5e1eb5ba50f52c
LoveYang/question-answer
/tf_seq2seq_QA/corpus_parse.py
UTF-8
5,309
2.78125
3
[]
no_license
import os import json from nltk.tokenize import word_tokenize import nltk import gensim try: word_tokenize(' ') except LookupError: nltk.download('punkt') class DocSQuAD: ''' -file.json -data -[i] -paragraphs -[i] -context...
true
579a17f8635a0bb8f93eed8bf01b3d7cb1d92faf
steven0129/pytorch-cifar10
/main.py
UTF-8
4,318
2.71875
3
[]
no_license
import torch as t import torchvision as tv import torch.nn as nn from torch.autograd import Variable from torch import optim import torch.nn.functional as F import torchvision.transforms as transforms from torchvision.transforms import ToPILImage from tqdm import tqdm import prettytable as pt show = ToPILIm...
true
0015eaf2577372d4ab97f3cef798b519c5ef3c61
TypeAtools/Internal_Linking_Tool
/TypeATool_GoogleSearch.py
UTF-8
8,261
3.0625
3
[]
no_license
# WHAT DOES THIS PROGRAM DO # The is based on the TypeATool_Keywords program as it gets the necessary information from there (in the form of a csv) - so it is not possible to use this program by itself, # except if a csv with urls and keywords is provided beforehand. # With the ‘site: command search’ we search the web...
true
d19eeab22b88bee30822397840bd24c3a1132266
En3rG/HaliteIII
/src/simulate_hlt/simulate_p1.py
UTF-8
588
2.734375
3
[]
no_license
import hlt import json import logging import numpy as np import traceback import sys import time name = "p1" with open('moves/' + name + '.txt') as json_data: moves = json.load(json_data) player_name = moves.pop(0) _ = moves.pop(0) ## EXTRA MOVE? game = hlt.Game() game.ready(player_name) log...
true
cd02308e7145031c0de408b201c5db67c5af718b
SiyanZhou97/VAE
/autoencodercmp/test_multiprocess.py
UTF-8
846
2.765625
3
[ "MIT" ]
permissive
import numpy as np import multiprocessing as mp import time class test(): def __init__(self): self.v=np.array([0,0,0,0]) self.results=[] def _collect_result(self, result): self.results.append(result) def _exc(self): print('self.v={}'.format(self.v)) return self.v ...
true
25806117894305f3c12e566168959ac1f34c2b34
SubhashreePrusty/project-euler
/Problem3/problem3.py
UTF-8
121
3.125
3
[]
no_license
n=600851475143 for i in range(3,n): while(i<n): if(n%i==0): n=n/i print("largestprimefactor="+n)
true
f25bcd5c2b249d1db6f1fcc46f23f902e01ee791
bgv26/Algorithms-theory-and-practice
/src/phone_book.py
UTF-8
657
3.46875
3
[]
no_license
phone_book = {} def add(number, name): phone_book[number] = name def delete(number): if number in phone_book: del phone_book[number] def find(number): if number in phone_book: return phone_book[number] else: return 'not found' def run(): num_of_queries = int(input()) ...
true
3b418876d15d528b5ed0b4eda20b1f7041033c8d
explorerwjy/rosalind
/iprb.py
UTF-8
447
2.53125
3
[]
no_license
from sys import argv def factorial(start,stop): res = 1 while start >= stop: res *= start start -= 1 return res def combine(m,n): return (factorial(n,n-m+1)+0.0)/(factorial(m,1)) k,m,n = map(int,file(argv[1]).read().split()) print "%.5f"%(combine(2,k)/combine(2,k+m+n)+combine(1,k)*combine(1,m)/combine(2,k+n+m...
true
e5cf5e3b744b7373638c07b97a455d133aa9d7ac
AndyZhang17/iaf2
/models/moon.py
UTF-8
6,989
2.578125
3
[]
no_license
__author__ = 'andy17' import theano import theano.tensor as T import models as M import utils import utils.theanoGeneral as utilsT import utils.mathT as mathT import utils.mathZ as mathZ import numpy as np import numpy.random as npr floatX = utils.floatX class Logistic(object): def __init__(self,dimx,debug=False...
true
75be4a7a023faa3730100c54c77659354b493ec2
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_2/LandoCalrizzian/pancakes.py
UTF-8
1,214
3.390625
3
[]
no_license
#!/usr/bin/python maxTestCases = int(raw_input().strip()) happy = '+' sad = '-' for caseNum in xrange(1, maxTestCases + 1): pancakeStack = list(raw_input().strip()) answer = 0 stackHeight = len(pancakeStack) if stackHeight == 1: answer = 1 if pancakeStack[0] == happy: answ...
true
60e11adfe040429608123e562ac4e484875e2d15
mariehposa/python-and-oop
/sets.py
UTF-8
653
4.25
4
[]
no_license
# Create a set my_set = {'rice', 'maize', 'oat'} # Loop through a set for x in my_set: print(x) # Check if an item exists if 'rice' in my_set: print('It exists') # Add an item to a set my_set.add('beans') # Add multiple items to a set my_set.update({'yam', 'egg'}) print(my_set) # Get the length of a set pr...
true
8352fc8731821c3da697e426a83067905497d447
inducer/pycuda
/examples/from-wiki/distance_element_wise3d.py
UTF-8
1,839
2.890625
3
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "Python-2.0" ]
permissive
#!python import pycuda.gpuarray as gpuarray import pycuda.driver as cuda import pycuda.tools as tools import pycuda.autoinit import numpy, random, time from pycuda.curandom import rand as curand from pycuda.elementwise import ElementwiseKernel as Elementwise x = 50 y = 50 z = 2 width = 100 height = 100 depth = 100 d...
true
c2e1ee0c3316ae803915b5098fce373be4a6585d
yoonmyunghoon/JDI
/알고리즘/프로그래머스/코딩테스트 고득점 Kit/이분탐색/입국심사.py
UTF-8
103
2.640625
3
[]
no_license
def solution(n, times): answer = 0 return answer N = 6 T = [7, 10] print(solution(N, T))
true
ff764c69ae46fd40bac31e21e380205e0ea2b8c6
josephcalver/CompleteDataStructuresAndAlgorithmsInPython
/Recursion/capitalise_first.py
UTF-8
280
3.734375
4
[]
no_license
def capitalise_first(arr): result = [] if len(arr) == 0: return result else: result.append(arr[0][0].upper() + arr[0][1:]) return result + capitalise_first(arr[1:]) test_list = ['joseph', 'caolan', 'freya'] print(capitalise_first(test_list))
true
c8b87ad20276846c478e194a25f164a7b5b6a52f
wgilpin/shout
/pwd_tool.py
UTF-8
4,883
3.296875
3
[]
no_license
#! /usr/bin/env python # __author__ = 'Will' import hashlib import hmac import math import random import string _rng = random.SystemRandom() ALPHANUMERIC = string.letters + string.digits def generate_random_string(length=None, entropy=None, pool=ALPHANUMERIC): """Generates a random string using the given sequence...
true
c6d055d13871a0315a2e7064cd638d386002aa93
Ticopress/visbrain
/visbrain/brain/interface/uiElements/uiAtlas.py
UTF-8
3,789
2.859375
3
[ "BSD-3-Clause" ]
permissive
"""Top level class for managing the MNI (rotation, structure...). Make the bridge between GUI and deep functions. Add some usefull commands for the user """ __all__ = ['uiAtlas'] class uiAtlas(object): """Link graphical interface with atlas functions. This class can be used to control the part of displayed...
true
dfc0890d3239f71b6f27ef14b2b6f61e58324578
mjDelta/stock-forecast-based-on-major-shareholders-investment-perspective
/utils.py
UTF-8
5,366
2.53125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019-07-25 13:13:14 # @Author : Mengji Zhang (zmj_xy@sjtu.edu.cn) import numpy as np import pandas as pd import os from six.moves import cPickle as pickle import scipy.sparse as sp def save_dict(di_,filename): with open(filename,"wb") as f: pickle.dump(di_,...
true
564d928994278a1803ae4c913b5815ba035a2f57
dinoivusic/Python-Challenges
/day20.py
UTF-8
329
3.03125
3
[]
no_license
def move_zeros(arr): new, zero = [], [] n = len(arr) for i in range(n): if arr[i] == int(0) or arr[i] == 0.0: if type(arr[i]) == float or type(arr[i]) == int: zero.append(arr[i]) else: new.append(arr[i]) else: new.append(arr[i]) return ...
true
715324a791c4dca50c9e6b5d057e52b779bb9e17
fstrike7/tweepy_basics
/bot.py
UTF-8
1,320
3.359375
3
[]
no_license
import tweepy # Tweepy module import time # Time module from credentials import * # From credentials.py import all variables. def twitter_setup(): # Function to set-up credentials # Authentication auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) # Authenticate with API's key. Provided by app...
true
91b7a310bd526def786754c2ce0079b31a464945
jaarmore/holberton-system_engineering-devops
/0x15-api/1-export_to_CSV.py
UTF-8
1,224
3.328125
3
[]
no_license
#!/usr/bin/python3 """ Python script to export data in the CSV format. """ import csv import requests import sys def exportData(id=None): """ Function to export data of user to CSV file. Args URL: URL of the resource to get data user_data: info about selected user user_id: id of t...
true
df708cb81ef18472da0d9e2e8010103b9e461134
WaWo-lone/Spider
/22-selenium_定位元素.py
UTF-8
1,194
3.140625
3
[]
no_license
# -*- author:caoyue -*- from selenium import webdriver import time driver_path = r'E:\drivers\chromedriver' driver = webdriver.Chrome(executable_path=driver_path) driver.get('https://www.baidu.com/') # 获取页面源代码 # print(driver.page_source) # time.sleep(2) # 关闭当前页面 # driver.close() # 关闭浏览器 # driver.quit() # 使用eleme...
true
95f52e0e52fb401a96417a142645084281f05666
jyotianeja/pythia
/data_prep/vqa_v2.0/extract_ques_info.py
UTF-8
1,743
2.546875
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import argparse import json def extract_info(annotations, writer): for annotation in annotations: question...
true
cb2792c6c9bd30e104c234510aa86ccf3c34ffbd
sk3l/moonshyne
/src/sftp/sftp_account.py
UTF-8
787
2.84375
3
[]
no_license
#!/usr/bin/python3 import json class SftpAccount: def __init__(self, acctId, acctName): self.acct_name_ = acctName self.acct_id_ = acctId self.sess_list_ = [] @classmethod def toStr(classobj, sftpAccount): return SftpAccountJsonEncoder().encode(sftpAccount) @classm...
true
1a3dc36ba85b385a44832513553146937a07146f
rickyound/cpic
/src/temp/test_hsv_2.py
GB18030
1,289
3.265625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # HSVչԣͬʱȡɫɫɫĶ # Try to find a way to extract more than one colored objects, for eg, extract red, blue, green objects simultaneously. import cv2 import numpy as np # ȼԭͼ img = cv2.imread('../../sources/colors.jpg', 1) # תHSVɫʿռ img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2...
true
f3a080e4ade71d801bb3da2137cd0abf4e8211de
sparkgeo/pystac
/pystac/extensions/storage.py
UTF-8
9,348
2.6875
3
[ "Apache-2.0" ]
permissive
"""Implements the Storage Extension. https://github.com/stac-extensions/storage """ from typing import ( Any, Dict, Generic, Iterable, List, Optional, Set, TypeVar, Union, cast, ) import pystac from pystac.extensions.base import ( ExtensionManagementMixin, PropertiesEx...
true
b8c7e5af6dc0189f575e5388931327a54bb905cf
cameronfr/RobotControl
/LilDRas/Controller.py
UTF-8
428
2.765625
3
[]
no_license
import Motor import Ultrasonic import RPi.GPIO as GPIO class Controller: LEFT_MOTOR_PORT = 7 RIGHT_MOTOR_PORT = 15 START_FREQ = 1600 def __init__ (self): GPIO.setmode(GPIO.BCM) self.leftMotor = Motor.Motor(self.LEFT_MOTOR_PORT) self.rightMotor = Motor.Motor(self.RIGHT_MOTOR_P...
true
815a37b741a302d106cf17bc9f31215067082465
stefsiekman/aoc2019
/05/first.py
UTF-8
2,474
2.640625
3
[]
no_license
import aoc.input if __name__ == "__main__": mem = [int(m) for m in aoc.input.input_lines(',')] # mem = [3,21,1008,21,8,20,1005,20,22,107,8,21,20,1006,20,31, # 1106,0,36,98,0,0,1002,21,125,20,4,20,1105,1,46,104, # 999,1105,1,46,1101,1000,1,20,4,20,1105,1,46,98,99] pointer = 0 while True: ins...
true
291a50ce65231f66525021bc455d13593c703774
LeeSM0518/TIL
/python/tkinter/TkinterClass.py
UTF-8
440
3.8125
4
[]
no_license
from tkinter import * class App: def __init__(self): window = Tk() helloB = Button(window, text="Hello", command=self.hello, fg='red') helloB.pack(side=LEFT) quitB = Button(window, text="Quit", command=self.quit) quitB.pack(side=LEFT) window.mainloop() def hello...
true
bb5f37baa7916642e9d6e83e8d4364c1ab8dc69f
e1810/kyopro
/ac/abc174/abc174_c/15612990.py
UTF-8
144
3.015625
3
[]
no_license
n = int(input()) x = 7 for i in range(1000000): x %= n if x==0: print(i+1) break x = x * 10 + 7 else: print(-1)
true
5f030d426178e794f24dfc76a461703351f83f33
Aasthaengg/IBMdataset
/Python_codes/p02690/s930421075.py
UTF-8
1,036
3.09375
3
[]
no_license
import math X = int(input()) absX = abs(X) X = math.pow(X, 1/5) #print(X) X = math.floor(X) #print(X) Pow = [] Dif = [] for i in range(64): Pow.append(int(math.pow(i, 5))) for i in range(1, 1000): Dif.append(i**5 - (i-1)**5) if ((i+1)**5 - i**5) > 1000000000: break #print(len(Dif)) #print(Pow)...
true
2e232995e3adfd856dc9d9111a5f8e32a3930ddb
quhuohuo/python
/file/fifo2.py
UTF-8
260
2.859375
3
[]
no_license
#!/usr/bin/python from time import sleep import os,sys try: os.mkfifo('fifo') except OSError: print 'fifo exist' f = open('fifo','a+') while True: #sleep(1) f.write(sys.stdin.readline()) f.flush() buf = f.readline() print buf
true
57f26d69204523890cd7d884d48bffff128897b4
lhyugithub/lhyu
/squarematrixdefinition.py
UTF-8
18,289
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> #import tesla from __future__ import print_function import matplotlib.pylab as plt import numpy as np import os #import commands from numpy import array from numpy import linalg import matplotlib import matplotlib.cm as cm import matplotlib.mlab as mlab ...
true
02bf5c8203ccf52ece52378221d3bcc96a45c41c
squirrelmaster/CMB-Credit_card_demand
/user1/src/feature/p_count.py
UTF-8
1,434
2.515625
3
[]
no_license
import pandas as pd from functools import reduce def get_count(data): click_cnt = data.groupby(by= ['USRID'], as_index = False)['EVT_LBL'].agg({'click_cnt':len}) evt_lbl_cnt = data.groupby(by= ['USRID'], as_index = False)['EVT_LBL'].agg({'evt_lbl_cnt':lambda x:len(set(x))}) day_cnt = data.groupby(by=['USRI...
true
feda391a6f5f04ee84a8739f35d60bf592c65683
inaheaven/Tutorials_NeuralNetwork
/Logistic-Regression/MNIST.py
UTF-8
3,679
3.515625
4
[]
no_license
#downloading the data (MNIST) from sklearn.datasets import fetch_mldata mnist = fetch_mldata('MNIST original') #there are 70000 images (28x28 images for a dimensionality of 784) print(mnist.data.shape) #there are the labels print(mnist.target.shape) #splitting data into training and test sets from sklearn.model_sel...
true
4857ef589f9bd5896d8dace85b53b32da8ef4c9c
antocad/Sorbonne_Master_DAC
/PLDAC/classeur/classeur.py
UTF-8
3,715
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- from statistics import mean from config.config import FORMULES_AGREGATION FONCTION_AGREGATION = {FORMULES_AGREGATION.MAX : max, \ FORMULES_AGREGATION.SUM : sum, \ FORMULES_AGREGATION.MEAN : mean} class Classeur: """Cette classe permet d'attribu...
true
9932ae25fb554fdf0bae37a7a0e9f8c9d1753ea6
Jason003/interview
/Doordash/Max Area of Island.py
UTF-8
1,700
3.59375
4
[]
no_license
''' if the map is too big: 1.我用的dfs 数据大了会stack overflow 然后说可以用bfs解决这个问题 2.数据有可能大到内存存不下整个地图。我就开始瞎说说可以每次读一行,然后再用一个map存每一列的信息。key是col index,value存这个col对应的数字,之前遍历过的总面积大小,以及之前行相连同一数字的index用来dedupe。具体细节我也没有想清楚。。。 ''' class Solution: def maxAreaOfIsland(self, grid): """ :type grid: List[List[int]] ...
true
5e0f919369d19c11a6b281d920d8d8c1e52ac830
emilyc7/db-team1-sentiment-analysis
/backend/main.py
UTF-8
4,342
3.015625
3
[]
no_license
# This function will handle all calls and passing of information import Web2String import WebCrawler import company_identifier import StockTest import evaluate_NN import summary import StockToPython import json def main(url): string = Web2String.url2string(url) print(string) entity = company_identifier.en...
true
1e7c9092b2f46e77f1977fb36232f183444647e1
Shenyue12345/BayOptSupplyChain
/GaussianProcess/data_preprocess.py
UTF-8
3,565
2.515625
3
[]
no_license
from plotters import plot_train_test import pandas as pd import random import numpy as np class preprocess(): def __init__(self, long_block_num, lat_block_num, train_pct = 0.8): self.long_block_num = long_block_num self.lat_block_num = lat_block_num self.train_pct = train_pct self....
true
940c7524882d85dcfcbf336f093d2a9ce0470bb6
CTMObservatory/socketprog
/client.py
UTF-8
324
2.90625
3
[]
no_license
# Echo client program import socket HOST = '192.168.2.243' # The remote host PORT = 50007 # The same port as used by the server with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sa: sa.connect((HOST, PORT)) sa.sendall(b'Hello, world') data = sa.recv(1024) print('Received', repr(data...
true
4911a22b0df0ba4b410a8cd3b6da6b9550fb17b2
tomaspham/online_kurzy
/Learn_Python_3_from_Beginner_to_Advanced/6_Loops/4_While_Loop.py
UTF-8
229
3.90625
4
[]
no_license
condition = 10 while condition != 0: # repeating loop while condition is not met print(condition) condition = condition - 1 while True: # infinte loop, keeps on going print("Infinite")
true
e876e73a2d11e1d445eb2041400c9f88d8b6921f
Wizmann/STUP-Protocol
/src/python/stup/packet/packet.py
UTF-8
4,263
2.578125
3
[ "MIT" ]
permissive
#!/usr/bin/python import ctypes import random import bitstruct from io import BytesIO from stup import utils as Utils from stup import config as Config from stup import crypto ''' STUP packet |<---------------------------------------16bits--------------------------------------->| | IV...
true
d427ed5eac0f8e9d80a5eafc698e46297157a195
parksimis/multicampus_big-services
/Python/Python_basic/2020-12-30/ex_별찍기.py
UTF-8
384
3.5625
4
[]
no_license
# 다중 for문 실습 # 별로 트리만들기 for i in range(4): for j in range(5): print('*', end='') print('') print('------------------------') for i in range(1, 6): for j in range(1, i+1): print('*', end='') print('') print('------------------------') for i in range(1, 6): for j in range(i, 6): ...
true
51b66601876c27cef425a9f607a6f7d257302568
franciscolemos/connectz
/connectz.py
UTF-8
4,446
3.671875
4
[]
no_license
import sys import re def read_file(fileName): try: f = open(fileName) return f except OSError: fileName = input("connectz.py: Provide one input file ") return None class play: def __init__(self, x, y, z): self.x = x # Width of the board self.y = y # Height o...
true
5ea07c2b855b5a0403e6c322f33dc42a02ff0c5c
Yemmy1000/python-solutions
/Loan_Amortization_C.py
UTF-8
2,719
3.953125
4
[]
no_license
print("-----> Author : Amujo Oluyemi E") print("-----> Matric No : 16483005") print("-----> Course of Study : Comp Sc - Information Security") print("-----> Email : oluyemiamujo@gmail.com") print("-----> Phone No : 07063717176") print("-----> Program Title : Loan Computation") #some...
true
71d7eb3dc3600ef0c90ee07c01265fb5ee46f95e
calvinleung20/Facebook-Analysis
/calvin and brianna facebook messages analysis.py
UTF-8
11,843
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jan 24 09:05:29 2019 calvin and brianna facebook messages analysis @author: Calvin """ import dateutil import bs4 import pandas import json import matplotlib.pyplot as plt from string import punctuation import plotly.plotly as py import plotly.graph_objs as go ...
true
ca105c260b89ad48295a9d1ee14b681e28616968
gavinrozzi/aleph
/services/extract-entities/entityextractor/normalize.py
UTF-8
699
2.9375
3
[ "MIT" ]
permissive
import re from Levenshtein import setmedian from normality import normalize, collapse_spaces MAX_LENGTH = 100 MIN_LENGTH = 4 CLEANUP = r'^\W*((mr|ms|miss|the|of|de)\.?\s+)*(?P<term>.*?)([\'’]s)?\W*$' CLEANUP = re.compile(CLEANUP, re.I | re.U) def clean_label(text): if text is None or len(text) > MAX_LENGTH: ...
true
89988b77607d9de0d478dbcdc48d5f5f93494ac1
Mumulhy/LeetCode
/729-我的日程安排表I/MyCalendar.py
UTF-8
1,144
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- # LeetCode 729-我的日程安排表I """ Created on Tues Jul 5 12:28 2022 @author: _Mumu Environment: py38 """ from bisect import bisect_left class MyCalendar: def __init__(self): self.calender = [] def book(self, start: int, end: int) -> bool: rep = [] idx_s = bisect_le...
true
a4589fe2f1fa1b7349e27093d8da0dba71f8d86c
ashirwadsangwan/HackerRankProblems
/10DaysOfStatistics/Day043.py
UTF-8
138
2.53125
3
[]
no_license
l, r = list(map(float, input().split(" "))) k = int(input()) prob = l/r print(round(sum(prob*(1-prob)**(i-1) for i in range(1,k+1)),3))
true
95fc9638bce29146aec6946ad587516268f4fd69
jackyko1991/vnet-tensorflow
/utils/batch_evaluate/batch_evaluate_step.py
UTF-8
5,953
2.6875
3
[]
no_license
import os import SimpleITK as sitk import math import csv def dist(a,b): x = 0 for i in range(3): x += (a[i]-b[i])**2 return math.sqrt(x) def overlapMeasure(imageA, imageB, method="dice"): if not (method == "dice" or method == "jaccard"): print("invalid method") return 0 overlapFilter = sitk.LabelOverlapM...
true
5536e748bf227da89a612aeb272a5e78eb78aa56
bidyashish/imdb-scrappy
/movie/spiders/movie_budget_spider.py
UTF-8
1,706
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from scrapy.selector import Selector from movie.items import MovieBudgetItem # shell command to run: # $ scrapy crawl movie_budget -o movie_budget.json class MovieBudgetSpider(scrapy.Spider): name = "movie_budget" allowed_domains = ["the-numbers.com"] start_urls = (...
true
48328c411a4ad07e2e47b5a0d81bb378dfe3e17f
JustMeliyu/training
/next_station/basics/A14tuple.py
UTF-8
610
3.4375
3
[]
no_license
# encoding: utf-8 from collections import Iterable a = [1, 2, 3, 4, 5, 4, 2] b = tuple(a) print b print type(b) c = (1, 2, 3, 4, 5, 4, 2) d = set(c) print d print type(d) print set(a) m = {1, 2, 4, 5, 3, 2, 4} print m n = set([1, 2, 3, 6, 2, 1]) print "n is : ", n # 迭代器 for i, v in enumerate(a): print(i, v) pri...
true
bd5563859eaa1d610e21f4c787997b1d1e2cf43c
moussafirk/DIGITALLIGHTING
/Codings/ESP32/MicroPython/NodeMCU_ESP-32S_Project/property4.py
UTF-8
378
3.359375
3
[]
no_license
class Test: def __init__(self): self.__color = "red" @property # get def color(self): return self.__color @color.setter #set def color(self, var): self.__color = var # t = Test() # t.color = "blue" # print(t.color) test = Test() print('test.color_old : ', test.color) t...
true
77961988c71a255b58d208037b48f9b14cc934a0
JuliaWozniak/computor2
/expression.py
UTF-8
2,578
2.515625
3
[]
no_license
import re from enum import Enum import settings from variable import Variable from variable import Operation from variable import OpList from postfix import to_postfix from my_types import Imaginary from enum import Enum class Types(Enum): REAL = 1 COMPLEX = 2 MATRIX = 3 NONE = 4 OPERATION = 5 class Types_eq(...
true
bf88e6c586ea40d99a2da2b3a20150a379daf06d
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4171/codes/1595_825.py
UTF-8
134
3.21875
3
[]
no_license
from math import pi r = float(input("valor de raio r")) A = pi * r ** 2 V = (4/3) * pi * r ** 3 print(round(A,3)) print(round(V,3))
true
e1e25768488713cb6db160492ff2d04dfa106f4d
SunR/AstroP2
/theanet_trial3.py
UTF-8
3,291
2.640625
3
[]
no_license
#Trying old dummy model with SDSS inputs # some utilities for command line interfaces import climate # deep neural networks on top of Theano import theanets import numpy as np from sklearn.datasets.samples_generator import make_blobs from sklearn.metrics import classification_report, confusion_matrix import matplotli...
true
ee534904a4ff5feab1ec42f9aeb823771d573421
gaivits/code_Kidding
/factorrrrrs.py
UTF-8
205
2.890625
3
[]
no_license
def L_prime(num): div=2 while num >= 1: while num%div==0: if num%div == 0: print(div) num=num//div div=div+1
true
ba40f2231af2c1097c2285c1ecd7e4eb2091e642
valerii2020/valerii2020
/starter/lesson 4/Kateryna/Задание 1.py
UTF-8
199
3.84375
4
[]
no_license
a = int(input("Enter a number ")) b = int(input("Enter another number ")) sum = 0 while a < b: a += 1 if a > 0: sum += a else: result = f'Your result is {sum}' print(result)
true
002b3e58e8455dc25061e7ee9668ab004c4846db
jhuang292/leetcode
/Amazon/2.Two Sum/two_sum.py
UTF-8
402
3.234375
3
[]
no_license
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ length = len(nums) index = 0 for i in range(len(nums)): for j in range(len(nums) - i - 1): if...
true
9d871dd106fdf017c2a07f76d6c97536ce6d7c68
ArkadiuszDomaros/PythonLessons
/zad1/zadanie5/zadanie5.py
UTF-8
411
2.59375
3
[]
no_license
import os import datetime import shutil a = os.getcwd() pat = os.listdir(a + "\\a") list = "\n".join(str(x) for x in pat) f = open("path.txt", "w").write(list) nowy = os.path.join(a + '\\b\\',datetime.datetime.now().strftime("%Y-%m-%d %H-%M-%S")) os.mkdir(nowy) for root, dirs, files in os.walk(a + '\\a\\'): for fi...
true
19e22242c425b6a7468b4a9d3816480760cc0835
gongqiong/CS61a
/week5/hw05/text.py
UTF-8
929
3.359375
3
[]
no_license
def ispalindrome(num): numstr = str(num) for i in range(int(len(numstr) / 2)): if numstr[i] != numstr[-i - 1]: return False return True def reverseNum(num): renum = 0 if num == 0: return renum else: while num: renum = renum * 10 + num % 10 ...
true
7e1ff595c2cc1607532882bef110dc2c2952b146
jfriend08/LeetCode
/ReverseLinkedList.py
UTF-8
470
3.46875
3
[]
no_license
''' Reverse a singly linked list. ''' # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseList(self, head): marchingP = head previousP = None returnP = None while ma...
true
6d1227af6c95c355771dee4d17a66b733650b7c0
shariqmahmood21/hello-world
/app.py
UTF-8
801
2.984375
3
[]
no_license
from flask import Flask from flask import request from datetime import datetime app = Flask(__name__) @app.route('/',methods=['GET','POST']) def hello_world(): # Requirement : If the request header : "Accept header" equals "application/json" , return JSON response if request.method == 'GET' and request.hea...
true
d7107747945b82d003b3379414d87294d495b0c7
liangheming/auto_assignv2
/losses/commons.py
UTF-8
3,177
2.84375
3
[]
no_license
import torch import math class BoxSimilarity(object): def __init__(self, iou_type="giou", coord_type="xyxy", eps=1e-9): self.iou_type = iou_type self.coord_type = coord_type self.eps = eps def __call__(self, box1, box2): """ :param box1: [num,4] predicts :param...
true
d9df4b325a370e78e742ad92cae4cbea66fd9545
seonukim/Study
/keras/keras120_embedding1.py
UTF-8
1,172
3.734375
4
[]
no_license
# NLP ; Embedding import keras from keras.preprocessing.text import Tokenizer text = '나는 맛있는 밥을 먹었다' '''자연어 처리의 기본''' token = Tokenizer() token.fit_on_texts([text]) # 토큰화: 지정한 문장을 '단어'단위로 자른 후 딕셔너리화한다 print(token.word_index) # {'나는': 1, '맛있는': 2, '밥을': 3, '먹었다': 4} x = token.texts_to_s...
true
9938dc2e7c2e0a5325974d80a2efc90ddbae40b8
gayathrithinagaran/guvi
/codekata/absolute_beginner/nth_term_of_series.py
UTF-8
106
3.125
3
[]
no_license
n=float(input()) if(n>0): mul=n*n print(mul) elif(n==0): print("0") elif(n<0): print("Error")
true
6b42245cc3c27280a6a376238327b6d035b841cb
emilydaskas/MySQL_Closet_Organizer
/Source/BrandClass.py
UTF-8
265
2.921875
3
[]
no_license
class BrandClass: def __init__(self, id, brand): self.id = id self.brand = brand def getId(self): return self.id def getName(self): return self.brand def getBrandTuple(self): return (self.id, self.brand,)
true
6ce20ba173fbc4b41623d7e0dc0ea1b6cfc4f7df
elras/seldon-core
/examples/combiners/spam_clf_combiner/skl-spam-classifier/SpamClassifier.py
UTF-8
1,103
2.984375
3
[ "Apache-2.0" ]
permissive
from pathlib import Path import numpy as np import pickle from sklearn.externals import joblib import sklearn class SpamClassifier(): def __init__(self, model_path = Path('./model')): self.models_path = model_path self.clf = joblib.load(model_path.joinpath('model.pkl')) self.vectorizer ...
true
96c88d2e6f944540f7f2861401761013eda6e2d2
cstuartroe/misc
/Python/DolphinSounds/dolphin sounds.py
UTF-8
1,396
2.796875
3
[]
no_license
import numpy as np import pyaudio import random PyAudio = pyaudio.PyAudio def sin_wave(amplitude, frequency, duration, bitrate): offset = random.random() return np.array([amplitude * np.sin((i*frequency/bitrate + offset)*2*np.pi) for i in range(int(duration*bitrate))]) def complex_wave(freq_dict, duration=1, ...
true
94a071b8340fb826dae451757806079194150f29
melerkan/Project1
/project1.py
UTF-8
3,355
3.015625
3
[]
no_license
import pandas as pd #Dictionary of high budget movies highBudget = {'Avengers: End Game': {'budget': 400000000,'rating': 94}, 'Happy Feet': {'budget': 85000000,'rating': 76}, 'Ready Player One': {'budget': 150000000,'rating': 72}, 'Hansel and Gretel: Witch Hunters': {'budget': 50000000,'rating': 16},...
true
5f8345fb31572abe5a1698a1526df45de203aaa8
VaLeRy013/problemele-if-while-for
/problema_05.py
UTF-8
536
3.421875
3
[]
no_license
n = int(input("Dati anul : ")) if (n % 12 == 0): print("Anul Maimutei") elif (n % 12 == 1): print("Anul Cocosului") elif (n % 12 == 2): print("Anul Cainelui") elif (n % 12 == 3): print("Anului Porcului") elif (n % 12 == 4): print("Anul Sobolanului") elif (n % 12 == 5): print("Anul Bo...
true
e2c4ef59181dd9b2865d9e6240f1530aee92d822
myeasyhome/magplan
/finance/models.py
UTF-8
3,730
2.515625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
from django.db import models from main.models import User, AbstractBase from django.utils import timezone # Create your models here. class Period(AbstractBase): JAN = 1 FEB = 2 MAR = 3 APR = 4 MAY = 5 JUN = 6 JUL = 7 AUG = 8 SEP = 9 OCT = 0 NOV = 11 DEC = 12 MONTHS_...
true
57d666b3fe0b22b6f04c5349a27dc6864359913a
paintception/RijksmuseumChallenge
/title_prediction/rijksmusem_title_extractor.py
UTF-8
1,907
2.609375
3
[]
no_license
from bs4 import BeautifulSoup from sklearn import preprocessing from multiprocessing import Pool import os import glob import time import re import cv2 import numpy as np IMAGES_PATH = "/home/matthia/Documents/Datasets/Rijksmuseum/jpg2/" METADATA_PATH = "/home/matthia/Documents/Datasets/Rijksmuseum/xml2/" STORING_P...
true
ae43fcfc7200e1b878b595924cab096ef987b630
gtrliyanfeng/project_1
/facetoobject.py
UTF-8
8,130
4.4375
4
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2018/7/28 0028 17:02 # @Author : Py_liyanfeng # @Site : # @File : facetoobject.py # @Software: PyCharm ''' 面向对象 ''' ''' 1.定义:一切皆是对象 基于面向对象设计一款英雄联盟,一个玩家选择一个英雄,每个英雄有自己的特征和技能 特征:数据属性 技能:方法属性 (英雄 = 特征 + 技能)那么(对象 = 数据属性 + 方法属性) 具...
true
3eaac5571b81a3bfecde4a7c1510e9899a1c50dd
mccornet/project_euler_2014
/problem_016.py
UTF-8
274
4.28125
4
[]
no_license
# 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. # What is the sum of the digits of the number 2^1000? number = 2**1000 digitsum = 0 for digit in str(number): digitsum += int(digit) print("The sum of the digits of 2^1000 is: {}".format(digitsum))
true
b86fb9ea007dab401f4e9ec48bfe57685d356951
jpbialas/backbone
/seg_features.py
UTF-8
12,057
2.71875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import cv2 import json from convenience_tools import * import os def px2segMulti(values, indcs): ''' See px2seg This implementation is faster for larger numbers of segments. The original is better for smaller numbers of segments because e...
true
d38f00c5a9af95690e86cfd1d63a6a581817e61d
kol9/Machine_Learning
/CF labs/F.py
UTF-8
3,621
2.953125
3
[]
no_license
import math def prob(x, c) -> [int, int]: if x not in one_more_map[c]: up = alpha else: up = one_more_map[c][x] + alpha down = 0 down += count_class[c] down += alpha * 2 return [up, down] n_classes = int(input()) lam_c = list(map(int, input().split())) alpha = int(input()) n_t...
true
d4253253ac9d63eb301318dc9abf3c48340493ca
debitrist/bt
/ST2.py
UTF-8
17,947
2.921875
3
[]
no_license
import datetime import matplotlib.pyplot as plt import numpy as np import pandas as pd import pandas_datareader.data as web from backtest import Strategy, Portfolio class STStrategy(Strategy): """ Requires: symbol - A stock symbol on which to form a strategy on. bars - A DataFrame of bars ...
true
ee805dbd941f40757bff6472e4f2cd12c089449e
Niixi/PyGame
/game.py
UTF-8
15,148
3.046875
3
[]
no_license
# Import random for random numbers import random import threading import time # Import the pygame module import pygame, sys # Import pygame.locals for easier access to key coordinates # Updated to conform to flake8 and black standards from pygame.locals import * # Initialize pygame pygame.mixer.pre_init(44100, 16, ...
true
b6eb34d5c600a2a63c647d6cacac9ce617f7abf5
CQ375482356/python-small-examples
/src/heatmap.py
UTF-8
417
3.3125
3
[]
no_license
# 导入库 import seaborn as sns import pandas as pd import numpy as np import matplotlib.pyplot as plt # 生成数据集 data = np.random.random((6,6)) np.fill_diagonal(data,np.ones(6)) features = ["prop1","prop2","prop3","prop4","prop5", "prop6"] data = pd.DataFrame(data, index = features, columns=features) print(data) # 绘制热力图 hea...
true
e34984622dde866434f7edbabb1c1d46e5b590f2
uldissturms/pi-ai
/talk-to-bot/test_talk.py
UTF-8
894
2.796875
3
[]
no_license
from talk import * import json # {u'customData': None, u'sessionId': u'63317874-1f69-4b6a-8bba-960398df6d7c', u'siteId': u'default', u'input': u'talk to bot', u'slots': [{u'slotName': u'bot', u'range': {u'start': 8, u'end': 11}, u'rawValue': u'bot', u'value': {u'kind': u'Custom', u'value': u'bot'}, u'entity': u'bot'}]...
true
69c5dd37ee42090330ecc29050bfdbe62b98dbeb
hstabelin/Python_Lista_Exercicios
/Lista2 - Decisao/Exercicio_19.py
UTF-8
1,082
4.3125
4
[]
no_license
# Faça um Programa que leia um número inteiro menor que 1000 e imprima # a quantidade de centenas, dezenas e unidades do mesmo num = (input('Informar o número (limita a 999): ')) if int(num) > 999: print('Erro - Valor informado inválido') exit() elif len(num) == 2: d = num[0] u = num[1] if int(d...
true
8d4c4e6da71875d440500b3140fd10fe88d81429
bepec/pydvbcss
/test/test_monotonic_time.py
UTF-8
1,713
2.71875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # # Copyright 2015 British Broadcasting Corporation # # 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 requ...
true
874b319dddd503985eda614b69b0b2af6433cce5
sunshicheng/Flask_learn
/second/app/auth/views.py
UTF-8
1,094
2.65625
3
[]
no_license
""" Author : sunshicheng DateTime : 19-8-28 下午9:42 FileName : views.py 身份验证蓝本中的路由和视图函数 """ from . import auth from ..models import User from .forms import LoginForm from flask_login import login_user, login_required, logout_user from flask import render_template, redirect, request, url_for, flash @auth.route('/log...
true
a32ef9837f6b57ebbf02e162aa3f52870f6b6447
PreciousEnahoro/The-benefits-of-improved-demand-forecasting-a-case-study
/utils.py
UTF-8
9,146
3.140625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[ ]: #Installing general public packages import pandas as pd, numpy as np, datetime, holidays,matplotlib.pyplot as plt,statsmodels.api as sm, seaborn as sns, warnings from datetime import date import seaborn as sns from matplotlib import dates as mdates sns.set(style="white...
true
2fd94756fb0501b4045b859672e051c712513762
ash/python-tut
/22.py
UTF-8
41
2.71875
3
[]
no_license
s = "Hello, World!" l = list(s) print(l)
true
ffa6aa999c74491f5daedc9c3ad0c142e79d33aa
shaunwcolley/codingpractice1
/ex1.py
UTF-8
217
4.125
4
[]
no_license
name = input("\nWhat is your name: ") age = int(input("\nAnd how old are you: ")) year_when_hundred = (100 - age) + 2019 print(f"\nOh wow, it will be \n \n \n{year_when_hundred} \n \n \nwhen you are a hundred!!\n")
true
3ec86f6b79d42259768083bd89e01015cf7b5f93
mpigelati/Mohansai_samples
/regular_expression/10-26/re_compile_1.py
UTF-8
127
2.75
3
[]
no_license
import re regex =re.compile('x(?P<first>[xy]+)(?P<secondary>)') match= regex.search('xyxxxyxxxyxyxy') print(match.groups())
true
7616518fa1a62297a4659d57be3b1661c74be0fb
debugger-zz/corona_landkreis_fallzahlen_scraping
/landkreise/get-regensburg-kreis.py
UTF-8
537
2.671875
3
[]
no_license
import scrape import helper url = "http://www.landkreis-regensburg.de/unser-landkreis/aktuelles/coronavirus/" prefix = "Zahl der bestätigten Coronavirus-Fälle im Landkreis Regensburg:" date_regex="Stand: [0-9]+.[0-9]+.[0-9]+, +[0-9]+:[0-9]+ Uhr" #Stand: 20.03.2020, 15:00 Uhr date_format = "Stand: %d.%m.%Y, %H:%M Uh...
true
1399680ca84a4740d06795876b4d77754a838338
nathancmoore/data-structures
/test_graph.py
UTF-8
5,480
3.28125
3
[ "MIT" ]
permissive
"""Various tests for Graph-class objects.""" import pytest s1 = { 'B': ['C', 'D'], 'C': ['X', 'Y', 'Z'], 'D': ['K', 'N'], 'N': ['A'], 'X': [], 'Y': [], 'Z': [], 'K': [], 'A': [] } s2 = { 'B': ['C', 'D'], 'C': ['X', 'Y', 'Z'], 'D': ['K', 'N'], 'N': ['A'], 'X': [...
true
a234a6c27cd7f1f1202337fb50a2cd2d1622fc43
Jmwilde/udacity-full-stack
/projects/01_fyyur/starter_code/forms.py
UTF-8
7,504
2.6875
3
[]
no_license
from datetime import datetime from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, SelectField, SelectMultipleField, DateTimeField, BooleanField from wtforms.validators import DataRequired, Optional, AnyOf, URL, Regexp # def phone_validator(min=-1, max=-1): # len_message = 'Phone number m...
true
c0f5e94c4ab023745152f727fef73ab65b3ca929
prateek3636/Assignment
/Python_assig.py
UTF-8
2,317
2.578125
3
[]
no_license
import cherrypy import mysql.connector class WelcomePage: def index(self): return ''' <body> <form action="store" method="POST"> <h1 align="center">TECHNICAL PORTPHOLIO </h1> <table align = "center" > <tr height = "40px"><td>Programm...
true
183c16443b8af97686d6a45a95ae1d1c0bcd2bd7
SevkiBekir/CodingInterviewStudies
/CrackingTheCode/Chapter2_LinkedLists/question_2_6.py
UTF-8
1,044
3.65625
4
[]
no_license
from Utils.LinkedList import LinkedList def getreversedLinkedList(linkedList): reversedLinkedList = LinkedList() node = linkedList.head while node is not None: reversedLinkedList.insertHead(node.data) node = node.next return reversedLinkedList def isPalindrome(linkedList): revers...
true
1d5c283d42a3c1f55036fb89fa1fb61ac5565fe7
akshathailangovan/GOT-Adventure-Game-AI
/Adventure_GoT_Game_AI.py
UTF-8
27,948
3.3125
3
[]
no_license
import time import random def print_pause(message_to_print, t=2): print(message_to_print) time.sleep(t) def error_message(): print_pause("\nSorry! Please select from one of the choices above.\n", 2) def initialization(): print_pause("\n>>>>>>>INITIALIZING GAME SEQUENCE>>>>>>>>>>>>\n"...
true
47dbc4df1f83ad272c5407f898031d64bdcb48ec
Wassouf289/Movie-Recommender
/helper_functions.py
UTF-8
578
3.453125
3
[ "MIT" ]
permissive
def movieId_to_title(movies_ids_list,movies): """ Convert a list of movie ids to a list of movie titles """ movies_list = [] for i in movies_ids_list: name = list(movies['title'][movies['movieId'] == i])[0] movies_list.append(name) return movies_list def movieTitle_to_id(movies_titles...
true
57d4c7dbebc326b6a7bf11931df7f2121a0b76bd
cburge3/DeltaV_Tools
/expression_tree.py
UTF-8
8,273
2.703125
3
[]
no_license
from graphviz import Digraph import os os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/' class Node: def __init__(self, uid=None, value=None): if uid is None: self._id = ExpressionTree._id ExpressionTree._id += 1 else: self._id = uid ...
true
a5f72ba0ebd06532c812708df51e534d7e845efe
douxing/dx-study
/leetcode/problems_600_non-negative-integers-without-consecutive-ones.py
UTF-8
1,462
3.59375
4
[]
no_license
# python3 import unittest class Solution: def find(self, cache, cache_total, numstr): if len(numstr) == 0: raise 'never happen' elif len(numstr) < 3: return cache_total[len(numstr) - 1] # len(numstr) >= 3 base = cache_total[len(numstr) - 2] if numst...
true
3a5d9c491d1816e764921d9f7f9b71425654a30a
HeDefine/LeetCodePractice
/Q211.添加与搜索单词-数据结构设计.py
UTF-8
1,720
3.96875
4
[]
no_license
#!/usr/bin/env python3 # https://leetcode-cn.com/problems/add-and-search-word-data-structure-design # 设计一个支持以下两种操作的数据结构: # void addWord(word) # bool search(word) # search(word) 可以搜索文字或正则表达式字符串,字符串只包含字母 . 或 a-z 。 . 可以表示任何一个字母。 # # 示例: # # 说明: # 你可以假设所有单词都是由小写字母 a-z 组成的。 class WordDictionary: def __init__(self): ...
true