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
331da208a40acbc2bf6cee1942cf4499608b9839
luckyLXF/Google-PageRank
/Page_rank.py
UTF-8
3,665
3.125
3
[]
no_license
from __future__ import division import numpy as np import matplotlib.pyplot as plt import operator relation_matrix = np.loadtxt("result_matrix.txt") page_num = 500 #处理的页面数 default_a = 0.85 #默认阻尼系数 0.85 def show_picture(): ''' 展示页面链接稀疏图 :return: ''' print('[+] NOW CREATING PICTUR...
true
be36a1fdc00f4c843cd713f2dc8db514ea0ca7ff
bellyfat/COLDBREW
/control.py
UTF-8
1,419
3.0625
3
[]
no_license
from os import listdir from os.path import isfile, join def get_host_info(): hosts = [f for f in listdir("cmds") if isfile(join("cmds", f))] return hosts def main(): escape = 0 command = '' host_num = 1 host_list = get_host_info() while escape == 0: print("Av...
true
d4c14032dbd62eac77edabf4b404fa1b07a66fad
lyndonhe666/Learn_python
/basic/领主游戏_何凌天.py
UTF-8
6,254
3.40625
3
[]
no_license
import random import os import time class Forest: def __init__(self, number, animal): self.number = number self.animal = animal class Soldier: def __init__(self, name): self.name=name def heal(self, hp): self.current_life+=hp if self.current_life > self.max_life: ...
true
1f8b820852525d193c70dc7019cd8d960275bc37
deesaw/PythonD-06
/Modules/os/dirwalk.py
UTF-8
176
2.796875
3
[]
no_license
import os for (dirname, subdir, files) in os.walk('c:\\'): for myfile in files: filename=os.path.join(dirname,myfile) if filename.endswith(".txt"): print(filename)
true
988376af583a4d5ed94bf4e333b2befababa27b5
wong-justin/melee-bot
/livemelee/utils.py
UTF-8
3,929
3.25
3
[ "MIT" ]
permissive
'''Group of functions returning helpful stats, mainly info from gamestates. Two kinds of gamestate functions: conditions returning bools, and pretty printers returning strings. Also included is a controller state wrapper: `loggable_controller()`. These would be nice additions to the libmelee package, but we ...
true
9ac2ddba39782087c8d47b1773d50bc1b9cf4489
existentielisteprogrammer/python
/suitegeometrique.py
UTF-8
109
3.140625
3
[]
no_license
n = 0 def u(n): u = [3.5/128] for n in range(20): s = 3.5/128 * 2**n u.append(s) print(u) u(n)
true
ad21b92116d08a9b1dbab08a5dde158fddec5c3e
junanyeap/myLeetcode
/7ReverseInteger.py
UTF-8
419
3.734375
4
[]
no_license
def reverse(x: int) -> int: if x > 0: # handle positive numbers a = int(str(x)[::-1]) if x <=0: # handle negative numbers a = -1 * int(str(x*-1)[::-1]) # handle 32 bit overflow mina = -2**31 maxa = 2**31 - 1 if a not in range(mina, maxa): return 0 ...
true
e930720389fee0d2421fab24fd2eda6bc9d6c06d
GabrielEstevam/icpc_contest_training
/uri/uri_python/iniciante/p1154.py
UTF-8
156
3.328125
3
[]
no_license
n = int(input()) soma = 0 i = 0 while n >= 0: i += 1 soma += n n = int(input()) if i > 0: print("{0:.2f}".format(soma/i)) else: print(0)
true
f9e7613b2a4df45e2ac35da38fc10df9183344e2
perhansson/zeromq
/examples/zmqHelloClient.py
UTF-8
476
2.90625
3
[]
no_license
# # Example of zmq client in python # # # import zmq context = zmq.Context() socket = context.socket(zmq.REQ) socket.connect("tcp://localhost:5555") for req in range(10): print("Sending req %s " % req) # bytes #socket.send(b"Hello") # unicode socket.send_string("Hello") # bytes #server...
true
b762d95b9da37cde62ce35199b865f7f1e1a9fa8
Danis98/AdventOfCode2018
/day25/part1.py
UTF-8
867
3.171875
3
[]
no_license
points = [list(map(lambda x: int(x), e.split(','))) for e in open('day25.input').read().strip().split()] def manhattan(p1, p2): return sum([abs(p1[i]-p2[i]) for i in [0, 1, 2, 3]]) class disjoint_set: def __init__(self, n): self.par = [i for i in range(n)] def get_par(self, n): if n == se...
true
8f1b56ad7d3b852a9a3a3699aaa98c79b26514ac
sauravsagar19/PYTHON-PROGRAMMING
/3_1.py
UTF-8
100
2.8125
3
[]
no_license
fhand=open("raja.txt") count=0 for line in fhand: count=count+1 print("line count:",count)
true
0657453efd530a670e4f08801e3bc3c5e6823113
LaZyRaifur/URI-Problem-solving
/uri1012.py
UTF-8
401
3.59375
4
[]
no_license
A, B, C = input().split() triangle = (1 / 2) * (float(A) * float(C)) print("TRIANGULO: %0.3f" % triangle) circle = 3.14159 * (float(C) * float(C)) print("CIRCULO: %0.3f" % circle) trapezium = ((float(A) + float(B)) / 2) * float(C) print("TRAPEZIO: %0.3f" % trapezium) square = float(B) * float(B) print("QUADRADO: %0.3f"...
true
569aef2f5f1661c2eb5f5ed84e5a2b7109aba715
sadscv/zhihu_ksb
/load.py
UTF-8
1,291
2.53125
3
[]
no_license
import pandas as pd #返回char_embedding.txt的dataframe def load_char_embedding(): header_list=['char'] for i in range(1,257,1): header_list.append(str(i)) data=pd.read_csv("./data/char_embedding.txt",header=None,names=header_list,delim_whitespace=True,skipinitialspace=True,skiprows=1) return data ...
true
c9285dd99b4a750af109678135967509842895f7
ggplot123/Py100-2017q1
/kdheard/Week 4/file_lab.py
UTF-8
212
2.59375
3
[]
no_license
from os import listdir def main(start_path): files = listdir(start_path) for x in files: print(x) if __name__ == "__main__": main('/home/vagrant/Documents/Py100/Py100-2017q1/kdheard/Week 4')
true
d58487ef50e669e1d63174688e2d3816fc632047
sosotaoge/Python_Learning
/List_Overlap_Comprehensions_Solution.py
UTF-8
231
2.9375
3
[ "MIT" ]
permissive
import random list1 = random.sample(range(100), random.randint(5, 20)) list2 = random.sample(range(100), random.randint(5, 20)) d = [i for i in list1 if i in list2] d2 = [i for i in list1 if list1.count(i) == 1] print d2
true
621270476173f285e39070fd05df694030912544
DravenShadow/CNS_Assignment_2
/sniffer.py
UTF-8
3,604
3
3
[]
no_license
""" Author: Rowland DePree sniffer.py This is a program designed as an packet sniffer. It will decode all incoming traffic as well as alert the user if the packet is using an port that is marked as dangerous. The original idea for this code came from Black Hat Python by J...
true
7e46d679a9c4af1079ab2020667fd128fdcecc57
lj960912/pythonlx
/day717/day7-17.py
UTF-8
1,754
3.59375
4
[]
no_license
m, y = eval(input("输入一个90年后的年份和日期:")) sumdays = 0 #1990-1-1到y-m-1号有多少天 for i in range(1990,y): if (i % 4 == 0 and i % 100 != 0) or (i % 400 == 0): sumdays += 366 else: sumdays += 365 for i in range(1,m): if i == 1 or i == 3 or i == 5 or \ i == 7 or i == 8 or i == 10 or i == 12: sumdays += 31 elif i == 4 ...
true
917e319665d039f15eddc2857db386b87d1da0aa
TanguyHardelin/QuickDrawRecognition
/utils/decrypt_command_line.py
UTF-8
268
3
3
[]
no_license
def decrypt_command_line(sys_argv): command = {} for i in range(len(sys_argv)): if(sys_argv[i][0]=='-' and sys_argv[i][1]=='-' and i+1<len(sys_argv)): command[sys_argv[i]] = sys_argv[i+1] return command
true
84885bea5d8daa854f967dcc55b73f0b9bbfeb2b
scott-strickland/python3
/vlan-info.py
UTF-8
2,329
3.21875
3
[]
no_license
#!/usr/bin/env python3 # CLEAN UP REMARKS AND REFACTOR CODE. """ This file parses through a VLAN report provided from Solar Winds that provides a list of every VLAN in an enterprise, then creates a folder for each location based on the first 4 characters of the NODE_NAME. In this folder, a CSV is created for ea...
true
41a767d279f2805e5576c36fc68893bba84db0f0
leroyshirto/cookiecutter-flask-restful-docker
/{{cookiecutter.project_name}}/{{cookiecutter.app_name}}/helpers/env.py
UTF-8
754
3.234375
3
[ "MIT" ]
permissive
"""Simple helper to read environment variables """ import os class Env: @staticmethod def env(variable_name, default=None): if default: return os.environ.get(variable_name, default=str(default)) else: return os.environ.get(variable_name) @staticmethod def ...
true
0b3242f0157ee22c7584254c6f51b9cef14f43b1
Priyanka140993/python_self
/for_range.py
UTF-8
148
3.4375
3
[]
no_license
if __name__ == '__main__': n = int(raw_input()) try: n=int(n) except: print('Invalid input') for i in range(n): print(i**2)
true
04c21bba9be503179c0d38ea915d2be6026e5302
jkrauska/leaguebot
/faceoffs.py
UTF-8
1,640
3.59375
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 from collections import deque from itertools import islice # Round robin scheduling # https://stackoverflow.com/questions/32358841/grouping-list-combinations-for-round-robin-tournament # itertools.combinations returns the right set of matchups, but in a unusable order def fixtures(teams): #...
true
7fb70cf677782bc296a5cc097eb384b9ba3b26e0
MaxLukinDS/Marketing-Analytics-with-Python
/C6/main_code.py
UTF-8
6,276
2.84375
3
[]
no_license
import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import numpy as np from sklearn import metrics from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.model_selection import Randomi...
true
9c9d6bb9c51ca0686ee0ec0a590e23f64312765f
JPMike/byte-of-python
/exceptions_handle.py
UTF-8
238
3.390625
3
[]
no_license
#-*-coding:utf-8-*- try: text = input('Enter somethin-->') except EOFError: print('Why did you do an EOF on me ?') except KeyboardInterrupt: print('You cancelled the operation.') else: print('You entered {}'.format(text))
true
cb9c7aff613bdd5fd975e1ff9903da7aeace9e01
crushyna/python_neo4j_projekt
/src/input_check.py
UTF-8
4,139
3.34375
3
[]
no_license
import time class InputChecks: """ this might be turned into decorators, but imho its FUBAR so for now, those are basic static methods """ @staticmethod def checkBaseName(list): while True: try: print(list) value = input("Base name: ") ...
true
56874f7fe3af56cfa51120a1343c095d4b0a1876
longbowapache/FileOrganizer
/fileorganizer/action.py
UTF-8
1,100
2.84375
3
[]
no_license
import logging import os import shutil from abc import ABCMeta, abstractmethod from pathlib import Path from fileorganizer.file import File from fileorganizer.util import osx_notify class Action(metaclass=ABCMeta): @abstractmethod def do(self, file): pass class MoveTo(Action): def __init__(self...
true
b5277c45ba7eefa88256ec3aa9ce8f1a46220a24
sondrt/FYS-STK4155
/Project3/MC_done.py
UTF-8
3,761
2.953125
3
[]
no_license
#MonteCarloSIRS_vitaldynamics_SeasonalVariation.py from numpy import * from matplotlib.pyplot import * import random import statistics #a = 4 # infection rate b = 1 # recovery rate c = 0.5 # immunity lose d = 0.0002 # death rate d1 = 0.0004 # death rate of infected e = 0.0006 # birth rate f = 40 # Vacc...
true
5b6ba50cb09df4fb9fc0ad2d3231f97c94965667
953250587/leetcode-python
/MinimumCostToHireKWorkers_HARD_857.py
UTF-8
2,715
4
4
[]
no_license
""" There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now we want to hire exactly K workers to form a paid group. When hiring a group of K workers, we must pay them according to the following rules: Every worker in the paid group should be paid in the ratio of their quali...
true
9a6f53c6910e1b15ed8a468474073ca17c8b844f
BigDeviltjj/mxnet-cornernet
/utils/metric.py
UTF-8
612
2.546875
3
[]
no_license
import mxnet as mx import numpy as np class CornerNetMetric(mx.metric.EvalMetric): def __init__(self): super(CornerNetMetric, self).__init__('CornerNet') self.name = ['Loss'] self.reset() def reset(self): self.num_inst = 0. self.sum_metric = 0. def update(self,...
true
84384297ee4c439bce4bc21225dc13377c257d06
Damnam/codecademyprointensive
/Sal_Shipping.py
UTF-8
1,400
3.6875
4
[]
no_license
def ground_shipping(weight): cost = 0 if (weight <= 2): cost = weight * 1.50 + 20.0 return cost elif (weight >2) and (weight<=6): cost = weight * 3.0 + 20.0 return cost elif (weight>6) and (weight<=10): cost = weight * 4.0 + 20.0 return cost else: cost = weight * 4.75 + 20.0 r...
true
372d8a050903b35bef62499e92ad47c61f7cded9
isabella232/qosa-snee
/scripts/lib/Energy.py
UTF-8
6,857
2.546875
3
[ "BSD-3-Clause" ]
permissive
import os, re cpu = "x" active = "0" idle ="0" adc = "0" ps = "0" es = "0" radio ="0" off ="0" down ="0" crys ="0" cb ="0" rx ="0" tx ="0" activeC = "0" idleC ="0" adcC = "0" psC = "0" esC = "0" offC ="0" downC ="0" crysC ="0" cbC ="0" rxC ="0" txC ="0" logger = None #Registers a logger for this library def register...
true
d9211e621f3f8c9af1404fd4a9eea1b3f37e67c4
CerjioNava/Python_ZTM
/Fundamental/Decorators/Decorators.py
UTF-8
2,848
4.90625
5
[]
no_license
#DECORATORS #Se declaran con '@' y sobrecargan las funciones para darle funcionalidad extra. #Son funciones que 'envuelven (wrap)' otra función y la mejora. #EXTRA: Las funciones ocupan espacio en la memoria como las variables def hello(): print ('helloooo') greet = hello #Podemos asignar una función a otra. prin...
true
a6f3b9c7bd083060e91a5847562e2bb719e8844c
Jeniamakarchik/ML_2_part
/HW_3/SGD/script.py
UTF-8
3,119
3
3
[]
no_license
import numpy as np import pandas as pd from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.model_selection import cross_validate, StratifiedKFold, GridSearchCV from random import randint param_grid = { 'learning_rate': [0.1, 0.05, 0.01, 0.005, 0.001], 'n_iter': [100, 200, 500, 1000, 2000, 30...
true
417c9203c280003a47f6cae1d27f8f9055692727
Haleemah31/first_repo
/numbers.py
UTF-8
627
3.546875
4
[]
no_license
# for i in range (10): # print (i*10) # for i in range (10): # print (i) # for i in range (100, 2100, 100): # print (i) # for i in range (20,520, 20) # print (i, i/2, i/2/2, i/2/2/5),20): # for i in range (8): # print (i, abs(i-8)) # IMPORT TIME # import time # for i in range (60): # time...
true
7331faaf102347b2972e9f6bc5d836ba7dea3278
suryaaathhi/guvi-program
/minus.py
UTF-8
141
2.890625
3
[]
no_license
t1=list(map(int,input().split())) t2=list(map(int,input().split())) tm1=t1[0] tm2=t2[0] mi1=t1[1] mi2=t2[1] print(abs(tm1-tm2),abs(mi1-mi2))
true
b00952c8aeefd97247c2561fe0a2fcf76d2a42d3
oggong/python_study
/aBasic/aBaisc/c_module_class/example1.py
UTF-8
2,306
3.78125
4
[]
no_license
# 1. 패키지(packages)에 대한 설명 중 틀린것은? # # ① 다양한 모듈의 합으로 디렉터리로 연결된다. # ② 하나의 대형 프로젝트를 만드는 코드의 묶음이다. # ③ 개별 .py 파일을 의미한다. # ④ 다양한 오픈소스들이 관리되는 방법이다. # ⑤ _ _init_ _, _ _main_ _ 등키워드 파일명이 사용된다. # 답 3 # 2. ‘game’이라는 패키지를 만들고 싶다고 가정하자. # 패키지를만들기 위해 디렉터리별로 필요한 모듈을 구현하고자 한다. 다음 그림에서 빈칸에 들어가야 할 파일은? # ➀ __main__ ➁import game ➂ __...
true
266b00821036b8f09c07f6124a5720917cd923f1
karimsoft/Disaster-Response-Pipelines
/models/train_classifier.py
UTF-8
8,737
2.953125
3
[]
no_license
""" Train Classifier Script For Udacity Data Scientist Nanodegree Program Project: Disaster Response Pipeline Usage: > python train_classifier.py ../data/DisasterResponse.db classifier.pkl Arguments: 1) Input File 1: DisasterResponse_Processed.db - SQLite database 2) Input File 2: ML Model ...
true
dbc3c22057bcd2f4c53c2a2e23f708934243c8df
ammeyjohn/brain
/dataset.py
UTF-8
1,473
2.796875
3
[]
no_license
import os import numpy as np import tensorflow as tf def _parse(example, image_shape, use_one_hot, num_classes): feature = { 'image/encoded': tf.FixedLenFeature([], tf.string), 'image/class/label': tf.FixedLenFeature([], tf.int64), 'image/class/text': tf.FixedLenFeature([], tf.string) }...
true
97c918730f5b0e7d2dd2d52bd7fb7d50a79859f8
zhengxxn/NMT
/src/module/adapter/mixture_of_adapter_with_classifier.py
UTF-8
7,393
2.546875
3
[]
no_license
import torch.nn as nn import torch from module.adapter.feedforward_adapter_layer import FeedForwardAdapterLayer from module.sublayer_connection.sublayer_connection import SublayerConnection class MixtureOfAdapterWithClassifier(nn.Module): def __init__(self, adapter_type, domain_...
true
ee37a53b2c35da95b664d86f36a5b380b48227ca
LID-DS/Demo
/Backend/data_handling.py
UTF-8
9,734
2.578125
3
[ "BSD-3-Clause" ]
permissive
import collections import operator from demo_model_stide import DemoModelStide MAX_BUCKETS = 1 INITIAL_TRAINING_SIZE = 10000000 MAX_TOP_NGRAMS = 10 ALARM_THRESHOLD = 0.05 class DataHandling: def __init__(self): """ Initialization of DataHandling In charge of: calculat...
true
0c340d9944d17815942372f67915a78e0fe8261c
Vlmas/WebDev
/Week9/informatics/c/e1.py
UTF-8
81
2.96875
3
[]
no_license
x = int(input()) sums = 0 for i in x.__str__(): sums += int(i) print(sums)
true
2d876fc653855a4541fe38b20bc90b174ff33103
Empire-of-Code-Puzzles/checkio-empire-playfair-cipher
/verification/src/tests.py
UTF-8
5,707
3.03125
3
[ "MIT" ]
permissive
TESTS = { "Rank_01": [ {"input": ["Fizz Buzz is x89 XX.", "checkio101"], "answer": "do2y7mt22kry94y2y2", "function_name": "encode"}, {"input": ["do2y7mt22kry94y2y2", "checkio101"], "answer": "fizxzbuzzisx89xzxz", "function_name": "decode"}, {"input": ["Ho...
true
6ea15d023112435e8cf09eb06786e5646d666c43
spiderpres/Pirates-Game
/components/ShipClass.py
UTF-8
6,287
3.1875
3
[]
no_license
import pygame, components.common, components.HealthBar from components.HealthBar import HealthBar from components.common import coordToPixel, findDistance class Ship(): #how to rotate an image #schSpriteRight = pygame.transform.rotate(schSprite, 90) def __init__(self, ship, pos): self.type = sh...
true
b858ae2cc8b42a0cd98739a2853d2768c191d446
saulshanabrook/congressional-text-reuse
/demos_wilkerson/matrix_maker.py
UTF-8
2,426
3.03125
3
[]
no_license
import glob import numpy as np from datetime import datetime import re import ipdb files = glob.glob("*txt") mo_mapper = {"oct": 10, "july": 7, "dec": 12, "june": 6, "mar": 3, "sep": 9} def find_ngrams(input_list, n): return zip(*[input_list[i:] for i in range(n)]) def vocab(input_dict): '''numberize''' ...
true
1daac3d32903c3a56cdb86a2575b2b506848e9be
ChiShao/cnn-auto-encoder
/experimental_scripts/gaussian_distribution.py
UTF-8
2,253
2.921875
3
[]
no_license
import numpy as np from keras.utils import to_categorical from keras.datasets import mnist def get_data(train_split=.7, test_split=.85): """retrieves data MNIST data set and rebalances dataset, such that train=.7, test=.15 and validation=.15""" (X_train, y_train), (X_test, y_test) = mnist.load_data() X_...
true
dcfa05257837279ee2c9ca3224d05a7cc8f0982e
ulrichji/HeightmapTileMaker
/heightmaptilemaker/mesh/heightmap_mesh.py
UTF-8
1,666
2.765625
3
[ "MIT" ]
permissive
from . import mesh import numpy as np class HeightmapMesh(mesh.Mesh): def __init__(self, heightmap, pixel_size): super(HeightmapMesh, self).__init__() mesh_width = heightmap.getWidth() * pixel_size mesh_height = heightmap.getHeight() * pixel_size mesh_vertices = self._createMeshV...
true
353bd4aed6255bde32cd79dc966180870e916ebb
sbodenstein/covid19_datasets
/age/data/load/utils.py
UTF-8
633
3.109375
3
[ "MIT", "CC-BY-4.0" ]
permissive
import pandas as pd import datetime def map_age(age): """Map ages to standard buckets.""" try: age = int(age) if age >= 90: return '90+' lower = (age // 10) * 10 upper = age+9 if age % 10 == 0 else ((age + 9) // 10) * 10 - 1 return f'{lower}-{upper}' ex...
true
4f95980243c55010c7b50b3fddf638f40cd20fc5
riverbed/Riverbed-Community-Toolkit
/AppResponse/Ansible-101-Playbook/modules/host_group_upload.py
UTF-8
3,290
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2021 Riverbed Technology Inc. # The MIT License (MIT) (see https://opensource.org/licenses/MIT) DOCUMENTATION = """ --- module: host_group_upload short_description: Upload a file with hostgroups to Riverbed AppResponse appliance options: host: ...
true
1b165a1a2dfb996dfd09cb02521fea9c96a54dc7
bghanchi/Hackerrank-Practice-Problem
/complex.py
UTF-8
164
2.984375
3
[]
no_license
from cmath import polar r = complex(input()) print(polar(r)[0]) print(polar(r)[1]) ''' from cmath import phase z=complex(input()) print(abs(z)) print(phase(z)) '''
true
991de32f7827fce1d33a984e74a6b76f0a5eaacf
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_201/1862.py
UTF-8
888
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 9 00:32:09 2017 @author: Billoier """ T = list(); from math import * def Get_Ans(key): if(key & 1): return key>>1,key>>1; else: return (key>>1)-1,key>>1; if __name__=='__main__': Test_Num = int(input().strip()); for i in range(Test_Num): lin...
true
a5586eb1bf82fe25da5685251a1fa60b2f62b3ab
alezenonos/Tube.Server
/src/test_uploader/receive_check_ins.py
UTF-8
2,408
2.625
3
[]
no_license
from data.check_in_db import check_in_db from data.check_in_db import check_in_db_key from data.strings import tube_line_arrays from data.strings import tube_lines from datetime import datetime import logging def add_to_check_in_db(self, user_id, check_in): "retreives the stored information and places it in the da...
true
77754b49e805351f90d50c71f51183ee36ba6f8f
webclinic017/la_proj
/src/la_proj/data/main.py
UTF-8
3,846
2.515625
3
[]
no_license
#! /usr/bin/env python from la_proj.settings import WS_ENDPOINT, WS_SESSION_HEADER, logger from la_proj.data.decoder import to_native from la_proj.data.storage import update_minute_price from la_proj.storage import get_symbols from datetime import datetime import argparse import asyncio import signal import random impo...
true
e4324e315a534b2b3ff1f28bd48a2862f06f7130
christinazavou/pointnet
/MyPointNet/tests/test_loss.py
UTF-8
2,609
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from src.train.loss import ClassificationLossCalculator import tensorflow.compat.v1 as tf tf.disable_v2_behavior() from unittest import TestCase class TestClassificationLossCalculator(TestCase): def setUp(self): self.config = tf.ConfigProto() self.config.gpu_options.allow_growth = True ...
true
e4be19c355125f5403a4e83873ffed4917ae1b89
saurabhagrawal0412/recommendation_engine
/neighbor_selection.py
UTF-8
2,768
3.890625
4
[]
no_license
# Contains the various methods to select (nearest) neighbors for a user/item import math from sorted_list import SortedList def perform_top_n_filtering(similarity_df, n): """Finds the n most similar user/item, and returns it in the form of a list of tuples :param similarity_df: Pandas dataframe representing ...
true
2267258fa30c2e8f73334a797e6325b1340d67ff
huikyole/pytaf
/examples/AF/modis2ug.py
UTF-8
3,192
2.75
3
[ "Apache-2.0" ]
permissive
""" This example code illustrates how to access and reproject a TerraFusion Advanced Fusion file in Python. Usage: save this script and run $python modis2ug.py The HDF file must be in your current working directory. Tested under: Python 3.6.6 :: Anaconda custom (64-bit) Last updated: 2019-04-03 """ import h5py...
true
6ec78e793be32bee1915b40e99fb5043909cbbf6
bmmtstb/adventofcode
/2022/Day25.py
UTF-8
3,829
3.25
3
[]
no_license
import unittest import math from typing import Dict, List, Tuple, Set from helper.file import read_lines_as_list SYMBOL_CONVERSION: Dict[str, int] = { "0": 0, "1": 1, "2": 2, "-": -1, "=": -2, } DEC_CONVERSION: Dict[int, str] = { 0: "0", 1: "1", 2: "2", -1: "-", -2: "=", } d...
true
624ff856c7f33abd297e4fe50bbb91143f0dc4ce
jeffb4real/SLHPA-Web-App
/utilities/regex_tester.py
UTF-8
671
3.65625
4
[ "MIT" ]
permissive
import re pattern = r'\D(\d\d\d\d)\D' pattern = r'^\D*(\d\d\d\d)*\D*$' pattern = r'^|\D(\d\d\d\d)\D|$' pattern = r'\D*(\d\d\d\d)\D*' # works 2nd best for finding year(s) pattern = r'\b(\d\d\d\d)\b' # works best for finding year(s) pattern = r'[\.\?\!][\"\'\)\s]*$' # does string have ending punctuation ...
true
db2bb3b758411c5abfd610163f3cbe2e65bacf7e
nebffa/project-euler
/python/59.py
UTF-8
972
3.0625
3
[]
no_license
import itertools, time, csv t = time.time() with open("cipher1.txt", 'rb') as f: encrypted = csv.reader(f, delimiter = ',').next() passwords = list(itertools.product('abcdefghijklmnopqrstuvwxyz', repeat = 3)) for password in passwords: n = 0 decrypted = [] for i in range(...
true
7b9df35b67745d3a353872a6b6c0c03f10386722
Sadac/python-webscraping
/fundamentals/app.py
UTF-8
1,767
3.640625
4
[]
no_license
from lxml import etree # convert the file to a tree element and assign that to the tree variable tree = etree.parse('fundamentals/src/web_page.html') # print(etree.tostring(tree)) # print it as a string # get the title element. The first in tree will be at html tag inside level # title_element = tree.find("head/title...
true
a27973e8d81a3baf3eb28fdc6a19197cce0a13ea
nati-elmaliach/AverageStockPriceScript
/Api.py
UTF-8
568
2.703125
3
[]
no_license
import requests as req # Why should we declare the key in here? headers = {'Content-Type': 'application/json'} api_key = "Your api key in here" # validate the response was 200 OK def validate_response(response): print(response) if response.status_code == 404: return None return response.json() ...
true
584a03565249c94a33ec53c2ca39fb7e4132943a
yusuke-matsunaga/afsyn
/py-src/afsyn/unit.py
UTF-8
31,738
2.703125
3
[]
no_license
#! /usr/bin/env python3 ### @file unit.py ### @brief Unit の定義ファイル ### @author Yusuke Matsunaga (松永 裕介) ### ### Copyright (C) 2020 Yusuke Matsunaga ### All rights reserved. import sys debug_out = None ### @brief セレクタの仕様を表すクラス class MuxSpec : ### @brief 初期化 def __init__(self) : self.__src_cond_dict =...
true
21c0bc94258bd8fc784ed9c1ace3e9dc0ab5f774
Bondarev2020/infa_2019_Bondarev2020
/turtle3.py
UTF-8
439
3.546875
4
[]
no_license
import turtle def nugolnik(x, shag, ugol): for i in range(x): turtle.forward(shag) turtle.left(ugol) def otstup(): turtle.penup() turtle.left(180) turtle.forward(a/2) turtle.left(90) turtle.forward(a/2) turtle.left(90) turtle.pendown() turtle.shape('tur...
true
5971e6c0b6a2138325c5ea89ff12ef670ac638d6
Aasthaengg/IBMdataset
/Python_codes/p02845/s382262690.py
UTF-8
468
2.53125
3
[]
no_license
N = int(input()) a = list(map(int,input().split())) dp = [[-1,-1,-1,1] for _ in range(N+1)] for i in range(N): check = dp[i][:3] pattern = check.count(a[i]-1) dp[i+1][3] *= dp[i][3]*pattern dp[i+1][3] = dp[i+1][3]%1000000007 for k in range(3): dp[i+1][k]= dp[i][k] if dp[i][0]== a[i]-1: ...
true
3235e15968963b8963887d98b0ec4f863593fd4e
RedheatWei/python-study
/实验/9章/例题/9-3文件信息.py
UTF-8
207
2.734375
3
[]
no_license
#!/usr/bin/env python #_*_ coding:utf-8 _*_ ''' Created on 2015��3��11�� @author: Redheat ''' file_name = raw_input('Enter an absolute path:') f = file(file_name) print len([line for line in f])
true
fc245ad1f34acd59739529a7bf0e8af32634c958
Sulfang/stepik
/stepik2/2-2 step 3.py
UTF-8
562
2.84375
3
[]
no_license
from datetime import time from selenium import webdriver from selenium.webdriver.support.select import Select browser = webdriver.Chrome() link = "http://suninjuly.github.io/selects2.html" browser.get(link) num1 = browser.find_element_by_css_selector("#num1").text num2 = browser.find_element_by_css_selector('#num2...
true
8223b7270f735f849afed1fa4fd3bd7213e1313a
sweetjohn33/Schmacc
/Objects/Effects.py
UTF-8
3,814
3.078125
3
[]
no_license
class Effect: # This class holds the effects of all the creatures, buildings, and spells def __init__(self, function, target=[], mandatory=False, aftereffect=None, trigger=[], conditions=None): """ :param target: :param function: :param aftereffect: :param trigger: ...
true
9896f5606a0575e3b6bab833a37bcd5a0ed3d9a3
AlexChiang0208/Futures-Tidy-the-TickData
/分別資料處理.py
UTF-8
5,699
3.125
3
[]
no_license
### 整理成交資料 ### %reset -f import pandas as pd import glob # use your path of 成交檔(事先刪除夜盤資料) path = "/Users/alex_chiang/Documents/Fin_tech/201909_期交所_期貨練習/成交檔/" files = sorted(glob.glob(path + "/*.txt")) # 合併很多個 txt 檔 data = pd.DataFrame() for i in files: temp = pd.read_csv(i, delimiter = "\t", header=None) da...
true
f158e74ca93bf29e78f2b1e0f407f71d1b5c0d33
ronmarian7/Moodle-web-scraping-
/moodleScraper.py
UTF-8
8,930
2.546875
3
[]
no_license
import os import os.path from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait import csv import smtplib from email.message import EmailMessage from googleapiclient.discovery i...
true
8a341ac019989fc7e65d6cd47ed305ff9141439d
AdamSwenson/CalendarFileMaker
/CalendarHelpers/FileSystemTools.py
UTF-8
640
3.09375
3
[]
no_license
""" Created by adam on 8/24/18 """ import os __author__ = 'adam' def makeDataFileIterator(folderPath, exclude=[]): """ Returns an iterator of all files in the source directory so that each file has its path appended to it. Args: folderPath: The path to get file names from exclude: fi...
true
7315bef2abf64a11e49702e1617a51b6b144e62f
ssquires/naive_bayes_classifier
/naive_bayes_classifier.py
UTF-8
3,441
3.71875
4
[]
no_license
""" Implementation of a Naive Bayes Classifier for numeric features. """ import math from typing import Tuple import pandas as pd from scipy.stats import norm class NaiveBayesClassifier: """Naive Bayes Classifier implementation. Uses a normal distribution to model each class-conditional distribution. ...
true
767933336738a5328a14403487a82b60328f2223
MohammadQu/demo
/Homework2/Hw2_6.22.py
UTF-8
730
3.484375
3
[]
no_license
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. first_x = int(input()) first_y = int(input()) first_ans = int(input()) sec_x = int(input()) sec_y = int(input()) sec_ans = int(inpu...
true
d70678f6168721ed82658f24baf84e288e420911
Leghart/Modeling-and-identification
/lab6/lab6.py
UTF-8
5,148
3.046875
3
[]
no_license
import matplotlib.pyplot as plt import random as rand from numpy import random import numpy as np import math import time from scipy import integrate def gen_roz(fun,N,a,b): x=np.arange(a,b,0.001) # wektor próbek nosnika y=np.zeros(len(x)) # obliczenie wartosci funkcji w punktach z nosnika for i in r...
true
5468f25e243f4e4ef9c55c15abdbc72a0ea11fa3
tnyo43/PRMLstudy
/ss2/BayesianInference.py
UTF-8
3,090
3.125
3
[]
no_license
""" m勝n敗したときの勝率のベイズ推定 """ import sys from numpy import array from math import gamma from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * sys.path.append('../widgets') from MyQWidget import MyQWidget from GraphWindow import GraphWindow from SliderLabel import SliderLabel def p(beta, win...
true
27d0d9ffa882ea170a513dcf262bd859fa55dc1f
paragshah7/Python-CodingChallenges-LeetCode
/AlgoDSEducative/6_find_min_rotated.py
UTF-8
1,035
3.953125
4
[]
no_license
""" Find minimum element in a rotated sorted array https://www.educative.io/courses/algorithms-ds-interview/N0NK6kDPrrN """ from icecream import ic as print import time def find_min_rotated(arr): left = 0 right = len(arr) - 1 index = -1 # 1 element in array if len(arr) == 1: return 0 ...
true
cebbf7c0386acb8e1794577932d9ad81d245bb0a
August1s/LeetCode
/Dynamic Programming/No70爬楼梯.py
UTF-8
595
3.53125
4
[]
no_license
def climbStairs(n: int) -> int: #res = Rec_climbStairs(n) res = DP_climbStairs(3) return res # 递归解法,会超时 def Rec_climbStairs(n): if n == 0: return 0 elif n == 1: return 1 elif n == 2: return 2 else: return Rec_climbStairs(n-1) + Rec_climbStairs(n-2) # ...
true
084072212ad60e5ef37e70790c2fb5c14b85a00d
LeeWeiHan97/how-to-do
/models/scheduled_task.py
UTF-8
1,161
2.53125
3
[]
no_license
from models.base_model import BaseModel import peewee as pw from models.user import User from models.room import Room import datetime class Scheduled(BaseModel): name = pw.CharField(unique=False, null=False) date_time = pw.DateTimeField(null=False, unique=False) user_incharge = pw.ForeignKeyField(User, bac...
true
f3c648de3765c9f293ab98ea1a9b158f601f5896
saichaitanya278/pythonfull
/week1/1.py
UTF-8
930
3.25
3
[]
no_license
class Student: counter = 0 def init(self, id, f_name, l_name, course, year, gpa, university, email, mobile): self.id = id self.f_name = f_name self.l_name = l_name self.course = course self.year = year self.gpa = gpa self.university = university s...
true
1edc305954b0acbfd6fee9f8886e33ea25a512e0
colby-j-wise/QTRS
/src/strategy.py
UTF-8
870
2.734375
3
[]
no_license
#!/usr/bin/python3 from abc import ABCMeta, abstractmethod from eventhandler import SignalEvent import datetime import numpy as np import pandas as pandas import queue class Strategy(object): """ Strategy is an abstract base class providing an interface for all subsequent strategy handling objects. The goal of...
true
d37bb9085a6548d5c822635768c164ef6948349e
fm1ck3y/TinkoffInvestments
/tinkoff_api.py
UTF-8
2,351
2.609375
3
[]
no_license
from datetime import datetime import tinvest import os from utils import * from decimal import Decimal from pydantic import BaseModel,validator from typing import Optional from rich import print class Position(BaseModel): type: str name: str amount: int = 0 ticker : str = '' avg_buy : Optional[Deci...
true
898f168e74bdfa49d3821b7f0330935af5676031
codemirror/google-modes
/test/py/fstrings.py
UTF-8
1,656
2.84375
3
[ "MIT" ]
permissive
[comment # no replacements] [string f'foo bar'] [string f"foo bar"] [string f'''foo bar'''] [string f"""foo bar"""] [comment # TODO(slebedev): Multi-line strings don't work.] [comment # f- with other prefixes] [string fr'foo bar'] [string rfu'foo bar'] [comment # escaped replacement] [string f'foo {{ bar {{}} boo }}'...
true
95a4737a3efd46d77137bdab44a9881940070596
meyrelles/Arbitary
/exchanges/kraken.py
UTF-8
950
2.59375
3
[]
no_license
from decimal import Decimal from exchanges.base import Exchange from exchanges.helpers import get_response class Kraken(Exchange): TICKER_URL = 'https://api.kraken.com/0/public/Trades?pair=%s' DEPTH_URL = 'https://api.kraken.com/0/public/Depth?pair=%s' PAIR = '' @classmethod def init2(self, tur...
true
38662c481f382f29b5bdb1751ec8ef30a361f2c5
mdeutsch86/Serial_Communication
/simple_serial.py
UTF-8
901
3.125
3
[ "MIT" ]
permissive
import serial import sys def get_serial_ports(): """ Lists all available serial ports :return a list of all available serial ports """ ports = [] if sys.platform.startswith('win'): for p in ['COM{}'.format(e+1) for e in range(255)]: try: s=serial.Serial(p) ...
true
e3d1c827ad6c4531733b96a5d79d0a7cccd4985b
smohapatra1/scripting
/python/practice/day16/create_a_graph_task1.py
UTF-8
888
3.8125
4
[]
no_license
#!/usr/bin/python #Given a directed graph node (vertex), #return all the nodes' (vertices) key in an array by performing a breadth first search (BFS) traversal. #Assume that all nodes are reachable from the input node and the nodes' key is unique """ addEdge(0, 1, g); addEdge(0, 4, g); addEdge(1, 0, g); addEdge...
true
c3986fd7382b1c5b5abb261c3563a4a8136d55a1
MMyungji/Algorithm-solving
/sw expert academy/list/fill_colors.py
UTF-8
617
3.609375
4
[]
no_license
T = int(input()) for test_case in range(1, T + 1): case = int(input()) #집합 set: 중복X 순서X color = [set({}), set({})] for i in range(case): #띄어쓰기로 변수 나누어서 저장 x1,y1,x2,y2,c = map(int, input().split()) #print("{} {} {} {} {}".format(x1,y1,x2,y2,c)) #원소생성 for x in ...
true
e703aff82ed1fe466c036b989f181cbf419fcb36
MatthieuDartiailh/HQCMeas
/hqc_meas/instruments/manager/profile_form.py
UTF-8
4,081
2.625
3
[]
no_license
# -*- coding: utf-8 -*- # ============================================================================= # module : profile_form.py # author : Matthieu Dartiailh # license : MIT license # ============================================================================= """ """ from atom.api import (Atom, List, Str, Unicode...
true
eaebf2c8f1cc82e9e0b3dfba16d6b54df2798fa4
maaikegooderham/SYSC4907-AirSim
/SAVE-master/catkin_ws/src/lka/scripts/lane_detect.py
UTF-8
3,978
3.3125
3
[]
no_license
#!/usr/bin/env python import cv2 as cv import numpy as np import rospy # Canny edge detection with Hough transform provided by https://towardsdatascience.com/tutorial-build-a-lane-detector-679fd8953132#127c ============================================= def do_canny(frame): # Converts frame to grayscale because we...
true
b0ebcc9890ce7f8412673de9c2881c5e4634b47e
MastersAcademy/Programming-Basics
/homeworks/vladimir.nosach_vovcoolaka/homework-2/homework-2-nv.py
UTF-8
1,042
3.65625
4
[]
no_license
#head of request print("Please provide us with the following information") #body of request fullname = input("What is your full name?\n") country = input("What is your country of residence?\n") age = int(input("How old are You?\n")) email = input("What is your email address?\n") #result of request result = ("Your ...
true
c159b5cfe3f320ca6e709c7104c5a4373598619a
reiwo65/gipod2
/prog.py
UTF-8
427
3.25
3
[]
no_license
L=[10,12,17,19,20] Z=[] def maplist(listequelle, startwert, endwert): scale=abs((endwert-startwert)/(listequelle[-1:][0]-listequelle[0])) return scale print (L[-1:]) # liefert das letzte Element der Liste # VORSICHT das ist eine Liste mit nur einem Element print (L[-1:][0]) # liefert d...
true
f39a5dc1bb2b7afb639f0bbc310e8d31a7069ebe
anhnguyendepocen/python-notes
/_build/jupyter_execute/dplyr.py
UTF-8
2,470
3.234375
3
[]
no_license
# dplyr - Recommended Readings - [Python for Data Analysis](https://www.amazon.com/gp/product/1491957662/ref=as_li_tl_nodl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491957662&linkCode=as2&tag=ledoux-20&linkId=eff92247940c967299befaed855c580a) - [Python for Data Analysis GitHub](https://github.com/wesm/pyda...
true
113de1a5a8a00b58614a683fbb07ba6e8e8ddadd
luckmoon/TextGAN
/models/GumbelGAN_G.py
UTF-8
4,094
2.6875
3
[ "MIT" ]
permissive
import torch import torch.nn.functional as F import config as cfg from models.generator import LSTMGenerator class GumbelGAN_G(LSTMGenerator): def __init__(self, embedding_dim, hidden_dim, vocab_size, max_seq_len, padding_idx, gpu=False): super(GumbelGAN_G, self).__init__(embedding_dim, hidden_dim, vocab...
true
269b1139ad9b7dceec176540890ec47a175a76b7
mastertweed/Python
/LeetCode/Easy/7_ReverseInteger.py
UTF-8
767
3.09375
3
[]
no_license
class Solution: def reverse(self, x): nums = [char for char in "1234567890"] s1 = [char for char in str(x)] s2 = "" for i in range(len(s1)): if s1[i] not in nums: s2 = s1[i] s1[i] = "" s1.reverse() if s2 != "": ...
true
8b3891797a9627cc7752c72b71df21ce6988ee89
neilpretzel/Aptar
/Garbage/TempInitail.py
UTF-8
3,701
2.609375
3
[]
no_license
import time import sys import Adafruit_ADS1x15 import socket import logging import os from ISStreamer.Streamer import Streamer host = socket.gethostname() logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %I:%M:%S %p') logging.info('initialState in...
true
c06970df24e9df4ded732c1d52b5140f485ce0da
msraju2009/CodingProblemsPractice
/Arrays/container_with_most_water.py
UTF-8
417
3.234375
3
[]
no_license
# https://leetcode.com/problems/container-with-most-water/description/ class Solution(object): def maxArea(self, h): """ :type height: List[int] :rtype: int """ if not h: return 0 L, R = 0, len(h)-1 res = 0 while L < R: res = max(res, min(...
true
613fb52618e12b6958f2aa7263566db57d6d8874
shayroy/ChamplainVR
/Week 5/Class2/fizz_buzz_w_functions.py
UTF-8
1,143
4.5
4
[]
no_license
# what should be returned? The number and variable we are testing. # so the parameters should be 1 - num and 2 - test value # what should be returned? # True or False # if the remainder 0 return True else return False # functions need to go on top # in original the num % num == 0 is repeated four times so want to creat...
true
bf449fe6d1d5bc4ae514dd6c3d436414675e41dc
yosho-18/AtCoder
/AtC_Beg_Con_121-130/ABC125/A.py
UTF-8
136
2.78125
3
[ "MIT" ]
permissive
a, b, t = map(int, input().split()) t = t+0.5 for i in range(100): if i * a <= t <= (i + 1) * a: print(i * b) exit()
true
b728a354fceae59e8fd18f2e06c9ea1dbb943da0
yjlou/simple-restful
/db.py
UTF-8
1,624
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/python # # I'm interface. Don't import me directly. class Db(): EXISTED = -2 # Only used for create new file/directory. NOT_EXIST = -1 DIR = 1 FILE = 2 def safe_path(self, path): return "/".join([p for p in path if len(p) and p[0] != "."]) def get_dir(self, path): raise Exception("...
true
8978c2e6f7cbd67ae4f385478aedeacf9e96b21a
JuDa-hku/building_machine_learning_system_with_python
/chapter 2/Character_to_number.py
UTF-8
448
3.0625
3
[]
no_license
import numpy as np def CharToNum(Char): Char=Char.split() Char=''.join(Char) nparray=np.array([(map(ord, Char))])-ord('0') return ''.join(map(str,list(flatten(nparray)))) from collections import Iterable def flatten(lis): for item in lis: if isinstance(item, Iterable) and not isinstance(i...
true
847afc5fb5513df88035d6967f54856d66ae820f
niketagrawal/F3DASM
/f3dasm/utils/plot.py
UTF-8
2,853
3.234375
3
[ "BSD-3-Clause" ]
permissive
''' Created on 2020-09-16 08:45:43 Last modified on 2020-09-17 17:02:05 @author: L. F. Pereira (lfpereira@fe.up.pt)) ''' # imports # third-party import numpy as np from matplotlib import pyplot as plt # object definition class BarPlot(object): def __init__(self, width=.8): self.width = width ...
true
9b71b7100624d3314658a7e7a74a08f45df6267d
pavelbely/built-in-nyc-scraper
/builtinnyc_scrapy/spiders/builtinnyc_scrapy.py
UTF-8
3,045
2.609375
3
[]
no_license
__author__ = 'Pavel Bely' from scrapy.linkextractors import LinkExtractor from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor from scrapy.spiders import Rule, CrawlSpider from scrapy.selector import Selector from builtinnyc_scrapy.items import CompanyItem class BuiltInNycSpider(CrawlSpider): """ Thi...
true
cd3c7beeb11cde4294177db88e18e8683dac4933
Duanrui-ni/pywinautodemo1
/demo7.py
UTF-8
1,256
2.78125
3
[]
no_license
from pywinauto.application import Application import time app = Application('uia').start('"D:\\Program Files\\PremiumSoft\\Navicat Premium 15\\navicat.exe"') # 选择窗口 dlg = app["Navicat Premium"] # 选择菜单 menu = dlg["menu"] # 选择菜单项:文件 file = menu.child_window(title="文件") # print(menu.items()) # 通过下标选择菜单项 # m = menu.ite...
true