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
c72882ff85c0ab69ced5e55b9e4982dcf68db4b5
whyynoot/train_schedule
/main.py
UTF-8
5,680
3.015625
3
[]
no_license
import datetime import csv def calculate_schedule(routes, time, intervals): time_schedule = {} for route in routes: for stations in routes[route]: if stations not in time_schedule: time_schedule.update({stations: []}) for route in routes: interval = intervals[ro...
true
85ecf178f301c7dec9407eb66554058bd9dafd64
Danilo-mr/Python-Exercicios
/Exercícios/ex005.py
UTF-8
106
3.6875
4
[ "MIT" ]
permissive
n = int(input('Digite um número: ')) print('Antecessor é {} e o sucessor é {}'.format(n-1, n+1))
true
01042166fe451d5c75ebc88522d486384b1a75b5
Sonalphulwani66/Image_Filter_Python
/Imagefilter.py
UTF-8
3,114
3.328125
3
[]
no_license
from PIL import Image path = input("please provide path to image") or 'child.jpg' img = Image.open(path).convert("RGB") width,height = img.size pixels = img.load() def red(r,g,b): newr = r newg = 0 newb = 0 return (newr,newg,newb) def darkpink(r,g,b): newr = g newg = b ...
true
d440d40597f5ce6e2ac78576c40bf410f0180744
King-Kingah/alx-higher_level_programming
/0x03-python-data_structures/1-element_at.py
UTF-8
112
3.234375
3
[]
no_license
#!/usr/bin/python3 def element_at(my_list, idx): return my_list[idx] if (0 <= idx < len(my_list)) else None
true
08e5b8c598f507be796818a67431069ebec6bb85
abhishekbajpai/python
/prefix-infix.py
UTF-8
805
3.34375
3
[]
no_license
class prefixToInfixConversion: def __init__(self): self.arrExpr = []; self.top = -1; self.expression = '*-A/BC-/AKL'; def peek(self): return self.arrExpr[self.top]; def push(self, data): self.top += 1; self.arrExpr.append(data); def pop(self): ...
true
e7f0a0384b97b97b960827eaeaaf465a410aca85
UlvacMoscow/BlowMyBrain
/last_elemnts.py
UTF-8
479
3.953125
4
[]
no_license
from collections import deque q = deque([1,2,3,4,5,6], maxlen=3) print(q) q.append(7) print(q) q.appendleft(7) print(q) q.pop() print(q) q.popleft() print(q) def search(lines, pattern, history=3): prev_lines = deque(maxlen=history) for line in lines: if pattern in line: yield line, prev...
true
12282cb524ca7f277261ff494b33724308c8c614
pecarprimoz/PR17_PPGAVB
/src/gregor_skripte/Regije/Št učencev po regijah.py
UTF-8
1,333
2.984375
3
[]
no_license
import csv from collections import defaultdict from csv import DictReader class Regija: def __init__(self, n): self.vals = n * [0] self.c = 0 def __iadd__(self, a): a = list(map(float, a)) for i, x in enumerate(a): self.vals[i] += x self.c += 1 return...
true
c407662e7346b6d727264e240fe0fc2d2d6812cd
gitForKrish/PythonInPractice
/TeachingPython/02_datatypes.py
UTF-8
3,403
4.375
4
[]
no_license
# Data Type - statically/dynamically typed language # Immutable - numeric, string, tuple # Mutuable - List, Dictionary, Set # Numeric # integer, float, complex number, boolean(true/false) x = 10 print(type(x)) # <class 'int'> x = 4.5 print(type(x)) # <class 'float'> m = 4j + 3 n = -6 -5j print(m+n) print(type(m)) #...
true
109cd4e440696c0cef27b2a647d1ced208a2285d
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_116/1685.py
UTF-8
2,257
3.59375
4
[]
no_license
#!/usr/bin/python n = int(raw_input('')) games = [] for _ in range(n): game = [] for _ in range(4): game.append(list(raw_input(''))) games.append(game) raw_input() size = 4 case = 0 for game in games: case += 1 incomplete = False hasResult = False for i in range(size): ...
true
fdf24c7bec13f64842e800a3690ad58447decba6
omkar27/PythonGeeksforgeeks
/List/sortusingotherlist.py
UTF-8
210
3.484375
3
[]
no_license
list1 = ["a", "b", "c", "d", "e", "f", "g", "h", "i"] list2 = [ 0, 1, 1, 0, 1, 2, 2, 0, 1] c = zip(list1,list2) print zip(list1,list2) print [x for _, x in sorted(c)] print list(sorted(c))
true
e38ccd375707785d35d34940b89e326a5cfc5218
yangjicheng/untitled
/owhat4_test/game2.py
UTF-8
4,532
2.8125
3
[]
no_license
#-*- coding:utf-8 -*- import sys, random, math, pygame from pygame.locals import * def print_text(font, x, y, text, color=(255, 255, 255)): imgText = font.render(text, True, color) screen.blit(imgText, (x, y)) # main program begins pygame.init() screen = pygame.display.set_mode((600, 500)) pygame.display.set_...
true
70b02bcaeb3e5b531e75fd335f09d1f884721b7f
kgpyi/python
/Problem Solving/Project Euler/2_Even Fibonacci Numbers.py
UTF-8
338
3.53125
4
[]
no_license
def even_fib_sum(num): array = [1, 2] next_fib_num = 0 while next_fib_num <= num: next_fib_num = array[(len(array) - 2)] + array[(len(array) - 1)] array.append(next_fib_num) sum = 0 for even in array: if even % 2 == 0: sum += even return sum print(even_...
true
4edb23107f81849bfff8ff674d7409efd825f13b
fengjixuchui/x64dbg-Anti-Debug-POC
/scripts/generate_code.py
UTF-8
2,163
3.0625
3
[]
no_license
import random #============================================================================== out_header_file_path = r".\generated_code.h" out_source_file_path = r".\generated_code.cpp" #============================================================================== def write_function_open(out): out.write("\n{\n") #==...
true
ffc82dad0ba5be1913d2a11319cb392c843f8f6c
anderdyl/duckGeomorph
/examples/plot_time_invariant_trajectories_with_viapoints.py
UTF-8
5,795
2.84375
3
[]
no_license
""" ================================================================================ Generate Time-Invariant Trajectories with GMR Learned from Multiple Trajectories ================================================================================ TODO """ from svgpathtools import svg2paths # pip install svgpathtools ...
true
3c2eeb2d32597513ece93373443735dbc18cc93c
jingshao69/py4fun
/deviation.py
UTF-8
417
3.5625
4
[]
no_license
#!/usr/bin/env python3 import numpy as np import math def average(array): return float(sum(array)/len(array)) def std_deviation(array): size = len(array) avg = average(array) ds_sum = 0.0 for i in range(size): delta = array[i] - avg ds_sum += delta**2 dev = math.sqrt(ds_sum/siz...
true
04b78300cd4b29d64a80225023b0cf9dc6a286b4
ribbas/Heat-Replay
/src/code/db/mgmt/msd/hdf5_getters.py
UTF-8
1,596
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Thierry Bertin-Mahieux (2010) Columbia University tb2332@columbia.edu This code contains a set of getters functions to access the fields from an HDF5 song file (regular file with one song or aggregate / summary file with many songs) This is part of the Million Song Dataset project from Lab...
true
660c95e44d5a767c3e0483ff30ae0b6e71c1481f
aycelacap/py_playground
/Fundamentals/Basics ii/067_loops.py
UTF-8
532
4.875
5
[]
no_license
# LOOPS # we can run lines over and over # for variable in iterable: # print variable for letter in 'Zero to Mastery': print(letter) # we can also use lists for item in [1, 2, 3, 4, 5]: print(item) # set for number in {5, 4, 3, 2, 1}: print(number) # tuple for tup in (0, 9, 8, 7): print(tup) # for loo...
true
d68768fe5dd317a55ce88f405cd21ff6f03fa099
picxenk/WYTIWYG
/sandbox/test.py
UTF-8
459
2.671875
3
[ "Artistic-2.0" ]
permissive
#!/usr/bin/python from Adafruit_Thermal import * printer = Adafruit_Thermal("/dev/ttyAMA0", 9600, timeout=5) printer.justify('C') # Print the 135x135 pixel QR code in adaqrcode.py import gfx.adaqrcode as adaqrcode printer.printBitmap(adaqrcode.width, adaqrcode.height, adaqrcode.data) printer.sleep() # Tell p...
true
7e38945a227ab6fb879fbc28fc671c255d47a027
Aasthaengg/IBMdataset
/Python_codes/p03370/s996522925.py
UTF-8
257
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- N,X = map(int, input().split()) min_req = 0 for i in range(N): m = int(input()) min_req += m if i==0: m_min = m else: if m_min > m: m_min = m num = N + ((X - min_req) // m_min) print(num)
true
a94a780a5671375f4029146c2ebd774afc7858dc
IvanSepulveda/elite-qualifier1
/main.py
UTF-8
2,092
2.53125
3
[]
no_license
from bs4 import BeautifulSoup import requests import lxml import replit import colorama as cr replit.clear() cr.init(autoreset=True) SubReddit = input("Which subreddit would you like to see popular posts for? r/").lower() print("wait for the posts to load...") url = ('https://www.reddit.com/r/' + SubReddit + '/...
true
0b68c1222930003a7c9d9a3925c6b1153d3af9b3
AndrewWedemier/Automate-Whatsapp-Messages
/automate.py
UTF-8
1,343
2.765625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import Select from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options import time contact = "###" text = "...
true
f52aa9d000016c91753d41fc6e80c4816f27bdbe
qiudebo/13learn
/mywork/PreprocessData_shaofeng.py
UTF-8
5,702
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: UTF-8 -*- import pandas as pd from sklearn.preprocessing import StandardScaler class PreprocessData: def readData(self,file): df = pd.read_csv(file) return df def writeData(self,df,file,): df.to_csv(file,index=False) def dropColumns(self,df,column...
true
1978768359acdc0203f2084a738295c9fa73e146
simonrw/NGTS-error-contributions
/CumulativeDists.py
UTF-8
4,087
2.734375
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 ''' Given the high precision range, plot the number of stars for a given magnitude to assess which exposure time gives the maximum number of bright objects ''' from srw import pghelpers as pgh import numpy as np import ppgplot as pg from BesanconParser import BesanconParser fro...
true
8d6aec0b425961c1fd4556d75562a78a67e9c542
jatinS-dev/Image_Processing_
/Image_Rotation/image_rotation_code.py
UTF-8
1,711
3.53125
4
[]
no_license
import numpy as np import math import matplotlib.pyplot as plt # inputs img = plt.imread('rotate_image.png') print(img.shape) #rotation_amount_degree = 45 # convert rotation amount to radian # get dimension info height, width, num_channels = img.shape rotation_in_degree = int(input("Enter the angle in which b...
true
f9b0cdac93bdf6c487a3387a4a2dc623a2aca984
HaeffnerLab/RealSimpleGrapher
/depricated/ScrollingGraphWidget.py
UTF-8
1,353
3
3
[]
no_license
from GraphWidget import Graph ''' This is just the Graph with the update function modified to also do scrolling ''' class ScrollingGraph(Graph): def __init__(self, name, reactor, parent = None, ylim = [0,1]): super(ScrollingGraph, self).__init__(name, reactor, parent, ylim) def update_figure(self, _...
true
6d0bdf07192c7b682a81dfe6fccbf822ec6772c0
josejpalacios/knowledge-management
/Client/loginEncryption.py
UTF-8
5,018
3.1875
3
[ "MIT" ]
permissive
# Encryption class for encrypting login info # 81 lines from Crypto.Cipher import AES import base64 import os import hashlib import binascii import time from itertools import zip_longest class LoginEncoding: def __init__(self): self.username = '' self.usernamePlain = '' self.password = '' ...
true
7ed973060f6e9c0084a12b156ea0e7846d900dde
cdump/investments
/investments/trade.py
UTF-8
592
2.890625
3
[ "MIT" ]
permissive
import datetime from typing import NamedTuple from investments.money import Money from investments.ticker import Ticker class Trade(NamedTuple): ticker: Ticker trade_date: datetime.datetime settle_date: datetime.date quantity: int # цена одной бумаги price: Money # комиссия за сделку ...
true
cd70ea447a5bc783e4d0d99f751194ea4d9c6d4e
Ulitochka/crt_labs
/pytorch/common/losses.py
UTF-8
2,324
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F import math import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import operator as op import functools as ft class TotalLoss(nn.Module): def __init__(self, loss_...
true
65bcd363cb4fb802cbd247b336e4e5ddb74465c0
IrfyNaz/advent-of-code-2020
/python/day7.py
UTF-8
1,246
3.09375
3
[]
no_license
import re def readRules(file): with open(file) as f: lines = f.read().splitlines() return {x.split(' bags contain ')[0]: parseInnerRule(x.split(' contain ')[1]) for x in lines} def parseInnerRule(rule): regex = "(\d+) ([a-z ]*) bag[s,.]{1,2}" return({x: y for y, x in re.findall(regex, ru...
true
79a4eeaf01559a0b8f6e8c929d4fd6337b78c2bc
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/93_11.py
UTF-8
3,164
3.890625
4
[]
no_license
Python – Rear character String categorization Sometimes, we have a use case in which we need to perform the grouping of strings by various factors, like last letter or any other factor. These type of problems are typical to database queries and hence can occur in web development while programming. This articl...
true
c7fbcb1374ac2f831609f04ec58fd005d85d29b3
Japroriple/Reconcile
/modules/lastfm.py
UTF-8
13,622
2.578125
3
[ "MIT" ]
permissive
""" The MIT License (MIT) Copyright (c) 2014 - 2015 Jos "Zarthus" Ahrens and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rig...
true
1f102a733fb2c66747c2dd0fe933171ac54dc445
cnscheihing/fluid-mechanics-project
/app/main.py
UTF-8
2,342
2.75
3
[]
no_license
import matplotlib matplotlib.use('Agg') import random import requests import os from flask import Flask, render_template, request, Response from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, DecimalField from wtforms.validators import DataRequired from flask import jsonify import numpy as np ...
true
0edbfa509375e23aad20521e0e3de940a2dbcced
Samiul1403001/Python_projects
/NFS_Game_py/Game.py
UTF-8
17,978
2.859375
3
[]
no_license
# Import libraries from tkinter import Tk, Menu, Canvas, mainloop import tkinter as tk, json, cv2, os, numpy as np, random, time, keyboard from PIL import Image, ImageTk class NFS(): def __init__(self, gui, score_json_path): # Additional variable # Time variables self.start_time = time.tim...
true
933697464f0b835f32eabe022c05637470a54680
alfinadisurya24/PSJ
/check_host_paralel.py
UTF-8
675
2.953125
3
[]
no_license
import os import time import concurrent.futures # import T1 = time.perf_counter() def check_host(ip): cek_ip = os.system('ping -c3 '+ip+' >/dev/null 2>&1') if cek_ip == 0: print(f'host {ip} is UP') else : print(f'host {ip} is DOWN') time.sleep(1) return "IP Berhasil dicek . . ." ...
true
cf98c15f9a19bfb8bec536da5b359cf2518d1d9d
seonghyeok01/project02
/app.py
UTF-8
1,738
2.65625
3
[]
no_license
from flask import Flask, render_template, request, jsonify, redirect, url_for from pymongo import MongoClient import requests app = Flask(__name__) client = MongoClient('13.124.229.155', 27017, username="test", password="test") db = client.dbsparta_plus_week2 @app.route('/') def main(): # DB에서 저장된 단어 찾아서 HTML에...
true
53aabca78577d8d748d2d153ceb2a5599c60db52
arsummers/python-data-structures-and-algorithms
/challenges/fb_challenge/hard/simple_anagrams/anagrams.py
UTF-8
1,741
3.90625
4
[ "MIT" ]
permissive
# text = ['code', 'code', 'frame', 'code', 'framer', 'frame'] # sorty = [] # joiner = '' # this is a decent way to get a list with no duplicates: # sorted_words = list(dict.fromkeys(sorted_words)) # # this makes a list of lists which isn't useful for what I'm trying to accomplish # for word in text: # sorty.appe...
true
430c56d8bfd9d9158d014d0a01062cb3ac335fc5
EsdeathEsdeath/data_analyze-2020
/task20.py
UTF-8
406
3.046875
3
[]
no_license
# ---- ВАШ КОД ТУТ --- def task_20(): pH1 = 0.1 pH2 = 0.9 pAH1 = 0.9 pAH2 = 0.1 pA = pH1*pAH1 + pH2*pAH2 return (pH1*pAH1)/pA # -------------------- proba = task_20() print(f'p={proba:.2f}') import unittest class TestNotebook(unittest.TestCase): def test_task(self): self.asse...
true
a3b05f7aedf215b6c60a0638c9138d508b8b1986
kh4r00n/Aprendizado-de-Python
/ex031.py
UTF-8
262
3.625
4
[]
no_license
passagem = float(input('Qual a distância em km da sua viagem?')) if passagem <=200: p1 = passagem * 0.50 print('A sua passagem custa {:.2f} R$'.format(p1)) else: p2 = passagem * 0.45 print('A sua passagem custa {:.2f} R$'.format(p2))
true
034c1438e076231cff550c6d9eb27a66558da9f9
meistalampe/rPPG
/CovPy/normalization.py
UTF-8
1,554
2.71875
3
[]
no_license
from hdf5_helper_functions import * import matplotlib.pyplot as plt def main(): """ Loads hdf5 thermal file from directory and extracts image dataset with the corresponding timestamps. Returns a set of normalized thermal images. :return: """ # Andreas #filename = 'ThermalData_18_06_2020_13...
true
a70d88b72c7699cbe81c099fad6b8185e4c77340
louisuss/PythonAdvancedStudy
/Concurrency/Generator/chapter01.py
UTF-8
4,971
4.25
4
[]
no_license
# Generator # 파이썬 반복형 종류 # for, collections, text file, List, Dict, Set, Tuple, unpacking, *args # 공부할 것: 반복형 객체 내부적으로 iter 함수 내용, 제너레이터 동작 원리, yield from # 반복 가능 이유? -> iter(x) 함수 호출 import itertools from collections import abc t = 'ABCDEF' # for for c in t: print(c) print() w = iter(t) while True: try: ...
true
258fa4c027f4532cb71885780ec18039f28fa08b
amyreese/playground
/circuitpython/cpx/ring.py
UTF-8
1,752
2.828125
3
[ "MIT" ]
permissive
import board from cpgame import tick, every, on, start, at, after from colors import RAINBOW, WHITE, RED, GREEN, OFF import neopixel import random ROUNDS = 10 SPEEDS = [0.11, 0.1, 0.1, 0.09, 0.08, 0.08, 0.07, 0.06, 0.05, 0.04] COLORS = [WHITE] + list(reversed(RAINBOW)) REWARD = [RED, GREEN] FLASH = [WHITE, OFF] pixe...
true
f94b1773e0a8b10cd32f349a9b9b3e0cd21f5307
gschen/where2go-python-test
/1806101073刘玉江/practice/Day0227/test04.py
UTF-8
515
3.890625
4
[]
no_license
''' 给出数字 N,返回由若干 "0" 和 "1"组成的字符串,该字符串为 N 的负二进制(base -2)表示。 除非字符串就是 "0",否则返回的字符串中不能含有前导零。 示例 1: 输入:2 输出:"110" 解释:(-2) ^ 2 + (-2) ^ 1 = 2 ''' class Solution(object): def baseNeg2(self, N): import math str1 = "" while(N!=0): str1 = str(N%2)+str1 N = math.ceil(N / -2) ...
true
1aefe44a9bc0ce0a00e0a1efceecae8d7cc54008
L0sted/esp32-data-receiver
/main.py
UTF-8
1,082
3
3
[]
no_license
#!/bin/python # -*- coding: utf8 -*- import socket, json, time print("\thi! receiver started!") values = dict() #open try: with open("stored_values.json", "r") as read_file: values.update(json.load(read_file)) except BaseException: print("\tempty or no file!") sock = socket.socket() sock.bind(('', 808...
true
e6e9b9be383dbb6f83e327669f3ccb0acf25215a
sidhu1012/BitCoin-Predcitor
/Bitcoin.py
UTF-8
1,090
2.765625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: bit_df=pd.read_csv('D:\\coinbaseUSD_1-min_data_2014-12-01_to_2019-01-09.csv') bit_df.head() # In[3]: bit_df.size # In[4]: bit...
true
50fc4edae4de5fc3c98f19b9165b9b0da6c6aa9a
Siddhant128-bit/Neural_Network_TREX_Game
/initial_learning_phase1.py
UTF-8
1,752
2.703125
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt df=pd.read_excel('Dataset1.xlsx') def cost(P,T): return(P-T)**2 def slope_cost(P,T): h=0.001 return (cost(P+h,T)-cost(P,T))/h def sigmoid(x): return 1/(1+np.exp(-x)) def sigmoid_p(x): return sigmoid(x)*(1-sigm...
true
f1170540fe34aa1c4dedbd06e5c76f37431db8b0
ibestrace/TushareIndexHenceFund
/IndexHenceFund.py
UTF-8
8,384
2.53125
3
[]
no_license
import os import tushare as ts import pandas as pd import time import numpy as np # import datetime def GetFundDailyTradeData(fundCode, tsConn): """从Tushare获取单只基金日线数据""" fundCode_OF = fundCode fundCode_SZ = fundCode.replace("OF", "SZ") fundCode_SH = fundCode.replace("OF", "SH") ...
true
ddb516081f0386de947a779cc02f1aedc18877e9
lukajovano/Pyton
/bigfibonacci.py
UTF-8
148
3.21875
3
[]
no_license
def big_fibonacci(n): i1=0 i2=1 i=i1+i2 while len(str(i))<n: i1=i2 i2=i i=i1+i2 return i
true
7bf64331ee30418f379359d6c7c1a1190f520f18
erikliu0801/leetcode
/python3/solved/P896. Monotonic Array.py
UTF-8
2,108
3.796875
4
[]
no_license
# ToDo: """ 896. Monotonic Array Easy An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j]. Return true if and only if the given array A is monotonic. ...
true
325876b06b45430fc98744a6db480bfa583adc4a
au1206/DailyCodingProblem
/problem_1_easy.py
UTF-8
783
4.53125
5
[]
no_license
""" Question: Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? """ def possible_sum(input_list, target_number): """ Check if two number can sum up to ...
true
bd73a166b7725c5168d628185229833f5f2a80dd
rafaelperazzo/programacao-web
/moodledata/vpl_data/394/usersdata/325/75149/submittedfiles/ex11.py
UTF-8
287
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- #entrada in [1]: import datetime in [2]: data1 = datetime date(day=22 month=11 year= ) in [3]: data2 = datetime date(day=25 month=3 year= ) in {4]: data2-data1 out[4]: datetime timedelta(123) in{5]: diferenca = data2-data1 in[6]: diferenca days out[6]: 123
true
89eeb90fe264f500c1141efcc47e69ec4b92596b
kailiu77/zfit
/examples/composing_pdf.py
UTF-8
561
2.75
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2019 zfit import zfit # create space obs = zfit.Space("x", limits=(-10, 10)) # parameters mu = zfit.Parameter("mu", 1., -4, 6) sigma = zfit.Parameter("sigma", 1., 0.1, 10) lambd = zfit.Parameter("lambda", -1., -5., 0) frac = zfit.Parameter("fraction", 0.5, 0., 1.) # pdf creation gauss = zfit.pdf.Ga...
true
375cc44a07801fe682b7a26a5786cbfebd191640
Jamim/ensemplix.mim.pw
/apps/ensemplix_log.py
UTF-8
275
2.671875
3
[]
no_license
import datetime def log(message_template, *args, style=None): message = args and message_template % args or message_template if style: message = '\033[%sm%s\033[0m' % (style, message) print('%s %s' % (datetime.datetime.now().strftime('%Y.%m.%d %H:%M:%S.%f'), message))
true
0e0816570a642ec967c27898e76bbee323053d97
sfcta/fast-trips_network_builder
/build_network.py
UTF-8
3,629
2.546875
3
[]
no_license
import sys import os import inro.emme.matrix as ematrix import inro.emme.database.matrix import inro.emme.database.emmebank as _eb import numpy as np import pandas as pd import itertools from itertools import groupby from itertools import chain from collections import defaultdict import collections from config.input_c...
true
3e73fc3a249d3c949e65aa34d9a8099f54987443
rl-game-training/multi-game-agent
/src/breakout/dqn.py
UTF-8
1,372
2.890625
3
[]
no_license
import torch.nn as nn class DeepQNetwork(nn.Module): def __init__(self, num_frames, num_actions): super(DeepQNetwork, self).__init__() self.num_frames = num_frames self.num_actions = num_actions # Layers self.conv1 = nn.Conv2d( in_channels=num_frames, ...
true
441a988b4322a8f384b8a51d8999acebbb502b2f
kwc305/DSP-Lab
/Lab2/Lab_2_4_10_phc307.py
UTF-8
1,683
2.8125
3
[]
no_license
from math import cos from math import pi import pyaudio import struct import numpy import Lab_2_ASGMNT_4_7_kwc305 # 16 bit/sample # Fs : Sampling frequency (samples/second) Fs = 8000 # Fs = 16000 # Fs = 32000 T = 1 # T : Duration of audio to play (seconds) N = T*Fs # N : Number of samples to play # Po...
true
778d6337f8c9dcf65d5d2fc256e8a8a06d3bf65e
Caro-app/calamari
/calamari_ocr/ocr/text_processing/str_to_char_list.py
UTF-8
916
2.953125
3
[ "Apache-2.0" ]
permissive
from calamari_ocr.ocr.text_processing import TextProcessor, TextProcessorParams class StrToCharList(TextProcessor): def __init__(self, params: TextProcessorParams): super().__init__() # chars are priority ordered and might be words as-well! self.chars = params.characters def _apply_si...
true
b18b0c1a349825d6e4269620acf4975f4269404b
mryanjulian/Programming-Portfolio
/Project_Euler/PE-Problem-22.py
UTF-8
555
4.0625
4
[]
no_license
#This program computes the sum of the name scores of the names in the file PE-22-names.txt #Name scores are computed by multiplying the rank (in alphabetic order) of each name by the sum of the positions of its letters in the alphabet f = open("PE-22-names.txt") names = [name.strip('"') for name in f.readline().split...
true
406ad098611777eff59191dd07914e85646bb0ee
artikalra/faultdetect
/data/sample.py
UTF-8
5,104
3.09375
3
[]
no_license
import bisect import math from scipy.integrate import quad import numpy as np # Sample Class class Samples: def __init__(self): self._times = [] self._data = [] def insert(self, data): self._times.append(data[0]) self._data.append(data) @property def size(self): ...
true
7d1b526cad0dac3dc2bcd75c8cfb923952392d1f
deniscostadsc/becoming-a-better-programmer
/src/problems/career_cup/k_lists_of_sorted_int.py
UTF-8
2,142
4
4
[ "MIT" ]
permissive
from itertools import chain from typing import List """ You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists. For example, List 1: [4, 10, 15, 24, 26] List 2: [0, 9, 12, 20] List 3: [5, 18, 22, 30] The smallest range here would be [20, 24] as it co...
true
ccb4a32e333ad482b7f04b4b47c9409abe85ccac
noeaversa/cs50_introduction_to_Computer_Science
/pset6/cash.py
UTF-8
409
3.5625
4
[]
no_license
import cs50 while True: cash = cs50.get_float("Change owed: ") if cash > 0: break coin = 0 cents = cash * 100 while cents >= 25: cents = cents - 25 coin = coin + 1 while cents >= 10: cents = cents - 10 coin = coin + 1 while cents >= 5: cents = cents - 5 coin = coin +...
true
fd31adaed7e4bb3e1b424b3a749e2cbe9cba3071
UCSDIEEEQP/Examples
/OpenCV/camera.py
UTF-8
347
2.890625
3
[]
no_license
import cv2 # grab the reference to the webcam vs = cv2.VideoCapture(0) # keep looping while True: # grab the current frame ret, frame = vs.read() cv2.imshow("Webcam preview", frame) key = cv2.waitKey(1) & 0xFF # if the 'q' key is pressed, stop the loop if key == ord("q"): break # close all windo...
true
03104f90e8af970fe0a48ff5241c11c0188f5746
flfelipelopes/Python-Curso-em-Video
/ex022.py
UTF-8
623
4.40625
4
[]
no_license
#Crie um programa que leia o nome completo de uma pessoa e mostre: - O nome com todas as letras maiúsculas e minúsculas. # - Quantas letras ao todo (sem considerar espaços). - Quantas letras tem o primeiro nome. nome = str(input('Digite o seu nome completo: ')).strip() print('Seu nome em maiúsculas é: {}'.format(nome....
true
76aa11951a2609ed9017249a7146f8473c5c55a0
rjc042/ProjectEuler
/pe76.py
UTF-8
945
3.625
4
[]
no_license
def find_elt(lst): # Find elt != 1 closest to end for i in range(len(lst)): if lst[::-1][i] != 1: return len(lst) - 1 - i return False def get_sub_lst(lst, i): sub_target = sum(lst[i:]) total = lst[i] - 1 inc = lst[i] - 1 sub_lst = [inc] while total < sub_target: ...
true
1bf83f08ecb351c72fd5987f9faae5bb66c1acc2
sk12678/pytho
/上課6.py
UTF-8
3,061
3.796875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Aug 22 19:32:28 2020 @author: andy6 """ ''' #猜密碼 password = "applepie" ch = input("請輸入字元=") print("猜密碼1:in運算式") #方法1 if ch in password: print("輸入字元在密碼中") else: print("輸入字元不在密碼中") #方式2 print("猜密碼2:not in運算式") if ch not in password: print(...
true
5d59c8d21702f527c06549f4f69a2fb93da21434
RichardsonMark/pub_lab_wk2
/tests/drink_tests.py
UTF-8
492
2.734375
3
[]
no_license
import unittest from src.drink import Drink from src.pub import Pub from src.customer import Customer class TestDrink(unittest.TestCase): def setUp(self): self.drink = Drink("House wine", 7) # @unittest.skip("Delete this line to run the test") def test_drink_has_name(self): self.assertEqu...
true
67c59fab14059b71a324267129a75d0ad8085773
Centauriss/Coursera-Python
/week2-5.py
UTF-8
146
3.5625
4
[]
no_license
N = 36 x = int(input()) y = int(input()) if (x < y) and (x == 1 or x % N == 1) and (y == N or y % N == 0): print('YES') else: print('NO')
true
aa87b8a41dd85a0c73101332c6a40003499f41f5
Gruant/advanced_python
/accounting/application/salary.py
UTF-8
511
3.46875
3
[]
no_license
from application.db.people import employers as employers class Employer: position = '' name = '' def __init__(self, name): for workers in employers: if name in workers['name']: self.position = workers['position'] self.name = name self.sa...
true
a0cd963f6ac9f7c7c1e341df03a7df7d4edeb34a
amogchandrashekar/Leetcode
/Easy/Balanced Binary Tree.py
UTF-8
542
3.203125
3
[]
no_license
class Solution: def isBalanced(self, root) -> bool: def height(node): if not node: return -1 left = height(node.left) right = height(node.right) return 1 + max(left, right) def is_balanced(node): if not node: ...
true
a932fdc353a3ed2f3e01082fed6686bc3049055e
ww35133634/chenxusheng
/ITcoach/xlrd_xlwt处理数据/第4章 字符串处理技术/4.1 字符串切片/4.1.2.py
UTF-8
147
2.859375
3
[ "AFL-3.0" ]
permissive
s='Excel我很忙' # print(s[2:5]) # print(s[:5]) # print(s[5:]) # print(s[-3:-1]) # print(s[-3:]) # print(s[:]) # print(s[3:-2]) # print(s[-7:7])
true
2e3ace9bd2798d8fa669200c71d2ab1270a67d35
hrdavidge/georgette_heyer
/machine_learning/cross_val_neural_net_class.py
UTF-8
5,915
3.078125
3
[]
no_license
# testing cross validation and grid search using neural network for classification using the Georgette Heyer survey dataset # import libraries import pandas as pd import pdb import argparse from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from sklearn.model_selection...
true
3dbc0318da17bb5e20450bec5891120bb27a5059
pinchyCZN/winmerge
/Tools/Scripts/cleanup_backups.py
UTF-8
2,964
2.78125
3
[]
no_license
############################################################################# ## License (GPLv2+): ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License,...
true
a17ce2a8116dbe7f15414687475e127f11f10923
flight7788/3d-printing-with-moveo-1
/Cura/Cura/plugins/UM3NetworkPrinting/src/Models/Http/ClusterPrintJobImpediment.py
UTF-8
746
2.515625
3
[ "LGPL-3.0-only", "GPL-3.0-only" ]
permissive
# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from ..BaseModel import BaseModel ## Class representing the reasons that prevent this job from being printed on the associated printer class ClusterPrintJobImpediment(BaseModel): ## Creates a new print job constraint....
true
b9e3328951a4c6d36de21f7d287c3b3f39ba1fcf
muqiann/NamedEntityRecognition
/src/NERsystem/others/embedding_lookup.py
UTF-8
457
3
3
[]
no_license
# -*- coding:utf-8 -*- import numpy as np import tensorflow as tf """ tf.nn.embedding_lookup函数的用法主要是选取一个张量里面索引对应的元素。 tf.nn.embedding_lookup(tensor, id):tensor就是输入张量,id就是张量对应的索引 """ a = np.random.random([10, 4]) print(a) print("-"*40) b = tf.nn.embedding_lookup(a, [1, 3]) with tf.Session() as sess: sess.run(tf.g...
true
093eff338ef27a39ec317015251d3f46e823e87c
chasselas/helloworld
/kina.py
UTF-8
25
3.109375
3
[]
no_license
x = 100 y = 99 print(x+y)
true
d3b2dad068a5b10b26a1aa16d915b6e70577cecc
rayzrchen/download-something
/tests/test_download_my_courses.py
UTF-8
7,351
2.9375
3
[]
no_license
import logging import os import unittest from multiprocessing.dummy import Pool as ThreadPool from pathlib import Path from unittest.mock import MagicMock from sources.download_helper import DownloadHelper from sources.download_my_course import DownloadMyCourses from test_demo import FORMAT logging.basicConfig(format...
true
a6f7be94f66e98a5828c46f6b01923bbd9bdf8dd
mimi1987/Minecraft-Python
/waterCurse.py
UTF-8
289
2.546875
3
[]
no_license
from mcpi.minecraft import Minecraft from time import sleep mc = Minecraft.create() pos = mc.player.getTilePos() x = pos.x y = pos.y z = pos.z count = 1 while count < 60: mc.setBlock(x, y, z, 8) count += 1 sleep(0.5) mc.postToChat("Flood has finished!")
true
8b1eff299197c501ad7ed2eb8cca5ac81a8a7bb6
martingaston/bangbangnapster
/src/server/index_server.py
UTF-8
1,462
2.71875
3
[ "MIT" ]
permissive
from typing import List from src.server.file import File from src.server.user import User from dataclasses import dataclass @dataclass class IndexedFile: file: File user: User def __repr__(self) -> str: return f'"{self.file.filename}" {self.file.md5} {self.file.size_in_bytes} {self.file.bitrate} ...
true
7c1e1b680bcd68ff31a31a6cb41f50c90914f4d7
saurabhbajaj207/CarpeDiem
/unitTests.py
UTF-8
1,464
3.078125
3
[ "MIT" ]
permissive
import unittest from cryptLib import encrypt, decrypt from fileLib import getFileList, updateFiles import os import shutil class TestMethods(unittest.TestCase): def test_encrypt_decrypt(self): plaintext = "hello world" password = "pass" ciphertext = encrypt(plaintext, password) sel...
true
19ded2c8ddb00c8016e3967628269a1bd2f0d59b
Andrei-d6/ASC
/Lab2/task4.py
UTF-8
1,048
3.34375
3
[]
no_license
from threading import Thread, Lock import time import random class Philosopher(Thread): def __init__(self, name, leftFork, rightFork): Thread.__init__(self) self.name = name self.leftFork = leftFork self.rightFork = rightFork def run(self): if self.name == 'Philosopher1...
true
fe4ac953abef65387b58dcc3c130352d71c3fb3c
sunq-run/openstreetmap
/myrouter2.py
UTF-8
973
3.15625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import csv import sys import pprint class Node: def __init__(self,nodeName): self.nd = nodeName self.childnodes = [] args = sys.argv startNode = args[1] endNode = args[2] def mkway_node(onenode): #ノード作成 imfile = "edges.csv" f = open(imfile,"r") edges = csv.reader(f)...
true
81dcff686f9a1f79eaf170395afa3175fe179ab0
ramlaxman/storyscript
/storyscript/hub/TypeMappings.py
UTF-8
1,902
3.0625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- from storyscript.compiler.semantics.types.Types import AnyType, BooleanType, \ FloatType, IntType, ListType, MapType, ObjectType, StringType class TypeMappings: @staticmethod def type_class_mapping(type_string): """ Maps a given string (holding type information, fr...
true
389d49a1e9dffa151a4515b631746671c4d10a1a
lolotrgeek/DHT-registry
/level.py
UTF-8
2,846
2.921875
3
[]
no_license
import time import binascii import operator import plyvel as level from itertools import takewhile from ast import literal_eval as make_tuple from kademlia.storage import IStorage class LevelStorage(IStorage): def __init__(self, name : str, ttl=604800): """ By default, max age is a week. ...
true
27332a9b9ec200154ccb8dcd2e4e5858e69707f0
stephennacion06/read_write_file
/list_to_file.py
UTF-8
164
3.3125
3
[]
no_license
list_value = [1] * 13 print(list_value) with open('listfile.txt', 'w') as filehandle: for listitem in list_value: filehandle.write('%s\n' % listitem)
true
634a7d3d0c732b93a49476c2782a8b7122f387d6
EllieSky/Automation2020_Summer
/tests/login.py
UTF-8
2,109
2.640625
3
[]
no_license
import time import unittest from selenium import webdriver from parameterized import parameterized import selenium class Login(unittest.TestCase): def setUp(self) -> None: self.browser = webdriver.Chrome(executable_path='/Users/ellie/Selenium/Automation2020_Summer/browsers/chromedriver') self.bro...
true
179ab5b1ef2f61e812b2e2d04f56a6c5f412aa87
MaksymSahan/Java_Labs
/Laba2/machines/Machine.py
UTF-8
194
2.65625
3
[]
no_license
class Machine: def __init__(self, model, weightInTones, team, fuel) : self.model = model self.weightInTones = weightInTones self.team = team self.fuel = fuel
true
f388bb67e08707aabb41a882474f9e53edec3965
stuartcrobinson/hackdays2017
/nn/hackdays_lightfm.py
UTF-8
20,433
2.6875
3
[]
no_license
import numpy as np from lightfm.datasets import fetch_stackexchange from scipy import sparse import pickle from sklearn.externals import joblib import os.path import time start_time = time.time() # Save the trained model as a pickle string. # saved_model = pickle.dumps(clf) # Save the model as a pickle in a file # ...
true
9bf5a8bb8e86b7a84c4f5d61b5c6b53a175e9a75
qfsf0220/gitskills
/flaskkk/wrapper.py/game2048.py
UTF-8
1,030
3.265625
3
[]
no_license
# import curses from random import randrange ,choice from collections import defaultdict actions=["Up","Left","Right","Restart","Exit"] letter_codes=[ord(ch) for ch in 'WASDRQwasdrq'] print letter_codes def main(stdscr): def init(): return "game" def not_game(): respons=defaultdict(lambda :...
true
f58cce63e41d23d6dd392ca79caf06e2549d5f56
MarcelaSamili/Desafios-do-curso-de-Python
/Python/PycharmProjects/aula18parte2lista/desafio 087.py
UTF-8
915
4.28125
4
[ "MIT" ]
permissive
#Aprimore o desafio anterior, mostrando no final: # A) A soma de todos os valores pares digitados. # B) A soma dos valores da terceira coluna. # C) O maior valor da segunda linha. m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] somap = 0 soma_tcol = 0 for linha in range(0, 3): for coluna in range(0, 3): m[linha][colu...
true
5f35920f5372205f57de8162b4ad13f7768e29e1
JohnStokes228/home_scraping_project
/HousingPriceScraper/HousingPriceScraper/spiders/MMASpiders/Wikipedia.py
UTF-8
2,030
2.78125
3
[]
no_license
""" spider for scraping wikipedia.com. Apparently they allow bot access so long as its not too fast, so keep it slowww, theres only a few tables we really need anyways. I'm only scraping the 'debuted' fighters list for the country of origin as the rest of them arent likely to have any fights listed yet. I'm also not ye...
true
32093aaeb2e741bfe1081ec4e2544e357c312494
bluesmasterelf/hashTable
/hashTable.py
UTF-8
3,848
4.15625
4
[]
no_license
""" First attempt to implement a fast-lookup hash table method with ISBN keys""" from random import randint class Book: def __init__(self, ISBN):#add other features later self.ISBN=ISBN self.title=str(randint(0,10000)) self.location=None class HashTable: def __init__(self, initialLengt...
true
bc5acf369e0fed269e0fd671d4960953f18881a0
BotOreo/FYP-SSD
/line following.py
UTF-8
1,276
2.703125
3
[]
no_license
E1 = 5 #4 M1 = 4 #For the wheel #5 E2 = 6 #7 M2 = 7 #For the wheel #6 LED = 13 a.pinMode(M1, a.OUTPUT) a.pinMode(M2, a.OUTPUT) a.pinMode(E1, a.OUTPUT) a.pinMode(E2, a.OUTPUT) def forward(valueR,valueL): a.digitalWrite(M1, a.HIGH) a.digitalWrite(M2, a.HIGH) a.analogWrite(E1, a.valueR) a...
true
0e3cf296e82a7b721401042b77a5abe369fca245
superwololo/codingpractice
/dynamicprogramming/binomial_coefficient.py
UTF-8
551
3.625
4
[]
no_license
""" https://www.geeksforgeeks.org/binomial-coefficient-dp-9/ """ # number of ways k objects chosen from among n objects def C(n, k): return C_inner(n, k, {}) def C_inner(n, k, cache): if (n, k) in cache: return cache[(n, k)] if n == 0: return 1 if k == 0: return 0 ...
true
8615ba24b05737ce595781416602aad0d6dd42bf
zzf531/proxypool
/test.py
UTF-8
285
2.6875
3
[]
no_license
import requests from selenium import webdriver url = 'https://leetcode-cn.com/problems/partition-array-into-three-parts-with-equal-sum/solution/python-chao-ji-kuai-zui-sha-gua-xie-fa-ming-ming-b/' rsp = requests.get(url) browser = webdriver.Chrome() browser.get(url) browser.close()
true
7a104b95cfcdad23318cb778efb4ea96fe111b1e
panhabothk/1st-RPG-Game
/RPG Beta1.py
UTF-8
6,264
3.4375
3
[]
no_license
print("Welcome to my RPG game\n") print("INSTRUCTIONS:\nFor every prompt, type '/' to go back.") print("To start the game, type 'start()'") gold = 500 bag = [] CAT = ["Attack Damage","Movement Speed","Health","Consumables"] AD = ["Long Sword","Doran's Blade","Bloodthirster"] AD_PRICE = [350,400,900] SPEED = [...
true
521dac84dd576d120c2fc9f4ee43397331abd91e
loveactualry/fluffy-octo-disco
/python/section04-1.py
UTF-8
1,077
3.578125
4
[ "Apache-2.0" ]
permissive
# 데이터 타입 v_str1 = "Niceman" v_bool = True v_str2 = "Goodboy" V_float = 10.3 v_int = 7 v_dict = { "name": "kim", "age": 25, } v_list = [3, 5, 7] v_tuple = 3, 5, 7 v_set = {7, 8, 9} print(type(v_tuple)) print(type(v_set)) print(type(V_float)) i1 = 39 i2 = 939 big_int1 = 9999999999999999999...
true
2be2f754349df72494fd7c1b1bff45177cdfd1a2
mimikrija/AdventOfCode2016
/python/07.py
UTF-8
2,088
3.390625
3
[]
no_license
# Day 7: Internet Protocol Version 7 import santas_little_helpers as helpers from collections import namedtuple import re IP_data = namedtuple('IP_data', ['words', 'hypernet_sequences']) def contains_abba(word): "checks if `word` contains abba sequence such as 'zuuz' or 'amma' " for first, second, third, fo...
true
013f167e158ac385d0942b7848181e3d7f821cff
lyukov/dl_markup
/dl_markup/Palette.py
UTF-8
3,277
2.734375
3
[ "MIT" ]
permissive
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QLabel from PyQt5.QtWidgets import QSizePolicy from PyQt5.QtWidgets import QGridLayout from PyQt5.QtWidgets import QPushButton from PyQt5.QtWidgets import QVBoxLayout from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import Qt import math from f...
true
d4bdda1476695552197f297136bc6c731c363a23
kanye2021/OOP-Game-S16-Iteration2
/src/map_gen/mapGenerator.py
UTF-8
3,085
2.9375
3
[]
no_license
import os import sys from xml.etree.ElementTree import Element, SubElement, Comment, tostring, ElementTree from xml.etree import ElementTree from xml.dom import minidom import random import time """ Return a pretty-printed XML string for the Element. """ def prettify(data): rough_string = ElementTree.tostring(...
true
9e552980a079def4ff5f7a3c039f4dbabe336332
fotinosk/IDP
/ComputerVision/contours.py
UTF-8
698
2.609375
3
[]
no_license
#mask contours import numpy as np import cv2 def cont(img): #im = cv2.imread('full_track3.jpg') imgray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(imgray,127,255,0) contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) for contour in contours: ...
true
d1d20b11f29a2e85fba1bf9784e84bfd8c920819
kunal-jain-99/Magic-8-Ball
/magic8ball.py
UTF-8
1,381
3.46875
3
[]
no_license
import random import time #https://en.wikipedia.org/wiki/Magic_8-Ball#Possible_answers answers = ["It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely", "You may rely on it", "As I see it, yes", "Most Likely", "Outlook Good", "Yes", "Signs point to yes", "Reply hazy, try aga...
true