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
36a2747de1ff2898e29d1993acb4f9372e7827ce
kuonanhong/Python-for-Finance-1
/t3.py
UTF-8
754
2.890625
3
[]
no_license
import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web style.use('ggplot') #start = dt.datetime(2000, 1, 1) #end = dt.datetime(2016, 12, 31) #df = web.DataReader('TSLA', 'yahoo', start, end) #print df.head() #df.to_csv('tsla.csv') d...
true
a212dc19ccaf702f852bff4b9b3f61a90d886cb2
risg99/Rosalind-Bioinformatics-Exercises
/Rosalind - Bioinformatics Stronghold/FIBD.py
UTF-8
1,159
4.28125
4
[]
no_license
''' Recall the definition of the Fibonacci numbers from “Rabbits and Recurrence Relations”, which followed the recurrence relation Fn=Fn−1+Fn−2 and assumed that each pair of rabbits reaches maturity in one month and produces a single pair of offspring (one male, one female) each subsequent month. Our aim is to somehow...
true
1a657b87f54909bd834f142695d0be919ebe288f
faemiyah/dnload
/dnload/glsl_source_chain.py
UTF-8
2,394
2.625
3
[ "BSD-3-Clause" ]
permissive
from dnload.common import is_verbose from dnload.glsl_block_source import assert_glsl_block_source from dnload.glsl_block_source import is_glsl_block_source ######################################## # Globals ############################## ######################################## class GlslSourceChain: """Chain of...
true
fffe433dbefe824f4ec21fcc5f9db0996ec7dd3b
BIDMAL/codewarsish
/HackerRank/Data Structures/Trees/Tree Level Order Traversal.py
UTF-8
2,029
3.546875
4
[]
no_license
class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None def __str__(self): return str(self.info) class BinarySearchTree: def __init__(self): self.root = None def create(self, val): i...
true
9499b1dca85a67c01ed209f0417b6f53d57806ae
RenatoMeloLira/Check-Point-2
/funcoes.py
UTF-8
1,650
3.4375
3
[]
no_license
#Cadastro da Pessoa def cadastropessoa(vaza): resp = "S" while resp =="S": nome = input("\nDigite o Nome: ").upper() from getpass import getpass vaza[nome] = [input("Digite o e-mail: "), getpass("Senha do Email: "), int(input("RG: ")), int(input("CPF: ")), int(input("CERTIDÃO: "))] ...
true
f065d7f8621dc68328e6b99b68b920d0fb84b0e6
qazqww/PythonPractice
/Baekjoon/2309_7dwarves.py
UTF-8
368
2.8125
3
[]
no_license
# https://www.acmicpc.net/problem/2309 height = [] for i in range(9): height.append(int(input())) sum_height = sum(height) for i in range(8): for j in range(i+1, 9): if sum_height - (height[i] + height[j]) == 100: del(height[j], height[i]) height.sort() for k in hei...
true
d5b8720d55f3461d7c0560c20a866c4f538037a9
Yrysbek03/parsebot
/utils/db_api/database.py
UTF-8
1,759
3.0625
3
[]
no_license
import sqlite3 class Database: def __init__(self): self.con = sqlite3.connect('database.db') self.cursor = self.con.cursor() def sql_table(self): with self.con: sql = """ CREATE TABLE IF NOT EXISTS 'users' ( `id` INTEGER PRIMARY KEY, ...
true
4344ef92b7d24148af72170385fb6a3eea7edee3
TheMan10-creator/Assignment
/test.py
UTF-8
1,142
2.90625
3
[]
no_license
import unittest from tkinter import Tk import Assignment root2 = Tk() a = Assignment.Student_info(root2) class TestNewAlgorithm(unittest.TestCase): def test_sort(self): a.sortcombo.set('fname') array_test = [('Aashish', 'Lama', '9866950525', 'Hacking'), ('Dipendra', 'Ary...
true
9b0f0b06b58dd8169998618714f5ec3be353999c
LesterKim/ctci
/exercises/rotate.py
UTF-8
509
3.359375
3
[]
no_license
def swap(a, b): c = a a = b b = c return (a,b) def rotate(M): n = len(M) if n == 1: return M for j in range(n//2): for i in range(j, n-1-j): (M[j][i], M[i][n-1-j]) = swap(M[j][i], M[i][n-1-j]) for i in range(j, n-1-j): (M[i][n-1-j], M[n-1-j][n-1-i]) = swap(M[i][n-1-j], M[n-1-j][n-1-i]) for i ...
true
d93cd531512d0d91f27a137b2303d0bb717d8d8e
0xDeeCee/ocr-document-scanner
/aadharExtract.py
UTF-8
618
2.75
3
[]
no_license
from PIL import Image import pytesseract import re def aadhar(file): text = pytesseract.image_to_string(Image.open(file)) gender = None uid = None #get gender for line in text.split('\n'): words = line.split() for word in words: if(re.search('(Female|Male|emale|male|ale...
true
7f310a8871035489ce47cfd69a39b1868ce4fc1a
chunweiliu/leetcode2
/first_bad_version.py
UTF-8
795
3.515625
4
[]
no_license
"""Binary search for bad version << [0, 1, 2, 3, 4, 5, 6] g g b b b b b => 2 - Is all bad versions grouping together? - What if we don't have bad version? Time: O(log n) Space: O(1) """ # The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # ...
true
561d1d4eada608860d27a275494697a2faf89c75
Muhammad12344/ca117
/week08/lab2/time_082.py
UTF-8
1,383
3.859375
4
[]
no_license
class Time(object): def __init__(self, hour=00, minute=00, second=00): self.hour = hour self.minute = minute self.second = second def to_seconds(self): return (self.hour * 60 * 60) + (self.minute * 60) + self.second def __eq__(self, other): return self.to_seconds()...
true
159f5f07d2a641b24f3fb5771093b7dec008e685
Ravirajadrangi/projects-assignments
/assignment1/cs231n/classifiers/neural_net.py
UTF-8
12,285
3.46875
3
[]
no_license
# coding: utf-8 # In[1]: import numpy as np import matplotlib.pyplot as plt # In[ ]: # In[2]: class TwoLayerNet(object): """ A two-layer fully-connected neural network. The net has an input dimension of N, a hidden layer dimension of H, and performs classification over C classes. We train the network ...
true
6ae0125692c60cad4f220da77d456b054ed921d2
JavaRod/SP_Python220B_2019
/students/will_chang/lesson01/assignment/inventory_management/market_prices.py
UTF-8
276
2.8125
3
[]
no_license
"""Module that provides item prices""" def get_latest_price(item_code): """Return price based on item code""" if item_code == 1: # Placeholder for future implementation return 24 return 24 # Raise an exception to force the user to Mock its output
true
bdf41e7a311447c21749172e0f425ac9c63d5958
Jerome12138/plane_game
/pygame_study.py
UTF-8
1,448
3.15625
3
[]
no_license
__author__ = "Jerome Chang" import pygame from plane_sprites import * pygame.init() # 初始化pygame模块 # 初始化游戏窗口 pygame.display.set_caption('飞机大战') screen = pygame.display.set_mode((480, 700)) # 绘制背景图像 # 1. 加载图片 bg = pygame.image.load('./images/background.png') # 2. 使用blit绘制图像 screen.blit(bg, (0, 0)) # 3. 更新游戏窗口 pygame...
true
8771c04f6b3c385d04ba454e9276ca984c1f400a
rubind/wfc3_psf
/wfc3_psf.py
UTF-8
1,436
2.78125
3
[ "MIT" ]
permissive
import numpy as np from astropy.io import fits from scipy.interpolate import RectBivariateSpline def index_PSF(PSF, x, y): return PSF[x+y*3] def get_native_PSF(filt, x, y, the_path): x = float(np.clip(x, 0, 1014)) y = float(np.clip(y, 0, 1014)) f = fits.open("%sPSFSTD_WFC3IR_%s.fits" % (the_path, fil...
true
36106980dfc845bff731f4786a2a19905f42fad6
anirudh1747/My-Captain-Python
/MC radius.py
UTF-8
63
2.96875
3
[]
no_license
import math r=float(input()) n=math.pi a=(n*r*r) print(a)
true
db2e810072459a6601e3dcc937acc144a48260fe
artcifra/camera
/test_savehdf5.py
UTF-8
2,940
3.03125
3
[]
no_license
########################################################################## # Testing of storage server thread. # A data cube is 5.5MBytes in size # It is either copied to shared memory or send via aueue to thread. # ########################################################################## # Results # ======= # Withou...
true
8692bd4f3964518c52ee56ede688bfe39e65ee9e
BUCT-CS1808-SoftwareEngineering/MusemData_Collection_System
/museum/spiders/education100.py
UTF-8
1,405
2.546875
3
[]
no_license
import scrapy from museum.items import educationItem class Education100Spider(scrapy.Spider): name = 'education100' #allowed_domains = ['www.xxx.com'] start_urls = ['http://www.zbstcbwg.cn/education.html'] def parse_detail(self, response): item = response.meta["item"] #/html/body/div/d...
true
2f85b08c2c24b049f29f06e734ee00268b4e43b5
Kapil-1729/Codeforces
/snow_footprints.py
UTF-8
299
3.265625
3
[]
no_license
def snow(): n=int(input()) S=input() if S.count('R')==0: s=S.rindex('L')+1 t=S.index('L') else: s=S.index('R')+1 if S.count('L')==0: t=S.rindex('R')+2 else: t=S.rindex('R')+1 print(s,t) snow()
true
49984c8a51da353c2b52bff89978b925ee1649c8
Zhenyuan-Fu/dairlib
/examples/Cassie/cassie_virtual_remote.py
UTF-8
3,219
2.796875
3
[ "BSD-3-Clause" ]
permissive
''' Uses Pygame (pip install pygame) to capture keyboard input. The virtual remote must be the active window to register commands. W / S to increase/decrease sagittal velocity A / D to increase/decrease longitudinal velocity use Keyboard Manager trim_x and trim_y member variables to add trim to the velocity commands '...
true
8faf91600ba4db0ab89f96ce625b7c95b32db88b
private-octopus/ithitools
/stats/load_l_root_folders.py
UTF-8
1,454
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/python # coding=utf-8 # # This scripts tries to estimate the variance of a few M3 test metrics. import codecs import sys import m3name import captures import m3summary import os from os.path import isfile, join def load_m3(file_name, sum_m3): m3sl = m3summary.m3summary_line() if m3sl.load_m3(file_n...
true
c1ac230c8a57463b5a3c8369515d57e3d2277a94
NT-eng/CP3-Sarun-Sangprabpai
/Exercise5_1_Sarun_S.py
UTF-8
549
3.796875
4
[]
no_license
num1 = int(input("กรอกตัวเลขตัวที่ 1 : ")) num2 = int(input("กรอกตัวเลขตัวที่ 2 : ")) print("ผลบวกของ",num1,"+",num2,"มีค่าเท่ากับ :",num1+num2) print("ผลลบของ",num1,"-",num2,"มีค่าเท่ากับ :",num1-num2) print("ผลคูณของ",num1,"*",num2,"มีค่าเท่ากับ :",num1*num2) print("ผลหารของ",num1,"/",num2,"มีค่าเท่ากับ :",num...
true
126fa5f13151193de656b2473ace3d0e94c366fa
jstevenpappas/word_pair_scoring
/word_pair_scoring.py
UTF-8
7,870
4.40625
4
[]
no_license
"""Word Pair Problem The Basics Given a list of words, find a pair with the highest score. The score is determined by multiplying the lengths of the words by one another. For instance: [Spoke, Branch] = 30 5 * 6 = 30 With the exception that if the words share any letters in common then the pair's score is ze...
true
30cb40f911f86bda81416a5c47f61703ff52dc5a
georgedunnery/Spotify_Song_Clustering_on_AWS
/src/main/pythonCode/findBestClustering.py
UTF-8
3,693
3
3
[]
no_license
import sys import os import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator # read within sum of squares error that was outputted for each K by KMeans program (parallel k) def readInput(inputDir): wSoSList = [] # loop through all files in input directory for filename ...
true
fb8d348f29793f14a251a12e80e2276e9084e665
BohdanLiuisk/python-course-beginner
/Solution/difficult_equation.py
UTF-8
252
3.09375
3
[]
no_license
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if a == 0 and b == 0: print('INF') elif a != 0: x = -b // a if c * x + d == 0 or b % a != 0 or a == 0: print('NO') else: print(x) else: print('NO')
true
d30b599340d3be3248b3bd98a388c0d43429f462
okipriyadi/NewSamplePython
/SamplePython/samplePython/database/Regex/_002_mengambil_huruf_kecil_saja.py
UTF-8
389
3.375
3
[]
no_license
""" bukan huruf kecil Catatan, ini berarti angka, simbol, maupun huruf besar cocok dengan pola ini. Karena semuanya bukan huruf kecil. [^a-z] """ import re s = "hOw mUch for the maPle syrup? $20.99? That's ricidulous!!!" print s #ganti selain huruf kecil dengan spasi d = re.sub(r'[^a-z]', ' ', s) print d #ganti se...
true
1d8b5fb5b29aac1f838e2007549aabe16c7c32f1
pancho111203/crypto-prediction
/model.py
UTF-8
2,216
2.84375
3
[]
no_license
import os import tensorflow as tf import numpy as np from keras.models import load_model from sklearn.preprocessing import MinMaxScaler from sklearn.externals import joblib from keras.optimizers import Adam class Predict_model(object): def __init__(self, model_path='model1'): model_from_path = os.path....
true
c4bf8dd595841ab8cf25861b17d75ee9cc7759bd
parul-l/Triple-Triple
/scripts/simulate_play.py
UTF-8
2,538
2.546875
3
[]
no_license
import os import pickle import numpy as np import triple_triple.simulate_player_positions as spp from triple_triple.config import DATASETS_DIR poss_type_to_num = { 'pass': 0, 'shot': 1, 'turnover': 2 } reg_to_num = { 'paint': 0, 'mid_range': 1, 'key': 2, 'perimeter': 3, 'back_court':...
true
1a554af3db15f577df3c3ec9b800391472ff19b3
swdotcom/swdc-sublime
/vendor/contracts/library/array_ops.py
UTF-8
8,245
2.53125
3
[ "Apache-2.0" ]
permissive
from abc import abstractmethod import numpy as np from .types_misc import CheckType from ..interface import Contract, ContractNotRespected, RValue, eval_in_context from ..syntax import W, Keyword, add_contract, add_keyword class ArrayElementsTest(Contract): @abstractmethod def test_elements(self, context, ...
true
c9a661124930d990a18efda6916105750810bef7
Deunitato/CS3237-Project-COVID
/others/move_checker.py
UTF-8
640
3.515625
4
[]
no_license
import random import time ''' Works by constantly adding into buffer of size 3 and checking if all is a slash or all is a stab, and sends the result to MQTT - if stable, it'll continue - else it will sleep for 0.5s ''' moves = ['stable', 'slash', 'stab'] move_buffer = [0, 0, 0] counter = 0 moves2 = ['stable', 'stabl...
true
ad1b692fff6a5c895b4a30db5a3bfcde9188c359
xiaoheiNLP/module_func
/jieba_property_strengthen.py
UTF-8
8,124
2.578125
3
[]
no_license
#-*-coding:utf-8 -*- ''' 利用结巴来判断词性 问题1:词性的增强对结巴"posseg"模块没有影响,已经解决 问题2: 想法1:利用结巴分词的词性标注功能,给句子标记然后再进行处理,起到一个降维的作用 ''' import time from collections import Counter import jieba import jieba.posseg as pseg from gensim.models import word2vec from find_num import * from numpy import ...
true
7bb127ee675aa20acfa7ac639fea8d60500230b7
krobertslab/primrose
/BackendWebAPI/Elastic.py
UTF-8
5,448
3.03125
3
[]
no_license
# Author: Sam Shenoi # Description: This file interacts with the elastic search client in order to retrieve information # Modification Log # - 4/16/2021 - updated documentation and comments for clarity ######################### Imports ########################### import json # This program uses the elasticsearch ...
true
fe0bb7ab512f7f981beb29dda31836f36aa6de52
ankitmahendru/Python101
/PythonDataTypes/DataType06_Sets.py
UTF-8
206
3.625
4
[]
no_license
# # SETS # myset = set() print(myset) myset.add(1) myset.add(2) print(myset) # You cannot add one value twice myset.add(2) print(myset) mylist = [1,1,1,1,2,2,2,4,3,3,3,3,] print( set(mylist) )
true
39bd68186cc6f4cf929694a88a3604396a8ed5eb
Rasadell09/LeetCode
/string_to_integer.py
UTF-8
1,075
3.109375
3
[]
no_license
class Solution(object): def myAtoi(self, str): """ :type str: str :rtype: int """ trimmed_str = str.lstrip() if trimmed_str == '': return 0 else: res = [] for i in xrange(len(trimmed_str)): if i == 0 and trim...
true
115086b35c88ff01835098fc7a79b370fafec9a4
cptanalatriste/data-center-optimization
/domain.py
UTF-8
3,920
3.015625
3
[]
no_license
""" Domain objects for the problem """ import numpy as np UNAVAILABLE = -1 class Server: def __init__(self, slots, capacity, id): self.id = id self.slots = slots self.capacity = capacity self.pool = None self.row = None self.slot = None def allocated(self): ...
true
d7adb1780123f47296257093ffc42961d0aa95fe
dingmyu/ClipBERT
/src/preprocessing/file2lmdb.py
UTF-8
2,175
2.703125
3
[ "MIT" ]
permissive
import os from lmdb_utils import write_lmdb_from_id_path, \ read_raw_img_from_pair, read_raw_binary_from_pair def get_abspaths_by_ext(dir_path, ext=(".jpg",)): """Get absolute paths to files in dir_path with extensions specified by ext. Note this function does work recursively. """ if not isinstan...
true
bb31e2e0c46e034b1cb5fe33fddc8e4953fe0909
rgrchen/datamined
/datamined/valid/tests/test_mining.py
UTF-8
869
2.734375
3
[ "MIT" ]
permissive
""" Tests for data mining. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import unittest import datamined as dm class TestMining(unittest.TestCase): """ Test basic mining example. """ def test_basic_mining(self): data = "ATTAGGACATTTA...
true
e0a814d362d00d4eae364829a560b3175a18e8a4
boddugopikrishna/LearningOne
/venv/hour_glasses.py
UTF-8
990
2.984375
3
[]
no_license
#!/bin/python3 import math import os import random import re import sys # Complete the hourglassSum function below. def hourglassSum(arr): i = 0 j = 0 hour_glasses_list = [] hours_glasses_val = [] while i <= 3: while j <= 3: val = arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + ar...
true
1ed2ceb6491c9d821967000c4b9e97aeb67931b3
notmybusiness521/PythonExerciseDemo
/PythonML/LeastSquareMethod.py
UTF-8
2,525
3.546875
4
[]
no_license
# --*--coding=utf8--*-- ''' @Author: @Time: @Describe: ''' """ 举例:我们用目标函数 y=sin2πxy=sin2πx , 加上一个正态分布的噪音干扰,用多项式去拟合【例1.1 11页】 """ import numpy as np import scipy as sp from scipy.optimize import leastsq import matplotlib.pyplot as plt regularization = 0.0001 def real_func(x): """ 真实函数 :param x: :r...
true
9ec26795ce44d010b5b26cfcaad45e18cdc1df50
WXCchen/myedu
/day01/base_type.py
UTF-8
945
3.625
4
[]
no_license
# def test1(): # print('test1') # def test2(): # print('test2') # def test3(): # print('test3') # if __name__ == '__main__': # test3() # test1() # test2() # def int_demo(): # aint = 5 # print(aint) # print(type(aint)) # if __name__ == '__main__': # int_demo() def str_demo(): ...
true
34b5552d64ed1818f4557d235f3d5463c646e1bf
PeterNashaat/0-robot
/zerorobot/dsl/ZeroRobotAPI.py
UTF-8
8,531
2.890625
3
[ "Apache-2.0" ]
permissive
""" This module expose the high level API that is meant to be used by service developer in the template actions. It provie ways to create and list services from a group of ZeroRobots in a unified way. """ from js9 import j from zerorobot import service_collection as scol from zerorobot import template_collection as t...
true
145895264f445a06e79f285443d4864c2009c797
astralis12/python
/string_format.py
UTF-8
175
3.578125
4
[]
no_license
num1 = 3.1425 num2 = 10.290 #format method #print('num 1 is {0:.3f} and num 2 is {1:.3f}'.format(num1, num2)) #using f strings #print(f'num 1 is {num1} and num 2 is {num2}')
true
47e7b3a69f2024615175715a0ea16da8d499960e
Fylipp/nice-list
/nice_list/__init__.py
UTF-8
1,897
4.0625
4
[ "MIT" ]
permissive
def nice_format(iterable, use_and: bool = True, string_quotes: str = None, oxford_comma: bool = False) -> str: """ Format a list nicely. Supports lazy collections. :param iterable: The collection to format :param use_and: Whether to use 'and' as the last conjunction otherwise a comma is used :param ...
true
c700961adf427917df05da37facfc7bd78472ad0
Aasthaengg/IBMdataset
/Python_codes/p02639/s321824206.py
UTF-8
269
2.875
3
[]
no_license
#!/usr/bin/env python3 def solve(xs: "List[int]"): for idx, x in zip(range(1, 6), xs): if x == 0: return idx def main(): x = list(map(int, input().split())) answer = solve(x) print(answer) if __name__ == "__main__": main()
true
a0b34aa77ab81d99ac2f0ce242062dd6b54d8a6a
keiffster/program-y
/test/programytest/parser/template/graph_tests/test_rand.py
UTF-8
3,506
2.78125
3
[ "MIT" ]
permissive
import xml.etree.ElementTree as ET from programy.parser.exceptions import ParserException from programy.parser.template.nodes.base import TemplateNode from programy.parser.template.nodes.rand import TemplateRandomNode from programytest.parser.template.graph_tests.graph_test_client import TemplateGraphTestClient clas...
true
231dcd966bc4f4025b0dfc2d5cdb1d5e30016a73
harshithasv16/python
/buddy/src/launch.py
UTF-8
1,362
2.59375
3
[]
no_license
import click import datetime from chain import chain from . import util markers = {'commit': ("\n\n# Write here to save the work summary of the day.\n" "# These commentted lines will not be stored with your commit.\n" ), 'update': ''} @click.group(invoke_without_...
true
8d936f541c41a69a5496c119f27253885cafad4d
swapdewalkar/Word-Clustering
/Test Code/testWC.py
UTF-8
217
2.78125
3
[]
no_license
WordCount={} upper_words=["swapnil","asad","swapnil"] for word in upper_words: if word in WordCount: WordCount[word]=WordCount[word]+1 print WordCount,word,1 else: WordCount[word]=1 print WordCount,word,2
true
40f8cdc739ccd33748c6d90472d618f5f773f4e1
darknetworm/homeWork06
/homeWork02.py
UTF-8
790
3.890625
4
[]
no_license
class Road: _length: int _width: int thickAsf: int = 5 def __init__(self, length: int, width: int): self._length = length self._width = width def weightAsf(self): return (self._length * self._width * 25 * self.thickAsf) / 1000 try: userLn = int(input('Введите длину до...
true
8a4bedca473b17b5b7f01b4dad847a4770170f3c
Apple7724/Probe
/64_модуль datetime_пример использования.py
UTF-8
867
3.46875
3
[]
no_license
import datetime as dt # Старт Гагарина - взлёт : 1961 год, 12 апреля, 9 часов утра, 7 минут start_time = dt.datetime(1961, 4, 12, 9, 7, 0) print(start_time) # текущее время и дата UTC now = dt.datetime.utcnow() print (now) # текущее время и дата местное now = dt.datetime.utcnow() delta = dt.timede...
true
a67913ee11a9717c9337c16998239dd26d9d64e7
kwx4github/facebook-hackercup-problem-sets
/2015/round_1/3.Winning_at_Sports/solutions/sources/x.3018.Iadigfno
UTF-8
1,179
2.84375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Jonathan S. Prieto # @Date: 2015-01-18 03:49:56 # @Last Modified by: usuario # @Last Modified time: 2015-01-18 09:20:18 import sys sys.setrecursionlimit(10000) MOD = 10 ** 9 + 7 unstress = {} def f(a, b): if a < b or a < 0 or b < 0: return 0 ...
true
d584ccbc766f71ce50fa5b812dcbb794ba743b9d
klintkanopka/seda-prediction
/class_utils.py
UTF-8
2,069
2.859375
3
[]
no_license
#!/usr/bin/env python3 import os import pandas as pd import numpy as np import torch import torch.nn.functional as F from torch.utils.data import Dataset class DistrictData(Dataset): """ Dataset of districts. """ def __init__(self, data, partition): csv_path = 'data/' + data + '_' + partition + '.cs...
true
e0f86a6edfb4bfb5496baadd63f46520076406bc
Von-kensington/Adventure
/Adventurer.py
UTF-8
1,817
3.953125
4
[]
no_license
import time # Sets a timed Delay after each print def pause_print(message_to_print): print(message_to_print) time.sleep(2) def left_path(): pause_print("you start walking down the path " "and you notice that everything look's the same.") pause_print("You start getting bo...
true
5ea3ca306ea013d0d6c2af033b369d04bb170aae
22yuu/Python
/CodingTest/상하좌우.py
UTF-8
418
3.578125
4
[]
no_license
N = map(int, input()) x, y = 1, 1 plans = input().split() for plan in plans: if plan == 'L': y -= 1 elif plan == 'R': if y == N: continue else: y += 1 elif plan == 'U': x -= 1 elif plan == 'D': if x == N: continue else...
true
a51b48e302d37b9a339abcf157a7bfa9e9a16d47
bebee/DeepArt
/deepart/build_model.py
UTF-8
2,145
2.53125
3
[]
no_license
__author__ = 'charles' import pickle from lasagne.layers import InputLayer from lasagne.layers.dnn import Conv2DDNNLayer as ConvLayer from lasagne.layers import Pool2DLayer as PoolLayer import lasagne import numpy as np from lasagne.utils import floatX IMAGE_W = 600 MEAN_VALUES = np.array([104, 117, 123]).reshape((3...
true
8e8ae1b485a093abd60abc954c37f9fd9ae3187f
mrquiroz/bigdata
/s3/3/quiroz_moises/reducer_4.py
UTF-8
437
2.828125
3
[]
no_license
#!/usr/bin/python3.6 import sys feed_output = sys.stdin previos_countes = None puntaje = 0 for line_o in feed_output: mov,nombre = line_o.split('\t') if mov != previos_countes: if previos_countes is not None: if puntaje >=2 and puntaje <=10 : print(previos_countes,'\t',str(...
true
616dff93d73e02fc83380e66c6cb2609d9bced86
jessej71/varglas
/src/data/antarctica/download_antarctica_data.py
UTF-8
4,139
2.59375
3
[]
no_license
import urllib2 import sys import os import zipfile import tarfile import inspect def download_file(url, direc, folder, extract=False, name = None): """ download a file with url <url> into directory <direc>/<folder>. If <extract> is True, extract the .zip file into the directory and delete the .zip file. If na...
true
21b8c04eef70117dd4effefee067a45529bdfcd8
github-anki/Machine_Learning
/Additional_assigment/net/initializers.py
UTF-8
2,759
3
3
[]
no_license
import numpy as np from net import dtype class Initializer(object): """ Base class for weights initializer """ def __str__(self): return type(self).__name__ def __call__(self, shape): """ Inits weights for layers shape: shape of weights :return: weights i...
true
989ef2a9ecc21cf762c04f9ddb6002e684e6b61b
shubhamoli/solutions
/leetcode/medium/228-Summary_ranges.py
UTF-8
1,085
3.625
4
[ "MIT" ]
permissive
""" Leetcode #228 """ from typing import List class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: if not nums: return [] res = [] tmp = [] tmp.append(nums[0]) continuous = 0 for i in range(1, len(nums)): if nums[i]...
true
ddb5bf1368110b310d71a4b2a3dbeabe44cc02be
roberg11/is-206-2013
/Assignment 2/ex6.py
UTF-8
2,004
4.71875
5
[]
no_license
# String where %d variable is determined as 10 x = "There are %d types of people." % 10 # Simple string 1 binary = "binary" # Simple string 2 do_not = "don't" # String combining Simple string 1 & 2 to %s and %s variables y = "Those who know %s and those who %s." % (binary, do_not) # Prints variable x where %d variable...
true
10d5786a9368a047fbc36a6d7c4d5858ce0d9064
eshthakkar/coding_challenges
/tree_traversals.py
UTF-8
19,216
4.03125
4
[]
no_license
def preorder(root): """Returns a tree in a list of preorder form >>> class Node(object): ... def __init__(self, value): ... self.value=value ... self.left = None ... self.right = None ... def add_node(self, obj): .....
true
607fe6da68fa94967fc90f3f222543bd25262c32
yas-say/snake-game
/scoreboard.py
UTF-8
688
3.53125
4
[]
no_license
from turtle import Turtle ALIGNMENT = "center" FONTA = ('Arial', 10, 'bold') FONTB = ('Arial', 15, 'bold') class Scoreboard(Turtle): def __init__(self): super().__init__() self.score = 0 self.color("White") self.penup() self.hideturtle() self.score_display() d...
true
4b2bd3e7f0db1c17df2ff16ecf73ee72563b36f4
Abdul-Basith-siddiqui/python-programming
/knapsack.py
UTF-8
699
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: Nirav """ import numpy as np n = int(input('total different values')) c = int(input('enter knapsack capacity')) w=[] p=[] k = np.zeros((n+1,c+1),int) print(k) print(k[1,3]) for i in range(n): print('enter values of weight and profit for item %d'%i) w.ap...
true
e5825553b010078767f076d3066ffebb95df2dd2
korowood/made_ml_course
/hw4/main.py
UTF-8
2,134
2.5625
3
[]
no_license
import dash import dash_html_components as html import dash_core_components as dcc import pandas as pd pd.set_option('display.max_columns', 100) import numpy as np df = pd.read_csv("players_stats_by_season_full_details.csv") cols_dict = { 'GP': 'Games_Played', 'MIN': 'Minutes_Played', 'FGM': 'Field_Goals...
true
6819908d301657183ac466bbecdd6f9140380d13
wh-forker/calibrated-quantile-uq
/losses.py
UTF-8
9,661
3
3
[]
no_license
import torch import numpy as np import matplotlib.pyplot as plt def cali_loss(model, y, x, q, device, args): """ original proposed loss function: when coverage is low, pulls from above when coverage is high, pulls from below q: scalar """ num_pts = y.size(0) q = float(q) ...
true
3ea46127d8982035819c34919092e8cdeca5847e
alexbebereche/python_atelierul_digital
/curs4-selenium.py
UTF-8
1,671
2.8125
3
[]
no_license
import requests from bs4 import BeautifulSoup import pandas as pd from selenium import webdriver import matplotlib.pyplot as plt browser = webdriver.Chrome('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe') #sau r'' in loc de \\ browser.get('https://www.bnr.ro/files/xml/nbrfxrates2019.ht...
true
af00b02b5f17fc3d4893e56398dc98456f9728de
berinhard/sketches
/s_072/save_frames.py
UTF-8
1,556
3.265625
3
[]
no_license
##### # The save_video_frames function saves sketches' frames to be used by `ffmpeg` command to generate videos. # For example, if we call the method with the following parameters: # # save_video_frames(25, 60 * 10) # # The ffmpeg commands to generate the video would be: # # $ ffmpeg -framerate 25 -pattern_type glob -i...
true
6a99fdaac1beb4f38d0211fd008932c7db944108
tarsisazevedo/pybr-tutorial
/linear_regression/linear_regression.py
UTF-8
3,019
3.375
3
[]
no_license
import random import numpy from matplotlib import pyplot def hypoteses(theta0, theta1, x): return theta0 + (theta1 * x) def cost(theta0, theta1, X, y): # R2 mse_model = 0 mse_baseline = 0 y_mean = sum(y) / len(y) for (xi, yi) in zip(X, y): y_pred = hypoteses(theta0, theta1, xi) ...
true
93d80fa32760ed703d6e63090403076fcf68a006
suryansh2020/httptime
/examples.py
UTF-8
693
3.09375
3
[]
no_license
from httptime import DateSlashTimeColon import httptime as s timestamp = DateSlashTimeColon('06/Dec/2011:13:12:48') timestamp2 = DateSlashTimeColon('24/Mar/2009:06:45:08') date, time = timestamp.date_and_time() date2, time2 = timestamp2.date_and_time() print date, time d, m, y = timestamp.date_pieces() d2, m2, y2 = ...
true
0769eaf01d39cbcb2a2e53a95c344e2833b5a738
kateapault/algorithm-practice
/leetcode/136_single_number.py
UTF-8
229
2.796875
3
[]
no_license
class Solution: def singleNumber(self, nums: List[int]) -> int: f = {} for x in nums: if x in f: del f[x] else: f[x] = 1 return list(f.keys())[0]
true
fa81fbec6dc800d71215448a51e851989152eddf
kevin1211221/From-Cost-Sensitive-Classification-to-Tight-F-measure-Bounds
/bisection.py
UTF-8
2,563
2.859375
3
[]
no_license
""" Consistent Multiclass Algorithms for Complex Performance Measures Algorithm 2 p6 """ import sys import logging as log import numpy as np from sklearn.metrics import confusion_matrix import classifier def run_algo(data, nb_class, hparam, argv): """ Tune classifier with bisection algorithm """ outputs = ...
true
27e429f9a7a207224d6fad47358f0382a5cd481c
cia05rf/stock_trading_ml_modelling
/stock_trading_ml_modelling/fund/fund.py
UTF-8
19,620
3.3125
3
[]
no_license
"""Functions to run the funds""" #Import models import numpy as np import pandas as pd import math import os #Create a class for a trade class Trade: def __init__(self, trade_type:str, ticker:str, trade_date:int, price:float, spread:float, signal_prob:float, ...
true
cb6d040378183c240f2c679798733f25b208fd1c
campagnola/return-to-carriage
/carriage_return/sprite.py
UTF-8
1,167
2.90625
3
[]
no_license
from carriage_return.entity import Component class SingleCharSprite(Component): """Component that draws a single-character sprite. - Reacts to location changes - Hides when not visible - Assumes background color from maze """ def __init__(self, entity, zval, char, fg_color=(1, 1, 1, 1), bg_co...
true
ca33f3db5d63bfd390b5024541afae6e6083e66d
John-CHN/Using-VGG-to-detect-defrauds-in-High-Reflection-Curved-Surface
/visualize.py
UTF-8
2,789
2.78125
3
[]
no_license
from keras.layers import Convolution2D, MaxPooling2D, Activation,Dropout,Flatten, Dense from keras.models import Sequential import numpy as np from PIL import Image import matplotlib.pyplot as plt import pylab #import h5py model = Sequential() in_shape=(320,520,3) #print(in_shape) # 创建卷积层 # 首先,添加第一层的1024层,并创...
true
1ab2177b8537efd050b0d91856317fcb2bf9f85c
michaelscales88/python-reporting-app
/app/report/utilities/report_helpers.py
UTF-8
4,057
2.578125
3
[ "MIT" ]
permissive
# report/services/sla_report.py from datetime import timedelta import pandas as pd from ..models import ClientModel SUM_COLS = [ 'I/C Presented', 'I/C Live Answered', 'I/C Lost', 'Voice Mails', 'Answered Incoming Duration', 'Answered Wait Duration', 'Lost Wait Duration', 'Calls Ans Wi...
true
c81c0b70991c36fdfca2e72485fa5904e5e73387
lisnb/lintcode
/LargestNumber.py
UTF-8
572
3.25
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: lisnb # @Date: 2015-05-07 22:48:54 # @Last Modified by: lisnb # @Last Modified time: 2015-05-07 22:50:06 class Solution: #@param num: A list of non negative integers #@return: A string def largestNumber(self, num): # write your code her...
true
f5f2108d30e2428acb1385c8e2ae8d0b7bf85f98
xiaocainiaogithub/algorithm010
/Week02/week02/二叉树层序遍历/levelOrder.py
UTF-8
366
2.875
3
[]
no_license
from sklearn.tree import DecisionTreeClassifier class Solution(object): def levelOrder(self,root:'Node'): if root is None: return [] result=[] queue=collections.deque([root]) while queue: level=[] for _ in range(len(queue)): node=queue.popleft() level.append(node.val) queue.extend(node.chi...
true
0d4c6b4b043a7c22c16ae058fa3c18d4ed5016ef
Welitondpm/Projeto-Fractal
/Fractals/DD_property_per_square.py
UTF-8
2,753
3.3125
3
[]
no_license
import matplotlib.pyplot as plt class PropertyPerSquare(): def __init__(self, x = [], y = [], value = 10, paint_squares = False): self.x = x self.y = y self.x_copy = self.x[::] self.y_copy = self.y[::] self.new_x = [] self.new_y = [] self.minimum_x = min(sel...
true
1ad76d55665b48c6206c5d21151f26492104d4e9
jennywei1995/sc-projects
/StanCode-Projects/boggle_game_solver/boggle.py
UTF-8
4,613
4.25
4
[ "MIT" ]
permissive
""" File: boggle.py Name: Jenny Wei ---------------------------------------- This program will ask the user to give 4 rows of 4 letters. And the program will check the board (4*4), starting form one of the letter and link to its neighbor letter(in 8 directions) and print all the possible words (length should be at leas...
true
62f8204cc217a928b3a8eb71cfba78586bf7c4fe
mrichko2705/lab_python
/py_72.py
UTF-8
276
3.390625
3
[]
no_license
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import re s = str(input("Введіть строку для перевірки ")) def isPalindr(s): s = s.lower() s = re.sub('\W+', '', s) print(s) return True if s == s[::-1] else False print("{}".format(isPalindr(s)))
true
fdae0b7e6a331e17e823aba0776945b5d0048716
Renato0402/Uri-Online-Judge
/python/uri1002.py
UTF-8
113
2.96875
3
[]
no_license
if __name__ == '__main__': pi = 3.14159 r = float(input()) print('A={:.4f}'.format(pi*pow(r,2)))
true
05abb828fa4dc50b390a9376965b54d991632f78
ahmedmeshref/June-LeetCoding-Challenge
/day_18/H-Index_II.py
UTF-8
1,863
4.3125
4
[]
no_license
""" Given an citationsay of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, an...
true
34c4c6e0f9d76c157af98f571ee46a1d5cd7a664
guiguidu-24/RaceWeek
/config_helpers.py
UTF-8
220
2.78125
3
[ "MIT" ]
permissive
from json import loads def get_dict_data(path): with open(path, 'r') as stream_file: data = stream_file.read() return loads(data) def get_data(path: str, id: str): return get_dict_data(path)[id]
true
b0901e599ce592fb16c823d09ec2d1d02f524990
lvbenson/Neural_Reuse_New
/Eduardo/Figures/Company_Size/Impact.py
UTF-8
10,294
3.171875
3
[]
no_license
""" Given the set of company projects and a fixed total employee count, how many important employees are required for the success of those projects? Importance defined as: removing the employee would cause project failure to some extent Options Option 0 -- None of the employees are important Option 1 -- All of the e...
true
574d6c1fbbf4da8b44673865b9e1510072baa23a
joopeed/lp1
/148 Mon, 23 Apr 2012 14:20:39.py
UTF-8
316
2.546875
3
[]
no_license
# Date: Mon, 23 Apr 2012 14:20:39 +0000 # Question 148 # JOAO PEDRO FERREIRA -21211940 ## PROGRAMACAO 1 - UFCG 2012.1 - JORGE ABRANTES ### 148 def devedores(contas): conta = 0 for i in range(len(contas.values())): if contas.values()[i] <0: conta+=1 ...
true
df0723cda669928ed928ec399c05daa780359240
TychoNiestadt/ProgHU
/Les_4/pe4_3.py
UTF-8
189
3.375
3
[]
no_license
a = eval(input('Wat verdien je per uur :')) print(a) b = eval(input('Hoeveel uur heb je gewerkt :')) print(b) print(str(b) + ' uur werken levert ' + str(a * b) + ' Euro op') print('Hello')
true
7a33138c816be356a0f9c33d80ab437c5c48bdda
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_201/1075.py
UTF-8
1,484
3.484375
3
[]
no_license
import math ''' example: N = 100 K = 10 1p -> {49, 50} : (49, 50) 2p -> {49, 24, 25}: (24, 25) 3p -> {24, 24, 24, 25}: (24, 24) 4p -> {24, 24, 24, 12, 12}: (12, 12) 5p -> {11, 12, 24, 24, 12, 12}: (11, 12) 6p -> {11, 12, 11, 12, 24, 12, 12}: (11, 12) 7p -> {11, 12, 11, 12, 11, 12, 12, 12}: (11, 12) 8p -> {11, 5, 6, 11,...
true
1e9e078826f61f13f7f641d30ae87c71988eb588
binref/refinery
/test/units/formats/test_winreg.py
UTF-8
2,378
2.796875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from inspect import cleandoc from .. import TestUnitBase class TestWindowsRegistryExtractor(TestUnitBase): def test_registry_export(self): unit = self.load() data = cleandoc( R""" Windows Registry Editor Version 5.00 ...
true
54d197343df19ab738ce474c7c9b6315af899f64
Mayst0731/vlerick_aws
/5_Gordon_SINGLE/detail/__init__.py
UTF-8
419
2.84375
3
[]
no_license
from pprint import pprint import tabula import requests import io import pandas as pd url = 'https://www.gibs.co.za/Documents/Executive%20Education%20Short%20Courses.pdf' page = requests.get(url).content with io.BytesIO(page) as f: df = tabula.read_pdf(f,multiple_tables=True,pages=1) # print(df) print(typ...
true
bbe0dce5426c2ddbafda50b991722b0b7dfab672
piEsposito/TanD
/tand/create_project.py
UTF-8
1,076
2.59375
3
[]
no_license
from .structured_data.classification.sklearn import create_project as sklearn_classification from .structured_data.regression.pytorch import create_project as pytorch_regression from .structured_data.classification.pytorch import create_project as pytorch_classification import argparse def main(): func_map = { ...
true
8deca8b8474b4612e6f82260d987e19e3c5f6de6
nesl/TransientSensorRobustInference
/CNN Training/Downsampler.py
UTF-8
1,627
2.828125
3
[]
no_license
# filenames to parse: # Watch_accelerometer.csv, Phones_accelerometer.csv #This program downsamples all the data into 5Hz #This works by choosing the first value in each 200ms block MAX_TIME_DELAY = 200 currentTimeMilliseconds = 0 #Example MotionSenseHRV: ACC: -0.5955810546875,-0.3194580078125,-0.7149658203125 #Exam...
true
b3a2d38f338290db5525879a8eb0f8d753cede5d
weezel/supybot-plugins
/Saa/plugin.py
UTF-8
3,078
2.625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import lxml.html import requests import time import re class FetchFailed(Exception): pass class FMIweather(object): def __init__(self, city=None): self.city = city self.url = "http://ilmatieteenlaitos.fi/saa/%s?forecast=short" % city self.ht...
true
914ad95ec396abf70d164db704bf4a31c69926e8
AFD-Illinois/ibothros2d
/contour.py
UTF-8
1,132
2.875
3
[]
no_license
#!/usr/bin/python # # first argument is dump number. # you must edit the file to change which variable is plotted! # # import import numpy as np import matplotlib.pyplot as plt import sys import argparse # # open data file and get data data = np.loadtxt("ibothros2d.dat") I = data[:,2] # # set font size plt.rc('text', ...
true
caa0fbff23eb14010a2f1a92f1239ffd72aec38c
yangzongyao/TictactoeGame_and_FNN
/Computer.py
UTF-8
2,004
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Apr 11 23:35:21 2018 @author: 19point """ def Computer(desktop): i = [[100,50,100], [50,200,50], [100,50,100]] best_location_num = -1 best_location_x = -1 best_location_y = -1 for a in range(3): if ...
true
d3d0536109370d9bf66124fff6ac5502d4f779a1
shamiliraghul/python
/cache.py
UTF-8
141
2.671875
3
[]
no_license
#sha n,k=map(int,input().split()) L=list(map(int,input().split())) sum=[] for i in range(n-k,n): sum.append(str(L[i])) print(" ".join(sum))
true
08f7f2db0e09f01da85a266c6f90be1f190d37a4
joshwolfley/accounting
/app_main.py
UTF-8
2,184
3.359375
3
[]
no_license
from chartofaccounts import ChartOfAccounts from accountdetail import AccountInfo from printstatements import PrintStatements class Configuration(object): def __init__(self): self.chart_of_accounts = ChartOfAccounts() self.account_info = AccountInfo() self.calculations = PrintStatements()...
true
57dee3cfacf429eec7cacd240b76859d723769ae
rarezhang/data_structures_and_algorithms_in_python
/exercises/ch05_array_based_sequences/ch5_exercise.py
UTF-8
9,332
3.78125
4
[]
no_license
""" exercises """ import sys import ctypes import random # R-5.4 # Our DynamicArray class, as given in Code Fragment 5.3, does not support # use of negative indices with getitem . Update that method to better # match the semantics of a Python list. # R-5.6 # Give an improved implementation # of the insert method, so t...
true
3805a3bd7b06c46e72d07ffb2499d7e68f032a13
thescripted/HAProxy_test
/server/data/data.py
UTF-8
453
2.890625
3
[]
no_license
class DataGenerator(object): """Generate Data to map to a response object""" def __init__(self): data = self._get_current_data() # returns a timestamp self.name = data["name"] self.time = data["time"] def _get_current_data(self): # generate self.data """generates the correct...
true
97b23c04600ed178981617170f8a6ac87aadab3d
mompccc/COMP9417-Machine-Learning-and-Data-Mining
/ass2/classify.py
UTF-8
4,371
2.890625
3
[]
no_license
import re import numpy as np import matplotlib.pyplot as plt import math def EUC(train_data, train_class, test_data, k): # use Euclidean-Distance to compute distance instances = train_data.shape[0] minus = np.tile(test_data, (instances, 1)) - train_data # step 1: minus squared_m = minus ** 2 # step 2: ...
true
df79573b0667c45621daeb117eec37c98e39a07c
EchoChloe/hdf5examples
/hdf5examples/low_level/h5ex_g_intermediate.py
UTF-8
1,474
3.15625
3
[]
no_license
""" This example shows how to create intermediate groups with a single call to h5py.h5g.create. """ import sys import numpy as np import h5py FILE = "h5ex_g_intermediate.h5" GROUP = "/G1/G2/G3" # Strings are handled very differently between python2 and python3. if sys.hexversion >= 0x03000000: FILE = FILE.encode...
true