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
53864fa843eb5da826f570269e28486df063967b
Anastasiya999/Python
/zestaw4/zad2.py
UTF-8
547
3.859375
4
[]
no_license
def miarka(n): '''Zwraca miarkę o dlugosci n''' miarka="....".join("|" for x in range(n+1)) miarka=miarka+"\n"+"".join("{:5d}".format(x) for x in range(n+1)).lstrip() return miarka def draw_rectangle(x,y): '''Zwraca prostokąt zbudowany z x*y pól''' napis="" for i in range(x+3): if i...
true
f942ae53326443e43def71796f6c2a9ce52d64f4
qwertpas/pythontests
/maps.py
UTF-8
1,985
2.625
3
[]
no_license
import string import json import os import urllib.request from colorama import init from colorama import Fore, Back, Style from os import path init() VERSION_FOLDER = os.getenv('APPDATA') + "\\.minecraft" + "\\versions" print(Fore.GREEN + " Minecraft Mapping Finder 1.0") print(Fore.WHITE + " ...
true
a7e9abe34241f02b1cb971147b6833d161ff366b
ColumbiaWeakLensing/LSST100parameters
/code/library/defaults.py
UTF-8
3,513
2.71875
3
[]
no_license
#Default settings for feature analysis (typically not to be touched) import numpy as np #Settings for Fisher matrix class FisherSettings(object): #Constructor def __init__(self): #Cosmological parameters and available features self.features = ["power_spectrum","moments","peaks"] self.fiducial_parameters = n...
true
a0df98ffcfccf808b0326d962e1ffd621cf19d19
didierquintius/MasterAIThesis
/Archive/UpdateDataFormat.py
UTF-8
1,818
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 22 14:16:25 2020 @author: didie """ import numpy as np import pandas as pd def create_transformation(format_electrodes_1d, format_electrodes_2d): n, m = format_electrodes_2d.shape transformation = np.zeros((n,m,108)) print(n, m) for i in ra...
true
4d5616cdac29c5e4d823ebc92ca186226e82abb3
Spoetnik1/werkspot_de_assignment
/question2_availability.py
UTF-8
1,931
2.640625
3
[]
no_license
import pandasql as ps import pandas as pd # Read csv and do some transformations df = pd.read_csv('event_log.csv', sep=';') df = df.rename(columns={"professional_id_anonymized": "prof_id", "created_at": "timestamp"}) df = df[['event_id', 'event_type', 'prof_id', 'timestamp']] df['timestamp'] = pd.to_datetime(df...
true
b9fe5c5d6377fb1fbff45a5d67601ddb43207b2d
teamteamdev/ugractf-2021-quals
/tasks/powerful/exploit.py
UTF-8
1,006
3.125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
import base64 import json import sys def get_phi(n): phi = int(n > 1 and n) for p in range(2, int(n ** .5) + 1): if not n % p: phi -= phi // p while not n % p: n //= p if n > 1: phi -= phi // n return phi if len(sys.argv) < 2: print("Usage: ...
true
6377b3f87ad66209b6678cfd4f6c3d0797ea4e8e
alex1528/utils
/exception_example.py
UTF-8
161
2.8125
3
[]
no_license
#!/usr/bin/python can_handle = False try: raise Exception("raise a exception !") except Exception, e: if not can_handle: raise print str(e)
true
9be52ba46d02ee749a172f95df16a99201ec77f8
developyoun/AlgorithmSolve
/solved/11404.py
UTF-8
493
2.859375
3
[]
no_license
N = int(input()) board = [[float('INF')]*(N+1) for _ in range(N+1)] for _ in range(int(input())): a, b, c = map(int, input().split()) board[a][b] = min(board[a][b], c) for i in range(1, N+1): for j in range(1, N+1): if i == j: board[i][j] = 0 for k in range(1, N+1): for i in range(1, N+1): ...
true
a3d482ef4deac77e922ee3ff38ece435b6c8a84d
markhorsfield/Get-Programming-with-Python-in-Motion
/u3m6-name_mashup.py
UTF-8
1,160
3.84375
4
[]
no_license
# get user input name1 = input("Enter one name: ") name2 = input("Enter another name: ") space = name1.find(" ") name1_first = name1[0:space] name1_last = name1[space+1:len(name1)] space = name2.find(" ") name2_first = name2[0:space] name2_last = name2[space+1:len(name2)] # find combinations name1_first_1sthalf = nam...
true
deb01ed216550bd4facb92adbb0871ae759e0e1a
Mrbrianojee/leiden-oo-recap
/employees/employee.py
UTF-8
1,500
3.5625
4
[]
no_license
class Employee(object): BASE_SALARY = 5000 fname = '' sname = '' no_of_years = 0 def __init__(self, fname, sname, no_of_years): self.fname = fname self.sname = sname self.no_of_years = no_of_years def calculate_salary(self): bonus = 0 ...
true
69e5e92c5ca4408157139602544fa024ada40144
curiousTauseef/Nand-to-Tetris-Build-a-Modern-Computer-from-First-Principles
/11/SymbolTable.py
UTF-8
5,207
2.96875
3
[]
no_license
class SymbolTable: """ A symbol table that associates names with information needed for Jack compilation """ def __init__(self): self.class_table = None self.class_name = None self.subroutine_table = None self.subroutine_name = None self.subroutine_type = None ...
true
cfe117fccc8900b4b3d89c4cd419ff99c4915189
IvayloSavov/Fundamentals
/regural_expression_exercise/extract_emails.py
UTF-8
390
2.8125
3
[]
no_license
import re user_pattern = r"( |^)[a-zA-Z0-9]+((\.|\-|_)[a-zA-Z0-9]+)*" host_pattern = r"[a-zA-Z]+(-[a-zA-Z]+)*(\.[a-zA-Z]+(-[a-zA-Z]+)*)+" pattern = rf"{user_pattern}@{host_pattern}" # pattern = r"(^|(?<=\s))(([a-zA-Z0-9]+)([\.\-_]?)([A-Za-z0-9]+)(@)([a-zA-Z]+([\.\-_][A-Za-z]+)+))(\b|(?=\s))" text = input() emails =...
true
2d86274950ca002d57544d9c30e556a799f4efb7
Pankaj1729/Music-Player
/Music_Player2.py
UTF-8
6,308
3.140625
3
[]
no_license
import tkinter # library for gui window import copy import tkinter.messagebox import os from tkinter import ttk # for extended feature of tkinter from PIL import Image, ImageTk from pygame import mixer # for music sound handling root = tkinter.Tk() # window page create here root.title("Music Player") # g...
true
e5300d07bf66e7a40596e9db8568bb6f933b6783
nikrasiya/Hashing-3
/187_repeated_DNA_Sequences.py
UTF-8
680
3.5625
4
[]
no_license
from typing import List class Solution: def findRepeatedDnaSequences(self, s: str) -> List[str]: """ https://leetcode.com/problems/repeated-dna-sequences/ Time Complexity - O(n) Space Complexity - O(n( """ seq = set() result = set() for i...
true
261c93565b642db65f1d34e5a244057ccd2b5993
Mbalazs21/pte_ep_c2_2021
/ora7/feladat2.py
UTF-8
663
2.78125
3
[]
no_license
import easygui years_str = easygui.enterbox("Adjon meg egy évszámot:", title="Adatlekérés") eredmeny = "eredmény" try: year = int(years_str) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: easygui.msgbox("A megadott év szövőév", title=eredmeny) else: ...
true
48f18f64948ac8e315e56bbd27964f24645ab4cf
Chenhuaqi6/python_base
/练习专用/day16/code/binary_file_read.py
UTF-8
289
3.53125
4
[]
no_license
# binary_file_read.py # 此示例示意用二进制模式读取文件中的数据 f = open("mynote.txt", 'rb') # 二进制读 b = f.read() # 返回字节串 print('读取的内容长度是:', len(b)) print("内容是:", b) s = b.decode() print("转为字符串后s为:", s) f.close()
true
6dde6fbd0486664e7347a5601a8ec764e722d167
k124k3n/competitive-programming-answer
/codechef/DIFFSUM.py
UTF-8
80
3.734375
4
[ "MIT" ]
permissive
a = int(input()) b = int(input()) if a > b: print(a-b) else: print(a+b)
true
1e6db525ef774d72f313ea029ab97ad460a781b0
begimai/python
/hw2.py
UTF-8
3,481
3.390625
3
[]
no_license
from collections import defaultdict def refactor(fromFile, file): d = {} lst = [] tempWord = '' with open(fromFile) as f, open(file) as l: for line in l: words = line.split() d[words[0]] = ' '.join(words[1:]) for line in f: wo...
true
1dac35e7c21ef2b794ae931a5b98d7c90e543333
Sridhar-S-G/Python_programs
/Pattern_backSlash.py
UTF-8
489
3.75
4
[]
no_license
''' Problem Print the black slash in the pattern given below Test case1 Input: 8 Output: \ \ \ \ \ \ \ \ Test case2 Input: 5 Output: \ \ \ \ \ ''' # Note: Before refering the solution try to solve the problem # Solution...
true
a4275bf1c0f2e0c98569c82f28bbebcc9177cdd5
jung9156/studies
/lecture/algorithm/problem/kakaopractice/멀쩡한 사각형.py
UTF-8
245
2.90625
3
[]
no_license
def solution(w,h): if w > h: h, w = w, h h1, w1 = h, w answer = 1 while True: if h1 % w1 == 0: break else: h1, w1 = w1, h1 % w1 answer = h * w - (h + w - w1) return answer
true
8b0d6684fd60ab8508ff5b29a067ec3cc01315fe
yaosichao0915/SNP_COLLECTION
/parseGenotype.py
UTF-8
1,850
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import os import mwparserfromhell class PageParser(object): def __init__(self,dir): self.files = self.AllFiles(dir) def AllFiles(self,filepath): for root,dirs,files in os.walk(dir): return files def ReadFile(self,file): f = open('./Rs...
true
abd98f43cb14d7ab0218ab44c04ce1c212771921
nickatnight/relationship-advice-update-bot
/bot
UTF-8
1,404
2.546875
3
[]
no_license
#!/usr/bin/env python3 import os import time import praw class RedditBotBase(object): def __init__(self): self.flair = None self.user_agent = f"{os.getenv('BOT_NAME')} | {os.getenv('VERSION')} | By {os.getenv('DEVELOPER')}" self.subreddit = os.getenv("SUBREDDIT") self.xpost_subre...
true
6cc367695bb20ebca872fe920a053bf052dc2f8e
BeemerCodes/Estudos-de-Python
/Guanabara/EX 48-Multiplos de 3.py
UTF-8
165
3.609375
4
[]
no_license
soma = 0 for c in range(1, 501, 2): if c % 3 == 0: soma += c print(soma) print('De 0 a 500 somando apenas os numero impares múltiplos de 3')
true
6f4a46d05251e2fb628833051fd1a5d336ccf94d
nro-bot/BallisticGame
/sliderTest.py
UTF-8
1,884
3.28125
3
[]
no_license
import pygame as pg from pygame.locals import * from sys import exit pg.init() WIDTH, HEIGHT = 800, 600 screen = pg.display.set_mode((WIDTH, HEIGHT), 0, 32) color = [127, 127, 127] # Creates an image with smooth gradients def createScales(height): redScaleSurface = pg.surface.Surface((WIDTH, height)) greenSc...
true
08ede9706cfc29758a25687e3d3b897afbd141fa
Neuropharmacol/3csrtt_q_learning
/src/visTools.py
UTF-8
4,110
2.796875
3
[ "MIT" ]
permissive
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import matplotlib.cm as cm import matplotlib.dates as mdates from matplotlib.lines import Line2D from typing import Union, Optional, List, Dict, Callable, Any, Tuple from types import ModuleType class BasicPlo...
true
2258657eb457f26cb6f7fcf5c41504e97affb95f
ElielCesar/Automacoes_Laboratorios
/nomeacao_ifro_cheker.py
UTF-8
690
2.921875
3
[]
no_license
# Funcao - Realizar um crawler no site do ifro onde as nomeacoes sao feitas # e trazer o nome dos candidatos convocados. from bs4 import BeautifulSoup as bs from urllib.request import urlopen # requisitando a pagina html = urlopen( 'https://selecao.ifro.edu.br/tecnico-administrativo/537-concurso-2018-servidores-t...
true
f368090b9f5c7afe759cd20dfa1b8059fd3d34c2
terryhu08/MachingLearning
/src/python/SVM/svm-complete.py
UTF-8
12,741
2.90625
3
[]
no_license
#!/usr/bin/python # coding:utf-8 ''' created on 2017/12/31 @author BigNewbie 参考文献: 支持向量机通俗导论(理解SVM的三层境界)http://blog.csdn.net/v_july_v/article/details/7624837 【机器学习实战】第6章 支持向量机 http://www.cnblogs.com/jiangzhonglian/p/7690033.html 功能: 完整的SVM算法 ''' print(__doc__) import numpy as np import matplotlib.pyplo...
true
6c01734dbf2035f82e8777f96c3796fef7c34e59
tomasstankovic/mgr-tensorflow
/flaskapp.py
UTF-8
4,324
2.75
3
[]
no_license
import os from sys import platform as _platform import numpy as np from six.moves import urllib import tensorflow as tf from flask import Flask, jsonify, render_template, request if _platform == "linux" or _platform == "linux2": pwd = '/var/www/html/flaskapp' else: pwd = os.getcwd() PREDICTION_DECIMAL_LENGTH ...
true
26309e74e489a7dc055558ae7fd678b0963b5dc1
prashilbhimani/AutomaticSudokuSolver
/source/set_matrix.py
UTF-8
214
2.984375
3
[]
no_license
def setmatrix(matrix,max,possiblemaze): for i in range(max): for j in range(max): if len(possiblemaze[i][j])==1: k=possiblemaze[i][j].pop() matrix[i][j]=k possiblemaze[i][j].add(k) return matrix
true
09781b91eff34527d264d21f82785ec59531dffc
Nolsters/2.1-Tasks
/main.py
UTF-8
998
4.03125
4
[]
no_license
def task_1(): data = { 'nolan': 'best', 'leo': 'best', 'anyone else': 'Everyone is best' } print(data) def task_2(): data = { 'nolan': 'best', 'leo': 'best', 'anyone else': 'Everyone is best' } try: print('Here are all the available index...
true
eee967eedbb577631c7853f3c9b09b2804b95c5c
shourya2002-geek/Web-Apps-using-ML
/apps/Models.py
UTF-8
6,968
2.859375
3
[]
no_license
import streamlit as st import numpy as np import pandas as pd from sklearn.svm import SVC from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from xgboost import XGBClassifier from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_te...
true
cf2769f5628fcbd275e7b74da1c95f835440cc50
lucasloo/leetcodepy
/solutions/33SearchInRotatedSortedArray.py
UTF-8
1,335
4.09375
4
[]
no_license
# Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. # (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). # You are given a target value to search. If found in the array return its index, otherwise return -1. # You may assume no duplicate exists in the array. # my soluti...
true
a7cfa7f01a7c528a9e09c0da1eab35a3fbde5544
LuisStruggle/ImageProcessing
/PIL-study/opencv12.py
UTF-8
2,193
3.328125
3
[]
no_license
#!/usr/bin/python # -*- coding:utf-8 -*- # @Time : 2018/11/19 11:03 # @Author : ly # @File : opencv12.py """ FAST(Features from Accelerated Segment Test)算法会在像素周围绘制一个圆,该圆包括16个像素,这是一种不错的方法。 然后,FAST会将每个像素与加上一个阈值的圆心像素值进行比较,若有连续、比加上一个阈值的圆心的像素值还亮或暗的像素,则可认为圆心是角点。 """ """ BRIEF(Binary Robust Independent Elementary Feature...
true
f2a8383d4ef5247714ea98a88359ac86e9bb4d16
nelsoncc3013/Coderep
/.idea/opsCode_tool/HostCheck.py
UTF-8
992
2.53125
3
[]
no_license
#!/usr/local/easyops/python/bin/python # encoding: utf-8 #主机巡检 import os import psutil import platform # cpu cpu = psutil.cpu_percent(interval=3) info = "IP=%s&CPU=%s" % (EASYOPS_LOCAL_IP, cpu) print info PutRow("table", info) # loads if platform.system() != 'Windows': load = os.getloadavg() info = 'IP=%s&L...
true
7d7d1ca103e68ca88231d5e34d91c3ca5f81398c
zebyja/applifting
/tests/offersConnector_test.py
UTF-8
1,383
2.921875
3
[]
no_license
# tests of offersConnector.py import pytest from ms import offersConnector def test_simple(): try: offers = offersConnector.OffersConnector() offers.auth() except Exception as e: assert True, 'Authentication raised exception: \n{}'.format(e) return # cannot continue without a...
true
9d3e7c1c7a20b524cf930e36d18ea57cfa72c7ce
pysal/segregation
/segregation/dynamics/divergence_profile.py
UTF-8
4,547
3.046875
3
[ "BSD-3-Clause" ]
permissive
import numpy as np import pandas as pd from scipy.spatial.distance import pdist, squareform from scipy.special import rel_entr as relative_entropy from ..network import compute_travel_cost_matrix from warnings import warn def compute_divergence_profiles( gdf, groups, metric="euclidean", network=None, distance_m...
true
428754659b09cca2c25b9a4f65d6f58f973c84e2
EzequielVijande/ASSD-TP2
/Programa_principal/programa_principal/additiveSynthesis.py
UTF-8
5,207
2.5625
3
[]
no_license
import synth import numpy as np import random from pathlib import Path import spectralAnalysis as sa import OLA as ola import matplotlib.pyplot as plt # envelope files GUITAR_ENVELOPE = "guitarSample.wav" VIOLIN_ENVELOPE = "violinSample.wav" SAXO_ENVELOPE = "saxophoneSample.wav" TRUMPET_ENVELOPE = "trumpetSample.wav"...
true
9e841735ad2c3fe3e2632d1d4004756cfcfc5413
maxslimmer/advent-of-code-2019
/day07/script.py
UTF-8
5,151
2.828125
3
[]
no_license
from itertools import zip_longest def deref(address, memory): try: return (memory[address], memory[memory[address]]) except IndexError: return (memory[address], None) class Computer: def __init__(self, program, inputs): self.program = program[:] self.inputs...
true
de277d213d7123679f8b6245e308597365a2a51e
brkronheim/WR-lite
/ml/mlPredict.py
UTF-8
20,252
3.03125
3
[]
no_license
""" Makes predictions from saved nerual networks. Put the names of the network folders in the list on line 111 and put the names as they should appear in the list on line 113. Graphs will be generated of interpolated and then relaxed accuracy and metric for each mass network. Additionally, the metric will be plott...
true
673da28523272ecdcf186bdd911dc952ad5f32a3
nicolabc/Automate-The-Boring-Stuff
/Chapter 10 - Debug/chap10testing.py
UTF-8
966
3.015625
3
[ "MIT" ]
permissive
#! python3 import sys, logging logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') if __name__ == '__main__': #raise Exception('This is the error message') # podBayDoorStatus = 'open' # assert podBayDoorStatus == 'open', 'The pod bay doors need to be "open".' # ...
true
fcd8075cab7e00ff0699f7d222313c876c667b52
aarontwillcock/RTCSA21-DC-CES
/pySimulation/gfRwsMaeRandGen.py
UTF-8
36,316
2.6875
3
[]
no_license
# Generic Function RWS MAE Random Generator # Description: # This file provides functionality for generating random task sets and logging data about attempts to generate task sets and stats about the task sets themselves #Imports # Import the general GF RWS MAE functions import gfRwsMaeGeneral as GF_RWS_MAE_GEN # ...
true
d6f88ceee29a5e2b67e4399917f1aa49843bd138
JarvisFree/UIAutoUestcedu
/uestcedu/auto_job.py
UTF-8
24,250
2.671875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time :2021/4/18 20:11 @Author :维斯 @File :auto_job.py @Version :1.0 @Function:组件_刷作业 """ import random import time from selenium.webdriver.chrome.webdriver import WebDriver def job_auto_start(driver_job: WebDriver, course_name): result_list = [] # 判...
true
a20a9fbae311aedbc20fc152f6175e3f27955584
haydengunraj/YRDSBMarkTools
/objects/student.py
UTF-8
15,017
2.828125
3
[ "MIT" ]
permissive
from mechanize import * from bs4 import BeautifulSoup from xlsxwriter import * class Student(object): """A YRDSB student""" def __init__(self, username, password, cc_password): """Username(student #), TeachAssist password, and Career Cruising password""" self.username = username self.pa...
true
67449810009317c5d5caa43c88b83ee9e59794ab
Noxy3301/AtCoder
/ABC/abc015_b.py
UTF-8
143
2.796875
3
[]
no_license
import math n = int(input()) a_original = list(map(int, input().split())) a = [i for i in a_original if i != 0] print(math.ceil(sum(a)/len(a)))
true
010c567fb872108e513d1200bbef90dc9016d55f
JakobKallestad/Python-Kattis
/src/HarshadNumbers.py
UTF-8
230
3.296875
3
[]
no_license
n = int(input()) while True: temp = n sum_temp = 0 while temp > 0: sum_temp += temp%10 temp //= 10 #print(sum_temp) if sum_temp == 0 or n%sum_temp == 0: print(n) break n += 1
true
037e6b2b0d496714e67afdd272a991c582136425
JohnLam916/Tip_Calculator
/Johns_tip_calculator.py
UTF-8
1,124
4.5625
5
[]
no_license
# Creating user input for cost of food, number of people splitting the bill and percentage of the tip. cost_of_food = input("How much does the food cost?") num_of_people = input("How many people are splitting bill?") tip_percentage = input("What percentage would you like to tip?") #Turn input into integers so that we...
true
2d554bef31635318ebe85ceac37f08f863aaa30b
dipu-bd/celeref-lang
/src/celeref_lang/functions/op.py
UTF-8
1,773
4.09375
4
[]
no_license
import math def plus(*args): ''' plus(*args) -> number Same as `sum(*args)` Add arbitrary number of arguments''' return sum(args) def minus(a, b): ''' minus(a, b) -> number Same as `a - b` Substract first number from second''' return a - b def cross(*args): ''' cr...
true
bf01fa94780356cb4a4b338b62fb38db4e782927
AmauryCarrade/ChatLogHighlighter
/highlighter.py
UTF-8
2,052
2.875
3
[ "CECILL-B", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import argparse from chat_highlighter import ChatHighlighter parser = argparse.ArgumentParser(description='Highlights quotes') parser.add_argument('--remove-dates', help='Remove the dates from the log.', action='store_true') parser.add_argument('--remove-bots', help='Remove the bots from the log. Comma-separated lis...
true
33c9b959bde5ce273135bccdf9f88d200d54cdfb
eafit-201620030010/M-todos-Num-ricos
/Entrega1/biseccion.py
UTF-8
2,109
3.4375
3
[]
no_license
import math from py_expression_eval import Parser parser = Parser() def biseccion(xInferior, xSuperior, tolerancia, maximoIteraciones, f): tabla = [] # #fxInferior = f(xInferior) fxInferior = parser.parse(f).evaluate({"x": xInferior}) #fxSuperior = f(xSuperior) fxSuperior = parser.parse(f).eval...
true
05f2677b7a1b33c3586ccf44a496e3b2aeb3b274
Aleks-Ya/yaal_examples
/Python+/Python3/src/module/builtins/boolean/parse_boolean.py
UTF-8
325
3.875
4
[]
no_license
# Parse boolean from str # Standard bool() function (DO NOT USE IT!) assert bool('True') is True assert bool('False') is True assert bool('') is False # Correct parsing def parse_bool(s: str) -> bool: return s.lower() in ("yes", "true", "t", "1") assert parse_bool('True') is True assert parse_bool('False') is ...
true
9e135a5e7079194e94c7cc8e09aa81344814809e
dastronmighty/dl-project
/src/Data/Preprocessor.py
UTF-8
5,189
2.8125
3
[]
no_license
import os import torch import torchvision import numpy as np import pandas as pd from tqdm import tqdm class Preproccessor: def __init__(self, data_path, output_path, from_, to_, MAX_SIZE=512, verbose=False): """ Preprocessor Class :param data_path: the path to the downloaded doata from...
true
3712e4287345d4087c15b91a71312e0010c498aa
chrispeng12345/mine
/status.py
UTF-8
7,704
2.796875
3
[]
no_license
# status page defi=[['username','difficultly','record','time'], ['-',1,999.99,'-'], ['-',1,999.99,'-'], ['-',1,999.99,'-'], ['-',2,999.99,'-'], ['-',2,999.99,'-'], ['-',2,999.99,'-'], ['-',3,999.99,'-'], ['-',3,999.99,'-'], ['-',3,999.99,'-']] # 初始化资料库用 import csv import pygame import operator import inputbox import m...
true
c3a1f3cd7f0e1fab94148de653337fa870af084c
atrnh/shopping-site
/shoppingsite.py
UTF-8
4,091
3.125
3
[]
no_license
"""Ubermelon shopping application Flask server. Provides web interface for browsing melons, seeing detail about a melon, and put melons in a shopping cart. Authors: Joel Burton, Christian Fernandez, Meggie Mahnken, Katie Byers. """ from flask import Flask, render_template, redirect, flash, session, request import j...
true
b3f8a96f324a0c7a327674df0e3a34960721614b
omhmichaels/analytics-ops
/harmony_analytics_ops/aws_util.py
UTF-8
2,439
2.75
3
[]
no_license
import subprocess import os import datetime env = os.environ.copy() timeout = 120 def _list_aws_dir(directory): cmd = ['aws', 's3', 'ls', directory] return [n.replace('PRE', '').strip() for n in subprocess.check_output(cmd, env=env, timeout=timeout).decode().split("\n") if n] def find_and_sort_...
true
503d6422c81d5ca1613f6566a94b0f6ba75a4bce
EndyLab/opentrons
/robobench/calibration/labware_recognition/tools/ImageCapture_orig.py
UTF-8
1,582
2.640625
3
[]
no_license
import argparse import time import cv2 import imutils import re from os import listdir from os.path import isfile, join parser = argparse.ArgumentParser() category = parser.add_mutually_exclusive_group() category.add_argument("-t", "--train", action="store_true") category.add_argument("-v", "--validate", action="stor...
true
cf65f424c85f491434ea9a53e63639978edbafff
KareemAbdella/Sound-Slide-Game
/game/BG2.py
UTF-8
12,635
2.671875
3
[]
no_license
from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from math import * import random forward = 0 angle = 0 Flash = 0 def stars(): global forward glLineWidth(2.5) glColor3f(1, 1, 1) for i in range(0, 10): px = random.randrange(-12, 12) py = rando...
true
17710f5b0478506e1c711061cc1633fc58bcbb39
cookiewang/fullStack
/media.py
UTF-8
559
3.03125
3
[]
no_license
import webbrowser class Movie(): """this is a constructor which takes the movie info as the parameters""" # noqa def __init__(self, title, storyline, poster_image_url, trailer_youtube_url): # noqa self.title = title self.storyline = storyline self.poster_image_...
true
c63397e40490a75d773b1315d4a78c06cf3f8f3f
yuansun86/leetcode
/Code/227. Basic Calculator II.py
UTF-8
940
3.140625
3
[]
no_license
class Solution: def calculate(self, s: str) -> int: stack = [] sign = '+' value = 0 s = s.replace(' ', '') for i in range(len(s)): if s[i].isdigit(): value = value * 10 + int(s[i]) if i == len(s) - 1 or s[i] in ['+', '-', '*', '/']: ...
true
1be4ec4789768cbc046626f50500cf62f49cc8e3
kirill-fedyanin/cozmo_experiments
/lib/hello.py
UTF-8
325
3.140625
3
[]
no_license
import cozmo import time def cozmo_program(robot: cozmo.robot.Robot): robot.set_lift_height(1.0).wait_for_completed() robot.set_lift_height(-1.0).wait_for_completed() robot.say_text("Have a nice day, Polina").wait_for_completed() robot.move_lift(2) robot.move_lift(-2) cozmo.run_program(cozmo_pro...
true
f1ced03935a90ae089456c4b6c698c8cf8ce6dd6
vmagamedov/metricslog
/metricslog/ext/_colors.py
UTF-8
3,078
2.59375
3
[ "BSD-3-Clause" ]
permissive
from ..compat import text_type CODES = { 'bg_black': '\x1b[40m', 'bg_blue': '\x1b[44m', 'bg_bold_black': '\x1b[100m', 'bg_bold_blue': '\x1b[104m', 'bg_bold_cyan': '\x1b[106m', 'bg_bold_green': '\x1b[102m', 'bg_bold_purple': '\x1b[105m', 'bg_bold_red': '\x1b[101m', 'bg_bold_white': ...
true
bc02f1f519e7354856c1565ba46c84160efbed41
ttsoftware/StatML
/assignment 2/thomsen.haarslev.nielsen.py
UTF-8
8,382
2.578125
3
[]
no_license
from DataReader import DataReader from LDAClassifier import LDAClassifier from Normalizer import Normalizer from MLRegression import MLRegression from MAPRegression import MAPRegression import matplotlib.pyplot as plt import numpy as np training_dataset = DataReader.read_data('IrisTrain2014.dt') test_dataset = DataRea...
true
c288fab752d5497a8c1cfb99b7ab4569ee0f58c9
ryazantseff/mysql-querymaker
/query_maker/QueryMaker.py
UTF-8
6,451
2.765625
3
[ "MIT" ]
permissive
import logging class QueryMaker: def __init__(self, dbName, queryFn): self.dbName = dbName self.type = 'select' self.query = queryFn def newQuery(self, config=None): if config is None: return Query(self.dbName, self.query) else: return Query(...
true
c0ab47fe8cb1a88a1a23611b947753f0b91ee657
tlainevool/eatspection
/model/restaurant.py
UTF-8
729
2.96875
3
[ "MIT" ]
permissive
class Restaurant: def __init__(self, rid, name, city, state, address=None, zip_code=None, latitude=None, longitude=None): self.rid = rid self.zip_code = zip_code ...
true
8db4b007fc07f1ff3f4924ad696ad631a20435fd
mwarrenus/WatchIR
/watchIR_pebble/scripts/generate_resources_json.py
UTF-8
1,426
2.703125
3
[ "MIT" ]
permissive
from __future__ import print_function import argparse import json import os import sys def main(resources_path, dummy_resource_file_name=None): num_files_processed = 0 resources = [] for file_name in os.listdir(resources_path): file_base_name, file_extension = os.path.splitext(file_name) file_extension_w...
true
9201961f6f1d94e645b1eab703959395f708b0ee
hhlp/Web_Scraping_Projects
/2019-10-07-car_datasheet/first_scraper_version.py
UTF-8
1,919
3.15625
3
[]
no_license
import requests from bs4 import BeautifulSoup PATH = 'http://localhost:8000/auto_mpg.html' def process_car_blocks(soup): """Extract infos from repeated divisions""" car_blocks = soup.find_all('div', class_='car_block') rows = [] for cb in car_blocks: str_name = cb.find('span', class_='car_na...
true
d620c877daf22d711590c23b8c0cb16c6e636815
majidgourkani/python
/learn 2/begginer/9.py
UTF-8
178
3.5
4
[]
no_license
#lists names = ["majid" , "hamid" , "milad" , "saeed"] nums = [1 , -2 , 3.1 , 44564 , -5] print(nums) # delete an item from list print(names) del names[1] print(names)
true
a19c3cecfc0a732aeffb5d5b059dc93bba133452
dhvssigrun/Fuzztime
/payloads.py
UTF-8
946
3.34375
3
[]
no_license
import sys class Payloads: def __init__(self): self.payload_list = [] def load_from_file(self, filename_in): try: file = open(filename_in, 'r') for line in file: self.payload_list.append(line.strip()) self.check_data_exists() pri...
true
95806ee9ebaa7aeac320e37fd112634059554333
diarmuidwhelan/python_project
/dataset_initial_exploration.py
UTF-8
2,048
3.984375
4
[ "Apache-2.0" ]
permissive
################################################################################################################### #GMIT Higher Diploma in Data Analytics #Scripting and Programming #Python Project #Diarmuid Whelan, 2018-04-10 #Iris Dataset initial exploration #Will provide summary stats and plots for the Iris Dataset ...
true
dce9c4787c185d1a0f38702a1e24d699a8b0dd58
plutoclement/ser2spi
/arduino_fonctions.py
UTF-8
721
2.546875
3
[]
no_license
def ser2spi(RW,CS,ADD,DATA): ## data types to be used for this fonction ## RW=0 (int) ## CS='01011001' (srt) ## ADD=17; (int) ## DATA='01001100' (str) if RW==1: if(int(CS[0])+int(CS[1])+int(CS[2])+int(CS[0])+int(CS[0])+int(CS[0])+int(CS[0])+int(CS[0])>1): print('Can\'t do Rea...
true
388bb2a79a2f9bc71e3b909e158b261d1e1e1007
alu-rwa-dsa/week-3---dynamic-array-linda_david_calebcohort1
/testquestion2_3.py
UTF-8
1,098
3.5625
4
[]
no_license
import unittest from question2_3 import SubArray class TestSubArray(unittest.TestCase): pass # question 2(a) -- Testing can be a word def testAdd(self): data = [2, 7, 9, 10, 5] forTest = SubArray.add(data) self.assertNotEqual(forTest, 12) # question 2(b) -- Testing if the item is delet...
true
e64a6294f728d73189b6629f65dea75c31ac5fc6
m23-tech/assemblyai_twilio
/url_and_transcribe.py
UTF-8
2,926
2.9375
3
[]
no_license
# url_and_transcribe.py import os import time from os.path import join, dirname from dotenv import load_dotenv from twilio.rest import Client import requests import json # Identify the .env file in the local environment dotenv_path = join(dirname(__file__), '.env') load_dotenv(dotenv_path) # Load the d...
true
e3ec35d92454c65e23603f18cfc45b58c2a85971
KieranORawe/PythonProjects
/Raycasting/Raycast 2.0.py
UTF-8
1,560
3.578125
4
[]
no_license
from tkinter import * import math window = Tk() canvas = Canvas(window, width=500,height=500, background="white") canvas.pack() def intercept(line,wall): x1 = wall[0][0] y1 = wall[0][1] x2 = wall[1][0] y2 = wall[1][1] x3 = line[0][0] y3 = line[0][1] x4 = line[1][0] y4 ...
true
5952a7b8b402bb9d235a633908b50d6837a3ce21
waikato-datamining/wai-bynning
/src/wai/bynning/binners/_StratifyingBinner.py
UTF-8
974
3.09375
3
[ "MIT" ]
permissive
from typing import Dict from ..extraction import Extractor, IdentityExtractor from .._typing import KeyType, LabelType from ._Binner import Binner class StratifyingBinner(Binner[KeyType, LabelType]): """ Binner which cyclically stratifies items over a number of bins. """ def __init__(self, ...
true
357889b0d6ad7a1bd2a810a7787ecb0339624a77
Aasthaengg/IBMdataset
/Python_codes/p02418/s202883784.py
UTF-8
390
3.28125
3
[]
no_license
s = input() p = input() Flag = False for i in range(len(s)): if len(s)<len(p): print("No") break for j in range(len(p)): if i+j>=len(s): if s[i+j-len(s)] != p[j]:break elif s[i+j] != p[j]:break if j == len(p)-1: print("Yes") Flag = True...
true
b2d7dbfdbe400a6eb272a015b63289a6cfa9fec4
bochaozhang/leetcode
/125-valid-palindrome.py
UTF-8
528
3.921875
4
[]
no_license
# Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ import re letters = re.compile("[^a-zA-Z0-9]") s = letters.sub...
true
f27919e65a85d8fd6cd1d669d82ac97bc0b5fede
trigger/trigger
/trigger/utils/importlib.py
UTF-8
2,346
3.171875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
# -*- coding: utf-8 -*- """ Utils to import modules. Taken verbatim from ``django.utils.importlib`` in Django 1.4. """ import os import sys # Exports __all__ = ('import_module', 'import_module_from_path') # Functions def _resolve_name(name, package, level): """Return the absolute name of the module to be imp...
true
5cfbf41e0841c6e8bd8ceb51cab81ee84916d93c
jaesungryu96/jsryu_DeepLearning_from_scratch_study
/01_basic_theory_and_CNN/ch05/example/buy_apple_orange.py
UTF-8
855
3.140625
3
[]
no_license
from layer_naive import * apple = 100 orange = 150 apple_num = 2 orange_num = 3 tax = 1.1 mul_apple_layer = MulLayer() mul_orange_layer = MulLayer() add_apple_orange_layer = AddLayer() mul_tax_layer = MulLayer() # 순전파 apple_price = mul_apple_layer.forward(apple, apple_num) orange_price = mul_orange_layer.forward(or...
true
e101eded41651d90fff96f1e57eded7bab42d6d5
siddhism/leetcode
/leetcode/475.heaters.py
UTF-8
999
3.1875
3
[]
no_license
# # @lc app=leetcode id=475 lang=python # # [475] Heaters # class Solution(object): def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ import sys import bisect heaters = sorted(heaters) #...
true
160904a41e28d12474b37095bc8c75d1ace7ffb5
AlexWufan/leetcode-python
/Longest Common Prefix.py
UTF-8
522
3
3
[]
no_license
class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ lcp = '' if strs == []: return lcp for i in range(len(strs[0])): x = strs[0][i] for y in strs: if len(y)-i >...
true
ab1a7b27b85f66974b7d75b5a3be5e2312ffb481
aleibovici/datrium_natural_hazard_protection
/earthquake.py
UTF-8
978
2.71875
3
[ "Apache-2.0" ]
permissive
from earthquakes import earthquakes import re import logging import sys logger = logging.getLogger() ''' Function to retrieve earthquake list from USGS''' def get_quake(city: str, magnitude_min, period: str): try: earthquakes.connect() # Establish connectivity to USGS to avoid cached results r...
true
5463f23c461e8e8f2a204218271fa2dff6355f70
navision/BankOCRKata
/result_writer_test.py
UTF-8
1,649
3.328125
3
[]
no_license
import StringIO import unittest from account_number import AccountNumber from result_writer import ResultWriter class ResultWriterTest(unittest.TestCase): def test_good_account_number_works(self): good_account = AccountNumber([3, 4, 5, 8, 8, 2, 8, 6, 5]) self.assertTrue(good_account.is_valid()) ...
true
9342241305c30c6f526bd5ae5d51d475d8141107
HenschelLab/FreqRT
/Scripts/scrapeAlleleFreqsByPop.py
UTF-8
2,142
2.5625
3
[]
no_license
import urllib from bs4 import BeautifulSoup import pandas as pd import time import pdb from collections import defaultdict, Counter """ page wise download Beware: BeatuifulSoup uses best installedHTML parser lxml failed to parse entire table. using python's parser now """ def extractData(row): cells = row.findAll("...
true
22cea03c6850664ec6be6f62f66fa6c15f41eb8b
zshwuhan/BLSTM-for-supervised-sequence-recognition
/Code/Max_timesteps.py
UTF-8
215
2.984375
3
[]
no_license
import sys f=open(sys.argv[1],'r') m=0 i=0 for line in f: if(i==3): feature = line[8:].split() timeSteps=int(feature[2]) if(timeSteps>m): m=timeSteps i+=1 i%=5 print m
true
05abad7ec661f23049b91f8254ed16daa752ac54
afreendin/MiniProject2
/DescriptiveStatisticsFunction/DescriptiveStatisticsFunction.py
UTF-8
3,423
2.75
3
[ "MIT" ]
permissive
import sys sys.path.append('../HelperFunctions') from HelperFunctions.HelperFunctions import add from HelperFunctions.HelperFunctions import subtract from HelperFunctions.HelperFunctions import multiply from HelperFunctions.HelperFunctions import division from HelperFunctions.HelperFunctions import square from HelperFu...
true
d15a36c4cce55781d8c11a39824cf9fdb12855ea
jesseholt/AIVScan
/www/monkey_patch/models.py
UTF-8
1,068
2.578125
3
[]
no_license
from django.contrib.auth.models import User from django.core.validators import MaxLengthValidator ''' This module monkey patches the validator for usernames so that they are suitably long enough to contain email addresses. This code is per the StackOverflow discussion here: http://stackoverflow.com/questions/2610088/...
true
4ebc0c19749d1b172197bc747f2b030287fb7d03
fengjzh/zhjf
/py3/password.py
UTF-8
167
3.453125
3
[]
no_license
#coding: utf-8 ''' password ''' letter = input("Please input an English letter: ") n = 3 pwd = ord(letter) + n pwd_letter = chr(pwd) print(letter,"==>",pwd_letter)
true
d0d408a266c11413a2cb9944c46d840f7a847c56
sum-blockchain/bitcoin_key_generator
/bitcoin_custom_address_generator.py
UTF-8
391
2.890625
3
[]
no_license
from bitcoin import * # input a custom string for the private key my_priv = sha256('this is my bitcoin private address') print(f'My private key = {my_priv}') # generate the public key based on the private key we just created my_pub = privtopub(my_priv) print(f'My public key = {my_pub}') # generate the BTC address my...
true
d76dabbf0d5caa6f2f3e4ac5dcc9b8bc8dac17ec
xuyinhao/test_study
/6def_/recursion.py
UTF-8
657
4.03125
4
[]
no_license
##递归 ##1 n阶乘 # def factorial(n): # if n == 1: # return 1 # else: # return n*factorial(n-1) # # print(factorial(3)) ##2. 幂 # def power(x,n): # if n == 1: # return x # else: # return x*power(x,n-1) # print(power(3,3)) ##二分法 # def search(seqe,num,lower,u...
true
19ae03f7a11c1aa43a0b3143eaad3b530987a5d5
theabhishekmandal/Python
/datastructures/Lists/List as Queues.py
UTF-8
1,575
4.09375
4
[]
no_license
from collections import deque if __name__ == '__main__': '''Lists can also be used as queue, but they are not efficient for this purpose. While appends and pop from the end of the lists are fast but doing inserts and pop from the front is slow. It requires to shift the elements by one position. ...
true
2213b79b02613d66fc34fb83c1ece20dd1245462
StefanCsPurge/Fundamentals-of-Programming-projects
/First-projects/Andromeda Strain/controller.py
UTF-8
1,553
2.9375
3
[]
no_license
class Service: def __init__(self,repo): self.__repo = repo self.__day = 1 def getPersonsAndDay(self): return self.__repo.getAll(),self.__day def simulateNewDay(self): """ Function that simulates a new day. No parameters, has effect on repo and updates the r...
true
c7245bfc7cb6e91d0d61d3c54147ada6b8a4baf3
Gunnthorian/TechGarage-robotcode
/one_axis_to_one_motor.py
UTF-8
1,788
3.296875
3
[]
no_license
# import the proper libraries import pygame import Adafruit_PCA9685 # setup the pi hat pwm = Adafruit_PCA9685.PCA9685() pwm.set_pwm_freq(60) # setup pygame to work with joystick pygame.init() clock = pygame.time.Clock() pygame.joystick.init() # get the number of joysticks joystick_count = pygame.joystick.get_count()...
true
6ebaa6526fbf8200922871b33a9760ccf2f3e614
zpeterg/bmig_5003_parse_words_distance_to_db
/utils.py
UTF-8
2,091
3.234375
3
[ "MIT" ]
permissive
from getFile import getFile class dealArgs: # A class that filters, validates, and returns arguments def __init__(self, args): self.start = '' self.stop = '' self.finish = '' self.clear = False for a in args: a = a.split('=') if a[0] == '--input'...
true
cd7633330199345dce364f9cb1530508bc4068ac
skhutan/codility
/codility-demo-equil-index.py
UTF-8
258
3.015625
3
[]
no_license
def solution(A): length = len(A) sum_a = sum(A) leftsum = 0 i = 0 while( i < length): value = A[i] if leftsum == sum_a - value: return i leftsum += value sum_a -= value i += 1 return -1 solution([-7, 1, 5, 2, -4, 3, 0])
true
7bde7047c29fb8b978497410420f21462fb6515b
GIP2000/Pong-AI
/game.py
UTF-8
5,302
2.890625
3
[]
no_license
import pygame from pygame.locals import * import os import math import random from QLeanring import QLearningHandler as QL SIZE = SCREEN_WIDTH,SCREEN_HEIGHT = 1000,1000 class Paddle: WIDTH = 10 HEIGHT = 50 IMG = pygame.image.load(os.path.join("resources/images","Paddle.png")) def __init__(self,is_p...
true
c4dd3cca5ef041456367d21306db88dd4279c70f
646981700/autotest1
/new_1119/test01.py
UTF-8
293
3.390625
3
[]
no_license
# # a=120 # b=100 # for i in range(1,b+1): # if a/b==11: # print(f'{i}年前,父亲{a}岁,儿子{b}岁') # a -= 1 # b -= 1 # if a==0 or b==0: # break my_dict = {'语文':89,'数学':100,'英语':9} q = [x if x%3==0 else x for x in range(1,101)] print(q)
true
d5350f01a80320d5d7f404672c88636d4a74bdea
psaikko/AdventOfCode2020
/7/run.py
UTF-8
641
2.640625
3
[]
no_license
lines = [line.strip() for line in open("input", "r")] adj = dict() for line in lines: s = line.split("contain") src = s[0].split("bag")[0].strip() if "other" in s[1]: adj[src] = [] continue dst = [x.split("bag")[0].strip() for x in s[1].split(",")] dst_names = [" ".join(s.split()...
true
bd90ae74b89245a6ec53165f16d2b0389867fb0a
jongtix/Python_Baekjoon
/단계별로 풀어보기/분할 정복/2261_가장 가까운 두 점.py
UTF-8
1,013
3.953125
4
[]
no_license
# 가장 가까운 두 점을 구하는 문제. 잘 알려진 문제지만 상당히 어렵기 때문에 검색을 추천드립니다. # 문제 # 2차원 평면상에 n개의 점이 주어졌을 때, 이 점들 중 가장 가까운 두 점을 구하는 프로그램을 작성하시오. # # 입력 # 첫째 줄에 자연수 n(2 ≤ n ≤ 100,000)이 주어진다. 다음 n개의 줄에는 차례로 각 점의 x, y좌표가 주어진다. 각각의 좌표는 절댓값이 10,000을 넘지 않는 정수이다. 같은 점이 여러 번 주어질 수도 있다. # # 출력 # 첫째 줄에 가장 가까운 두 점의 거리의 제곱을 출력한다. # # 예제 입력 1 # 4 # 0 0...
true
ac0d27d134c4360f9ed7ccaea8a1181afb9cd014
ithangarajan/HackerRank
/HackerRank in a String.py
UTF-8
549
3.328125
3
[]
no_license
#!/bin/python3 import sys def hackerrankInString(s): check = "hackerrank" counter=0 result="" for x in range(0,len(s)): if (check[counter] == s[x]): result = result + s[x] counter = counter+1 if counter > (len(check)-1): break if result =...
true
1d826a70aeea983bf23bb46ff5fc87afebf48a8d
mondon11/leetcode
/0002addTwoNumbers.py
UTF-8
2,082
3.515625
4
[]
no_license
# coding = utf-8 # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ ...
true
8e13298bc055d56a5ea3b8687aa8ca4a947cb7d7
subhandp/python-async
/_03_get_spesific_data.py
UTF-8
295
2.609375
3
[]
no_license
import requests,json req = requests.get('https://res.cloudinary.com/sivadass/raw/upload/v1535817394/json/products.json') products = req.json() output_dict = [product for product in products if product['category'] == 'fruits'] output_json = json.dumps(output_dict,indent=4) print(output_json)
true