blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d95acff188a7d285fcc6f4ba1b098be0c7a9e7e8 | Python | michaelulin/pytorch-ergonomics | /ergonomics/serialization.py | UTF-8 | 3,714 | 3.046875 | 3 | [] | no_license | """
These functions are ergonomics improvements for pytorch.
By saving the source code along with the model definitions,
you can reuse your models easily in new modules without needing to redefine
everything from scratch.
"""
import torch
import tempfile
import os
import zipfile
import sys
import pickle
DEFAU... | true |
363cfa7a201cb68c71d706dfb62eac7a9c81da53 | Python | pgkavade/comp110-21f-workspace | /exercises/ex01/numeric_operators.py | UTF-8 | 686 | 4.03125 | 4 | [] | no_license | """practicing the numeric operators, type conversions, and string concatenation."""
__author__ = "730395347"
left_hand: int = int(input("Left-hand side: "))
right_hand: int = int(input("Right-hand side: "))
exponent: int = left_hand ** right_hand
divison: float = (left_hand / right_hand)
integer_division: int = (lef... | true |
c254ca6a0419a25c0d357b063dc7d70652927374 | Python | raunak-shr/intermediate-python-course | /dice_roller.py | UTF-8 | 711 | 3.953125 | 4 | [] | no_license | import random
def main():
dice_rolls = 2
dice_sum = 0
for i in range(0, dice_rolls):
roll = random.randint(1,6)
dice_sum = dice_sum + roll
print(f'You rolled a {roll}')
print(f'You rolled a total... | true |
58e63955326486c3c84d6cae693aa022c3ee976a | Python | leducthanguet/PyContinual | /src/tools/prep_ner.py | UTF-8 | 8,816 | 2.578125 | 3 | [] | no_license | import nltk
import numpy as np
import json
from collections import defaultdict
import xml.etree.ElementTree as ET
import random
random.seed(1337)
np.random.seed(1337)
"""TODO: this file is not well-tested but just copied from another repository.
"""
# valid_split=150
def change_beginning_to_B(label):
changed =... | true |
96cc957b1853675567d4222586ec0f884d4cdfc8 | Python | singhbhaskar/projectEuler | /6difference_sonatural_sosquarenatural.py | UTF-8 | 133 | 2.84375 | 3 | [] | no_license | def differnce(n):
sumOfN = n*(n+1)/2;
sumofSqreN = n*(n+1)*(2*n+1)/6
return sumOfN**2 - sumofSqreN
print differnce(100)
| true |
91aefa4c96b586fa59e4ad9d0fb1cfc6bd766f38 | Python | jettero/gr-alt-moving-average | /python/wmoving.py | UTF-8 | 1,698 | 2.859375 | 3 | [] | no_license |
from gnuradio import gr
from operator import itemgetter
import numpy, cmath, os
class wmoving(gr.sync_block):
"""
weighted moving average
"""
def __init__(self, alpha=0.5, samples=False):
"""
Create the block
Args:
alpha: the weight of new information (vs the weight ... | true |
b1563fe7986a3f494f000aa499ad75351e121ca9 | Python | omite773/watersensor | /i2c_bb_devices.py | UTF-8 | 2,619 | 2.78125 | 3 | [] | no_license | import pigpio
import math
from time import sleep
arduino_addr = 0x04
SDA = 22
SCL = 27
pi = pigpio.pi()
#Close bus if already open
try:
pi.bb_i2c_close(SDA)
sleep(0.2)
except pigpio.error as e:
print(str(e) + " Startar om bb i2c port " + str(SDA))
#Open bus on GPIO pins, 300KHz
bus = pi.bb_i2c_open(SDA,... | true |
a7079c587f83123da30a5717f2c309ac975d06cf | Python | RichardW35/ethereum-SQL | /organize.py | UTF-8 | 1,509 | 2.75 | 3 | [] | no_license | def get_block_data(block, web3):
""" build a block table to be compatible with SQLite data types"""
block_data = web3.eth.getBlock(block)
return block_data
def order_table_foreverstrong(hashh, block, web3, balance=False):
#open transaction data
tx_data = web3.eth.getTransaction(hashh)
#get ... | true |
8c0a1d7211982c5c8efd28d20dbe8fd53ff01996 | Python | kckr/SimpleTkinterGUI | /dbutil.py | UTF-8 | 3,395 | 2.546875 | 3 | [] | no_license | import pyodbc
class DbUtil:
def __init__(self, dbname, tablename1, tablename2): # class constructor
self.dbname = dbname #
self.tablename1 = tablename1
self.tablename2 = tablename2
self.conn = None
def connect(self): # initiates the connection
# connect... | true |
7b0e6fc178aaa34d6a62cb494a0a5bc5393939cd | Python | gaaferHajji2/AI | /DataMining/guide2datamining/ch2/file.py | UTF-8 | 212 | 3.046875 | 3 | [] | no_license | import csv;
reader=csv.reader(open("./BX-Book-Ratings.csv", 'r'));
for row in reader:
print "Row is: ", row[0].split(';');
#print "Type of row is: ", type(row).__name__;
#print "length of row is: ", len(row);
| true |
6c1b85d7fa20a0f98e17ab4131c18f283b162087 | Python | aid8/CS01 | /Introduction to Computing/Algorithms Needed/DIA_convpoint.py | UTF-8 | 476 | 3.5625 | 4 | [] | no_license | n = [23,0,0,42,36,29,0,0,25,1]
legit = 10
left = 0
right = 9
tSh = 0
print("Left:",left,", Right:", right," Legit:",legit)
print(*n)
while left < right:
if n[left] != 0:
left += 1
else:
legit -= 1
n[left] = n[right]
right -= 1
print("Copied: 1")
tSh... | true |
7872d9b98631115dd9f5e21c58403eab838e813d | Python | SuwaliArora/Demo-Project-Of-RESTFUL-API | /NewProject3/myapp.py | UTF-8 | 1,687 | 2.734375 | 3 | [] | no_license | #third party application
import requests
import json
URL = "http://127.0.0.1:8000/studentdata/"
def get_data(id = None):
data = {}
if id is not None:
data = {'id': id}
json_data = json.dumps(data)
headers = {'content-Type': 'application/json'}
r = requests.get(url = URL, header... | true |
934e1fd8c5c647c6ee4fe9c3678768ef717caf7b | Python | VectorInstitute/vector_cv_tools | /vector_cv_tools/datasets/mvtec.py | UTF-8 | 8,326 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
from glob import glob
from pathlib import Path
from torch.utils.data import Dataset
from ..utils import load_image_to_numpy, load_binary_mask_to_numpy
MVTec_OBJECTS = ('bottle', 'cable', 'capsule', 'carpet', 'grid', 'hazelnut',
'leather', 'metal_nut', 'pill', 'screw', 'tile', 'toothbrush',
... | true |
3a14ed3928e44164bb09cb99742299f9194ebb50 | Python | khalillakhdhar/exercices_python_et_codes | /parite.py | UTF-8 | 131 | 3.53125 | 4 | [] | no_license | x=0
while x<2000:
x=input("donner un entier")
x=int(x)
if(x % 2==0):
print("paire")
else:
print("impaire")
| true |
eccdd9474f74a8fcc1c146f62b639cdce349cb97 | Python | amenson1983/2-week | /_2_week/Homework_2_week/average_thick_rain.py | UTF-8 | 589 | 3.703125 | 4 | [] | no_license | years = int(input("Укажите количество лет: "))
tot_thick = 0
month_quant = 0
for yea in range(0,years,1):
for mon in range(12):
rain_thick = int(input("Введите толщину осадков для месяца"))
tot_thick +=rain_thick
month_quant = years*12
average = tot_thick/(years*12)
print("Средняя толщина осадков за... | true |
fda2fbb82c5ea8f98fab0bbd42470fb8c9d5cd9c | Python | machine-learning-quickstarts/ML-python-tensorflow-mnist-cpu-service | /service.py | UTF-8 | 2,944 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# coding=utf-8
import os
import sys
import json
import numpy as np
import onnx
import onnxruntime as rt
import tensorflow as tf
import time
class MNIST(object):
def __init__(self):
"""Load the MNIST test dataset (10000 images). Load onnx model and start inference session."""
st... | true |
c4c0e455c2ec4998d7db7e2df69188f71eecebf3 | Python | Naoya-abe/siliconvalley-python | /section12/lesson139.py | UTF-8 | 2,559 | 3.453125 | 3 | [] | no_license | """
SQLAlchemy
PythonのORMライブラリの一つ
RDBにアクセスするためのラッパー
SQLAlchemyを使って記述しておけば、sqliteとMySQLの置換が容易になる
オブジェクト指向的に簡単にDBにアクセスできる。SQL文を書かなくてもOK!
"""
import sqlalchemy
import sqlalchemy.ext.declarative
import sqlalchemy.orm
# 作業場所の作成 今回はsqliteのメモリ echo=True:sqlalchemyがどのようなSQL文を実行したか確認することができる
# engine = sqlalchemy.create_engin... | true |
60de62633fb68981b8fd2e97b3aed98380177949 | Python | sreytouchmoch/html.1 | /pyton/py/array2D1.py | UTF-8 | 189 | 3 | 3 | [] | no_license | array2D=[
["A","B","c"],
["D","F","c"],
["A","A","F"],
["v","B","c"],
]
row=int(input())
for k in range(len(array2D[row])):
array2D[row][k]="*"
print(array2D)
| true |
8c903dd94de39a71430779e02fba848171fddc7f | Python | avlakshmy/programming-practice | /rangeSumBST.py | UTF-8 | 558 | 3.359375 | 3 | [] | no_license | def inorderTraversal(root):
if root == None:
return []
ans = []
ans.extend(inorderTraversal(root.left))
ans.append(root.val)
ans.extend(inorderTraversal(root.right))
return ans
def rangeSumBST(root, low, high):
inorder = inorderTraversal(root)
sumVal = 0
i = 0
while i < ... | true |
ad32d63ec5ef563eb3669f7448dfa53d1faeed13 | Python | kate-melnykova/CanvasAPI-Learning-Analytics | /auth/model.py | UTF-8 | 466 | 2.6875 | 3 | [] | no_license | from auth.crypting import aes_encrypt, aes_decrypt
class UnauthorizedMethod(Exception):
pass
class BaseUser:
def __init__(self, url=''):
self.url = aes_encrypt(url)
def is_authenticated(self):
raise UnauthorizedMethod
class User(BaseUser):
def is_authenticated(self):
retur... | true |
7be639760d26c23689fb9222b8b0240a61005119 | Python | vustkdgus/StudyRaspberry21 | /opencv_img03.py | UTF-8 | 375 | 2.578125 | 3 | [] | no_license | import cv2
import numpy as np
#
org = cv2.imread('./image/cat.jpg')
gray = cv2.cvtColor(org, cv2.COLOR_BGR2GRAY)
h, w, c = org.shape
cropped = gray[:int(h/2), :int(w/2)]
# cropped = org[:int(h/2), :int(w/2)]
cv2.imshow('Original', org) #cv2 새창 열림
cv2.imshow('Crop', cropped)
cv2.waitKey(0) # 창에서 키입력 대기
cv2.destroyA... | true |
e44353ef68a3d4b7d366174a54ced40ee9350411 | Python | GeneMANIA/pipeline | /builder/extract_identifiers.py | UTF-8 | 8,802 | 2.53125 | 3 | [] | no_license |
'''
Create GENERIC_DB files:
* NODES.txt columns 'ID', 'NAME', 'GENE_DATA_ID', 'ORGANISM_ID'
* GENES.txt columns 'ID', 'SYMBOL', 'SYMBOL_TYPE', 'NAMING_SOURCE_ID',
'NODE_ID', 'ORGANISM_ID', 'DEFAULT_SELECTED'
* GENE_DATA.txt 'ID', 'DESCRIPTION', 'EXTERNAL_ID', 'LINKOUT_SOURCE_ID'
* GENE_NAMING_SOURCES.txt, ... | true |
e738ee2e4420ba6b8a4208c190384a3e058a20fc | Python | kshm2483/ssafy_TIL | /Algori/AD/A/A9_1~n sum.py | UTF-8 | 121 | 2.921875 | 3 | [] | no_license | def DFS(i):
global sums
if i < 1: return
sums += i
DFS(i-1)
N = int(input())
sums = 0
DFS(N)
print(sums) | true |
19cd43187380bc3882e79ae7e8e41c5d48b27dcf | Python | ccollado7/Curso-Python-Pildoras-Informaticas | /32.Video 37/manejo_archivos.py | UTF-8 | 314 | 3.640625 | 4 | [] | no_license | #Importo el modulo
from io import open
#Creo un archivo en blanco
archivo_texto = open("archivo.txt","w")
frase = "Estupendo dia para estudiar Python \n el miercoles"
#Escribo sobre el archivo una frase
archivo_texto.write(frase)
#Cierro el archivo (abierto desde memoria)
archivo_texto.close()
| true |
a118ffca7989b71caae9399d7b5fb948ea048661 | Python | H-P-U/PythonUygulamalar | /Python Genarators/genarators.py | UTF-8 | 515 | 3.859375 | 4 | [] | no_license | """def cube():
result=[]
for i in range(5):
result.append(j**3)
return result
print(cube())"""
#generator sayesinde daha az bellek kullanılır
"""def cube():
for i in range(5):
yield i**3
iterator=cube()
for i in iterator:
print(i)"""
generator= (i**3 for i in range(5)) #liste... | true |
65fba29250169499756a7e44b267b8d20f72444e | Python | han201/EulerProjects | /EulerProject3_LargestPrime.py | UTF-8 | 156 | 2.75 | 3 | [] | no_license | #What is the largest prime factor of the number 600851475143 ?
from EulerProject_HanFunctions import largestprime
N = 600851475143
print largestprime(N)
| true |
19028abfacd8080f81198a465dab5c11f94bb6c3 | Python | shenfanyi/NLP | /w2v.py | UTF-8 | 2,179 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
## calculate the number of sentences which include each dictionary word
def idf(dic, text):
idf = []
for i in dic.index:
#print i
n_i = 0
for j in text:
if i in j:
n_i +=... | true |
6294ccb0cffe9a503f8f60678b312b6f58b1ce7d | Python | Florence-TC/University_Admission_Procedure | /Topics/Iterators/Students/main.py | UTF-8 | 69 | 2.984375 | 3 | [] | no_license | for n, student in enumerate(student_list):
print(n + 1, student)
| true |
eabd4cbdd37c799101641760c674b561e4392e28 | Python | KDD-OpenSource/geox-young-academy | /day-3/Kalman-filter_Mark.py | UTF-8 | 1,494 | 3.171875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 11 10:10:24 2017
@author: Mark
"""
import numpy as np
import matplotlib.pyplot as plt
#Define functions
def model(state_0,A,B):
state_1 = A*state_0 + np.random.normal(0,B)
return state_1
state_null=np.random.normal(0,0.4)
def observation_functi... | true |
6d13303815c54f7662a3d0cf764337eac843716f | Python | zhao750456695/cvpro | /爬虫/myscrapy/baidunews/test.py | UTF-8 | 375 | 2.53125 | 3 | [] | no_license | # -*- coding=utf-8 -*-
__author__ = 'zhaojie'
__date__ = '2018/4/4 8:41'
import re
with open('./new 5.txt', 'r') as f:
data = f.readlines()
idlist = []
for line in data:
if len(line)>1:
print('line', len(line))
pat = 'id=(.*?)&'
res = re.compile(pat).findall(line)... | true |
793db199be8db80c5fcd0839821df1a7afbcce88 | Python | heliumman/AdventOfCode | /2020/python/day17A.py | UTF-8 | 1,718 | 2.9375 | 3 | [] | no_license | import common
def main() :
dat = common.readFile('day17.dat')
pd, dims = parse_dat(dat)
i = 0
while i < 6:
pd, dims = new_pd(pd, dims)
i = i + 1
print(count_active(pd))
def parse_dat(dat):
pd = {}
i = 0
for d in dat:
j = 0
for l in list(d):
... | true |
99b4d819ad0bf76a21267c9795f5ad6efb5d587d | Python | yujinK/TIL | /Algorithm/LeetCode/swap_nodes_in_pairs.py | UTF-8 | 1,575 | 3.546875 | 4 | [] | no_license | class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
# # 내가 한 풀이
# def swapPairs(self, head: ListNode) -> ListNode:
# prev = None
# result = cur = ListNode(0)
# while head:
# if prev:
# cur... | true |
50b5df882bab37f29bdaa4342ef52177bbb84e1c | Python | adrishg/Intersemestral_Python_Proteco2020 | /Clase2-Archivos_Regex/Regex_codigo2.py | UTF-8 | 234 | 3.375 | 3 | [] | no_license | import re
txt = """Tomás alias San Nicolas fue Capaz de ir con el Capataz
haciendolo andar de altas
"""
parrafo = txt.split()
for palabra in parrafo:
coincidencia = re.findall("(á|a)(s|z)", palabra)
if coincidencia:
print(palabra) | true |
25baa45399a235b98a416d4553f82362d81597ea | Python | mandyshen/YelpSentiment | /NgramsAnalysis/evaluate/filterOutCommon.py | UTF-8 | 1,073 | 2.984375 | 3 | [] | no_license | arrayNegativeNgrams = []
arrayPositiveNgrams = []
arrayPositiveNgramsWithFreq = []
arrayNegativeNgramsWithFreq = []
with open("positiveNgrams", "r") as ins:
for line in ins:
lastIndex = line.rfind(':')
str1 = line[:lastIndex]
str1.strip()
arrayPositiveNgrams.append(str1)
arr... | true |
9330bfd62ac7d4a34615c6b9792093e92c59ae84 | Python | mmilenkoski/twitter_sentiment_classification | /train_LSTM_CNN.py | UTF-8 | 1,619 | 3 | 3 | [] | no_license | # Make sure the training is reproducible
from numpy.random import seed
seed(2)
from tensorflow import set_random_seed
set_random_seed(3)
import numpy as np
from preprocessing_and_loading_data.DataLoader import DataLoader
max_words=40
# Create DataLoader object to get the training, validation and testing data
dl = Data... | true |
475fbd5342bcf2e83f149cbec4fb8acf1b07a099 | Python | sebvstianrodrigo/CYPSebastianVL | /libro/problemas_resueltos/capitulo3/problema3_15.py | UTF-8 | 785 | 3.40625 | 3 | [] | no_license | CL = 0
CUENTA = 0
TIPO = str(input("Ingresa el tipo de llamada: "))
DUR = int(input("Ingresa la duracion de la llamada en minutos: "))
while(TIPO != 'X' and DUR != (-1)):
if TIPO=='I':
if DUR > 3:
COSTO = 7.59+(DUR-3)*3.03
else:
COSTO = 7.59
elif TIPO=='L':
CL = C... | true |
834bf644903227457e47b3d876e49b6ac09df78b | Python | CNwangbin/shenshang1 | /shenshang/simulate.py | UTF-8 | 6,043 | 3.5625 | 4 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from scipy.stats import rankdata
def permute_table(m, inplace=False, seed=None):
'''Randomly permute each feature in a sample-by-feature table.
This creates a table for null model. The advantage of this is that
it doesn't change distribution for any feature in the original
table, t... | true |
fb23c9d4fe506e81ad846ee1e52e5d40da56297b | Python | Vinaykumarujee/Face_Detection_Using_OpenCV | /detector.py | UTF-8 | 2,050 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on july 2019
@author: vinayujee
"""
# import necessary modules
import cv2
import sys
# importing the cascade classifier for face and eye
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
# check f... | true |
8ff6d4fed9ffaf1b54bd1115e050972125e38ac6 | Python | GlenHaber/euler | /problem77.py | UTF-8 | 1,262 | 4.15625 | 4 | [] | no_license | """
Prime summations
It is possible to write ten as the sum of primes in exactly five different ways:
7+3
5+5
5+3+2
3+3+2+2
2+2+2+2+2
What is the first value which can be written as the sum of primes in over five thousand different ways?
"""
from time import time
from problem47 import prime_sieve
primes = prime_sie... | true |
6cc80531b9aa3a955932c89453fed38ce559a910 | Python | johnchen383/RocketGame | /game.py | UTF-8 | 1,127 | 4.21875 | 4 | [] | no_license | def showMenu():
print(" ---- Welcome to the Rocket Game ----- ")
print()
while True:
command = input("Press [s] to Start or [e] to exit ")
if (command == 's' or command == 'e' or command == 'S' or command == 'E'):
break
else:
print("Invalid input. Try ag... | true |
f4546e96bce9f0db5220899412ef1d03a5e5bf12 | Python | koyoshizawa/gajumaru | /lib/scrape_rate.py | UTF-8 | 1,599 | 2.765625 | 3 | [] | no_license |
# -*- encoding:utf-8 -*-
__author__ = "SosukeMatsunaga <>"
__version__ = "0.0.1"
__date__ = "01 August 2018"
from decimal import Decimal
from datetime import datetime
import urllib.request
from bs4 import BeautifulSoup
from transaction_management.models import HistoricalRate
class ScrapeRate(object):
def __i... | true |
5d1846c09f93e1ac251fdcddb5485e522b3704d9 | Python | Sriram-52/Python-Lab | /Exp-6/Prg2.py | UTF-8 | 467 | 4.0625 | 4 | [] | no_license | if __name__ == "__main__":
path = input("Enter path of the file: ")
fp = open(path, 'r')
count = {}
for line in fp:
for char in line:
if char in count.keys(): count[char] += 1
else: count[char] = 1
print(count)
print("Checking the type of file...")
ext = path.split("\\").pop().spli... | true |
90e266ada39db84855496a11d30bbdfcb18f0753 | Python | kimotot/aizu | /itp2/itp2_9_d.py | UTF-8 | 379 | 3.5 | 4 | [] | no_license | n = int(input())
A = [int(x) for x in input().split()]
m = int(input())
B = [int(x) for x in input().split()]
i = j = 0
while i < n and j < m:
if A[i] == B[j]:
i += 1
j += 1
elif A[i] < B[j]:
print(A[i])
i += 1
else:
print(B[j])
j += 1
while i < n:
print... | true |
32f29c174c6800ef266d65167c40c2d9c824f098 | Python | ChristophReich1996/ECG_Classification | /scripts/lstm_example.py | UTF-8 | 300 | 2.515625 | 3 | [
"Python-2.0",
"MIT"
] | permissive | import torch
import torch.nn as nn
if __name__ == '__main__':
input = torch.rand(5, 3, 128)
lstm = nn.LSTM(input_size=128, hidden_size=512, num_layers=2, bias=True, batch_first=False)
print(sum([p.numel() for p in lstm.parameters()]))
output, _ = lstm(input)
print(output.shape)
| true |
a665478b79c20be91c34b072d305e7f4da375c59 | Python | afreeman100/TetrisDQN | /code/DQN.py | UTF-8 | 15,804 | 2.59375 | 3 | [] | no_license | import tetris
from tqdm import tqdm
from tetriminos import *
from networks import *
from replay import ReplayMemory, PriorityMemory
from array2gif import write_gif
def update_targets(tau):
values = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='Q_Net')
targets = tf.get_collection(tf.GraphKeys.GLOBAL_... | true |
0191cfb6c5a2b56364b96d586d6475e4d5a77c30 | Python | jramcast/ml_weather | /example9/classifier.py | UTF-8 | 2,999 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | """
The weather classifier module
"""
import time
import math
import numpy as np
from sklearn.svm import LinearSVC
from sklearn.model_selection import cross_val_score
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.externals import joblib
fro... | true |
b148a319b4813089bcf433c3ffca78f5f33e6906 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/1607.py | UTF-8 | 684 | 3.03125 | 3 | [] | no_license | var = raw_input("Enter something: ").split('\n')
text = ""
caseno = 0
for line in var[1:]:
if line != "":
caseno += 1
addpeople = 0
(maxshy, situ) = line.split(" ")
#print situ
maxshy = int(float(maxshy))
stand = 0
addall = 0
for j in ran... | true |
4b2ae2afca5125c99b1d74c8ed014dd79fcc321f | Python | msarker000/ML_hw1 | /DSEHW1.py | UTF-8 | 2,861 | 3.703125 | 4 | [] | no_license | import numpy as np
class DSELinearClassifier(object):
"""DSELinearClassifier classifier.
Parameters
------------
activation: string
values are ('Perceptron', 'Logistic', 'HyperTan').
initial_weight: vector
inital weight
random_state : int
Random number generator seed... | true |
e3c144c944544048c64c4afe37b97706269c0d22 | Python | MFALHI/gremlinsdk-python | /exampleapp/reviews/reviews.py | UTF-8 | 2,037 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
from flask import Flask, request
import simplejson as json
import requests
import sys
from json2html import *
app = Flask(__name__)
reviews_resp="""
<blockquote>
<p>
An extremely entertaining and comic series by Herge, with expressive drawings!
</p> <small>Reviewer1 <cite>New York Times</cite></smal... | true |
667e151f324f1528b71cdb91c6d6239248b3f834 | Python | EddiePulido/django_assignments | /django_intro/Random/apps/random_word/views.py | UTF-8 | 621 | 2.640625 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse, redirect
from django.utils.crypto import get_random_string
def index(request):
return HttpResponse("this is the equivalent of @app.route('/')!")
def random_word(request):
rWord = get_random_string(14)
dic = {
'word' : rWord
}
if 'count' n... | true |
f0a3ed337d6c4a98b6bc62339bf9cda47ce44f5c | Python | ChangxingJiang/LeetCode | /0401-0500/0471/0471_Python_1.py | UTF-8 | 1,108 | 3.0625 | 3 | [] | no_license | class Solution:
def encode(self, s: str) -> str:
size = len(s)
dp = [[""] * size for _ in range(size)]
for l in range(1, size + 1):
for i in range(size - l + 1):
j = i + l - 1
dp[i][j] = s[i:j + 1]
if l > 4:
# ... | true |
989ee8fd1ff45a3e0e6948ce56751850d6275d90 | Python | phuchonguyen/contextual-personalized-feeds-migiphu | /recsys/recommender/learning_to_rank_ensemble.py | UTF-8 | 7,221 | 2.6875 | 3 | [] | no_license | import collections
import pickle
import random
import re
from collections import Counter
import numpy as np
import pandas as pd
from scipy.sparse import dok_matrix
from sklearn.metrics.pairwise import cosine_similarity
from tqdm import tqdm
def save_obj(obj, name):
with open(name + '.pkl', 'wb') as f:
pi... | true |
989c4f147cc45dc7b5e476dbea63c52f39a979ee | Python | Erotemic/netharn | /netharn/layers/swish.py | UTF-8 | 2,008 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | """
References:
https://github.com/lukemelas/EfficientNet-PyTorch/blob/master/efficientnet_pytorch/utils.py
https://discuss.pytorch.org/t/implementation-of-swish-a-self-gated-activation-function/8813
https://arxiv.org/pdf/1710.05941.pdf
"""
import torch
from torch import nn
class _SwishFunction(torch.au... | true |
4c7f73839b4b2cba1e07f7b63cdb1397cf5cf11d | Python | rohan-sawhney/correspondence | /deps/cyamites/viewer/Camera.py | UTF-8 | 6,478 | 3.0625 | 3 | [
"MIT"
] | permissive | # A class encapsulating the basic functionality commonly used for an OpenGL view
# System imports
import numpy as np
from math import pi, sin, cos, tan
# OpenGL imports
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
# Use euclid for rotations
import euclid as eu
# Cyamites imports
from .... | true |
de94fa336f0876b3fd4e27ab6f71c60c12851734 | Python | hanuschv/GeoPy | /Assignment_04_Hanuschik.py | UTF-8 | 6,638 | 3.34375 | 3 | [] | no_license | # ==================================================================================================== #
# Assignment_04 #
# (c) Vincent Hanuschik, 10/11/2019 #
# ... | true |
41ca9aea83c35bf739f2ecd1d3a89a23009420cb | Python | Ashley95/Python-FruitMall | /shopping/utils/functions.py | UTF-8 | 204 | 2.75 | 3 | [] | no_license | import random
def get_ticket():
s = 'qwertyuiopasdfghjklzxcvbnm1234567890'
ticket = ''
for i in range(28):
ticket += random.choice(s)
ticket = 'TK_' + ticket
return ticket
| true |
a874bc2a235dc5e13549aeef15b34a241722bda0 | Python | maguoying/python_work | /4-11.py | UTF-8 | 687 | 3.90625 | 4 | [] | no_license | pizzas = ['New York','chicago','Pan','Thick','Cracker'];
message = 'The first three items in the list are:';
print(message);
print(pizzas[:3]);
print('Three items from the middle of the list are:');
print(pizzas[1:4]);
print('The last three items in the list are:');
print(pizzas[-3:]);
friend_pizzas = [];
pizzas.append... | true |
67443a8a61aa52c1dd90bfcf04cb43018828805a | Python | pranavdave893/Leetcode | /redundant_conections_2.py | UTF-8 | 1,304 | 3.296875 | 3 | [
"MIT"
] | permissive | class Solution:
def findRedundantDirectedConnection(self, edges):
def find(u): # union find
if p[u] != u:
p[u] = find(p[u])
return p[u]
def detect_cycle(edge): # check whether you can go from u to v (forms a cycle) along the parents
u, ... | true |
c1cdcf8fb82b7af04edbb9f5b4ecaa453fb05ffe | Python | Muyiyunzi/ML-pyCV-Notes | /W8/7.2-create_vocab.py | UTF-8 | 668 | 2.65625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from PIL import Image
import imtools
import pickle
import vocabulary
import sift
# 获取selected-fontimages文件下的图像文件名,并保存在list中
imlist = imtools.get_imlist('first500')
nbr_images = len(imlist)
featlist = [ imlist[i][:-3]+'sift' for i in range(nbr_images)]
for i in range(nbr_images):
... | true |
48c25f3106a1c76881078957bca974d0e29d9c77 | Python | atrinik/dwc | /maps/shattered_islands/scripts/strakewood_island/gandyld.py | UTF-8 | 4,444 | 3.0625 | 3 | [] | no_license | ## @file
## Quest for power crystal, given by Gandyld northwest
## of Quick Wolves guild.
from Atrinik import *
from QuestManager import QuestManager
activator = WhoIsActivator()
me = WhoAmI()
msg = WhatIsMessage().strip().lower()
player_info_name = "gandyld_mana_crystal"
player_info = activator.GetPlayerInfo(player... | true |
fb7c48f8267248bb0340d83253cbcd1637138a78 | Python | usnistgov/swid-autotools | /lib/swidtag.py | UTF-8 | 13,696 | 2.671875 | 3 | [
"NIST-PD"
] | permissive | #!/usr/bin/env python
# This software was developed at the National Institute of Standards
# and Technology by employees of the Federal Government in the course
# of their official duties. Pursuant to title 17 Section 105 of the
# United States Code this software is not subject to copyright
# protection and is in the ... | true |
3135f9cf5e4592f5e9ccce9f2f259f6aaed19108 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2119/60833/281948.py | UTF-8 | 545 | 3 | 3 | [] | no_license | x=list(input().split(','))
x=list(map(int,x))
judge=1
if len(x)<=3:
print(False)
else:
for i in range(3,len(x)):
if((x[i]>=x[i-2])&(x[i-3]>=x[i-1])):
print(True)
judge=0
break
if((i>=4)&(x[i-1]==x[i-3])&(x[i]>=x[i-2]-x[i-4])):
print(True)
... | true |
9b36d3cd9d8779b6c3065bc85932a5d61d9962ff | Python | pwoble/ISM-4402 | /Woble_7-1.py | UTF-8 | 613 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
names = ['Bob', 'Jessica', 'Mary', 'John', 'Mel']
grades = [76,83,77,78,95]
GradeList = zip(names, grades)
df = pd.DataFrame(data = GradeList,
columns=['Names', 'Grades'])
get_ipython().magic(u'matplotlib inline')
df.plot()
# In[11]:
df.p... | true |
ad460ac9219846698c392928a8ebe0da3ad81b50 | Python | Jeongeun-Choi/CodingTest | /python_algorithm/소수찾기.py | UTF-8 | 335 | 3.359375 | 3 | [] | no_license | n = int(input())
arr = [False, False] + [True] * (n-1)
answer = []
for i in range(2, n+1):
if arr[i]:
answer.append(i)
for j in range(2*i, n+1, i):
arr[j] = False
print(len(answer))
#소수찾기는 에라토스테네스의 체를 사용해서 풀자
#그리고 짝수는 2 빼고 소수가 아님
| true |
cc46f2e727fac712a56ea4e55c2a286bad4ebfb1 | Python | peanut996/Leetcode | /Python/1208.GetEqualSubstringsWithinBudget.py | UTF-8 | 1,910 | 3.625 | 4 | [] | no_license | """1208. 尽可能使字符串相等
给你两个长度相同的字符串,s 和 t。
将 s 中的第 i 个字符变到 t 中的第 i 个字符需要 |s[i] - t[i]| 的开销(开销可能为 0),也就是两个字符的 ASCII 码值的差的绝对值。
用于变更字符串的最大预算是 maxCost。在转化字符串时,总开销应当小于等于该预算,这也意味着字符串的转化可能是不完全的。
如果你可以将 s 的子字符串转化为它在 t 中对应的子字符串,则返回可以转化的最大长度。
如果 s 中没有子字符串可以转化成 t 中对应的子字符串,则返回 0。
示例 1:
输入:s = "abcd", t = "bcdf", cost = 3
输出:3
解释:s 中的... | true |
63962552f9fb356b1f78a403655d64f8e44494d6 | Python | adrienlagamelle/csSurvival | /build/lib/css/tests/test_database.py | UTF-8 | 2,664 | 2.78125 | 3 | [] | no_license | """Test for database implementation"""
import unittest
from css.app import app
from css.app.database import sqlalchemy
from css.app.database import user
from css.app.database import thread
from css.app.database import comment
class Database_TestCase(unittest.TestCase):
def setUp(self):
app.config['SQLALC... | true |
c40d3b0e04029f3b63c03062039d5498587f4297 | Python | KuroKousuii/Algorithms | /Dynamic Programming/Assembly line scheduling/Space optimized.py | UTF-8 | 726 | 3.5 | 4 | [] | no_license | # A space optimized solution for assembly
# line scheduling in Python3
def carAssembleTime(a, t, e, x):
n = len(a[0])
# Time taken to leave first station
# in line 1
first = e[0] + a[0][0]
# Time taken to leave first station
# in line 2
second = e[1] + a[1][0]
for i in range(1, n):
... | true |
339f653834122418516b49d753b1796ac370a3c8 | Python | potter8/Pizza-Crust | /Pizza Crust.py | UTF-8 | 227 | 3.453125 | 3 | [] | no_license | import math
r, c = map(int, input().split())
#(Area of cheese divided by area of pizza) * 100
cheeseArea = math.pi * ((r-c) ** 2)
pizzaArea = math.pi * (r ** 2)
crust = (cheeseArea / pizzaArea) * 100
print(crust)
| true |
ca13505f73b00c89a01f0e533e1dd4b0ddf049f8 | Python | markreynoso/mail_room_madness | /src/mail_room_madness.py | UTF-8 | 3,248 | 3.59375 | 4 | [
"MIT"
] | permissive | """Allows user to search database for donors.
Send thank you notes to non-profit donors.
And to run a donoation report of all donors.
"""
import sys
donor_data = {'Phil Collins': [25, 45, 76, 100],
'Sven Sunguaard': [50, 1000, 76, 1400]}
def main(): # pragma: no cover
"""Initiate function when... | true |
684dad4fa6a7e74a608f16b31e5a438f183a518f | Python | LeanderLXZ/nlp-n-gram-language-models-python | /bigram_optimized.py | UTF-8 | 1,185 | 2.953125 | 3 | [] | no_license | import re
from bigram import biGram
class biGramOptimized(biGram):
def __init__(self):
super(biGramOptimized, self).__init__(0)
def predict(self, sentence):
max_prob = 0
language = 'EN'
for bigram_prob, lang in [(self.bigram_prob_en, 'EN'),
... | true |
01f851012231b39550d50be470be7f0363ab8376 | Python | DAP-web/AirbnbProyect | /Segundo Avance/Formularios ABC/Calificaciones_BE.py | UTF-8 | 1,178 | 3.28125 | 3 | [] | no_license | from prettytable import PrettyTable
from DB_Calificaciones_BE import calificacionesDB
class calificionesBE:
def __init__(self):
self.calificiones=calificacionesDB()
def getCalificaciones(self):
result = self.calificiones.obtenerCalificaciones()
table = PrettyTable()
table.fiel... | true |
a8de7768d6adbb65efd0b244bf1cee40689b69ac | Python | Evilnames/FactoryGame | /Factory/building.py | UTF-8 | 3,230 | 3.1875 | 3 | [] | no_license | class building:
def __init__(self):
#Filler Text
self.name = ""
self.outputGood = ""
#General Attributes
#Input Rules
##What goods do I need? This should be stored as a dictionaries of dictionaries
### IE inputGoods.a... | true |
a66e36fe98502bcebc0d25c5dc11264d6c439b6f | Python | Mikesteinberg/Updated_Cr_NeuralNetwork | /Clash_Royale_Neural_Network-master/Generator_Test.py | UTF-8 | 1,852 | 2.9375 | 3 | [] | no_license | from numpy.random import seed
seed(30)
from sklearn.utils import shuffle
# Importing the dataset
def Deck_Generator():
with open('/home/mike/"Clash Royale Neural Network"/Clash_Royale_Neural_Network-master/new_match_file_ladder.txt,"r") as deck_file:
while True:
i = 0
while i < 319... | true |
60c5a5dc8e0c53d630667c25b9963a0e6646db1c | Python | wchming1987/Tumbler | /handler/Book.py | UTF-8 | 1,462 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- coding=utf-8 -*-
import json
from bson import json_util
from tornado_swagger import swagger
from handler.GenericApiHandler import GenericApiHandler
class BooksHandler(GenericApiHandler):
@swagger.operation(nickname='list')
def get(self):
"""
@rtype: L{Book}
... | true |
8670c1b668830f4ca4cdce2f551495709ce3c18b | Python | Harshil-Patel24/Machine-Perception | /Assignment_2/assignment.py | UTF-8 | 2,270 | 2.90625 | 3 | [] | no_license | import cv2 as cv
import numpy as np
import os
import sys
from tools import *
from matplotlib import pyplot as plt
def main(argv):
# Controller to allow for different input directories
if len(argv) > 1:
print('usage: python3 assignment.py <image-directory>')
exit(0)
elif len(argv) == 1:
... | true |
85db0ddab1f19bb9b14eadad269eb1aba49f11ab | Python | benbendaisy/CommunicationCodes | /python_module/examples/804_Unique_Morse_Code_Words.py | UTF-8 | 2,191 | 4.1875 | 4 | [] | no_license | import string
from collections import Counter
from typing import List
class Solution:
"""
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:
'a' maps to ".-",
'b' maps to "-...",
'c' maps to "-.-.", and so o... | true |
549de621bddc7b5371520db81c28590f626c3b1e | Python | githubli97/leetcode-python | /202011/20201127/q454.py | UTF-8 | 1,337 | 3.125 | 3 | [] | no_license | from typing import List
class Solution:
def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
if not A:
return 0
def sameNum(arr: List[int]) -> dict:
result = {}
for i in arr:
if i in result:
r... | true |
0d9f01bdabd15f91f4411f6ff0a62eff6682a683 | Python | caogtaa/OJCategory | /ProjectEuler/1_100/0025.py | UTF-8 | 113 | 2.953125 | 3 | [] | no_license | f1, f2 = 1, 1
index = 2
while len(str(f2)) < 1000:
f1, f2 = f2, f1+f2
index += 1
print(index)
# = 4782 | true |
1fd99440d9dcfe1af22b79a0d045a8ce9078b635 | Python | ZayneHuang/TCP007 | /data_process/create_protocol_dictionary.py | UTF-8 | 1,175 | 2.546875 | 3 | [] | no_license | import numpy as np
filepath = '../data/pcaps/'
namelist = range(1, 19, 1)
protocol_list = []
protocol_dic = {}
protocol_num = np.zeros(40, dtype=int)
for filename in namelist:
fullpath = filepath + str(filename)
with open(fullpath, 'rb') as f:
lines = f.readlines()
for line in lines:
... | true |
235ecfc077d293c90723000921b0c58bc201c6af | Python | ShadowMinerXIII/AI-iris-flower | /AI(iris).py | UTF-8 | 2,466 | 3.234375 | 3 | [] | no_license | from sklearn import datasets
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import metrics
from mlxtend.plotting import plot_decision_regions
from skl... | true |
4a6688f7d1a3ad64a45cd6c4ccf656fef75d176e | Python | amyq7526110/python100 | /74_lsR.py | UTF-8 | 343 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import sys
def list_files(path):
if os.path.isdir(path):
print(path + ':')
content = os.listdir(path)
print(content)
for fname in content:
fname = os.path.join(path,fname)
list_files(fname)
if __name__ == '__main__':
lis... | true |
a992a761a980b76a0a833927a5a575cf6954e39f | Python | IvanIsCoding/OlympiadSolutions | /beecrowd/1065.py | UTF-8 | 299 | 3.046875 | 3 | [] | no_license | # Ivan Carvalho
# Solution to https://www.beecrowd.com.br/judge/problems/view/1065
# -*- coding: utf-8 -*-
"""
Escreva a sua solução aqui
Code your solution here
Escriba su solución aquí
"""
array = []
for i in range(5):
array.append(int(input()) % 2)
print("%d valores pares" % (5 - sum(array)))
| true |
5ee9dd3f6c1067451c6c152a3995d38ca39a805a | Python | Koushika-BL/python | /dictionary is empty or not.py | UTF-8 | 85 | 2.609375 | 3 | [] | no_license | dict1={}
if not dict1:
print("dictionary is empty")
else:
print("not empty")
| true |
62eea2b5234acdcaba3a27a26c22bc72280c27a1 | Python | lucky-wn/ApiTest | /variables/script_variables.py | UTF-8 | 1,619 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : WangNing
# @Email : 3190193395@qq.com
# @File : script_variables.py
# @Software: PyCharm
# 生成脚本时,相关变量的存储
# 脚本预备:导入包
code_prepares = """#encoding=utf-8
import unittest, requests
from core.db_manager import *
import os, sys,json"""
# 脚本头部[需要连接数据库(有依赖数据)]:class, setup
code_head_w... | true |
48cae9311eb933c366c27f82f78607fbdb6cb625 | Python | kdh0514/Openstack | /Device/dummyInputImage.py | UTF-8 | 1,552 | 2.859375 | 3 | [] | no_license | import socket
import cv2
import numpy
import os
import time
import threading
# 이미지 파일 경로
path = './in.jpg'
# IP , PORT
ip_add = '127.0.0.1'
port_num = 8989
# 서버의 IP와 PORT로 소켓연결을 신청
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ip_add, port_num))
def send_data():
fileNumber = input("Inpu... | true |
f87de134ebc418211ad899e7557d520596442fb1 | Python | bigsem89/post_to_postgresql | /flask_app/src/app.py | UTF-8 | 1,116 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://dbuser:123@db/testdb'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class Person(db.Model):
id = db.Column(db... | true |
ea2eb0b89398b322bd5c24665906e787af648cd2 | Python | vishalonip/python | /kangaroo_seperate_input.py | UTF-8 | 193 | 3.109375 | 3 | [] | no_license | k1=int(input())
v1=int(input())
k2=int(input())
v2=int(input())
result="No"
for t in range(0,10000):
if k1+v1*t==k2+v2*t:
# print(t)
result="Yes"
break
print(result) | true |
6c0cf0d6903915062dd8499ca4a0ee0305236264 | Python | jackone666/analyse | /models/Infor/IndividualInfor.py | UTF-8 | 1,154 | 2.953125 | 3 | [] | no_license | import math
import sys
count = 0
sys.setrecursionlimit(100000000)
def nodeInformationentropy(node: str, tree):
rowSumDic = {} # 以字典储存每个节点出度
listTemp = list(tree.index)
rowSum = list(tree.sum(axis=1)) # 每个节点出度和 列表
for i in range(0, rowSum.__len__()):
rowSumDic[listTemp[i]] = rowSum[i]
... | true |
1c8937f5d4273d451927eab5dd7bce3278e322d4 | Python | Mskty/Coattiva | /ui_test/funzioni.py | UTF-8 | 17,143 | 2.671875 | 3 | [] | no_license | import tkinter as tk
import matplotlib.pyplot as plt
import pandas as pd
import sklearn as skl
import numpy as np
import seaborn as sns
import time
import xgboost as xgb
from tkinter import filedialog
from joblib import dump, load
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets, svm, m... | true |
0ffcadac74144fde57a6e442cb58cb412e192014 | Python | darraes/coding_questions | /v2/_data_structures_and_algorithms/segment_tree.py | UTF-8 | 2,598 | 3.078125 | 3 | [] | no_license | from typing import List
import math
class SegmentTree:
def __init__(self, arr: List[int], agg=lambda x, y: x + y):
x = math.ceil(math.log(len(arr), 2))
self.tree = [None] * (2 * (2 ** x - 1))
self.len = len(arr)
self.aggregator = agg
self._build(arr)
def _build(self,... | true |
cce0fe9951c108eb6d71fb62438eb5fd97a3fe69 | Python | SunMyoungJun/emotion_extraction | /keyword_extraction.py | UTF-8 | 1,208 | 2.671875 | 3 | [] | no_license | import pandas as pd
from konlpy.tag import Kkma
from konlpy.tag import Twitter
from konlpy.tag import Okt
from nltk.tokenize.punkt import PunktSentenceTokenizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import norma... | true |
8616d3457b5da1c1e694139c6ebcdb8d16d9ff56 | Python | JiaolongYu/Share | /compute_tests.py | UTF-8 | 690 | 2.78125 | 3 | [] | no_license | from unittest import TestCase
import compute_highest_affinity
class StandAloneTests(TestCase):
def test_compute2(self):
a = "a"
b = "b"
c = "c"
d = "d"
e = "e"
f = "f"
g = "g"
h = "h"
A = "A"
B = "B"
C = "C"
D = "D"
E = "E"
F = "F"
G = "G"
H = "H"
site_list = [a,a,b,c,c,c,d,d,e,... | true |
4a94cdea4fc10e21e108baff44accd8f5b709c38 | Python | Yasmojam/DoYouHaveTheGuts2019 | /src/collectable.py | UTF-8 | 1,317 | 2.609375 | 3 | [
"MIT"
] | permissive | from server import ObjectUpdate
from time import time
from typing import Tuple
Vector = Tuple[float, float]
COLLECTABLE_TYPES = set(["AmmoPickup", "HealthPickup", "Snitch"])
class Collectable:
def __init__(self, payload: ObjectUpdate) -> None:
self.name = payload.name
self.id = payload.id
... | true |
c371d5104897f43e779c78d8515cc528a528bb42 | Python | Heyu-cmd/distrbutied_Crawl | /socket_server.py | UTF-8 | 2,207 | 2.9375 | 3 | [] | no_license | import socket
import sys
import threading
import signal
class ServerSocket:
def __init__(self, callback, host='localhost', port=20011):
"""
:param callback: callback function for handling received data
:param host: Symbolic name meaning all available interface
:param port: Arbitr... | true |
0993777fe1de0442bb41f92a373d4a194778d47f | Python | python-diamond/Diamond | /src/collectors/scribe/scribe.py | UTF-8 | 2,069 | 2.546875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
"""
Collect counters from scribe
#### Dependencies
* /usr/sbin/scribe_ctrl, distributed with scribe
"""
import subprocess
import string
import diamond.collector
class ScribeCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(ScribeCollec... | true |
30c5d6404997f9668c281c8373c832643c2addbd | Python | rjmcf/Bi-onic | /game/line.py | UTF-8 | 3,431 | 3.296875 | 3 | [] | no_license | import pyxel
from plugins.enum import Enum
from plugins.geometry import Point, Size
from plugins.sprite import Sprite, Anchor
from typing import Any
# Possible states for the line
class LineState(Enum):
STATE_NORMAL = 0
STATE_HIGH = 1
STATE_LOW = 2
# Represents the line drawn on the graph.
#TODO Unfinished: Allow ... | true |
396aa57f0af05a031ad902d83eda6980a37b5d79 | Python | krito1124/python200817 | /score.py | UTF-8 | 447 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 14:58:30 2020
@author: USER
"""
score = int(input("please enter your score:"))
if score >= 0 and score <=100:
if score >= 90:
print("level A")
elif score >= 80:
print("level B")
elif score >= 70:
print("level C")
... | true |
e8070fa0f542db266948b6616badd6c03d11a300 | Python | StudyGroupPKU/fruit_team | /Scraping/Junho/project/old_n2_baidu_xinwen.py | UTF-8 | 1,391 | 2.578125 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import datetime
import numpy
from time import sleep
#random.seed(datetime.datetime.now())
def naver(duration=3,time=3):
DIC = dict()
#html = "https://datalab.naver.com/keyword/realtimeList.naver?datetime=2018-04-04T18:20:00"
# html ... | true |
094829ee588b6db15beccbc890fcd0cffae738ab | Python | ingunnjv/IT3708 | /Project_1/src/test.py | UTF-8 | 445 | 2.921875 | 3 | [] | no_license | import numpy as np
from timeit import default_timer as timer
def numpy_read(N, A):
for i in range(0,N):
b = A[55,55]
def list_read(N, B):
for i in range(0,N):
b = A[55][55]
N = 1000000
A = np.zeros((1000,1000))
B = [[0] * 1000] * 1000
start = timer()
numpy_read(N, A)
end = timer()
print(... | true |
4adfdf24d2e97385a21ebbc77b4f608b7c4b0c41 | Python | zerotk/zops.anatomy | /zops/anatomy/layers/_tests/test_tree.py | UTF-8 | 3,632 | 3.03125 | 3 | [] | no_license | import pytest
from zops.anatomy.assertions import assert_file_contents
from zops.anatomy.layers.tree import AnatomyFile, AnatomyTree, merge_dict
import os
def test_anatomy_file(datadir):
# Prepare
f = AnatomyFile(
"gitignore",
"""
a
b
""",
)
# Execut... | true |