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
b89c6cd8cae421b08e707d18c1b2b955c506a3f0
alibell/py_thesis_toolbox
/thesis_analysis/.ipynb_checkpoints/genererTableau-checkpoint.py
UTF-8
25,259
3.265625
3
[]
no_license
from io import StringIO, BytesIO import pyexcel as pe import csv import math class genererTableau (): """ ecrire_tableau : Permet de créer un tableau et l'exporter au format excel, ods ou csv à partir de données d'analyses. Input : data : données aggrégées généré ...
true
0bd9f1a685ce41e8a036a5735e09dfce0acbe18d
eddiegz/Personal-C
/AIO/missing mango/missing mango.py
UTF-8
344
2.78125
3
[ "MIT" ]
permissive
line =open('manin.txt','r').readline() lx,cx,ld,cd=map(int,line.split()) p=lx-ld l=cx-cd c=cx+cd d=lx+ld if (lx-ld)==(cx-cd): result=p elif (lx-ld)==(cx+cd): result=p elif (lx+ld)==(cx-cd): result=d elif (lx+ld)==(cx+cd): result=d outfile=open('manout.txt','w') outfile.write(str(r...
true
a56bbfc5e43d26be1ff5555e010185f023fea0f0
Healthedata1/Flask-Alerts-Sender
/utils.py
UTF-8
632
2.59375
3
[]
no_license
from pathlib import Path # validate by writing to ig examples file and then as separate step running the IG Build: def write_out(out_path,f_name,my_file): p = Path(out_path) / 'test_output' / f_name p.write_text(my_file) # validate by writing to ig examples file and then as separate step running the IG...
true
28b39c31b6b2296326f6707ef7ab7eadffdaaee8
ruan1998/Design_Pattern_in_Python
/src/SOLID/srp.py
UTF-8
1,466
3.625
4
[]
no_license
from collections import Counter from string import ascii_lowercase as alphabet import matplotlib.pyplot as plt # SRP = Single Responsible Principle # Code Reuse Rate # Maintenance Difficulty class CharCounter(Counter): def load(self, content): self.update(content) @property def alphabet_count(sel...
true
24040667d425cff2b210b16d44c91c3d963092b5
xingetouzi/fxdayu_betaman
/fxdayu_betaman/calculator/analysis.py
UTF-8
33,568
2.671875
3
[]
no_license
# enconding = utf-8 from __future__ import division from math import copysign import warnings from collections import deque, OrderedDict import empyrical import numpy as np import pandas as pd import scipy as sp from pyfolio import capacity from pyfolio import pos from pyfolio import timeseries from pyfolio import txn ...
true
12d748c6669969902f7d01c95578e0df3863f629
IvanWoo/coding-interview-questions
/puzzles/minimum_number_of_days_to_eat_n_oranges.py
UTF-8
1,959
4.125
4
[]
no_license
# https://leetcode.com/problems/minimum-number-of-days-to-eat-n-oranges/ """ There are n oranges in the kitchen and you decided to eat some of these oranges every day as follows: Eat one orange. If the number of remaining oranges (n) is divisible by 2 then you can eat n/2 oranges. If the number of remaining oranges (...
true
7ac3355115cfc082cad4fbb1ac4aa66ab5fdf79b
jiyoon1156/42_PythonBootcamp
/day02/ex03/csvreader.py
UTF-8
742
3.234375
3
[]
no_license
class CsvReader(object): def __init__(self, file_name,sep=',', hbool=False, skip_top=0, skip_bottom=0): self.name = file_name self.sep = sep self.hbool = hbool self.top = skip_top self.bottom = skip_bottom def __enter__(self): try: self.file_obj = open(self.name, 'r') except: return None lst = ...
true
861bc9269a839b6846a5cc0159ba2f6e095a3bcf
yanghaoyue001/DIAGNOSER
/OPTICS/bright_pixel_calculation.py
UTF-8
1,696
2.625
3
[]
no_license
import numpy as np import cv2 from PIL import Image import math from imutils import paths from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import seaborn as sns sns.set() # threshold for the distribution th...
true
a6af8bf86decc4aff0656b550dcf0dd27533c817
grbalmeida/hello-python
/procedural-programming/map-filter-reduce/map-increase-price.py
UTF-8
221
3.21875
3
[]
no_license
from data import products def increase_price(product): product['price'] = round(product['price'] * 1.05, 2) return product new_products = map(increase_price, products) for product in new_products: print(product)
true
ae3f6130fc9a94943b198534b58e96cc73d7e158
nikkisora/cses_problemset
/7 Mathematics/1 Josephus Queries.py
UTF-8
811
3.828125
4
[]
no_license
''' CSES - Josephus Queries Time limit: 1.00 s Memory limit: 512 MB Consider a game where there are n children (numbered 1,2,...,n) in a circle. During the game, every second child is removed from the circle, until there are no children left. Your task is to process q queries of the form: "when there ...
true
e07b50c47a463ede3ec1434a596dbfb20da3b15b
doctor-blue/python-series
/Beginner/variable_operator.py
UTF-8
89
3.15625
3
[]
no_license
# print('Hello World') # String user_name = "John" age = 30 is_male = False print(2**4)
true
fa87e7511a763410220ec358ddc757ac9e9b9aa4
mikroskeem/tu_programmeerimise_alused_MTAT.TK.012
/week_2/yl2.2.py
UTF-8
330
2.96875
3
[]
no_license
def user_boolean(text): return text.lower() == "jah" size = float(input("Sisesta kirja suurus: ")) topic = input("Sisesta kirja teema pealkiri: ") inc_file = user_boolean(input("Kas kirjaga on kaasas fail? ")) if len(topic) < 1 or (inc_file and size > 1.0): print("Kiri on spämm") else: print("Kiri ei ole ...
true
7746da6f2edd165350b81f839564f3b3586f34a7
billhowland/PythonLabs
/python/17PalAna.py
UTF-8
1,360
4.21875
4
[]
no_license
# 17palana.py # Version 1: # define functions here------------------------------------------- def check_palindrome(word): if word == word[::-1]: return (f'Yes, {word} is a palindrome.') else: return (f'No, {word} is not a palindrome.') def check_anagram(worda, wordb): # Remove all space...
true
bfd4f5eb040f5fedf370cfd9945aaae0cb86aca2
cassiemanrique/qblinalg2021
/eigenvalue.py
UTF-8
947
3.3125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import matplotlib.patches as mpatches from numpy import linalg as LA vec=np.array([[4,3], [1,2]]) #making a vector eigenvalues, eigenvectors = LA.eig(vec) #compute the eigenvalues #print the eigenvalues print('lambda_1: {}, v_1: {}'.format(eigenvalues[0], eigenvect...
true
1abf1b2bed408c8bbea534d6af0b0a32f130efdd
zaydane-mokni/Ac-LabM2
/Python/InitiOpencv/main.py
UTF-8
861
2.859375
3
[]
no_license
import cv2 as cv import rescale # Read img """img = cv.imread('Photos/2.jpg') print(f'width:{img.shape[1]}\nheight:{img.shape[0]}') img_rescale = rescale.rescaleFrame(img,0.1) print(f'width:{img_rescale.shape[1]}\nheight:{img_rescale.shape[0]}') cv.imshow('cat',img) cv.imshow('cat_rescale',img_rescale) cv.waitKey(0)...
true
00ab2ce77518172d95b58f5f5cc9b0fea38a464b
Cphayim/fisher
/test/notes/test7.py
UTF-8
410
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created by Cphayim at 2018/6/30 19:04 """ __author__ = 'Cphayim' # 普通上下文管理器 class MyResource: def __enter__(self): print('connect to resource') return self def __exit__(self, exc_type, exc_val, exc_tb): print('close resource connection') def query(...
true
e9025017a335c7bbf5476c1cc2eba775fdcb96df
liartist/pythonchallenge
/bull.py
UTF-8
518
3.171875
3
[]
no_license
# pythonchallenge 10 # bull.html # look and say sequence a = [''] * 31 a[0] = '1' result = {} for number in range(30): current = ['', 0] for char in a[number]: position = 0 if char == current[0]: current[1] += 1 else: if current[0] != '': # record ...
true
8c7689cf655692b7b761d8f16f22a7821f90ff0f
Thomas00010111/SimpleDiscreteRobotEnvironment
/TestRl.py
UTF-8
1,959
2.546875
3
[]
no_license
''' Created on Jun 29, 2013 @author: mrfish ''' import unittest import SimpleRLAgentContinuousTransMatrix.RL as RL import SimpleEnvironment import numpy class TestRl(unittest.TestCase): def setUp(self): NumberOfStates = 5 self.RL = RL.RL(NumberOfStates) def test_getRewardedTransitio...
true
f06c6f5da1fb42ab2200e6d6c3e26f701a7feef0
YulitaGap/BinarySearchTrees
/xo_task3/btnode.py
UTF-8
342
3.3125
3
[]
no_license
class Node: """ Class for Tree Node representation """ def __init__(self, board, cell=None, result=0): self.board = board self.cell = cell self.result = result def move(self, move_cell): return self.board.move(move_cell) def check_state(self): return sel...
true
b931274ea6b5265f5654e5d76a7f0b638468cc88
tumpji/NuberTheoryPyLib
/test/test_totient.py
UTF-8
1,539
2.875
3
[]
no_license
#!/usr/bin/env python3 from __future__ import division import unittest import test_utils from totient import * class TestTotient(unittest.TestCase): def setUp (self): import test_utils cache = test_utils.global_CacheFile url = 'http://oeis.org/A000010/b000010.txt' strpair = ( li...
true
63de39a907d5b645186d8ee1a7499f937d630d86
vividcurlyfry/Reinforcement-Learning
/NLE_OPTION_CRITIC/logger.py
UTF-8
2,889
2.65625
3
[ "MIT" ]
permissive
import logging import os import time import numpy as np #from torch.utils.tensorboard import SummaryWriter class Logger(): def __init__(self, logdir, run_name): self.log_name = logdir + '/' + run_name self.tf_writer = None self.start_time = time.time() self.n_eps = 0 if not...
true
476c201c7ef29cda5a1c06ca0e96a872dc2a9944
YannMerillac/TutoCEM
/tests/test_mom_interface.py
UTF-8
929
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- from MoM import mom_interface import numpy as np import matplotlib.pyplot as plt # n disc pts npts = 50 N = npts-2 # physical properties eps_0 = 8.8542e-12 mu_0 = 4.0e-7*np.pi c = np.sqrt(1/(eps_0*mu_0)) # frequency = 100MHz #f = 10.0e6 Lambda = 1. #c/f f = c/Lambda w = 2*np.pi*f k = 2.*np.pi/...
true
cb513ee47a5f3c7426e4ddb09a9122621843f688
herissonsilvahs/ListPy
/main.py
UTF-8
380
3.25
3
[]
no_license
from arraylist import ArrayList from linkedlist import LinkedList arl = ArrayList([1,2,3,4,5]) lkl = LinkedList() lkl.append(4) lkl.append(6) lkl.append(5) #lkl.insert(3, 9) #print(lkl.size()) #lkl.showHead() lkl.remove(5) print(lkl.size()) print(lkl.indexOf(4)) element = lkl.getElement(1) print(element) rmE...
true
b8de40cffb3f2ab9f98092735b8d1288763103ba
urapdf/tutorial_projects
/Treehouse_projects/Battleship/battleship_objects.py
UTF-8
12,275
3.09375
3
[]
no_license
SHIP_INFO = [ ("Aircraft Carrier", 5), ("Battleship", 4), ("Submarine", 3), ("Cruiser", 3), ("Patrol Boat", 2) ] BOARD_SIZE = 10 VERTICAL_SHIP = '|' # Not using this. Using 1st letter of ship HORIZONTAL_SHIP = '-' EMPTY = '0' MISS = '-' HIT = 'X' SUNK = '!' x = "" NONEMPTY = [ship[0][0] for ship ...
true
74892116ef31a2d9dd35c3807c049ea2c55c64e5
eidonfiloi/criticalityPy
/mnist_criticality/mnist_stats.py
UTF-8
2,374
2.78125
3
[]
no_license
import utils.tflearn from utils.tflearn.layers.core import input_data, dropout, fully_connected from utils.tflearn.layers.conv import conv_2d, max_pool_2d from utils.tflearn.layers.normalization import local_response_normalization from utils.tflearn.layers.estimator import regression class MnistStats(object)...
true
b2ff6c86e96e6729e5492d67c4069a9b72fb9d23
15ec016/python-programming
/Beginner/hello.py
UTF-8
39
2.765625
3
[]
no_license
a="hello" for i in range(5): print(a)
true
b4632b38b4026cff287eb5d3d50d44091bfb3cf2
ashwinkumarraja/Testing-different-Recommender-Systems
/collabWithBaseline.py
UTF-8
10,191
3.296875
3
[]
no_license
import numpy as np from numpy import linalg as la from numpy.linalg import svd import math import operator import time # Function to get top k movies # This basically sorts movies by average rating of movies , acc to the entries of the input matrix 'temp' and return top k.... def get_top_k_movies(temp, k): movi...
true
9bc0b8b849638fb4a0e4d70855d76b05fcb99b96
JohnByrneJames/SpartaGlobalRepo
/Python-Files/Inheritance/inheritance.py
UTF-8
1,276
3.75
4
[]
no_license
from vehicle import Vehicle from car import Car from sports_car import SportsCar # Inheritance class # Before starting this I am going to layout the idea behind the inheritance example, you can also find # a more in depth view of it on the README_OLD.md file located at the main page of this directory. # This file wil...
true
0c3db7420bdc88682b616e72bcc865980d6c5864
ashutoshkpandey/ASE_prealignment
/Calculate_ASE_chisqr_pvalue.py
UTF-8
4,654
2.609375
3
[]
no_license
import sys,re,fileinput,os from decimal import Decimal, getcontext # This program calculates the p-value for allelic ratio # Input files are heterozygous SNPs, Allelic_ratio file Argument = [] Argument = sys.argv[1:] if (len(Argument)) < 3: print "Usage: Input_allelic_ratio_file SNP_file Output_file" ...
true
b72a9790ef52598c38c3de89a88eb42b42b5f8be
theod07/image_clusters
/code/decomposition.py
UTF-8
3,015
2.734375
3
[]
no_license
import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import seaborn as sns def get_photos_df(): pickles = os.listdir('../pickles') dfs = [] for pickle in pickles: username = pickle.split('_predictions.pkl')[0] df = pd.read_pickle('../pickles/{}'.format(pickle)) ...
true
15e404a8b2d2b2a5bc8e74d3c9c2d03e65c07b77
mrrobby/pandasticsearch
/pandasticsearch/operators.py
UTF-8
7,794
2.625
3
[ "MIT" ]
permissive
# -*- coding: UTF-8 -*- _metric_aggs = ('avg', 'min', 'max', 'cardinality', 'value_count', 'sum', 'percentiles', 'percentile_ranks', 'stats', 'extended_stats') _sort_mode = ('min', 'max', 'sum', 'avg', 'median') class Aggregator(object): def __init__(self, field): self._field = field ...
true
6a5554065333268a7d9cadb0d0160392526280ca
joseph1475/GITwithJenkinsFOTA
/tests/conftest.py
UTF-8
5,224
2.59375
3
[]
no_license
import pytest import pandas as pd from selenium import webdriver # Importing web driver from selenium.webdriver.support.select import Select import time driver = None #browser code for selecting different browser at run time : def pytest_addoption(parser): parser.addoption( "--browser_name", action="stor...
true
dceba3fdfaa4677e5e9571430b3e7f2f82bfc450
klin-usgs/shakemap
/test/grind/vector_test.py
UTF-8
1,000
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain-disclaimer" ]
permissive
#!/usr/bin/env python #stdlib imports import os.path import sys #third party import numpy as np #hack the path so that I can debug these functions if I need to homedir = os.path.dirname(os.path.abspath(__file__)) #where is this script? shakedir = os.path.abspath(os.path.join(homedir,'..')) sys.path.insert(0,shakedir...
true
83723c0e58ca9db0aebd74e67cac0c6792f1ed96
wonjunee/sinkhorn_v2
/plotting/plot_N.py
UTF-8
3,462
3.0625
3
[]
no_license
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import csv def open_file(filename): arr = [] with open(filename) as csvfile: spamreader = csv.reader(csvfile, delimiter=',') for row in spamreader: arr.append(list(map(float,row))) retu...
true
a8d73a940a8772307710fbe69b8a8b90119395e9
JitenKumar/Data-Structures-Practice
/Practice/Queues/circularlinkedlistqueues.py
UTF-8
1,709
3.828125
4
[]
no_license
import sys class Node: def __init__(self,info,next=None): self.info=info self.next = None class CircularLinkedListQueue: def __init__(self): self.head=self.tail=None def isEmpty(self): if self.head is None: return True return False ...
true
28c58245889f88730998a0a9b707f24c89cd9604
cfireborn/PrepCS
/backend/code_submission/solution_code/reverse-digits-solution.py
UTF-8
459
3.78125
4
[]
no_license
def reverse_integer(number): is_negative = False if number < 0: is_negative = True absolute_number = abs(number) # one may use the integer_to_string.py method here reversed_string = str(absolute_number)[::-1] # reverses a string reversed_int = int(reversed_string) ...
true
f4539a758d1d8b6d2e65ca364f30712024e901d8
josephkamel/F2MD
/machine-learning-server/MLStats.py
UTF-8
1,662
2.671875
3
[]
no_license
""" /******************************************************************************* * @author Joseph Kamel * @email josephekamel@gmail.com * @date 28/11/2018 * @version 2.0 * * SCA (Secure Cooperative Autonomous systems) * Copyright (c) 2013, 2018 Institut de Recherche Technologique SystemX * All rights ...
true
b67817a594c0a7f189e5fee568dece331874922b
gaofingal/python
/demo/decorate_2.py
UTF-8
792
3.484375
3
[]
no_license
# 完整版的装饰器 # 两层的装饰器 import functools def log(func): @functools.wraps(func) def wrapper(*args, **kw): print('call %s():' % func.__name__) return func(*args, **kw) return wrapper @log def now(): print('2015-3-25') # 调用函数 now(); def log_defence(action): def decorator(func): @f...
true
620f97f7087392165e3629e665fece75abf6d1b7
vincefio/python_work
/functions.py
UTF-8
248
3.421875
3
[]
no_license
def display_message(): print('we\'re learning python functions!') display_message() def favorite_book(title): #book = input('What\'s youre favorite book?') print('your favorite book is ' + title) favorite_book('alice in wonderland')
true
a0141aa30c428cdaff5a788932fe497276218a93
baback-izadi-lab/DAGGeneration
/utils/schedule_runner.py
UTF-8
5,380
2.84375
3
[]
no_license
import json """ This module runs and calculates execution times for each task and processor based on the schedule generated by EDLS.py """ class Task: def __init__(self, task_num, processor, speed, exec_time, exec_power, comm_data): self.task_num = task_num self.proces...
true
5eb5dffe91274b582ac1135a2b890c6e13f0e017
matti-matti/crypto_projects
/sources/asymmetric_crypto/Elgamal/elgamal_falsification/squere_multiply.py
UTF-8
500
3
3
[]
no_license
def sqmul(base, exp, mod): tmpBase = base x = 1 # print("---------------------------") # print("SQMUL: {}^{} mod {}".format(base, exp, mod)) # print("") for i in bin(exp)[3:]: if(i == '1'): tmpBase *= tmpBase tmpBase *= base # print("{:>3} SQMUL".form...
true
87a929bc8ec45534f38139eedc5a75d10aeffcbe
nkanungo/session9_epfi
/test_session9.py
UTF-8
4,903
2.875
3
[]
no_license
import pytest import session9 import os #import numpy as np import inspect import re README_CONTENT_CHECK_FOR = [ ] CHECK_FOR_THINGS_NOT_ALLOWED = [ ] def test_readme_exists(): assert os.path.isfile("README.md"), "README.md file missing!" def test_readme_contents(): readme = open("README.md", "r",enco...
true
145a966704200bb74e5e5e0b1eb74b729a8854fe
AmpedUpCodeLark/AmpedUpCodeLark.github.io
/vowels.py
UTF-8
209
3.171875
3
[]
no_license
# Head First Python - vowels code # David Gillette # 630-975-7282 # jupyter editor vowels = ['a', 'e', 'i', 'o', 'u'] word = "Milliways" for letter in word: if letter in vowels: print(letter)
true
87ee035e3a80f09dde4ee16888ffffe328ef1a81
MariaZork/Coursera-Python-Course
/week7 - Множества и словари/week7 - Количество различных чисел.py
UTF-8
915
3.890625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Nov 14 21:10:02 2017 @author: Maria """ # Дан список чисел, который может содержать до 100000 чисел. # Определите, сколько в нем встречается различных чисел. # Формат ввода # Вводится список целых чисел. Все числа списка находятся на одной строке. # Формат вывода # Выведите ...
true
059e59aabdb8f3028b51bae0a3ad21f33aa7edf0
kho903/python_algorithms
/Baekjoon/알고리즘별/브루트포스 알고리즘/2548.py
UTF-8
445
2.921875
3
[]
no_license
# 시간 초과 남 # n = int(input()) # lst = list(map(int, input().split())) # lst.sort() # lst_set = list(set(lst)) # lst_oper = [] # for s in lst_set: # lst_oper.append(sum([abs(a-s) for a in lst])) # print(lst_set[lst_oper.index(min(lst_oper))]) # 중앙값을 이용하여 품 n = int(input()) lst = list(map(int, input().split())) lst.s...
true
44307c345bc60240e6c8e07ad17f54a8c3487e87
AnatolyDomrachev/karantin
/is28/vavilova28/lab4/1.py
UTF-8
87
3.28125
3
[]
no_license
a=int(input()) b=int(input()) c=int(input()) m=a if m<b: m=b if m<c: m=c print(m)
true
cfcd5169ee277e80ebb1f49fa6de83cfbc4678c9
mjpatter88/topCoder
/AB/AB.py
UTF-8
646
3.390625
3
[]
no_license
import math class AB(object): def createString(self, N, K): letters = "" smaller_half = math.floor(N / 2) bigger_half = N - smaller_half if K > smaller_half * bigger_half: return letters remainder = K letters = ["B"] * N index = 0 while ...
true
a891d90cd0976db5afa36e191e4d4afef9bc332d
JaumeEstany/Decision-Trees-And-Random-Forests
/validation_methods.py
UTF-8
8,994
3.375
3
[]
no_license
import tree as tr import numpy as np import data_clean as dc import validation_metrics as metr def holdout_data(attributes, instance_class, train_ratio=0.8): """ :param attributes: matrix of attributes of the data base (col = attribute) :param instance_class: vector with the classification of every sample...
true
6b8499a6528b4a2bf3a58d2cdcbe35ac4ef7fc3d
psorus/muskiebot
/curl/main.py
UTF-8
871
2.53125
3
[]
no_license
import json import os def curlit(task,cou=5,uid=44196397): with open("job_"+str(task),"r") as f: job=f.read() os.system(job.strip().replace("###cou###",str(cou)).replace("###uid###",str(uid))+" -o output.txt") def load(): with open("output.txt","r") as f: q=f.read() return json.loads(...
true
539d18fa61bcb3aee62a789d59d0df068a4ed8bc
Mountain-AI/python-to-the-offer
/3_1_find_dup_num_in_a_list.py
UTF-8
1,890
4.09375
4
[]
no_license
# -*- coding:utf-8 -*- class Solution: # 这里要特别注意~找到任意重复的一个值并赋值到duplication[0] # 函数返回True/False def duplicate(self, numbers, duplication): """借助辅助数据结构,时间复杂度O(n),空间复杂度O(n) Arguments: numbers {list} -- 给定数组 duplication {list} -- 结果数据(牛客系统为了便于检测结果强制要求的,其实没有必要) R...
true
9c4404d708e523f0898738d7ad802a502b05a844
kacyouhuugetu/ml
/gaussian/hmm.py
UTF-8
15,649
2.59375
3
[]
no_license
from math import log from numpy.linalg import norm from scipy.misc import logsumexp from scipy.stats import multivariate_normal as mn from ..base import less_equal from .gmm import get_gmm_init_parameters,_gmm_cem_check,_gmm_cem_calculate_logpdf,_gmm_cem_M_step import numpy as np class hmm: def __init__(self,M,mixtur...
true
66d8cc10fd6f6468f8fb974d546bd52e95ec4def
lelandpaul/bookshelf
/app/models.py
UTF-8
4,966
2.84375
3
[]
no_license
from app import db from app.years import Years from statistics import mean class Author(db.Model): id = db.Column('id', db.Integer, primary_key=True, autoincrement=True) surname = db.Column('surname', db.String(128), index=True) other_names = db.Column('other_names', db.String(128)) white_author = db....
true
26c8abe6c76f9977de05ce014252d439f10bb9e4
18006426023/movies-download
/movies infos.py
UTF-8
3,207
2.59375
3
[]
no_license
import requests from lxml import etree import lxml import csv BASE_DOMAIN = 'https://www.dytt8.net' HEADERS = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36' } def get_detail_urls(url): response = requests.get(url, header...
true
c5a0508ff1bf5731483193436084e402eede45eb
norbertosanchezdichi/TIL
/Python3/OOPPartII/multiple_inheritance.py
UTF-8
1,194
3.84375
4
[ "MIT" ]
permissive
class Aquatic: def __init__(self, name): print("AQUATIC INIT") self.name = name def swim(self): return f"{self.name} is swimming" def greet(self): return f"I am {self.name} of the sea!" class Ambulatory: def __init__(self, name): print("...
true
a3c2b7f3916b9ce3f3c7494e15ef5dbda70253fb
Sora-Shiro/Algorithm-Python
/CheckIO/001Elementar/007Right to Left.py
UTF-8
1,930
4.03125
4
[]
no_license
''' One of the robots is charged with a simple task: to join a sequence of strings into one sentence to produce instructions on how to get around the ship. But this robot is left-handed and has a tendency to joke around and confuse its right-handed friends. You are given a sequence of strings. You should join these str...
true
27ad39a00341c9c1c016a78ba7e0fb0ee2dfc90d
aspnetcs/Master_Thesis
/slidingWindows.py
UTF-8
3,510
3.265625
3
[]
no_license
#This package implements how to divide an image in a sliding window fashion. The rest of the functions enables to see the result. import matplotlib.pyplot as plt import numpy as np import tensorflow as tf #Divide an array of image into an array of patches, the number of patches being determined by the stride, s...
true
42fe17a374264954fbd4d057805fca76a2fa5cc7
abhisun/loan_default_prediction
/load_model.py
UTF-8
1,169
3.359375
3
[]
no_license
""" Import Required Libraries """ import pickle import logging from configparser import ConfigParser logging.basicConfig(level=logging.DEBUG) logging.info('Executing the script as a standalone') ''' Read Config File ''' config = ConfigParser() config.read('config.ini') MODEL_PATH = config['MODELS']['...
true
9ada50650b8bf40788aaee9b41c39934da252f1a
bwindsor22/quality-diversity-rl
/models/lockable_resource.py
UTF-8
379
3.125
3
[]
no_license
import threading class LockableResource: def __init__(self, resource): self.lock = threading.Lock() self.resource = resource def __call__(self, *args): return self.resource(*args) def acquire(self): self.lock.acquire() def release(self): self.lock.release() ...
true
0dc5e15050009c671252c6e870167c3a3d0b2aa0
HillGiant/stitch
/src/stitch.py
UTF-8
584
3.125
3
[ "MIT" ]
permissive
import urllib.request import os CURRENTDIR = os.path.dirname(__file__) print (CURRENTDIR) TILEFOLDER = os.path.join(CURRENTDIR, 'Tiles') print (TILEFOLDER) def DownloadTile(url, filename): filepath = os.path.join(TILEFOLDER, filename) urllib.request.urlretrieve(url, filepath) def CollectTiles(): print ("...
true
7dfed2f0287f12ea213b1b40a30ba9fedecef28a
123qpq/Beakjoon
/silver/level1/트리 순회.py
UTF-8
560
3.578125
4
[]
no_license
#1991 def bfs(level, node): if level == n: print() else: lt = graph[node][0] rt = graph[node][1] res1.append(node) if lt != '.': bfs(level+1, lt) res2.append(node) if rt != '.': bfs(level+1, rt) res3.append(node) n = int(in...
true
38f86776c524ee9e07fcaf56447538639f29b7cc
TheAzmyr/Traduction-FR-Kaiserreich
/update_english.py
UTF-8
2,827
2.8125
3
[]
no_license
import os import argparse import shutil import zipfile from time import gmtime, strftime def get_args(): parser = argparse.ArgumentParser(description='Update English files') parser.add_argument('steam', type=str, help='Steam mod directory') parser.add_argument('mod', type=str, help='Local mod directory') ...
true
ad1ba429bf787592cb8fb99d285d255ec5e49b88
WellyZhang/seq2seq-opt
/src/utils.py
UTF-8
2,593
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- import math from collections import namedtuple import numpy as np import torch import torch.nn as nn import torch.nn.functional as F Hypothesis = namedtuple('Hypothesis', ['value', 'score']) def input_transpose(sents, pad_token): max_len = max(len(s) for s in sents) batch_size = l...
true
b5ad7851c5eb7df3d04cccafb89f0a8a0f0eda4a
Jeevita7812/Codechef
/beginner/Is_It_A_Cakewalk_Problem.py
UTF-8
284
3
3
[]
no_license
x = int(input()) l = [] for i in range(x): sum = 0 for j in range(10): a = str(input()).split(" ") for k in a: k = int(k) if(k <= 30): sum += 1 if(sum >= 60): l.append("yes") else: l.append("no")
true
87c93cb36993b9fef6a9fbf9de8823e5f0bb7744
Manya-Singh/Web-Scraping-and-API-in-Python
/05.Web Scraping with Beautiful Soup/scraper4_dealing_links.py
UTF-8
1,059
3.40625
3
[ "MIT" ]
permissive
import requests from bs4 import BeautifulSoup from urllib.parse import urljoin #Making GET request base_url = "https://en.wikipedia.org/wiki/Music" response = requests.get(base_url) if response.status_code: html = response.content #Making the soup soup = BeautifulSoup(html, "html.parser") links = s...
true
de97d60c30a0d8bef096c3ff6d0b9eaa33964d37
Apple7724/Probe
/55_множества_проверка значения.py
UTF-8
2,177
4.09375
4
[]
no_license
def is_anyone_in(collection, city): if city in friends.values(): # если есть среди значений словаря collection for name in friends.keys(): # переберите все ключи словаря if friends[name] == city: # если соответствующее ключу значение равно city print('В городе ' + city + ' ж...
true
127b9ee5387f31b403104b9a0471a86f2071fb9c
ssevR/Basic-algorithms-of-applied-topology
/problem1.py
UTF-8
1,723
3
3
[]
no_license
import numpy as np def rank_mod2(a, l): #m < n m = a.shape[0] n = a.shape[1] res = 0 for i in range(n): flag = 0 for j in range(res, m): if (a[j][i] == 1): a[[res, j]] = a[[j, res]] flag = 1 l.append(i) brea...
true
1d65057977bcdd34f11d379745ee92d80b80e92f
genera11ee/code
/py/subject5/10.py
UTF-8
215
3.515625
4
[]
no_license
#updated secret word program secret_word = "apples" guess = input("Guess the secret word: ") if guess == secret_word: print("Congratulations! You've found the secret word!") print("You can play again")
true
57ad8670560588627bdcf7a9881617ff24c4eacc
rohitsuratekar/ZFINExpAnalysis
/visualization/expression_patterns.py
UTF-8
1,152
2.796875
3
[]
no_license
""" Rohit Suratekar March 2019 Visualization functions """ import matplotlib.pyplot as plt from SecretColors import palette from analysis.basic import get_expression_pattern_in def plot_expression_profile(gene: str, parent_structure: str = None): p = palette.Palette() entries_start = [] for d in get_ex...
true
3d4458239a8002e8004b058592e5c68f6a0b0a9c
varerysan/python_start_lessons
/some_ideas/locals_v1.py
UTF-8
405
2.90625
3
[]
no_license
a = 10 def func(): pass print('--- locals for main ---') print(locals()) print('------------------') def loc_func(): v = 123 print('--- locals for loc_func ---') print(locals()) print('------------------') def loc_func_args(param): v = 123 print('--- locals for loc_func_args ---') pri...
true
ee1329b9928b264acae33a643746254639913198
angry77cat/ML2017
/hw5/bow_test.py
UTF-8
2,989
2.5625
3
[]
no_license
import numpy as np import pickle import sys import nltk nltk.download("stopwords") nltk.download("punkt") from keras.models import model_from_json from nltk.corpus import stopwords from nltk.tokenize import word_tokenize test_path= sys.argv[1] output_path= sys.argv[2] def read_data(path,training): print ('Reading...
true
7d6fdc9d6b4a04a99d35e87f880640eab6f50cd8
marcosaraujo2020/ifpi-ads-algoritmos2020
/Lista_Prof_Fabio/Fabio01_Parte02/f1_q8_binario_para_decimal.py
UTF-8
711
3.796875
4
[]
no_license
# ENTRADA binario = int(input('Digite um número inteiro binário com 4 digitos: ')) # PROCESSAMENTO digito0 = binario % 10 digito1 = (binario // 10) % 10 digito2 = ((binario // 10) // 10) % 10 digito3 = ((binario // 10) // 10) // 10 decimal = (digito3 * 2 ** 3) + (digito2 * 2 ** 2) + (digito1 * 2 ** 1) + (digito0 * 2 ...
true
4dfeeaa03ca75ff0079e4aab55dca25fa11364fa
taomiao/translate
/pytorch_translate/char_aware_hybrid.py
UTF-8
4,058
2.578125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 from ast import literal_eval import torch import torch.nn as nn import torch.nn.functional as F from pytorch_translate import char_encoder, hybrid_transformer_rnn class CharAwareHybridRNNDecoder(hybrid_transformer_rnn.HybridRNNDecoder): """ A decoder that is similar to the HybridR...
true
6071ea938a58a7d458be17b807ea513effa0faee
KuoYuHong/Kuo-python
/convert_row_list.py
UTF-8
1,361
3.125
3
[]
no_license
import numpy as np import pyperclip import textwrap #貼上內容 text = ''' ''' #範例else: # text = ''' # 123 # 3@1 41 # 456 # ''' #範例if: # text = ''' # ['貼上內容', # '123', # '3@141', # '456'] # ''' # text = ["'123'"] # text = ["123"] # text = ['123','456'] # for x in text: # if "'" in x[0]: # x = x[1:] # if "'" in x...
true
25d213e9591a9fa5adcd235f6ba4ad601e81a27e
JungleKim/django-shard-library
/shard/config/database_config.py
UTF-8
4,493
2.53125
3
[ "BSD-3-Clause" ]
permissive
import copy import urllib.parse from typing import Dict, List, Optional, Tuple from dj_database_url import config from shard.constants import DATABASE_CONFIG_MASTER, DATABASE_CONFIG_SHARD_GROUP, DATABASE_CONFIG_SHARD_NUMBER __all__ = ('make_shard_configuration', 'make_replication_configuration', ) def make_shard_c...
true
032fe83b76b63858eb4a702cd94541b75bb5221a
RaghavJindal2000/Python
/basics/Python/PYTHON --------/Exception Handling/unknown.py
UTF-8
141
3.015625
3
[]
no_license
try: f = open("intro.txt") a=f.read() print(a) print(f.closed) except: print("File not found") finally: f.close() print(f.closed)
true
107a5df85647d6e9b66b4db370595592e5c77d26
A1fuq/fape-coding
/untitled5.py
UTF-8
359
2.5625
3
[]
no_license
from mcpi.minecraft import Minecraft mc=Minecraft.create() import random,time while True: hits=mc.events.pollProjectileHits() if len(hits) > 0: hit=hits[0] x,y,z=hit.pos.x,hit.pos.y,hit.pos.z for i in range(100): mc.spawnEntity(x+random.randrange(-3,3),y+10,z+random....
true
5e49be78a8739a059d0d2688f43e488fd33bd2b9
ankitsaini84/python
/conditionals.py
UTF-8
493
4.53125
5
[]
no_license
""" 1. Create a program that asks the user how far they want to travel. If they want to travel less than three miles tell them to walk. If they want to travel more than three miles, but less than three hundred miles, tell them to drive. If they want to travel three hundred miles or more tell them to fly. """ distance =...
true
520a00a04bc98d6a54e7c718a3af7cbeb28ad755
dinsizimansiz/battleship-cli
/communicate.py
UTF-8
3,006
2.9375
3
[]
no_license
import requests from termcolor import colored from time import sleep def communicate(method:str,url:str) -> None: resp = requests.request(method,url) try : _json = resp.json() if _json.get("err",None) is not None: print(colored(str(_json["err"]),"red"),flush=True) if _jso...
true
0d08fc51c05488539edcbfa22a3c02a141dc953d
dex4er/Pyjoyment
/t/docs/Parameters.py
UTF-8
5,028
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- import Pyjo.Test class NoseTest(Pyjo.Test.NoseTest): script = __file__ srcdir = '../..' class UnitTest(Pyjo.Test.UnitTest): script = __file__ if __name__ == '__main__': from Pyjo.Test import * # noqa import Pyjo.Parameters # Parse params = Pyjo.Parameters.n...
true
61de332353e4f4c584211ec995da0cd9980c18c7
harringtonjd2/foobar
/braille/solution.py
UTF-8
738
3.359375
3
[]
no_license
#!/usr/bin/env python alpha = 'abcdefghijklmnopqrstuvwxyz' capitals = alpha.upper() binbraille = ['100000', '110000', '100100', '100110', '100010', '110100', '110110', '110010', '010100', '010110', '101000', '111000', '101100', '101110', '101010', '111100', '111110', '111010', '011100', '011110', '101001', '111001', '...
true
23217c536277f94ccdc9010660f762410d043747
youngmg1995/NES-Music-Maker
/LSTM/reduced_model/generation_utils.py
UTF-8
8,454
3.5625
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Apr 8 21:29:08 2020 @author: Mitchell generation_utils.py ~~~~~~~~~~~~~~~~~~~ This file contains helper functions used to generate original NES music using our trained model. Primarily it contains the following functions: 1) generate_track: - Generates new sequ...
true
2d622818e97ebf4e3365dafb89aa9c7276afc845
skamithi/tower-monitoring-demo
/roles/metrics/templates/tower_capacity.py.j2
UTF-8
1,408
2.515625
3
[ "MIT" ]
permissive
#!/var/lib/awx/venv/ansible/bin/python """ Ansible Tower - Calculates Current System Capacity usage Requires a usernamee and password. Create a System Auditor account and make this script only readable by the telegraf user. tower_system_capacity, host=tower1, max_capacity=100,capacity_used=10,active_job_count=10 Th...
true
fe3354a9f0e467735309c27115bc302e96419e8f
vishalmarwaha/Python-codes
/files.py
UTF-8
252
2.953125
3
[]
no_license
'''from os import walk f=[] for (dirpath, dirnames,filenames) in walk('/var/www/html/python'): f.append(filenames) print f''' import os dirname='second' try: os.mkdir(dirname) print('Directory created') except: print('Directory already exists')
true
2f416ad7ee1384d755ba4728dddfbe6dadd476f1
sflcoder/Python-and-Deep-Learning
/ICP2/Source/stringAlternativer.py
UTF-8
307
3.890625
4
[]
no_license
def string_alternative(input): # returns every other char of a given string wordNum = len(input) str = '' for i in range(int(wordNum)): if i%2 == 0: str += input[i] return str originalStr = input ('please input the string: ') print(string_alternative(originalStr))
true
f45eafc7d4098a379d900525a234e978e2fb761a
arXiv/arxiv-search
/search/converters.py
UTF-8
1,018
2.84375
3
[ "MIT" ]
permissive
"""URL conversion for paths containing arXiv groups or archives.""" from typing import List, Optional from arxiv import taxonomy from werkzeug.routing import BaseConverter, ValidationError class ArchiveConverter(BaseConverter): """Route converter for arXiv IDs.""" def to_python(self, value: str) -> Optional...
true
4edb1da351c8c650aa2291f7f848293a79a13948
nanli-7/algorithms
/92-reverse-linked-list-ii.py
UTF-8
1,969
4.21875
4
[]
no_license
""" 92. Reverse Linked List II - Medium # linked list # 206. Reverse Linked List - Easy Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL """ # Definition for singly-linked list. class List...
true
f5ce93c8bab214390393f41250798dec2c317b17
abdullahglobaledx89/python-notes-programmes
/tuple/test7.py
UTF-8
243
3.890625
4
[]
no_license
print("BY USING MIN() & MAX() FUNCTION") t1=eval(input("Enter any tuple:")) print("minimum value from tuple") print(min(t1)) print("maximum value from tuple") print(max(t1)) print("Fetching the items in tuple") for t2 in t1: print(t2)
true
d42dd7e9a447880ab2bb4cd532afb18111466f84
k-harada/AtCoder
/ABC/ABC101-150/ABC143/B.py
UTF-8
409
3.015625
3
[]
no_license
def solve_b(n, d_list): s1 = sum(d_list) s2 = sum([d ** 2 for d in d_list]) res = (s1 ** 2 - s2) // 2 return res def main(): n = int(input()) d_list = list(map(int, input().split())) res = solve_b(n, d_list) print(res) def test(): assert solve_b(3, [3, 1, 2]) == 11 assert sol...
true
7b53c06d0c853314e7deb7424b0eef3078ad0981
watsonca/PyMethyl
/ResultInfoGather.py
UTF-8
1,305
3.53125
4
[]
no_license
##Author Cody Watson ## ##BCRL Fox Chase Dr. Jose Russo, Dr. Julia Pereira ##Program to put results into file that can be easily seen. ##Packages needed for this program import re import os def getResults(): global result_folder global searching_for ##Global variable directory names. These ...
true
e1d4a80066f8a213f9fbc7d3668e9a3701cfdb17
rudneff/http-server
/src/response.py
UTF-8
2,275
2.53125
3
[ "MIT" ]
permissive
from datetime import datetime from enum import Enum RESPONSE_STATUS = { 200: "200 OK", 403: "403 Forbidden", 404: "404 Not Found", 405: "405 Method Not Allowed", } CONTENT_TYPES = { 'html': 'text/html', 'css': 'text/css', 'js': 'application/javascript', 'jpg': 'image/jpeg', 'jpeg':...
true
7d80428d9e812aacae0d8e30d3587205ce7525d3
shuntaroumt/-
/j_stream.py
UTF-8
2,869
2.71875
3
[]
no_license
import os, sys, glob import pandas as pd from pathlib import Path import datetime import os ##元データのcsvファイルを取得 df_1 = pd.read_csv('j_stream.csv',header = None) M = df_1.shape[1] ##0列目と3列目から(N-1)列目を取得すればよい.0行目のみを抽出して格納するdfと3行目から(N-1)行目を抽出して格納するdfを作る df_2 = df_1.iloc[:,0] df_3 = df_1.iloc[:,3:M] df_4 = p...
true
9cd382d4543435ebb81435c26626bba049f295cc
Unidata/python-awips
/awips/UsageOptionParser.py
UTF-8
473
2.953125
3
[ "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
permissive
import sys from optparse import OptionParser class UsageOptionParser(OptionParser): """ A subclass of OptionParser that prints that overrides error() to print the whole help text, rather than just the usage string. """ def error(self, msg): """ Print the help text and exit. ...
true
772cbb7de6471ec1cc95bafedd97694b345a6c86
IchenDEV/Leetcode
/190.颠倒二进制位.py
UTF-8
230
2.703125
3
[]
no_license
# # @lc app=leetcode.cn id=190 lang=python3 # # [190] 颠倒二进制位 # # @lc code=start class Solution: def reverseBits(self, n: int) -> int: return int(str(bin(n))[2:].zfill(32)[::-1],2) # @lc code=end
true
88c3e8832fdf0b384f6b9e4ba5831fbf413c7500
Aasthaengg/IBMdataset
/Python_codes/p03600/s201106971.py
UTF-8
1,312
2.96875
3
[]
no_license
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def size(self, x): if self....
true
69533da6ac82426873ee9735eb3d06f0e46dfa1d
nameisdheeraj/BlackJack
/Black Jack.py
UTF-8
2,796
3.6875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Oct 18 22:09:52 2019 @author: Dheeraj """ import random dealer_cards = [] player_cards = [] while len(dealer_cards) < 2: dealer_cards.append(random.randint(1,11)) if len(dealer_cards) == 2: print("Dealer has X &", dealer_cards[1]) while le...
true
dcfc5454077211484ab45cff293a2a7a6b8084d9
Ivanlasich/algoritms
/algoritms/week2_algorithmic_warmup/4_least_common_multiple/lcm.py
UTF-8
375
3.140625
3
[]
no_license
# Uses python3 import sys def gcd_naive_fast(a, b): if (a < b): d = a a = b b = d if b == 0: return a d = a % b return gcd_naive_fast(d, b) if __name__ == "__main__": a, b = map(int, input().split()) c = gcd_naive_fast(a, b) if (a < b): d = a ...
true
7f8a57e39115b91958a0b69deb642f87f5976b68
mattsfowler/Dataset-Visualisation-Dissertation
/python/K-Means/clusterdata.py
UTF-8
2,142
3.359375
3
[]
no_license
import os import json import csv from kmeans import kmeans from readcsv import read_and_normalise_csv def load_params(param_path): params = None with open(param_path, 'r') as pfile: params = json.loads(pfile.read()) print(params[0]) params[2] = int(params[2]) #index col params[3] = int(par...
true
d15aed337d975d3d5c3dc08c117d78d203802dac
Dawidsoni/ai-cars
/game_won_state.py
UTF-8
272
2.59375
3
[]
no_license
class GameWonState: def __init__(self, board, car_state, board_progress): self.board = board self.prev_car_state = self.car_state = car_state self.board_progress = board_progress def with_move(self, _game_move_type): return self
true
a9bdd86c3b482253020f553f3e68b85942ed8cb4
ParzivalMarcos/Curso_Mestres_Automacao
/mestre_web/interagindo_c_dropdowns.py
UTF-8
1,034
3.15625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.select import Select from time import sleep class Automacao: def __init__(self): chrome_options = Options() chrome_options.add_argument('--lang=pt-BR') self.driver = webdriv...
true
29077c28e0aad4b917171ebf415bc7cf013ddf49
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/2686.py
UTF-8
3,266
3.03125
3
[]
no_license
#!/usr/bin/python import glob import sys import os import re import filecmp import time def main (): # Get the name (sans extension) of the app, # which is also the name of the data. app = sys . argv [0] app = re . sub (r"^(.+)\.py$", r"\1", app) # For each input file of the same name as the app: ...
true