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
ba6425c86f1e8a54e1bb8917556a320feb14a54b
shilpa2020/python
/pro7.py
UTF-8
120
3.140625
3
[]
no_license
farrari1=int(input()) c=0 for r in range(0,farrari1): if(pow(2,r)>farrari1): break c=farrari1-pow(2,r) print(c)
true
c7160a9362fede669c105b0d44e6d94835d19a05
afs2015/SmallPythonProjects
/FunPythonProjects/FibonacciGenerator.py
UTF-8
976
4.78125
5
[]
no_license
# FibonacciGenerator # Purpose: Fibonacci Sequence Generator def genFib(): '''Generator which calculates Fibonacci numbers. Yields next Fibonacci number in sequence. Starts at 0''' fibn_1, fibn_2 = 0, 1 #fib(n-1), fib(n-2) while True: # fib(n) = fib(n-1) + fib(n-2) yield fibn_1 ...
true
c70e597146a9021c284032a0a1ca5f0d3ca939cb
stulsani/Additional-WorkSpace
/DataAnalysis/question2.py
UTF-8
4,082
2.828125
3
[]
no_license
import os from datetime import datetime import json from pprint import pprint import re from concurrent.futures import ProcessPoolExecutor class ProcessData: def __init__(self): pass def get_date(self): dateToSearch = input("Enter the date in YYYY-MM-DD format: ") try: datet...
true
6be36149db55d96c134c105a6b2b4c530be8d949
JameScottX/RL-Methods
/DDPG.py
UTF-8
7,148
2.53125
3
[]
no_license
import tensorflow as tf import numpy as np import os import shutil np.random.seed(1) tf.set_random_seed(1) class DDPG_Actor(object): def __init__(self, sess,action_dim,action_bound,state_dim,learning_rate,replace_iter): self.sess =sess self.action_dim = action_dim self.action_bound = ac...
true
b47dc3218df1b5638eee02964c59cdf65e6d2389
etworker/LocalizationHelper
/res_manager.py
UTF-8
7,693
2.796875
3
[ "MIT" ]
permissive
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys import getopt # detect if chinese in word def contains_zh(word): return re.compile(u'[\u4e00-\u9fa5]+').search(word) # resword is basic unit, save english word and chinese word class resword_info: def __init__(sel...
true
7ee97abcb5d476f1a70f59d4e5645c704fd57841
sclabs/projectile
/projectile/image_to_array.py
UTF-8
616
2.75
3
[]
no_license
import argparse import os import numpy as np from PIL import Image from PIL.ImageOps import invert def image_to_array(image_file, mode='RGB'): return np.asarray(invert(Image.open(image_file).convert(mode))) def run(image_file, mode='RGB'): np.save(os.path.splitext(image_file)[0], image_to_array...
true
44ea154804a8bc38700c94376d539f5b3032fe1a
KAIST-AILab/NeuralPipeline_DSTC8
/ConvLab/convlab/modules/dst/state_tracker.py
UTF-8
1,069
2.953125
3
[ "MIT", "Apache-2.0" ]
permissive
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ """ class Tracker: """Base class for dialog state tracker models.""" def __init__(self): """The constructor of Tracker class.""" pass def update(self, user_act=None): """ Update dialog state based...
true
0329dea6b2699871653d854e4acf2bd773fef5d1
jij3x/SolutionJudger
/_problems_001/3Sum Closet/convert_in.py
UTF-8
239
3.375
3
[]
no_license
import sys lines = sys.stdin.read().splitlines() print(len(lines) // 2) for line in lines: if line[0] == "[": nums = line[1:-1].split(",") print("{} {}".format(len(nums), " ".join(nums))) else: print(line)
true
c17ba20a9c606ab366ba2166dab50c5a74ab452e
howard1005/GoogleCrawler-KakaoTalk
/KakaoTalk.py
UTF-8
3,286
2.625
3
[]
no_license
import os import json import requests import webbrowser class KakaoTalk(): code_path = 'accounts/code.txt' token_path = 'token.txt' def __init__(self): self.rest_api_key = "720e4f2ac0b1f44552cbc00c7803bd31" self.redirect_url = "http://127.0.0.1:8000/account/login/kakao/callback" sel...
true
cf8e8aa461460c572c176e05b6ffeb9702a4084a
Franjey/Python
/Facturas/Montos_Facturas.py
UTF-8
4,905
3.078125
3
[]
no_license
import PyPDF2 import os import re from openpyxl import Workbook, load_workbook ''' General: Extrae los montos de las facturas y los copia en un excel. Instrucciones básicas: - Dentro de la carpeta donde va a guardarse el programa, crear una subcarpeta llamada "Archivos". Guardar las facturas allí. - Dentro de la ...
true
66ef8ebe1b4647693150e9ffc0c6d3cb4f8d5b7f
d1pakda5/pcapgraph
/pcapgraph/get_filenames.py
UTF-8
4,718
2.5625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- # Copyright 2018 Ross Jacobs All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
true
4cdee879b6202e724a31e87173397947131c2344
enakshi194/Image-Processing-Number-Plate-Recognition
/Test_svm_char_V07.py
UTF-8
12,725
2.625
3
[]
no_license
#!/usr/bin/env python ''' SVM character detection. Test_svm_char_V07.py can be tested on image as well as video. It finds contours in the image or frame and selects samples from it. Following preprocessing is applied to the image: - Moment-based image deskew (see deskew()) - Digit images are split into 4 1...
true
d16bec01dee54b52f973f53b94569ecad6678194
JhonyCacuango/prueba_1_2018A
/Ejercicio.py
UTF-8
1,677
3.921875
4
[]
no_license
#funciones def vol_pircuadrada(): print ("Ingresa") altura=int(input("valor de la altura: ")) lado_base=int(input("valor de un lado de la base: ")) areab=lado_base*lado_base vol=(areab*altura)/3 print ("El volumen es ",vol," cm3") import math def funcion(): r=float(input("Ingrese el radio ...
true
a6e59759793ea3aa461e9ce330e952cf78223412
mohammedhamada475/IUG_NLP
/Mohammed_Hamada_3rd_Assig.py
UTF-8
1,425
3.46875
3
[ "Apache-2.0" ]
permissive
def minEditDist(first, second, costs=(1, 1, 2)): s = first.split() t= second.split() #calculate the length rows = len(s)+1 cols = len(t)+1 #delete = 1 , insert = 1 , substitues = 2 , deletes, inserts, substitutes = costs #2D arr dist = [[0 for x in range(col...
true
2323930d174382e0f5059a287cb7de59d4fdaedb
rezeile/world-records
/scrape-records.py
UTF-8
1,554
2.921875
3
[]
no_license
#!/usr/bin/python from lxml import html import requests import json IAAF_URI = 'https://www.iaaf.org/records/by-category/world-records' TABLE_IDS = ['menoutdoor','womenoutdoor','menindoor','womenindoor'] OUTPUT_FILES = ['data/men-outdoor.json','data/women-outdoor.json','data/men-indoor.json','data/women-indoor.json'...
true
49212ee9563062dada1d55f9f3bb3dab4755aafc
Bahrom21/python_lessons
/14,07,2021/14.07. O'yin dasturlar.py
UTF-8
90
2.6875
3
[]
no_license
import camelcase c = camelcase.CamelCase() txt = "tanaffus bo`ldi" print(c.hump(txt))
true
5b7e90c817c6e0dd76b1a724048f9634fec9f6bc
an-ju/simpleazure
/simpleazure/simpleazure.py
UTF-8
18,411
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- """ simpleazure.SimpleAzure ~~~~~~~~~~~~~~~~~~~~~~~~ This module provides a Python library for Windows Azure Virtual Machines. :copyright: TBD :license: TBD """ import os import base64 import random from urlparse import urlparse from time import sleep from azure import * from azure.servic...
true
967a942afc87c47e471a9d575b26504fbf663f5d
AspiringOliver/kkb
/2 爬虫/课内练习/2.7 储存我们爬取的数据.py
UTF-8
2,182
3.671875
4
[]
no_license
# 爬取了豆瓣排行里的“豆瓣新片榜”的电影名,URL,电影基本信息,电影评分信息现在我们将他保存下来 import requests, openpyxl # 引用requests库 from bs4 import BeautifulSoup wb = openpyxl.Workbook() # 利用openpyxl.Workbook()函数创建新的workbook(工作薄)对象,就是创建新的空的Excel文件。 sheet = wb.active # wb.active就是获取这个工作薄的活动表,通常就是第一个工作簿,也就是我们在上面的图片中看到的sheet1。 sheet.title = '豆瓣新片榜' # 可以用.title给...
true
6f5502a00b592739c254b9993a91a1623fb6927c
figmans/chatbot
/keyword_kbbi.py
UTF-8
919
3.34375
3
[ "MIT" ]
permissive
import csv # maaf, saya tidak yakin dapat mengupload kode yang terbaru. # buat dict kosong yang akan terisi kata dan definisinya kamus = {} with open('datacsv/kamus.csv',newline='') as csvfile: # delimiternya '|', karena ini jarang dipakai # kecil kemungkinannya untuk error dalam pemprosesan baris = csv.r...
true
8c09d6eff7fbe5455531a902ee8d4992cf41f69d
jaikko/chess_project
/views/player/addplayer.py
UTF-8
778
3.34375
3
[]
no_license
class AddPlayerView: def __init__(self, player): self.player = player @staticmethod def get_firstname(): first_name = input("prenom: ") return first_name @staticmethod def get_lastname(): last_name = input(("nom: ")) return last_name @staticmethod ...
true
3aa77e2da2e3ebb26906056340f511dd202c29ff
taehwan920/Algorithm
/leetcode/path_crossing.py
UTF-8
513
3.25
3
[]
no_license
class Solution: def isPathCrossing(self, path: str) -> bool: direction = { 'N': (-1, 0), 'S': (1, 0), 'E': (0, 1), 'W': (0, -1) } visited = [[0, 0]] now = [0, 0] for move in path: print(now) dy, dx = dir...
true
c96aa7b69dcf6449661b99b60e2f00a4a26e47ac
CianLR/judge-solutions
/kattis/natrij.py
UTF-8
350
2.796875
3
[]
no_license
curr = [int(i) for i in input().split(':')] fut = [int(i) for i in input().split(':')] mins_carry, sec = divmod(fut[2] - curr[2], 60) hrs_carry, mins = divmod(mins_carry + fut[1] - curr[1], 60) _, hrs = divmod(hrs_carry + fut[0] - curr[0], 24) if hrs == 0 and mins == 0 and sec == 0: hrs = 24 print("{:02}:{:02}:{...
true
b80b451a1bedb92de5953799c644e2f900fdc77b
shiyazhou121/python
/jdprice.py
UTF-8
1,111
2.515625
3
[]
no_license
#coding=utf-8 import urllib2 import requests from lxml import etree import re def crawler(url): html = requests.get(url).content page = etree.HTML(html) return page def download(url): page = crawler(url) sku = page.xpath('//li[@class="gl-item"]//div/@data-sku') for i in sku: name_url =...
true
3e4634c5672943b990516316f0dcd7b4e1de4299
AlcantaraGabriel/CuitCom
/testSchemDraw.py
ISO-8859-1
2,143
3.015625
3
[]
no_license
# -*- coding: cp1252 -*- import SchemDraw as schem import SchemDraw.elements as e import SchemDraw.logic as l d = schem.Drawing() # * = N # --- = linha horizontal com comprimento padro(3.0) # -- = linha horizontal com comprimento modificado # ||| = linha vertical com comprimento padro(3.0) # || = linha...
true
2e4a0807e6ca07b4244a4cfff40612b201196776
leodaher/duckero-backend
/tests/test_auth.py
UTF-8
1,988
2.546875
3
[]
no_license
import json from unittest import mock from uuid import uuid4 from app.models import User def test_sign_up_without_email(client): rv = client.post("/sign_up", content_type="application/json", data=json.dumps({})) json_data = rv.get_json() assert json_data["message"] == "The e-mail field is missing" a...
true
44f331de2f44ece79d558bdf63ddddc3b7045e2f
HollyCorbin/AI_project2
/project2.py
UTF-8
1,053
3.125
3
[]
no_license
from csp import CSP from backtracking import backtracking_search # read in graph from input file f = input("file name: ") with open(f, 'r') as file: line = file.readline() # Everything that starts with # is a comment while line.startswith('#'): line = file.readline() # First non c...
true
d8ab90ad673917bb9d58ceabe40ae3603ff570e4
kumcp/face-recognition-dlib
/performance_measure.py
UTF-8
363
3.296875
3
[]
no_license
import time def measure_time(func): def function_wrapper(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) end_time = time.time() print("Executing %r takes: %f ms from %f to %f" % (func.__name__, (end_time - start_time) * 1000, start_time, end_time)) ...
true
abb2afd130a7e003bbc34ee7118f2d696099cf45
jbmohler/turngames
/scum/player1.py
UTF-8
1,557
3.203125
3
[]
no_license
import itertools # terms: # - hand # - dealt # - group # - trick class GreedyPlayer: def __init__(self): self.hand = None self.played = [] def receive_deal(self, game, dealt): self.hand = dealt def play(self, game, trick): if len(trick.play_history) == 0: ...
true
8e6af77d92e41676f57473fe5c10e020679ef359
BerndMenia/Information-Retrieval
/code/src/exercise9/Sequence2.py
UTF-8
2,099
2.78125
3
[]
no_license
from os.path import abspath from spotlight.evaluation import sequence_mrr_score from spotlight.sequence.implicit import ImplicitSequenceModel from spotlight.cross_validation import user_based_train_test_split import pandas as pd # parameters: our sequence model, the dataframe of the dataset and a list of user ids out...
true
c01f46251c7d9ca4cdbc9e0920e810fc569ffbfd
dawnknight/Kproject
/animation_opt_data.py
UTF-8
1,085
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Dec 02 13:04:16 2016 @author: liuqi """ import cPickle import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D data_all = cPickle.load(file('mocapdata1128_array.pkl','r')) keys = data_all['keys'] NUM_LABELS = len(keys) # total number of the labels NUM_...
true
58e08c2e1fb2f87c95554cdb59a7f8149e95a09c
yasser-aboelgheit/performance-task
/quiz/management/commands/create_large_data.py
UTF-8
496
2.546875
3
[]
no_license
from django.core.management.base import BaseCommand from quiz.factories import QuestionFactory, AnswerFactory class Command(BaseCommand): help = 'Create 100 questions and 10000 answers' def handle(self, *args, **kwargs): questions = QuestionFactory.create_batch(size=100) for i in range(100): ...
true
ec8e74242013aea5bf481a441b2aa19ba61d022e
Akmakosh/python-training
/if elif else/c/main.py
UTF-8
122
3.28125
3
[]
no_license
y = int(input()) x = int(input()) if (y != 1 and x != 1) or ( x == 1 and y == 1): print('YES') else: print('NO')
true
8e10df4bf1a58843e58e453ed45beda569235ef5
gnetscher/Capstone_MachineLearning
/processFile.py
UTF-8
3,735
2.984375
3
[]
no_license
import csv from StringIO import StringIO import numpy as np from datetime import datetime import math def openFile(file, type, new, dates): # extract data from file. # type = 'accelerometer' or 'temperature' or 'pressure' or 'magnetometer' or 'humidity' or 'luxometer' # new (boolean): if the fil...
true
e4fc44aa90827b059cd75bcc503f74b4fd5d0e24
bschlenk/roku-steam-controller
/main.py
UTF-8
855
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python from settings import ROKU_IP from roku import Roku import sys import argparse roku = Roku(ROKU_IP) def handle_args(): parser = argparse.ArgumentParser(description='Press the given button on the roku remote.') group = parser.add_mutually_exclusive_group(required=True) group.add_argum...
true
d20f00d8397128711004df3f3340cb7cb3552519
fjaguado/PrEd
/Brain_1.py
UTF-8
1,037
2.515625
3
[]
no_license
from pyrobot.brain import Brain class WB(Brain): def setup(self): self.counter = 0 self.inverse = {} self.inverse['right'] = 'left' self.inverse['down'] = 'up' self.inverse['left'] = 'right' self.inverse['up'] = 'down' d = 'down' r = 'right...
true
72ed4fd694837e40dbca210f9d20e27803d6bf92
azaaza987/FirstDjango
/testORM/testInsert.py
UTF-8
1,131
3.109375
3
[]
no_license
import sqlalchemy from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column,Integer,String from sqlalchemy.orm import sessionmaker engine = create_engine("mysql+pymysql://root:root@localhost/testdb",encoding='utf-8',echo=True) Base = declarative_base()#生成...
true
ee8cf8fdf857292bb41a8ea4855335f340565fbf
Black3bird/firstrepo
/Hello-git/dictwithloops.py
UTF-8
71
2.875
3
[]
no_license
mydict = {"Color":"White","Gender":"Male"} print(mydict.get("Age",13))
true
9037cc1389444bb01b7aa4cd8325cda91de3c4b7
wendian/DNS_Cache
/LRUQueue.py
UTF-8
1,463
3.5
4
[]
no_license
#Queue using the DLL from DLListNode import DLListNode class LRUQueue: def __init__(self): #front_ and rear_ will be head nodes self.front_ = DLListNode(None) self.rear_ = DLListNode(None) self.front_.set_next(self.rear_) def enqueue(self, url = None, ip_add = None): #enqueue will always be pos...
true
5adfd97a11e461245434358f31288cb2975ef15a
PattyDelaluz/CS1400
/EX10_LancePeters.py
UTF-8
140
2.703125
3
[]
no_license
import csv file = open('station.csv') csv_file = csv.reader(file) for row in csv_file: print(row[7]) if not ''.join(row).strip():
true
2fac27c802520f981b64cd2df59fbd2caf5b8833
dsananez/NBA-B2B
/sandbox/costo_plataforma.py
UTF-8
1,065
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jul 5 16:20:37 2018 @author: dsananez """ import pandas as pd d = {'tipo_oferta': ['cater','upsell','bono','descuento','descuento','upsell','descuento','bono','upsell','cross_sell','bono','upsell']} data = pd.DataFrame(data=d) def costo_plataforma(df, t_util = 8, efic_rep...
true
b5deeff87273319212b82183cbf1c7b5e06712c1
DITICCY-WALLET/wallet_common
/coin/coin_tools.py
UTF-8
2,818
3.09375
3
[]
no_license
import json from digit import digit from enumer.coin_enum import TxStatusEnum class BlockHeight(object): def __init__(self, current_height, best_height): self._current_height = current_height self._highest_height = best_height def __str__(self): return 'current: {}, highest: {}'.forma...
true
83d2d406e1507509244c27f68015a46579c4b5e6
akashgkrishnan/HackerRank_Solutions
/InterviewPrep/marsExploration.py
UTF-8
395
3.375
3
[]
no_license
def marsExploration(string): error_count = 0 for i in range(0,len(string), 3): s = string[i: i + 3] if s != 'SOS': if s[0] != 'S': error_count += 1 if s[1] != '0': error_count += 1 if s[2] != 'S': error_count += ...
true
a23e6beb59919a9692de8a8fb4fa4dbf3bed5c64
m3gaDewD/fortune512
/app.py
UTF-8
3,087
2.53125
3
[]
no_license
#!/usr/bin/env python3 from http.server import BaseHTTPRequestHandler, HTTPServer import logging import random import codecs import os from pathlib import Path from hashtable import HashTable FLAG = os.environ.get('FLAG', 'not_a_real_flag') FORTUNE_LOCATION = Path(__file__).parent / 'fortune' def get_fortunes(locat...
true
06bad0b0ee4af0d3bd6fa7bbdb0012d213c82724
ohnena/algorithm_test2
/32 11055 가장큰증가부분수열/main2.py
UTF-8
856
2.796875
3
[]
no_license
N = int(input()) S = list(map(int, input().split())) DP = [0] * N DP[0] = S[0] rev = [0] * N # 점화식 DP[i] = S[i] + min(DP[j]) (j는 0<=j<i and S[j] < S[i]) for i in range(N): val = 0 rev_p = 0 for j in range(i): if S[j] < S[i]: if val < DP[j] : rev_p = j val =...
true
b3314bb215b69d3f3f74ae2d2bea89c06e3fd8d6
anamorales05/-201902207_TareasLFP
/pythonProject/CSV.py
UTF-8
151
2.59375
3
[]
no_license
import csv with open('tarea python/tarea2.csv', newline='') as File: reader = csv.reader(File) for document in reader: print(document)
true
e10af81e59860a0899eb9ed0b57811fa40409b2a
Graeme-Miller/EvolveTwo
/example.py
UTF-8
5,765
2.71875
3
[]
no_license
import docker, requests, time, random, subprocess, datetime client = docker.from_env() numberToCreate = 5 def addAnimals(url, speciesId, number, diet): moveSpeedPercentage = random.randint(20, 100), maturityAgePercentage = random.randint(20, 100), gestationSpeedPercentage = random.randint(20, 100), ...
true
2737ca074247f73fef765c45832c90e1b7baf413
rootid23/fft-py
/bit-manipulation/missing-number.py
UTF-8
1,096
3.78125
4
[]
no_license
class Solution(object): def missingNumber(self, nums): #priori info - [0,n] #[0,1,3] #BF - populate set with 0-n elem #pass 2 -> go over elements and remove the elemtn return not existing elem # 2 pass move the element to right position #[3,0,1] -> [0,1,2] #...
true
09023fb1677015c916e8f48dcff23fb85c2689d8
KarolProgramista/SPyFTI
/SPyFT/Reciver.py
UTF-8
2,842
3
3
[]
no_license
import socket from SPyFT.settings import * class Receiver(object): def __init__(self, port=DEFAULT_PORT, save_path=DEFAULT_PATH): self.port = port self.save_path = save_path self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.bind((socket.gethostname(), self...
true
efacc4f81d085c018f6279b8afb18976c2c0e87a
jammiess/architus
/src/generate/gulag.py
UTF-8
1,397
2.578125
3
[ "MIT" ]
permissive
from wand.image import Image import urllib.request as urllib2 from wand.drawing import Drawing from wand.drawing import Color import random, os, string from PIL import Image as pilimg def generate(url): hdr = { 'User-Agent':'Mozilla/5.0', 'Accept': 'text/html,application/xhtml+xml,applicat...
true
c97dde0765c87e86c10397ee4a766f8148627b9c
rehafj/CMPM_Project3
/Helper scripts/jsonifier.py
UTF-8
487
2.75
3
[]
no_license
### ### Takes a list of pokemon attacks as created by AttackReader.py ### and converts them to JSON (for text classifier validation) ### import glob import os f_in = open("./attacks/test.txt", "r") f_out = open("./attacks/attacks.json", "a") f_out.write("[\n") for line in f_in: f_out.write("\t{\n") f_out.wri...
true
ae1ba8a25194a6617271580e70a8b825ca3ca561
Vinay-Pratap-Singh/Complete-ATM-Machine-Project-
/atm_machine.py
UTF-8
3,428
4
4
[]
no_license
option = 0 balance = 5000 pin = 1234 def driver_code(option): if option == 1: check_balance() elif option == 2: withdraw() elif option == 3: transfer() elif option == 4: deposit() elif option == 5: change_pin() elif option == 6: print("Thanks for ...
true
6d73defb7f0e29a812e0591309289b21d8e78ef7
bossjoker1/algorithm
/pythonAlgorithm/Practice/1051高度检查器.py
UTF-8
437
2.9375
3
[]
no_license
# 桶排序 class Solution: def heightChecker(self, heights: List[int]) -> int: bucket = [0] * 101 for h in heights: bucket[h] += 1 res = 0 j = 0 for i in range(1, 101): while bucket[i] > 0: if heights[j] != i: print(i, he...
true
8cf71d838f54b26cf747ed087d9602db2d16376d
korid24/projectEuler
/problem22_NamesScores.py
UTF-8
570
3.390625
3
[]
no_license
#https://projecteuler.net/problem=22 from time import time start = time() f = open('files/names.txt', 'r') names_list = ['_'] + sorted(map(lambda el: el.strip('\n').strip('"'), list(f)[0].split(','))) letters_list = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ' def name_score(name): acc = 0 for letter in name: acc +=...
true
84e70bb750c02e9f718fdf38e3a308641228ae37
tkln/kinesis-eeprom
/json-to-svg.py
UTF-8
1,623
2.75
3
[]
no_license
#!/usr/bin/env python3 import xml.etree.cElementTree as ET import json from sys import argv import hwmap def key_rect(root, x, y, label, addr, w = 1, h = 1): grid = 64 key_sz = 0.9 r = ET.SubElement(root, "rect", attrib = { "width": str(grid * key_sz * w), "height": str(grid * key...
true
3ee83f5f0b30b281983a219b5dd419b4c145826e
emil2015/StudentDist
/dist.py
UTF-8
1,016
3.796875
4
[]
no_license
#First draft, still a little hacky import random #Array for advanced programming students advPro = ["mary", "jane", "sue"] #Array for non advanced programming students begPro = ["frank", "joe", "bob"] #Array for non programming students nonPro = ["sally", "jinx", "nasus", "holly"] #Array for tables tables = [""...
true
e950134887ee89864868bf9c10446136111e4afd
renepickhardt/Imbalance-measure-and-proactive-channel-rebalancing-algorithm-for-the-Lightning-Network
/code/mppalgo.py
UTF-8
1,871
3.484375
3
[ "MIT" ]
permissive
""" 7. Janary 2020 example code that demonstrates how the imbalance improvement measure should be applied for multi path payments on the lightning network. Author: Rene Pickhardt """ import numpy as np # amount that is to be paid. a = 0.7 def gini(x): # from https://stackoverflow.com/questions/39512260/calcu...
true
7f933c625e012981702cf6cb8f4bf7654794f422
bellmit/scrapy_all_project
/zaluan/meizitu/meizitu/spiders/example.py
UTF-8
2,047
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from scrapy import Request from copy import deepcopy import os class ExampleSpider(scrapy.Spider): name = 'jieba_try' allowed_domains = ['3.com'] start_urls = ['http://www.mzitu.com/page/0/'] def parse(self, response): # 主页面的每个图片集的li以及进入的url li_li...
true
b6afdba49f4d127ce97255112a28f6503275c70a
VitrSantos/cursoemvideo
/desafio 3.py
UTF-8
163
3.75
4
[]
no_license
print('Vamos fazer a sequência de Fibonacci?') stop = int(input('Qual o último número?')) a = 0 b = 1 while (b < stop): print(b) b = b + a a = b - a
true
b35cb481a09976b18b51fdc71b8c99d23d3577b9
weiJinzhou/pythonCode
/closurestest.py
UTF-8
140
2.703125
3
[]
no_license
#!/usr/bin/env python def add_number(num): def adder(number): # 这是一个闭包 return num + number return adder
true
56a20ee250403f3e9a6fa64aed10ce6ba1fe502f
oksmina/hyperskill
/Problems/Prepositional genitive/task.py
UTF-8
55
3.3125
3
[]
no_license
str1, str2 = input().split() print(f"{str1} of {str2}")
true
492b5710e9eb70cf4944a3dafd15e594a92a9f8e
jielaizhang/archangel
/sfb/half_light.py
UTF-8
2,552
2.625
3
[]
no_license
#!/usr/bin/env python import sys from xml_archangel import * def interp(x1,x2,y1,y2,z1): return y1+(z1-x1)*(y2-y1)/(x2-x1) if __name__ == '__main__': if sys.argv[1] == '-h': print 'calculate petrosian value for its half light radius' sys.exit() if os.path.exists(sys.argv[-1].split('.')[0]+'.xml'): ...
true
b70c1c06b6beed7b1c760937fb126198b3cd6127
ariebovenberg/snug
/tests/test_query.py
UTF-8
7,683
2.6875
3
[ "MIT" ]
permissive
import asyncio import inspect import urllib.request from operator import methodcaller import snug async def awaitable(obj): """an awaitable returning given object""" await asyncio.sleep(0) return obj class MockAsyncClient: def __init__(self, response): self.response = response async de...
true
a911622e62b1062a24d726f4fd19351a1f5752c5
Celinemmbonekerrine4/passlocker
/Credentials/credential_test.py
UTF-8
2,666
2.65625
3
[ "MIT" ]
permissive
import unittest from credentials import User, Credentials import pyperclip class TestUser(unittest.TestCase): def setUp(self): self.new_user = User("Celine", "mmbone", "0719476296", "celinekerrine@gmail.com") def test_init(self): self.assertEqual(self.new_use...
true
83e215fb44c03a0ae993b83bfe8a98ddc0c477ac
n3d1117/NERComparison
/utils.py
UTF-8
1,127
3.265625
3
[]
no_license
import statistics import pandas as pd def cleaned(sentence): return sentence.replace(' ,', '').replace(' .', '.').replace('( ', '(').replace(' )', ')').replace('$ ', '$')\ .replace(" '", "'").replace(" '", "'").replace(' "', '"').replace("' ", "'").replace(" :", ":")\ .replac...
true
2700d69c8bd7475d28958e5e07dcf1b69fd49ab9
JunchuangYang/Machine-Learning
/逻辑回归(Logistic_Regression)算法/Logistic_Regression_疝气病症预测病马的死亡率/Logistic_Regression_疝气病症预测病马的死亡率.py
UTF-8
4,418
3.25
3
[]
no_license
import numpy as np import math import pandas as pd ''' 定义辅助函数: 函数功能:计算sigmoid函数值 参数说明: inX:数值型数据 返回: s:经过sigmoid函数计算后的函数值 ''' def sigmoid(inX): s = 1/(1+ np.exp(-inX)) return s ''' 为什么要标准化,见(pdf) 标准化函数 函数功能:标准化(期望为0,方差为1) 参数说明: xMat:特征矩阵 返回: inMat: 标准化之后的特征函数 ''' def regularize(xMat): inMat...
true
ab7be6372884f1faac0319ee2ddb045a23224df2
gxy924924/code_test
/pytest/server.py
UTF-8
741
3.125
3
[]
no_license
#!D:\Python27\python.exe #coding=utf-8 import socket # 导入 socket 模块 s = socket.socket() # 创建 socket 对象 host = socket.gethostname() # 获取本地主机名 port = 12345 # 设置端口 s.bind((host, port)) # 绑定端口 s.listen(5) # 等待客户端连接 i=1 while i: c, addr = s.accept() # 建立...
true
acc2de7ebf9311bfe8b0f918b88bbc7b84c5f4a7
arbyadav/Python_Program_Basics_StepbyStep
/Python/OOPS/Constructor.py
UTF-8
490
4.125
4
[]
no_license
class person() : def __init__(self): self.name='Amit' self.age=25 def update(self): self.age=25 def compare(self,otherobj): if self.age==otherobj.age: return True else: return False p1=person() p2=person() p1.name...
true
5ce379d10a8f9a81f541970fd4b9982789f6a332
mr-nishanth/PythonDT
/Regular_expression_py/24-Decorators.py
UTF-8
1,061
4.03125
4
[]
no_license
""" 1. Design Pattern 2. Adding Additional functionality to an object at RUN TIME 3. Reduce code duplicate 4. Python provide easy syntax for decorators too 5. Deecorators are like a extension methods 6. Which can accepts arguments too 7. Decorators executes first EX ...
true
e98f4c7a9cbea38822ef78d1856381e1f05c1310
FrodeWY/Python_test01
/src/test05/BytesIO.py
UTF-8
543
3.640625
4
[]
no_license
from io import BytesIO # StringIO操作的只能是str,如果要操作二进制数据,就需要使用BytesIO。 # BytesIO实现了在内存中读写bytes,我们创建一个BytesIO,然后写入一些bytes def bytes_io_write(): f = BytesIO() f.write('中文'.encode('utf-8')) # 请注意,写入的不是str,而是经过UTF-8编码的bytes。 print(f.getvalue()) def bytes_io_read(): f = BytesIO('b\xe4\xb8\xad\x...
true
bbc6545d8ab07b5c10a9e64b894a2586e59b1fd3
rahalrsh/point-of-sale
/pos/routes/items.py
UTF-8
4,550
2.875
3
[]
no_license
from flask import request, jsonify, abort, Blueprint from pydantic import ValidationError from pos import db from pos.exceptions.custom_exceptions import EmptyResourceError from pos.models.item import Item from pos.validators.item_input_validator import ItemInputValidator # Blueprint for api/v1/items routes items_bp ...
true
d2b7b213201efdc625cde5a8fec6dea191669427
cxt2333/axf
/market/goodfilters.py
UTF-8
1,162
2.515625
3
[]
no_license
# coding:utf-8 # 学校:闽江学院 # 编写人:陈端倪 # 开发时间:2021/3/11 23:53 from django_filters import rest_framework as filters from home.models import AxfGoods class GoodsFilter(filters.FilterSet): typeid = filters.CharFilter(field_name='categoryid') childcid = filters.CharFilter(field_name='childcid', method='filter_child_...
true
3bb015bc5e51ff46297be50b46e3b056775e429d
mwegiere/serwo
/symulacja/publisher_seeByIRP6HomogMatrix.py
UTF-8
887
2.546875
3
[]
no_license
#!/usr/bin/env python # license removed for brevity import rospy import math from serwo.msg import SerwoInfo def talker(): pub = rospy.Publisher('seeByIRP6HomogMatrix', SerwoInfo, queue_size=10) rospy.init_node('seeByIRP6HomogMatrix', anonymous=True) msg = SerwoInfo() matrix = [] #w rzeczywistosci...
true
b87ec0ad3544216a17f898dd56c1d02791796326
medit74/DeepLearning
/MyTensorflow/MyTensorBasic/mytensor_compare_index.py
UTF-8
582
3.53125
4
[ "Apache-2.0" ]
permissive
''' Created on 2017. 5. 17. @author: Byoungho Kang ''' import tensorflow as tf ''' Initialize Tensors ''' m1 = tf.constant([[1.0,2.3,0.7],[3.9,1.0,9.3]]) print(m1) ''' Buid a Graph - Sequence Comparison and Indexing (https://www.tensorflow.org/api_guides/python/math_ops) ''' node1 = tf.argmax(m1...
true
7795848c66375f76b60a0bf2ef84a4caa5770255
stevenschmatz/project-euler
/problem-057.py
UTF-8
686
3.546875
4
[]
no_license
from fractions import Fraction import sys def get_continued_fraction(depth=1): if depth == 1: return 1 + Fraction(1, 2) else: return 1 + Fraction(1, 1 + get_continued_fraction(depth - 1)) def main(): # You usually shouldn't set this. However the recursion limit default is 1000. # Thi...
true
e1dac82c43d8de59f78e0d2e329e5495e389644f
po5i/verum
/jrv/storage.py
UTF-8
1,473
2.578125
3
[]
no_license
from django.conf import settings from storages.backends.s3boto import S3BotoStorage class StaticStorage(S3BotoStorage): # location = settings.STATICFILES_LOCATION custom_domain = settings.AWS_S3_CUSTOM_DOMAIN bucket_name = settings.AWS_STORAGE_BUCKET_NAME class MediaStorage(S3BotoStorage): location = s...
true
dd5b9db4f59235e7eb27f66990811605e26dacf1
okmd/insects-detection-and-classification
/test.py
UTF-8
3,404
2.625
3
[]
no_license
import pickle import re import argparse import cv2 import imutils import matplotlib.pyplot as plt import numpy as np from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import img_to_array, load_img import settings import utils model = load_model(settings.MODEL_PATH) # model.lo...
true
8f1ab4bafae0a79e95136bcc057e924111a274bc
oliver32767/cork
/test/test.py
UTF-8
371
2.65625
3
[]
no_license
import unittest import cork class PseudorandomTest(unittest.TestCase): def testSeed(self): prnd = cork.Pseudorandom(555) control_value = prnd.random() prnd.seed() prnd.seed("*args", 2, {"key": 90210}, ['foo', 187]) prnd.seed({}) prnd.seed(555) ...
true
3a560c07e3ed2d5dde6cc5041b0066cb404e7876
Pri-Alves/CursoMundoPython
/Mundo1/ex0028.py
UTF-8
298
3.734375
4
[]
no_license
import random print('Vou pensar em um numero entre 0 e 5. Tente adivinhar...') n = int(input('Em que numero eu Pensei?')) e = random.randint(0,5) print('Processando....') if n == e: print('Parabéns! Você conseguiu me vencer') else: print('Ganhei! eu pensei no {} e nao no {}'.format(e,n))
true
5cdf77b6615028ff035976188addc24f2248a4f3
LucasSSouzaSSantos/Python
/Mundo 1/Ex004.py
UTF-8
367
4.25
4
[]
no_license
""" EXERCÍCIO 004: Dissecando uma Variável Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo e todas as informações possíveis sobre ele. """ variavel = str(input("Digite qualquer coisa: ")) print(f"É numerico: {variavel.isnumeric()}") print(f"É uma letra {variavel.isalpha()}") print(f"...
true
255095f63c88a728c0fd8829de013b837756d131
DSZzm/Text_Annotation
/Text_Annotation/Data_process.py
UTF-8
3,334
2.5625
3
[ "MIT" ]
permissive
from keras.preprocessing.text import Tokenizer import numpy as np import pandas as pd import os import pickle import re import jieba from .data import load_chat, load_docx jieba.setLogLevel('WARN') DIR = os.path.dirname(os.path.abspath(__file__)) class Data_process(): def __init__(self): self.file = Non...
true
8fab5a513bf32b516a2b603bd66aa94f2485b0c4
jessicaportillo/humann
/humann/tools/join_tables.py
UTF-8
9,100
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Join a set of gene, pathway, or taxonomy tables into a single table This module will join gene and pathway tables output by HUMAnN. Dependencies: Biom (only required if running with .biom files) To Run: $ ./join_tables.py -i <input_dir> -o <gene_table.{tsv,biom}> """ import argparse im...
true
2e5911ee6e074e3c8146856cc4599028d675659d
GreenMarch/datasciencecoursera
/algo/basic/threeSum.py
UTF-8
1,488
3.578125
4
[]
no_license
class Solution: def threeSum(self, nums): """ :param nums: List[int] :return: List[List[int]] """ nums.sort() out = set() for i in range(len(nums)): l = i + 1 r = len(nums) - 1 target = 0 - nums[i] while l < r: ...
true
2ab9cb7f1ce6121927cb8ce8f3c19ec0ce09b657
pl6c2/Python-ML-DL
/ICP2/ICP2/Lists.py
UTF-8
363
3.890625
4
[]
no_license
lbs = [] number = int(input("enter the size of a list")) for x in range(number): e = input("enter an element") # reading list lbs.append(int(e)) print(lbs) # kgs = [] # second list # # for x in lbs: # kgs.append(round(x * 0.45359, 2)) # converting into kgs kgs = [round(lb * 0.45359, 2) for lb in ...
true
16cb1645b97a4fb0184eb4f973fb3d95ec155a0b
LeoLamCY/c8emu
/chip8.py
UTF-8
10,856
2.671875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import random class Chip8(object): ERROR_UNKNOWN_OPCODE = "ERROR: unknown opcode" running = False count = 0 font_set = [ 0xF0, 0x90, 0x90, 0x90, 0xF0, 0x20, 0x60, 0x20, 0x20, 0x70, 0xF0, 0x10, 0xF0, 0x80, 0xF0, 0xF0, 0x10, 0xF0, 0x10, 0xF0, 0x90, 0x90, 0xF0, 0x...
true
c51518adf4dd98245e8174f98c0ba816cfa3ca81
HengTing-Tim/Machine_Learning
/Final/code/ml_final.py
UTF-8
3,303
2.515625
3
[]
no_license
from os import listdir from os.path import isfile, isdir, join import pickle import time import matplotlib.pyplot as plt mypath = "/Users/hykuan/Documents/machinelearning/MLGame-master-1/games/pingpong/log" files = listdir(mypath) data = [] for f in files: fullpath = join(mypath,f) loadFile = open(fullpath, "...
true
b14f19dcb42177db74166e30f11a7775d6dac424
Bhumika0821/BLOCK-CHAIN
/blockchain.py
UTF-8
2,184
2.859375
3
[]
no_license
from block import Block from verify import BlockOutOfChain, BlockVerifier import logging logger = logging.getLogger('Blockchain') class Blockchain: __slots__ = 'max_nonce', 'chain', 'difficulty', 'wallet' def __init__(self, difficulty, wallet): self.max_nonce = 2**32 se...
true
55dd829e3e8b401b648ca3e2160b6e8a38232a7d
sianios/python_mini-projects
/4.pong.py
UTF-8
3,959
3.3125
3
[]
no_license
# Implementation of classic arcade game Pong import simplegui import random # initialize globals - pos and vel encode vertical info for paddles WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True ball...
true
99138bc0d358c3b8dc48652553cc875522f6e3ed
jackmeldrum/Chronicling-America-Parser
/Downloader/downloader.py
UTF-8
3,260
3.40625
3
[ "MIT" ]
permissive
# CAP Project - Download and unzipper - JS # Loops through a given JSON file, extracts file locations, and downloads them # import urllib.request import logging import configparser import json import time import bz2 import tarfile import io # Start our config parser, and read out config file. # This co...
true
6bf83d59ff3430f59bcccdf3b565cc966edb5559
MadJangE00/Algoritom_py
/chap05/recur1b.py
UTF-8
618
3.984375
4
[]
no_license
# 스택으로 재귀 함수 구현하기(재귀를 제거) from stack import Stack # stack.p의 Stack 클래스를 임포트 def recur(n: int) -> int: """ 재귀를 제거한 recur()함수 """ s = Stack(n) while True: if n > 0: s.push(n) # n값을 푸시 n = n - 1 continue if not s.is_empty(): # 스택이 비어 있...
true
1fe4f77f7c57941ad54a4724b224e8901f09a48c
sangjianshun/Master-School
/data_structure/my_set.py
UTF-8
3,322
4.125
4
[]
no_license
# Python3 中有六个标准的数据类型: # # Number(数字) # # String(字符串) # # List(列表) # # Tuple(元组) # # Set(集合) # # Dictionary(字典) ## 1. 集合的创建 ### 1.1 直接创建 set_master_school = {1, 2, "master", "school"} ### 1.2 通过set创建 set_master_school = set(("123")) # 注意,创建一个空集合必须用 set() 而不是 { },因为 { } 是用来创建一个空字典。 set_master_school = set((...
true
c0d982f9b0c492326c9546956d12f2012f706a02
i-gap4uk/time_manager
/main.py
UTF-8
594
2.59375
3
[]
no_license
#!/usr/bin/python3 import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtGui import QIcon from scripts.mainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) app.setWindowIcon(QIcon("resources/images/app_icon_os.png")) app.setQuitOnLastWindowClosed(False) mai...
true
fd6cf1340299e4089778c4e19bcf4364813b646a
francescovaiana/Proj
/v_modules/script/extract_sw.py
UTF-8
593
2.765625
3
[]
no_license
#!/bin/python import re i = 0 with open('./report.txt') as f_in: with open('./pyout.txt','w') as f_out: #row = f.read() #row = f.readline() for row in f_in: if (i == 2): period = row.rstrip() print('Period: {}ns'.format(period)) i = i+1 if ("DUT" in row): line_no_space = re.sub(r'\s+', " "...
true
83a4be59c7283aa4dcde9ac70ff6e98bb38977c2
Liu233w/nwpu-acm-python
/src/c1-3.py
UTF-8
126
3.6875
4
[ "WTFPL" ]
permissive
age = input('请输入您的年龄:') print("明年您的年龄是:%d" % (int(age) + 1)) input("Press Enter to Continue")
true
f138d0657e94a41bbada53a22d1ee8664d9e8298
benjamin-bigot/runtrack-python
/jour04/Job03.py
UTF-8
224
4
4
[]
no_license
def puissance2(k): if k > 0: puis = 2 * puissance2(k - 1) else: puis = 1 return puis x = int(input("Choisissez la puissance de 2 que vous voulez calculer\n")) print("2^", x, " = ", puissance2(x))
true
924e88770f7ff16b5c4b94868628b30f7dbfdf22
igrishaev/mars-task
/mars.py
UTF-8
6,846
3.53125
4
[]
no_license
import sys def make_world(w, h): """ The world is represented by a tuple (w, h, scents), where: - w: width, - h: height, - scents: a tuple of pairs (x, y). """ return w, h, () def parse_input(source): """ Parses input data from a file-like object. Returns a tuple (w, h, rout...
true
80fb348de4353c35cb9c2d51f6b7c3463f7ff91d
0377wxy/Python-File
/20年数模校赛/four.py
UTF-8
16,578
2.9375
3
[]
no_license
import copy import random import math import matplotlib.pyplot as plt import pandas as pd import numpy as np # 小盒子的类 BinLongth = 50 BinWidth = 40 BinHeight = 32.2 class Box: def __init__(self, length, width, height, kind): self.length = length self.width = width self.height = height ...
true
2cb30ae49748eae13225be327dfd2fa117b1f518
TargetIt/lab
/python/PythonCodeOrganization/class.py
UTF-8
648
3.78125
4
[]
no_license
class Bird(object): have_feather = True way_of_reproduction = 'egg' def move(self, dx, dy): position = [0,0] position[0] = position[0] + dx position[1] = position[1] + dy return position class Chicken(Bird): way_of_move = 'walk' possible_in_KFC = True def __init_...
true
eb45a3c95d335a90600d520f3fe5c9036ac34fbe
aherzfeld/udacity_programming_foundations
/lesson6/entertainment_center.py
UTF-8
1,860
3.1875
3
[]
no_license
import media import fresh_tomatoes toy_story = media.Movie( "Toy Story", "A story of a boy and his toys that come to life", "http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "https://www.youtube.com/watch?v=vwyZH85NQC4") #print(toy_story.storyline) avatar = media.Movie( "Avatar", "A ...
true
c117a57e207ac0c3b3678a19765698600b5dc86f
RVACardoso/PavaoMartinsPython
/data_abstraction_9.py
UTF-8
2,867
3.09375
3
[]
no_license
# # A9.1 # def create_vector(x, y): # return (x, y) # # def abcissa(vec): # return vec[0] # # def ordenada(vec): # return vec[1] # # def eh_vector(vec): # return isinstance(vec, (tuple)) and len(vec)==2 and isinstance(vec[0], (float, int)) and isinstance(vec[1], (float, int)) # # def eh_vector_nulo(vec...
true
0708e7f063e624f7d0f875e45f2b67c0b7d379d3
CuteFwan/aqbit
/qbittorrent/connectors.py
UTF-8
3,304
2.59375
3
[ "MIT" ]
permissive
from .errors import TorrentHashNotFound, TorrentNotValid, HttpException import aiohttp import asyncio import json class AConnector: def __init__(self, *, base, session = None, loop = None): self.base = base self.loop = loop or asyncio.get_event_loop() self.session = session async def ...
true