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
4e4391bc77441bf1b976e940c46e4231b0ec77dd
DiploDog/Skillbox-Homeworks-on-Python
/16_Lists/04_videocards/main.py
UTF-8
487
3.453125
3
[]
no_license
N = int(input('Количество видеокарт: ')) gpu_list = [] max_x_gpu = 0 for i in range(N): print(i + 1, 'Видеокарта:', end=' ') x_gpu = int(input()) gpu_list.append(x_gpu) if x_gpu > max_x_gpu: max_x_gpu = x_gpu new_gpu_list = [] for j in gpu_list: if j < max_x_gpu: new_gpu_list.append...
true
6bffabb940a443eaabacbb2ceb18b0a61fc50a44
felixdittrich92/NLP
/01_NLP_Basics/matching.py
UTF-8
1,721
2.984375
3
[ "MIT" ]
permissive
import spacy from spacy.matcher import Matcher from spacy.matcher import PhraseMatcher nlp_en = spacy.load('en_core_web_sm') matcher = Matcher(nlp_en.vocab) # Matcher hinzufügen/bauen siehe spacy Doku pattern1 = [{'LOWER': 'solarpower'}] pattern2 = [{'LOWER': 'solar'}, {'LOWER': 'power'}] pattern3 = [{'LOWER': 'sol...
true
b65ea810f6422acbd8d4d0b7a1b5cf2044592f69
teofr/CompProg
/Meli/2018/india.py
UTF-8
180
2.9375
3
[]
no_license
s = input() a = len(s) print (a) print (a*(a+1)/2) dicc = {s : 0} for x in range(len(s)): for y in range(x+1, len(s)): dicc[s[x:y+1]] = 0 print (len(dicc)) print (len(dicc))
true
17aa9df4e57e711c87f41b3e101d894ce19c50ba
DrakeVorndran/Tweet-Generator
/Code/reaarrange.py
UTF-8
602
3.421875
3
[]
no_license
import sys import random def reaarrange(words): for i in reversed(range(1,len(words))): pos = random.randint(0,i-1) words[i], words[pos] = words[pos], words[i] return(words) def reverseString(string, seperator=""): if(seperator == ""): return_string = list(string) else: return_string = string....
true
a283fe2abd2cd07a0bcfe0135177f7863a8a920d
almarklein/visvis
/examples/plotting.py
UTF-8
632
2.875
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import visvis as vv app = vv.use() f = vv.clf() a = vv.cla() vv.plot([12,34,21,38], lc='b', ls=':',mc='b', mw=7, lw=2, ms='s', mec='r') vv.plot([1,3,4],[33,47,12], lc='r', mc='r', ms='.') vv.plot([20,24,45,21], lc='g', ls='--', mc='g', mw=12, lw=3, ms='') vv.plot([35,14,40,31], lc='k', ls='-.'...
true
0c26165aa1d776b48bc8975da70309c0676b6f03
iamryabinov/SER_SVM_KNN
/feature_extractor.py
UTF-8
2,020
2.828125
3
[]
no_license
import os import pandas as pd from constants import * class FeatureExtractor: def __init__(self, input_folder, exe_path, config_path, output_folder): self.input_folder = input_folder self.exe_path = exe_path self.config_path = config_path self.output_folder = output_folder def ...
true
eca5e00dabbde4d3ff4d57b84ad87c4859e36520
multi-os-engine/art
/tools/checker/common/logger.py
UTF-8
2,474
2.546875
3
[ "Apache-2.0", "NCSA" ]
permissive
# Copyright (C) 2014 The Android Open Source Project # # 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 required by applicable law or ...
true
591b8c939cabf3c908d9893cfc0d162946291c29
MauriDV/Financial_Indicators
/financialIndicators.py
UTF-8
6,635
3.078125
3
[]
no_license
""" Input: stockPrices : array of floats period : integer volume : array of floats shortPeriod: integer longPeriod: integer StockPricesHigh: array of floats StockPricesLow: array of floats MACDArray: array of floats array: array of floats """ import math class FinancialService(object): """ -pre: len(stockP...
true
a8fbb73469124f7239154480478a50893b4fb66a
786440445/leecode
/sougou/1.py
UTF-8
742
2.890625
3
[]
no_license
#!/usr/bin/env python # -*- coding: UTF-8 -*- '''================================================= @Project -> File :leecode -> 1 @IDE :PyCharm @Author :chengli @Date :2020/9/5 6:23 PM @Desc : ==================================================''' class Solution(): def func(self): inp = list(map(int...
true
0c80d07a0cd3eb571465234754a55272255d9042
zclccc/CAE_Keras
/utils.py
UTF-8
2,024
2.765625
3
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- # author: YueJie time:2020/8/12 import numpy as np import PIL.Image as I from glob import glob import config as C # 读取图像数据 def read_image(batch_img_path_lst,show=False): print(len(batch_img_path_lst)) images = [] for img_path in batch_img_path_lst: ...
true
1dc725e54e04253f672a78b709594f1587941add
alt113/flow-triangle-scenario
/flow/scenarios/triangle_scenario.py
UTF-8
8,163
2.734375
3
[ "MIT" ]
permissive
"""Contains the triangle scenario class""" from flow.scenarios import MergeScenario from flow.core.params import InitialConfig from flow.core.params import TrafficLightParams from numpy import pi, sin, cos INFLOW_EDGE_LEN = 200 # length of the inflow edges (needed for resets) VEHICLE_LENGTH = 5 additional_net_param...
true
4574ba77d5df4317782494a333cfa1cb5f7ae50f
f-fathurrahman/ffr-python-stuffs
/unicode/test_unicode.py
UTF-8
165
3.125
3
[]
no_license
star = "\xe2\x98\x85" x = "This is a star " + star.encode("latin1").decode("utf-8") print(x) emoji1 = "\x1F\x60\x00" print(emoji1.encode("latin1").decode("utf-8"))
true
d0cba706ca49737a5d8a9d5c7f6fd8de831d3f7d
NirmaniWarakaulla/HackerRankSolutions
/Python/Python If-Else.py
UTF-8
141
3.328125
3
[ "MIT" ]
permissive
N = int(input()) if (N % 2 == 1) | (6 <= N <= 20): print("Weird") elif N >= 2 & N <= 5: print("Not Weird") elif N > 20: print()
true
1b28606f807f91da24627aba72bad4c499213f08
rckortiz/codewars
/rock-paper-scissors.py
UTF-8
974
3.734375
4
[]
no_license
# https://www.codewars.com/kata/rock-paper-scissors/train/python def rps(p1, p2): if p1 == 'rock' and p2 == 'scissors': return "Player 1 won!" elif p1 == 'scissors' and p2 == 'paper': return "Player 1 won!" elif p1 == 'paper' and p2 == 'rock': return "Player 1 won!" elif p2 == '...
true
5707731e9aee9ca0961fb1746ed24b9581986656
TopZeraProductions/desenvolvimento-de-aplicacoes-distribuidas
/AtividadesContinuas/AC06,7,8/SalaDeAulaApi/Services/alunos/services/alunos_services.py
UTF-8
719
2.53125
3
[]
no_license
from Models.aluno.entities.aluno import Aluno from Models.aluno.dataAccess.alunos_dao import AlunoDAO from typing import List, Dict # Camada que executa a validaçao dos dados class AlunoServices: @staticmethod def list_all() -> List[Aluno]: return AlunoDAO.list_all() @staticmethod def find(id...
true
f03c354058a71ebb2865c928a2e1076f4842be71
raikoss/advent-of-code
/2019/day2/__main__.py
UTF-8
1,221
3.6875
4
[]
no_license
import os class FinishedIntcode(Exception): pass def get_opcode_result(opcode, value1, value2): if opcode == 1: return value1 + value2 if opcode == 2: return value1 * value2 if opcode == 99: return None def run_opcode(intcode, position): opcode = intcode[position] if opcode == 99: raise ...
true
b0c637438d94c631bc3c6e1002b57ecf5741382b
maurosch/Procesamiento-Digital-de-Imagenes
/Guias/7 - CNN/Ejercicio 2/python/common/samplePatches.py
UTF-8
883
2.734375
3
[]
no_license
import numpy as np def samplePatches(rawImages, patchSize, numPatches): # rawImages is of size (image width)*(image height) by number_of_images # We assume that image width = image height imWidth = np.sqrt(np.size(rawImages,1)); imHeight = imWidth; numImages = np.size(rawImages,2); rawImages = n...
true
3f1e30c913d6aafae42fa483d0b9eef860a73515
nauco/Problem_Solving
/Kakao/2019 카카오 개발자 겨울 인턴십/튜플.py
UTF-8
217
2.859375
3
[]
no_license
import re import collections def solution(s): answer = [] m = re.findall('\d+', s) c = collections.Counter(m) for k, v in c.most_common(): answer.append(int(k)) return answer
true
c7b326107433b21778634e75933a94fc4dd79a0a
hunye/Groove
/app/common/meta_data_getter/get_song_info.py
UTF-8
8,374
2.546875
3
[]
no_license
# coding:utf-8 import os import json from mutagen import File from tinytag import TinyTag from common.os_utils import checkDirExists from common.os_utils import adjustName from PyQt5.QtCore import QFileInfo, Qt, QObject class SongInfoGetter(QObject): """ 创建一个获取和保存歌曲信息的类 """ def __init__(self, folderPaths: ...
true
88319386db55e94fad19d26fb2899d653ee1f6dc
ahenshaw/graph-theory
/jerseymikes/showroute.py
UTF-8
919
2.796875
3
[ "MIT" ]
permissive
import numpy as np from stores import locations, station from credentials import API_KEY import urllib.request import json import htmlparser def get_polys(route): nodes = locations + [station] points = [nodes[x] for x in route] URL = 'https://maps.googleapis.com/maps/api/directions/json?key={0}&origin={1}&...
true
4421ffb788baf2fd8dbcea402b8ab49f0a1db43a
xmpf/aoc-2020
/DAY-2/part1.py
UTF-8
656
3.40625
3
[]
no_license
#!/usr/bin/env python3 import re def verify(entry): # regex: <low>-<high> <char>: <string> regex = re.compile(r'(\d+)\-(\d+) ([a-z]): (.*)') try: matched = regex.findall(entry) (low, high, char, password) = matched[0] except ValueError: print('Error: ', matched) return...
true
3b8127adce3ec5daca561d2afca8fcba07455bbb
pbaioni/learningPython
/learningPython/main/loops.py
UTF-8
541
3.71875
4
[]
no_license
from sys import stdout #printing list elements c = ["first", "second", "third"] for item in c: print"list item value:", item #printing within range 0 - 3 for i in range(4): print"range value:", i #building a string to print in one single line stringChain = "chainOfCharacters" for char in stringChain: if ...
true
bfecc21f3b957911bf738463db978ae3cf84be24
mistbane/stock_db
/test/test_differential_portion.py
UTF-8
777
2.65625
3
[]
no_license
import stock_db.sdb_class as sdc import stock_db.differential_loading as dfl import datetime as dt sym ='SPY' db = sdc.Stock_Db() # df, rec =db.update_whole('SPY') # print(rec) df = db.from_db(sym) # print(f"{df.tail()}\nFinish reading...") df = df[0:-2] print(df) print(f"After reduce len ={len(df)}") end_str = dt.da...
true
144ea772fdf0bc87cf09e0be4db881c0c1031957
yhangang/PythonStudy
/__python__/__mail__.py
UTF-8
1,099
2.734375
3
[]
no_license
# -*- coding: UTF-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header # 第三方 SMTP 服务 mail_host = "smtp.badtom.cn" # 设置服务器 mail_user = "admin@badtom.cn" # 用户名 mail_pass = "Password123" # 口令 sender = 'admin@badtom.cn' receivers = ['admin@badtom.cn'] # 接收邮件,可设置为你...
true
2490b41774a172de22154b99f7c9d0f92d09dacb
JacobPaulette/PyLife
/main.py
UTF-8
10,652
3.390625
3
[ "MIT" ]
permissive
"""PyLife - a Conway's Game of Life implementation. By Jacob Paulette """ import rle import gui import numpy as np from scipy import ndimage import re import argparse import time import sys # NOTE: input rle pattern file as command line argument. # e.g. python3 main.py pattern.txt # will default to rle.string if...
true
1b2473d2ebe2f1623f058124ae58b5b8f0edfaf2
lwmcdona/Text-based-Adventure-Game
/player.py
UTF-8
20,260
3.78125
4
[]
no_license
import items, world import random # Contains the player class. # Methods within the player class are used to execute all actions in the game. class Player(): def __init__(self): """Player class to represent the player as they travel through the game. Attributes: -inventory: list contai...
true
2858d9f7fd1a4e4c1ca19862ca350409a415f136
raghupai/Python_Learning
/Python_Learning/Functions/CalculateSum.py
UTF-8
260
3.609375
4
[]
no_license
''' Created on 07-May-2020 @author: raghuveer ''' def calculate_sum(data1, data2): #All the statements in the block of code must have the same level of indentation result_sum=data1+data2 return result_sum result=calculate_sum(10,40) print(result)
true
d82e4fa7d0b150974ea5a790eeec43dbb07b338c
paalso/learning_with_python
/03 Hello, little turtles/3-8.py
UTF-8
1,088
4.40625
4
[]
no_license
##http://openbookproject.net/thinkcs/python/english3e/hello_little_turtles.html ##7. A drunk pirate makes a random turn and then takes 100 steps forward, ##makes another random turn, takes another 100 steps, turns another random amount, etc. ##A social science student records the angle of each turn before the next...
true
78eeabfbfbc1b1e5e2c405b935c5a950771d721a
OfekShochat/chess-tuning-tools
/tune/priors.py
UTF-8
1,000
3.5
4
[ "Apache-2.0" ]
permissive
import numpy as np __all__ = ["roundflat"] def roundflat(x, a_low=2.0, a_high=8.0, d_low=0.005, d_high=1.2): """Return the log probability of the round flat prior. The round flat prior is completely uninformative inside the interval bounds ``d_low`` and ``d_high`` while smoothly going to -inf for values...
true
0d41df8d5dba96cba8cacd28e2a2625fb3047946
ZoePetrovskaya/koshelek
/API_test1.py
UTF-8
1,679
2.71875
3
[]
no_license
print("#Тестирование API") from requests import Request, Session import json from datetime import datetime url = 'https://sandbox-api.coinmarketcap.com/v1/cryptocurrency/listings/latest' #песочница parameters = { 'start':'1', 'limit':'10', 'convert':'USD', 'sort_dir':"desc" } headers = { 'Accepts': 'appl...
true
6b5c2db8a0f516ab8aafd03603e4e7734f439812
fathimanovrin/python
/ordinalvalue.py
UTF-8
67
3.390625
3
[]
no_license
s=input("enter the character") li=[ord(x) for x in s] print(li)
true
71d6b215a251a14ca7638c23af01a767268657a4
LordBees/DM
/old/main/io test.py
UTF-8
999
2.859375
3
[]
no_license
##iotest def readfile(fname): try: f = open(fname,'r') data = f.readlines() f.close() except: try: f.close() except: print('error/file already closed!') return data x = readfile('Dwarf.tx...
true
4b8ca08a01577fb2838c9451bd997b4ee191b592
Hopson97/Kattis
/Oddities.py
UTF-8
107
3.765625
4
[]
no_license
for i in range(int(input())): n = int(input()) print (n, "is", "even" if ((n % 2) == 0) else "odd")
true
2d7128e1ce21fd7bd4f1fce0f7cc0ca8a812919d
Bishopbhaumik/python_test
/list_6.py
UTF-8
369
3.703125
4
[]
no_license
matrix=[[1,2,3],[4,5,6],[7,8,9]] for sub in matrix: print(sub) print("Printing distinct element:---------------------------->") for sub in matrix: for i in sub: print(i) nu=list(range(1,23)) print(nu) def neg(l): a=[] for i in nu: a.append(-i) return a pi=neg(...
true
5cf013341a4e92cd955f0c0ba87e0dd2e28b4f9a
cfjedimaster/adventofcode
/2020/4/part1.py
UTF-8
1,301
3.140625
3
[]
no_license
sampleInput = """ ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in """ file = open(r...
true
00134f3b52d9ae27550d377781c93e7a8dccdc2a
stefifm/Guia11
/cuestionario11.py
UTF-8
115
3.09375
3
[]
no_license
def ejemplo(a, b=0, c='Desconocido', d='Ingeniero'): print("ejemplos") ej = ejemplo(40, 20) print(ej)
true
bad9660a737c1c899ef09f4ab2d1ed1345ad5065
eisaacs21/Programming2_SP19
/energy_scatterplot.py
UTF-8
2,833
3.59375
4
[]
no_license
# https://data.cityofchicago.org/Environment-Sustainable-Development/Chicago-Energy-Benchmarking/xq83-jr8c import matplotlib.pyplot as plt import csv ''' Energy Efficiency of Chicago Schools (35pts) Chicago requires that all buildings over 50000 square feet in the city comply with energy benchmark reporting each year. ...
true
ffc791d21e740dd9671ba5cf976c0cfe23c5ccde
Moiseser/pythontutorial
/ex4.py
UTF-8
615
3.546875
4
[]
no_license
cars = 100 space_in_a_car = 4 #We need to include underscores for variables as spaces drivers = 30 passengers = 90 cars_not_driven= cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = passengers/ cars_driven print 'There Are' , cars , 'cars available' print...
true
3f7e9b06ecc9f5a859eaed9d1206c38865b89e19
981377660LMT/algorithm-study
/21_位运算/二进制枚举与三进制枚举/枚举子集/经典题/1239. 串联字符串的最大长度.py
UTF-8
1,055
3.359375
3
[]
no_license
from itertools import chain, combinations from typing import Collection, List, TypeVar # n,m<=20 # 选择word使其无相同字符,求最长长度 T = TypeVar("T") def powerset(collection: Collection[T], isAll=True): """求(真)子集,时间复杂度O(n*2^n) 默认求所有子集 """ upper = len(collection) + 1 if isAll else len(collection) ...
true
b305845ed7e90b55b04c88025c1b6ac49c8c15d6
akondrahman/Miscellaneous
/funda_/binaryTree.py
UTF-8
1,682
3.375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 14 12:10:57 2015 @author: akond """ class binaryTree: def __init__(self, ID, left=None, right=None): self.ID = ID self.left = left self.right = right def __str__(self): return str(self.ID) leftChild = binaryTree(2) rightChild = binaryTree(3...
true
82a30c03ab9b543f7feb49f6cf1d245d4b4a5573
jasek/AdventOfCode2016
/adventofcode/day2.py
UTF-8
419
3.140625
3
[]
no_license
m = [[1,2,3],[4,5,6],[7,8,9]] x=1 y=1 inpt = [] res = '' while True: l= input() if l=='fin': break inpt.append(l) print(inpt) for l in inpt: for s in l: if (s == 'U' and y>0): y-=1 elif (s == 'D' and y<2): y+=1 elif (s == 'L' and x >0): ...
true
d33597b99cadd13f7137c69274cdeca9ec6d97e1
mgershovitz/MCFGParser
/MCFG.py
UTF-8
15,564
3.21875
3
[]
no_license
""" @author: Maya Gershovitz """ #================================================================================ # Imports #================================================================================ import copy, re from tabulate import tabulate #==============================================================...
true
6cb5cfbff708d236e42e3e804432e6579d511e78
Srinayan/Recommender_System
/data.py
UTF-8
693
2.796875
3
[]
no_license
import csv import pandas as pd import numpy as np from sklearn.model_selection import train_test_split movies_data = pd.read_table('movies.dat', header=None, sep='::', names=['movie_id', 'title', 'genre'],engine='python') movies_data.to_csv("movies_data.csv") ratings_data = pd.read_table('ratings.dat',header=None, s...
true
eb9333169561ec732f9689d6cd5667a9091d4fd8
shawnmjones/cs595-f13
/assignment2/work/q3/joinAndProcessAgesWithMementoData.py
UTF-8
540
3.09375
3
[ "MIT" ]
permissive
#!/usr/local/bin/python3 import sys mementoDataFile = sys.argv[1] ageDataFile = sys.argv[2] mementoData = {} ageData = {} f = open(mementoDataFile) for line in f: line = line.strip() (mementoCount, uri) = line.split('\t') if int(mementoCount) > 0: mementoData[uri] = mementoCount f.close() f ...
true
d51ff3783cc886e128a3919eb96411ef3a2f924d
NickVBi/MathModeling
/QSnetwork/CloseNetwork.py
UTF-8
1,199
2.921875
3
[]
no_license
import math import matplotlib.pyplot as plt def printPlot(x, y, legend = []): fig, ax = plt.subplots() ax.grid(True) ax.plot(x, y, linestyle="solid") ax.fill_between(x, y, where = y > [0], color='green', alpha=0.3) if legend: lgnd = ax.legend(legend, loc='upper center', ...
true
8145b82dcead28ff993bc45c1f095581ecc958b1
miniyk2012/leetcode
/refractoring/example1/main.py
UTF-8
760
3.171875
3
[]
no_license
from Customer import Customer from movie import Movie from rental import Rental def test(): c_movie = Movie("CHILDRENS", Movie.CHILDRENS) r_movie = Movie("REGULAR", Movie.REGULAR) n_movie = Movie("NEW_REALEASE", Movie.NEW_REALEASE) c_rental = Rental(c_movie, 20) r_rental = Rental(r_mov...
true
f6784098930f89d5a7af78566abaf43ee96e319e
akintu/akintu
/src/ai.py
UTF-8
5,887
3.125
3
[]
no_license
''' AI was initially designed to be used for both overworld and combat AI, but is now only for overworld. TODO: Add 'chase' and 'evade' behaviors ''' import random from command import * from network import * from time import time import collections import cPickle import zlib class AI(): def __init__(self, history=...
true
a65348a316f52ba7758bce63e98d3ad55e1b4b0e
eh-am/Exercises-Resolution-For-Practical-Introduction-to-Functional-Programming
/ex3.py
UTF-8
697
3.5625
4
[]
no_license
def zero(s): if s[0] == "0": return s[1:] def one(s): if s[0] == "1": return s[1:] def rule_sequence(s, rules): for rule in rules: s = rule(s) if s == None: break return s print rule_sequence('0101', [zero, one, zero]) print rule_sequence('0101', [zero,...
true
e06e20fadae2226bf30eb5c9639e537bdd152e87
Zoujoko/Maths_Epitech_Tek3
/307multigrains/main.py
UTF-8
1,307
2.90625
3
[]
no_license
## ## EPITECH PROJECT, 2020 ## Maths ## File description: ## main ## import sys from new import * # USAGE # ./307multigrains n1 n2 n3 n4 po pw pc pb ps # DESCRIPTION # n1 number of tons of fertilizer F1 # n2 number of tons of fertilizer F2 # n3 number of tons of fertilizer F3 # n4 number...
true
2a6c29637d333ea9ff8cbb3afa51b2c4fab0dc2c
Buza/OpenPhoto
/photo.py
UTF-8
2,361
2.53125
3
[]
no_license
#!/usr/bin/env python """ A simple photo representation for the iOS-based OpenPhoto project. Created by Kyle Buza on 2/5/11. Copyright 2010 BuzaMoto. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...
true
8b729f8b5f9c6ee461ddbd2a4c9eaf791afba504
christianeda/wifi_kurs
/run.py
UTF-8
156
2.703125
3
[]
no_license
import file1 einkauf ={1,2,3,34,5} print(file1.abrechnung(einkauf)) #import personal.abrechnung import personal print(personal.abrechnung.verrechnung())
true
8df0b14a05388e043c49b1f204d67a09fac2388c
widderslainte/langmaker
/tests/phoneme_tests.py
UTF-8
712
2.75
3
[ "MIT" ]
permissive
''' test phoneme generator ''' import unittest from unittest import TestCase from langmaker.phoneme import Phoneme instance = Phoneme(consonants=['p'], vowels=['o']) class PhonemeTest(TestCase): ''' phoneme tests ''' def test_get_consonant(self): ''' retrieve a consonant ''' consonant = ins...
true
1e8662171c60df2d16db83e59090018853de083e
vcostas/education
/sistemaDeNotas/venv/lib/python3.6/site-packages/etc/toolbox.py
UTF-8
5,981
2.546875
3
[ "BSD-3-Clause" ]
permissive
from os import environ from functools import partial from collections import OrderedDict from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import module_has_submodule try: from django.contrib.sites.shortcuts import get_current_site except Im...
true
2aa1bf155f325e2607f085a2dc9153322af2f0d3
Tkootstra/Evo_comp2
/Python/search_algos.py
UTF-8
17,270
2.71875
3
[]
no_license
#!/usr/bin/env pypy # -*- coding: utf-8 -*- from Graph import Graph from Node import Node from Bucket import Bucket from Net import Net import time import random from copy import deepcopy import numpy as np def get_solution_from_nodes(node_list): sol = [n.belongs_to_partition for n in node_list] return sol d...
true
77201ef7414bac854bbf5ade90d1fad29a718d65
lowlighter/sound
/bin/energies.py
UTF-8
918
3.359375
3
[]
no_license
import numpy as np from energy import energy def energies(signal, fs, dt, bits=False): """ Calcule l'énergie contenue dans un signal segmenté par une certaine résolution temporelle. :param signal: Signal d'entrée :type signal: number :param fs: Fréquence d'échantillonage :type fs: number :...
true
e7d81093700a0e76b22cca36c880237496ead0e2
christiandelrio/ubbitt
/api/dao/session_dao.py
UTF-8
638
3.015625
3
[]
no_license
class SessionDao: def __init__(self): self.sessions = [] def save_session(self, session): self.sessions.append(session) def find_user_by_session(self, session_id): found_sessions = list(filter(lambda session: (session.session_id == session_id), self.sessions)) user_session...
true
dc29affc66fec475b2ae110227f080625147cf4d
Nic30/pyDigitalWaveTools
/pyDigitalWaveTools/json/writer.py
UTF-8
3,220
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pyDigitalWaveTools.vcd.common import VcdVarScope, VCD_SIG_TYPE from pyDigitalWaveTools.vcd.parser import VcdVarParsingInfo from pyDigitalWaveTools.vcd.value_format import LogValueFormatter from pyDigitalWaveTools.vcd.writer import VarAlreadyRegistered, VcdVarWritingS...
true
82d729c73ebad0b584e1f835b7c2c7d9e2cf6237
alexander-travov/algo
/InterviewBit/LinkedLists/linked_list.py
UTF-8
2,449
3.734375
4
[]
no_license
class LinkedListException(Exception): pass class Node: def __init__(self, val): self.val = val self.next = None def __len__(self): node = self n = 1 while node.next: node = node.next n += 1 return n def __str__(self): s ...
true
560bd3241a3f4a60de1c900d8627a8b6865180da
MitsurugiMeiya/Leetcoding
/leetcode/Array/Interval/435. 无重叠区间.py
UTF-8
2,441
4.09375
4
[]
no_license
""" 给定一个区间的集合,找到需要移除区间的最小数量,使剩余区间互不重叠。 注意: 可以认为区间的终点总是大于它的起点。 区间 [1,2] 和 [2,3] 的边界相互“接触”,但没有相互重叠。 示例 1: 输入: [ [1,2], [2,3], [3,4], [1,3] ] [1-----2] [1--------------3] [2--------3] [3---------4] 输出: 1, 移除【1,3】 """ class Solution(object): def eraseOverlapIntervals(self, intervals): ...
true
08a1c1f0bc9f816ee1933f8b26096a3527ea5415
severian5it/udacity_dsa
/data_structures/recursion/staircase.py
UTF-8
967
4.0625
4
[ "MIT" ]
permissive
""" param: n - number of steps in the staircase Return number of possible ways in which you can climb the staircase """ MIN_STEPS = {0: 0, 1:1, 2:2, 3:4} def staircase(n): '''Hint''' # Base Case - What holds true for minimum steps possible i.e., n == 0, 1, 2 or 3? Return the number of ways the child can climb...
true
ed620cdbd9c1f42cb478629ab09637517ba40821
tnvols/dataviz
/MySourceFiles/tip_data.py
UTF-8
10,250
2.6875
3
[]
no_license
from collections import Counter import csv import numpy as np import p1_parse as p from bookedmoves import BELLHOP_ORDER #first tip 2014-03-08 #2014-05-01 when refund data occured order_file = p.parse(BELLHOP_ORDER, ",") begin_date = '2014-09-01' #raw_input("Start date: ") end_date = '2014-10-01'#raw_input("End date: ...
true
6a6f011b2da0ca83169c09c5376a8cee1e02a73a
fjfhfjfjgishbrk/AE401-Python
/zerojudge/d122.py
UTF-8
286
3.078125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 13 11:48 2020 @author: fdbfvuie """ while 1: try: n = int(input()) a = 5 c = 0 while a <= n: c += n // a a *= 5 print(c) except: break
true
4f514cc9005ad0bf5ba7e1c9c6f98317a913e81b
taufanlubis/mycode
/python/function.py
UTF-8
100
3.5
4
[]
no_license
def hello(x): return 'Hello ' + x yourname=raw_input("Enter your name ") print hello(yourname)
true
da4e21033959921ad1735d02a85a3432fd75f8eb
bdelfin1/binf-final
/BD_final_Esearch.py
UTF-8
852
2.890625
3
[]
no_license
#!/usr/bin/python from Bio import Entrez Entrez.email = "bdelfin1@ramapo.edu" f1=open('/Users/Hubble_Space_Telescope/Desktop/LargeData/BioPython/BC_search_test_doc.csv', 'w+') #file to write to f1.write("year,count\n") #Not sure if this is needed, commenting out for now for year in range (2003, 2018): #loops 2003-20...
true
36b7f2d42cb69c1ade8364a8b090d3dcca781405
uw-data-science-seminar/clustering
/k_means.py
UTF-8
2,339
3.109375
3
[]
no_license
import random, math from matplotlib import pyplot as plt random_vector = lambda n : [random.random() for i in range(n)] average = lambda l : float(sum(l))/len(l) l2_norm_squared = lambda v1,v2: sum([ (i-j)*(i-j) for i,j in zip(v1,v2)]) def average_vect(l): n = len(l[0]) result = [] for i in rang...
true
10352bb6371634d9ed995d3aadc6036664ee93fa
estraviz/python3-object-oriented-programming
/ch03_when_objects_are_alike/src/contact_manager/contact.py
UTF-8
299
2.640625
3
[]
no_license
from contact_manager.contact_list import ContactList class Contact: all_contacts: ContactList = ContactList() def __init__(self, name="", email="", **kwargs): super().__init__(**kwargs) self.name = name self.email = email Contact.all_contacts.append(self)
true
b2f3c0b045d34572ae9259bb8521dfc68e4060f1
wyy-huli/Leetcode
/合并区间.py
UTF-8
353
3.09375
3
[]
no_license
# Leetcode Leetcode-Python-Soultion def merge(intervals): intervals.sort(key=lambda x:x[0]) h =[] h.append(intervals[0]) for interval in intervals: if interval[0] > h[-1][1]:#可以加一个if判断是否等于h【-1】 h.append(interval) else: h[-1][1] = max(interval[1],h[-1][1]) ret...
true
2919f62c66ac738fb1973e05560c81c64fb89f23
wtokarz80/Python
/dice/dice.py
UTF-8
2,918
3.8125
4
[]
no_license
import random first_input = input("How many units attack: ") while first_input not in ["1", "2", "3"]: first_input = input("How many units attack: ") second_input = input("How many units defend: ") while second_input not in ["1", "2"]: second_input = input("How many units defend: ") ask1 = int(first_input) as...
true
4c59396b31cdcee1094912ebc8e9ee4bd5ac6902
wangguangli/pystest
/utils/test_config.py
UTF-8
2,909
2.609375
3
[ "MIT" ]
permissive
# coding = utf-8 import os import yaml from utils.util import Util def getFileName(path): config_files = os.listdir(path) all_test_files = [] for name in config_files: index = name.rfind('.') all_test_files.append(name[:index]) return all_test_files def getAllTestCase(path, files): ...
true
745b2942bc3290f080f6231890a7993a6f71aa64
zhaoqidev/douban
/douban/spiders/douban_spider.py
UTF-8
1,352
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from douban.items import DoubanItem class DoubanSpiderSpider(CrawlSpider): name = 'douban_spider' allowed_domains = ['movie.douban.com'] start_urls = ['http://movie.douban.com/top250?start...
true
cbdbdd9c7ebfe9ecdfd378dc496a591b1fe173d3
iamdsv/incubator-superset
/superset/Insights/insights_correlation.py
UTF-8
1,372
3.109375
3
[ "Apache-2.0", "OFL-1.1" ]
permissive
from itertools import combinations import plotly.express as px """ Traverse all possible combination of measures and find correlation """ def generate_correlation_insights(data_frame,measure_attributes,out_queue): print('Generating correlation insights for the datasets') # corrMatrix = data_frame[measure_att...
true
7d8ab43451646c6d51be2a6f392d68df79b1eb97
Vasudevatirupathinaidu/Python_Harshit-vashisth
/116_add_delete_data.py
UTF-8
429
3.484375
3
[]
no_license
# add and delete data user_info = { 'name': 'Vasudev', 'age': 24, 'fav_movies': ['Inception', 'Tenet'], 'fav_tunes': ['awakening', 'fairy tale'] } # add data user_info['hobbies'] = ['chess', 'drawing'] print(user_info) print() # pop method # tunes = user_info.pop('fav_tunes') # print(tunes) # print(u...
true
c1ac7b4ac8e26b65c4daef4920f9227ecf281712
enoch-enchill/hacker-rank-python
/splitAndJoin.py
UTF-8
126
3.328125
3
[]
no_license
string = "this is a string" def slugify(s): slug = s.split(" ") slug = "-".join(slug) print(slug) slugify(string)
true
eddc96f2035f18202943bb3396beb02f695ac54a
TaranMNeeld/python-practice
/TextBasedInterface/Player.py
UTF-8
1,686
3.25
3
[]
no_license
from Shop import Shop class Player: def __init__(self, data={ 'name': None, 'level': 1, 'max_hp': 100, 'current_hp': 100, 'base_dmg': 2, 'req_xp':...
true
e789d6d58d124aa74759f4fd9d449c1863b059ca
gaford/project-euler
/python/12.py
UTF-8
654
3.625
4
[]
no_license
# -*- coding: utf-8 -*- # Project Euler 12 from math import sqrt def triangular(N): return int(N * (N+1) / 2) # def triangularNumbers(N): # return [triangular(j) for j in range(1,N+1)] # numberOfDivisors = [] # for N in range(15000): # t = triangular(N) # divisors = [] # x = 1 # while x < sqrt(t) + 1: # if...
true
46b18792e843d8d54edb1e1bfbda7618cf262844
VrushaParikh/Rock_Paper_Scissor
/rockpaperscissor.py
UTF-8
2,656
3.640625
4
[]
no_license
import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' trophy = ''' {} /__\ /| |\ ...
true
42966936108257429d82fe95b2e00e547b86f4d6
matteonistri/bender-test
/scripts/due.py
UTF-8
146
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python import time import os import sys for i in range(100): sys.stdout.write("1234567890") sys.stdout.flush() sys.exit(1)
true
ca170a158af204bcdcde291d7ce4448a9739468d
sensoraCloud/DeepTextModeling
/rnn_theano.py
UTF-8
15,967
2.9375
3
[]
no_license
from __future__ import print_function, division from builtins import range # Note: you may need to update your version of future # sudo pip install -U future import sys import numpy as np import matplotlib.pyplot as plt import theano import theano.tensor as T from sklearn.metrics.pairwise import pairwise_distances ...
true
a5dfe2eb4410893ada92d02306e855e66ea20c87
jiepy/byte
/magedu/week03/class_base.py
UTF-8
454
3.53125
4
[]
no_license
class A: def __init__(self): """ :rtype: return val """ self.val = 123 # a = A() # print(a.val) class B: def __init__(self): self.__var = 666 @property def var(self): print('get var') if self.__var < 0: return 0 return self.__var @var.setter def var(self, value): print('set var') if ...
true
fec5b494734ec5170517e051e773f2474019476e
dutdongxiao/2019
/robot/17/VoiceRecognition/weather.py
UTF-8
5,991
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jul 8 14:16:50 2019 @author: 10762 """ import time import pyaudio import pygame import json import requests import wave import snowboydecoder from aip import AipSpeech from imp import reload from pydub import AudioSegment APP_ID = '16698599' API_KEY = 'g...
true
f53c5f7eb2047155962dbda0094e3132cc3b08e1
coderNamedPaul/science-project
/наши примеры/пример7.py
UTF-8
101
3.421875
3
[]
no_license
a = "abc" b = 'xyz' c = a + b print("a =", a) print("b =", b) print("(a + b) =", a + b) print(c * 3)
true
92a349bc86d14bec82981a94aea2da2ec076aeed
choi-h-s/algorithm_python
/ch4.implementation/4-2_Time.py
UTF-8
324
3.234375
3
[]
no_license
N = int(input()) result = 0 for i in range(N+1): if i % 10 == 3: result += 3600 else: for j in range(60): if j // 10 == 3 or j % 10 == 3: result += 60 else: result += len([x for x in range(60) if x // 10 == 3 or x % 10 == 3]) print(resu...
true
7cce6d89d20f113689e3880e408b84d1e5f8d0ca
nbeezander/Vefui
/vefui/form.py
UTF-8
8,829
2.53125
3
[]
no_license
#! /use/bin/python3 # -*- coding:utf-8 -*- # @Author : zander # @Time : 2021/2/20 14:59 from vefui.rules import Rule, RequiredRule, TypeRule, JsType, LengthRule from typing import List, Any, Union, Tuple Rules = List[Rule] SwitchType = Union[Tuple[bool, bool], Tuple[str, str], Tuple[int, int], Tuple[float, float]] c...
true
95f256845cb28918d994755f57096cf0e5fc6093
matheushent/labmat-challenge
/wordcloud_generator.py
UTF-8
1,561
2.859375
3
[]
no_license
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator import matplotlib.pyplot as plt from PIL import Image import pandas as pd from optparse import OptionParser from nltk.corpus import stopwords from utils.process_data import text_process_with_lemmatization parser = OptionParser() parser.add_option("-o"...
true
50cd147b4ab66827d1e9c2f6ee5ec39a1b523d8a
LeBronPrince/interface_system
/SAR/CNN_Chen.py
UTF-8
8,512
2.5625
3
[]
no_license
import tensorflow as tf import math import scipy.misc import numpy as np DROPOUT = 0.7 # dropout比例 NUM_CLASSES = 10 # 类别数一共是10类 ### define gloabal parameter conv_1_trans_1 = 0 conv_1_trans_2 = 0 conv_2_trans_1 = 0 conv_2_trans_2 = 0 conv_3_trans_1 = 0 conv_3_trans_2 = 0 conv_4_trans_1 = 0 conv_4_trans_2 = 0 conv_5_tr...
true
fcc766590f9952a5671d17b698a69ff55cb65002
mohamedmohsen20/python
/sec6-selection/Getnthprime.py
UTF-8
770
4.09375
4
[]
no_license
''' Implement the following 2 functions: -is_prime(num); -nth_prime(n); -Return the n-th prime number. It should use is_prime function -E.g nth_prime(6) = 13 Recall primes are: 2, 3, 5, 7, 11, 13, 17, 19 ''' def is_prime(num): if num==2 : return True if num==0 or num==1:...
true
a1e8800dec439abe17b8bbef54325ebd41abd430
serdarbozoglan/My_Streamlit
/my_app.py
UTF-8
3,471
3.328125
3
[]
no_license
import os import pandas as pd import streamlit as st import matplotlib.pyplot as plt import seaborn as sns from PIL import Image, ImageFilter, ImageEnhance # Title st.title("Iris EDA App") st.header("Built with Streamlit") # EDA my_dataset = 'iris.csv' # Fxn to Load DataSet @st.cache(persist=True) # To run it from...
true
e73adffd80a3ecdcbfd4b13e939f86d55fe9d4e3
gyhd/python_study
/CNN模型/LeNet-5.py
UTF-8
1,776
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 29 15:11:00 2019 @author: Maibenben """ import tensorflow as tf from tensorflow.contrib.layers import flatten # 定义LeNet网络 def LeNet(input_tensor): # C1 conv Input=32*32*1, Output=28*28*6 conv1_w = tf.Variable(tf.truncated_normal(shape=[5, 5, 1, 6], mean=0, st...
true
251cec3886cdc540ff06a3794609a250c0ef76f9
eg-mart/hukkel-method
/det.py
UTF-8
3,111
3
3
[]
no_license
import numpy as np import sympy as sp import pysmiles import networkx as nx from sympy.solvers import solve class polynome: def __init__(self, pol): self.polynome = pol def __mul__(self, other): polynome_other = '' if not self.polynome.startswith('('): self.polynome = '(' + self.polynome + ')' if not ot...
true
6f0d47a4ad46ffaa600754f352229e4e58cef326
kaiweic/OpenSidewalksDashboard
/database_pkey/InsertPkeyToDB.py
UTF-8
1,834
2.875
3
[]
no_license
''' Copyright 2018 Kai-Wei Chang This code inserts the data in sidewalks_incline.geojson to SQL database. It uses the new primary key "pkey". File(s) required: 1. sidewalks_incline.geojson (contains the pkey and incline) ''' import pymysql import geopandas as gpd import sys # connect to localhost MySQL server ...
true
a4a5ef36677ba1188b53bae551c5aaa2d9fc10a2
gabriellaec/desoft-analise-exercicios
/backup/user_299/ch65_2020_04_21_01_33_16_552118.py
UTF-8
178
3.25
3
[]
no_license
def capitaliza(string): primeiraletra = string[0:1] resto = string[1:] primeiraletra = primeiraletra.upper() string = primeiraletra + resto return string
true
0dd5f09450ced303c5cb996e533b4f626be27944
doomnonius/advent-of-code
/2021/day06.py
UTF-8
1,329
3.640625
4
[]
no_license
from typing import List def part1(nums: List[int], cycles: int) -> int: # horrifically inefficient, interacts with each member of list each time for x in range(cycles): new_nums = [] for fish in nums: new_fish = fish - 1 if new_fish < 0: new_nums.append(6) ...
true
4d7c1ea75e2db7d0f4a3a0831434e1712acd3cb6
mcncm/scripts
/weather-cli/weather.py
UTF-8
1,821
2.609375
3
[]
no_license
#!/usr/bin/env python # mcncm 2019 import os import sys import requests # TODO: replace this with a better way of getting my coordinates coords_file = "coords.txt" api_key_file = "api-key.txt" script_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), os.pardir)) class Report: def __init__(self,...
true
68b48e34bb148c7cec539ca26ec005c4f412f0ec
durgeshsingh-17/python-hands-on
/pytut/arithmetic_opration2.py
UTF-8
635
4.1875
4
[]
no_license
num1 = int(input('enter the first number: ')) num2 = int(input('enter the second number: ')) if(num2 != 0): val = num1 / num2 print('the division of', num1, 'and', num2, 'is', val) else: print('division is not possible') print('the addition of', num1, 'and', num2,'is:', num1 + num2) print('the...
true
ab287163be980e81a9c4ffbbd6140ae2b7bc6dcb
abhi0203/Data-Structure-And-Algorithms
/DS_AlgoBook/BasicDSAndImpFunctions/DictIndexComplexityexperiment.py
UTF-8
892
3.703125
4
[]
no_license
# Below experiement is to understand the time complexity of the dict get and set operation. # We run this experiment for varying size of items in a dictonary and check if there is impact on the timing of the dictonary. # Author: Abhiram # Date 25-March import random import timeit t1= timeit.Timer("d[k]","from __main_...
true
57ac900f2667c8baf471e5c46c9146e1e498361c
UULIN/py
/python-100days/day0-15/day14/socket_client.py
UTF-8
260
2.65625
3
[]
no_license
from socket import socket def main(): # 1.创建套接字对象默认使用IPv4和TCP协议 client = socket() client.connect(('127.0.0.1',7865)) print(client.recv(1024).decode('utf-8')) client.close() if __name__ == '__main__': main()
true
b5b0078c327e862893758eb7c08d80ef70fe5dee
gilles/gilles-fresh
/counter/__init__.py
UTF-8
954
2.8125
3
[]
no_license
# coding=utf-8 from contextlib import contextmanager from functools import wraps from counter.mc import increment def counted(counter_name): """ decorator for easy counting. This makes an assumption that failure comes from an exception only. The behaviour could be augmented by passing failure ret...
true
59cc2252505eb141048ba61f2e0b001042fa585c
Taoge123/OptimizedLeetcode
/LeetcodeNew/LinkedList/LC_708_Insert_into_a_Cyclic_Sorted_List.py
UTF-8
7,850
4.34375
4
[]
no_license
""" Given a node from a cyclic linked list which is sorted in ascending order, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be a reference to any single node in the list, and may not be necessarily the smallest value in the cyclic list. If there are mu...
true
9404c59c4e88b19cf5c5dd1668cd926987db79b5
KalyakulinaAnastasiya/DNA
/Hagstogram.py
UTF-8
2,133
2.71875
3
[]
no_license
import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') import numpy as np from scipy import interpolate file = open('D:\Kalyakulina_Anastasiya\OLS\observables.txt') key_age = 'age' key_sex = 'gender' line = file.readline().rstrip() list = line.split('\t') id_age = list.index(key_age) id_sex =...
true
3fcc7c05f4209981b2086dd5666ac63d0a10a256
imhewon/RL-Coverage-Planner
/exercises/chapter2/exe2.5.py
UTF-8
3,937
2.796875
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt def initialize_action_values(nb_arms): return np.zeros(nb_arms) def update_action_values(old_values): random_walk = 0.01 * np.random.standard_normal(old_values.shape) return old_values + random_walk def sample_reward(action_values, index): return ...
true