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
d4191d7a0d5c6604638103619eb6a9897137368c
Artinto/Python_and_AI_Study
/Week02/Main_HW/Eye_and_Identity/Eye_and_Identity_LGY.py
UTF-8
143
2.6875
3
[]
no_license
import numpy as np np.set_printoptions(sign=' ') # print시 항상 space 출력하기 N , M = map(int, input().split()) print(np.eye(N, M))
true
cf0017a089a193f4e550e8f3585270928439164d
synara/mapreduce
/exercicio/mrmovies3.py
UTF-8
1,165
2.90625
3
[]
no_license
from mrjob.job import MRJob from mrjob.step import MRStep import re WORD_RE = re.compile(r"[\w']+") class MrMovies(MRJob): top10 = [] def mapper_movies(self, _, line): user_id, movie_id, rating, timestamp = WORD_RE.findall(line) yield movie_id, 1 def mapper_get_top10(self, key, valu...
true
fec84fc4265e517a7ae5c8de7d0384c14b84e83b
LucasMorettoSilva/persistent-ds
/test/ds/test_bst_tp.py
UTF-8
7,194
3.25
3
[]
no_license
import random import unittest from src.ds.bst_tp import BSTTP class TestBSTTP(unittest.TestCase): def test_constructor_shouldCreateEmptyBSTWithOnlyTrivialVersion(self): bst = BSTTP() self.assertEqual(0, bst.size()) for i in range(1, 20): with self.assertRaises(ValueError): ...
true
2a95f8a8c6ea338d07622ee9f3b5a5039eec0deb
gitanz/gcloud_python_app
/models/TaskboardMemberModel.py
UTF-8
4,053
2.890625
3
[]
no_license
from google.appengine.ext import ndb from models.AppUserModel import AppUserMethods, AppUser from models.TaskboardModel import Taskboard """ TaskboardMember association table This table contains associaion within taskboard and User key Each association/record implies that user is member of the taskboard ...
true
8b5cb4e7e673239f1b3da5d3769629f220e99338
SabNK/client_1c_timesheet
/client_1c_timesheet/models.py
UTF-8
19,305
3.46875
3
[ "MIT" ]
permissive
""" Models the objects with which the 1C API works. Models as simply as possible, omitting any fields not used by this package TODO complete class and methods documentation """ from typing import Type, List from abc import ABC, abstractmethod from datetime import datetime, date import dateutil import dateutil.parser ...
true
f884a9cee0b79e97a4ea310545cbb129cd535cb4
daniel-reich/ubiquitous-fiesta
/i3eLgCmDEPdBWPkrT_17.py
UTF-8
173
3.125
3
[]
no_license
def limit_number(num, range_low, range_high): if range_low < num < range_high: return num elif num < range_low: return range_low else: return range_high
true
623105ac3b059fa5d28d3c7352bee3226239daca
Infinity2013/ux-script
/contact_generator.py
UTF-8
768
2.859375
3
[]
no_license
import os import subprocess import random class VCF: def __init__(self, name, number): self.name = name self.number = number def __str__(self): return "BEGIN:VCARD\nVERSION:2.1\nN:;%s\nFN:WXL\nTEL;CELL:%s\nEND:VCARD\n" % (self.name, self.number) alpha = ['a','b','c','d','e','f','g','h...
true
0eae5c7f829aa2f19b8dc1dd9d77c4dff3211489
niemmi/algolib
/tests/segment_tree/test_lazy_segment_tree_flex.py
UTF-8
2,829
2.859375
3
[ "BSD-3-Clause" ]
permissive
import unittest from .context import lazy_segment_tree_flex from operator import mul def update_min_max(value, diff, _count): return value + diff class TestSegmentTree(unittest.TestCase): def test_sum(self): nums = [1, 2, 3, 4, 5] tree = lazy_segment_tree_flex.SegmentTree(nums) for i...
true
349ddc9b37e2d3e0621d498ced5be36e18a2ab05
Prithvi-Shah/Ogma
/Exploration.py
UTF-8
1,738
2.84375
3
[]
no_license
from nltk import CFG, Nonterminal, grammar, corpus from nltk.parse.generate import generate from random import choice def produce(gr, symbol): words = [] productions = gr.productions(lhs = symbol) production = choice(productions) for sym in production.rhs(): if not type(sym) == Nonterminal: ...
true
b63c3d974954db720ed521c29972a44f8c000475
pankaj1181998/video_filter
/python_learning/matplotlib_learning1.py
UTF-8
1,362
3.390625
3
[]
no_license
''' - Matplotlib ''' import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ''' Using fig = plt.figure() it is like manual method We have to set_axes , choose location ,size Then plot ''' ''' Second method is for subplots based on rows and columns . Plot using row and columns . Using we get array ...
true
4b3520a62c87b1feb139931c5c6d758e13ac72f9
pablodiegoss/pytaon
/pytaon/__init__.py
UTF-8
1,733
3.03125
3
[ "MIT" ]
permissive
""" Physics module for the Pyxel engine. """ __version__ = "0.0.2b" import pyxel as _pyxel from .body import Body from .circle import Circle from .aabb import AABB from .segment import Segment from .poly import Poly from .space import Space from .collision import Collision from .vec2d import Vec2d, VecLike, asvec2d fr...
true
aee039aed30199a624eda9723be89ba78eedfc36
Tanish970/Leet-code-Python
/009.Palindrome Number.py
UTF-8
332
3.21875
3
[]
no_license
class Solution: def isPalindrome(self, x: int) -> bool: x=str(x) if(x==x[::-1]): return True return False #Runtime: 56 ms, faster than 76.29% of Python3 online submissions for Palindrome Number. #Memory Usage: 13.8 MB, less than 6.50% of Python3 online submissions for Palindr...
true
530b71dcd13baa3cb51a2ca16d547833a04a142b
SerAguilarV/Robot-movil-con-algoritmo-RL
/p1.py
UTF-8
1,110
3.078125
3
[]
no_license
import cv2 import numpy as np A = [5,2,5,7] CA = 5 CS = 10 CX = 90 CY = 150 Mov = "Izquierda" def CrearImagen(y, x, frame): x = abs(int(x)) y = abs(int(y)) Ima = np.zeros((y,300,3), np.uint8) hcat = cv2.hconcat((frame, Ima)) font = cv2.FONT_HERSHEY_SIMPLEX ...
true
ac32f5ce16221fbb889976d874450e6214bdfbc8
KFranciszek/pylove-training
/1.2/Excersise_2_1.py
UTF-8
380
3.296875
3
[]
no_license
file = open("py1.2") data = file.readlines() file.close() persons = {} for i, person in enumerate(data): data[i] = person[(person.find(". ") + 2):] data[i] = data[i].split(" has ") data[i][1] = data[i][1].split(" and is ") data[i][1][1] = data[i][1][1].split(" cm tall") persons[data[i][0]] = {"heigh...
true
324a87277c83d5c9d1149e24da1abb4d26c2149d
pangyuteng/closed-contour-segmentation-using-graph-theory
/ccs.py
UTF-8
7,803
2.734375
3
[ "MIT" ]
permissive
import os import math import numpy as np from scipy import spatial import matplotlib.pyplot as plt from scipy.spatial import Delaunay import networkx as nx from networkx.algorithms.shortest_paths.generic import shortest_path def in_hull(p, hull): """ Test if points in `p` are in `hull` `p` should be a `...
true
5d4e2c9ff7e8d2381bfb9479dcf4b9a3acc92b70
ZhouningMan/LeetCodePython
/search/LongestContinuousIncreasingSubsequenceII.py
UTF-8
2,570
3.5625
4
[]
no_license
import collections DIRECTIONS = [(-1, 0), (1, 0), (0, 1), (0, -1)] class Solution: """ @param matrix: A 2D-array of integers @return: an integer """ def longestContinuousIncreasingSubsequence2(self, matrix): if not matrix or not matrix[0]: return 0 m = len(matrix) ...
true
d7d05c2ee02cf1f6119e055f0a8eaa4469441101
sneha0103/GitPython
/WriteFile.py
UTF-8
287
3.140625
3
[]
no_license
#read the file and store all the lines in lisy #Reverse the list #write it back to the file with open('test.txt','r') as Reader: content= Reader.readlines() reversed(content) with open('test.txt','w') as Writer: for line in reversed(content): Writer.write(line)
true
cc1544ac72ecb25b9ee52f9b4bfd152233955cbd
enokule/alien_invasion
/alien_invasion/background.py
UTF-8
655
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Mar 14 11:54:49 2019 @author: U197327 """ import pygame class Background(): def __init__(self, ai_settings, screen): """Initialize the background and set the starting position.""" self.screen = screen self.ai_settings = ai_settings ...
true
cc45df120a16fb41c558b454bfadbae371675a8e
mb1069/PSEC_Assessment
/mainold.py
UTF-8
7,048
3.390625
3
[]
no_license
import argparse as ap import random dictionary_filename = "data/500-worst-passwords-processed.txt" password_frequency_filename = "data/rockyou-withcount-processed.txt" results_file = "data.csv" # Method to pick a key from a dictionary based on the frequency of the key # (frequency of a key is the key's value in the...
true
1c524e599c857adc3feced7af0b7a25ccf7be2cd
huangsen365/boto3-docker
/test_print_json.py
UTF-8
192
3.171875
3
[ "Apache-2.0" ]
permissive
import json your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]' parsed = json.loads(your_json) print(type(your_json)) print(type(parsed)) #print(json.dumps(parsed, indent=4, sort_keys=True))
true
a035dcabeebe45ec8d3c06c93f58d1a20fb96c79
tomekmatuszewski/Simple-complex-number-calculator
/tests/test_controller.py
UTF-8
4,199
2.734375
3
[]
no_license
from calculator.controller import Controller import json import pytest @pytest.fixture(name="controller") def create_controller(): controller = Controller() controller.path = "result_test.json" return controller def test_load_results(controller): controller.results = None assert type(controller.l...
true
7152ffe550c026497f6b1cac02d6c35c4d955c89
wangfuli217/ld_note
/cheatsheet/编程笔记/07.Python/1.基础/f2.0.数据结构.py
UTF-8
11,254
4.0625
4
[]
no_license
序列:迭代,切片,排序和拼接 Python的内建序列, 如果按类型分,可分为: 容器型序列(Container Sequence): list, tuple 和 collections.deque. 元素可以是不同类型 扁平序列(Flat Sequence): str, bytes, bytearray, memoryview 和 array.array, 只能存储基本类型 容器型序列存放的是它们所包含的任意类型的对象的引用。 扁平序列里面存放的是值而不是引用。一段连续的内存空间,更加紧凑。 如果按是否可变, 可分为: 可变序列: list, bytearray, array.ar...
true
d3a48e4b5d3379ac018dcf6d10c7d1c8681aceb5
pinstinct/naver-webtoon-crawler
/crawl.py
UTF-8
2,167
2.765625
3
[]
no_license
import requests import parser WEBTOON_ID = 651673 # soup = get_soup_from_naver_webtoon_by_page('690502') # episode_list = get_episode_list_from_page(soup) # print(episode_list) # r = parser.get_webtoon_recent_episode_number(WEBTOON_ID) # print(r) # parser.get_webtoon_episode_list(WEBTOON_ID) # result = parser.ge...
true
f3bfab0a0d257fd498057b6cbe5d9fe6cbbc7fe8
hakusama1024/Leetcode
/flower.py
UTF-8
449
3.109375
3
[]
no_license
def test(arr): size = len(arr) if size == 0 : return False if size == 1 : return 1 - arr[0] count = 0 for i in range(size): if arr[i] == 0: if (i == 0 and arr[i+1] == 0) or (i == size-1 and arr[i-1] == 0) or (arr[i-1] == 0 and arr[i+1] == 0): arr[i] = 1 ...
true
42e22af687ff5474b0fad8399c922657cabc5e1a
j-mhu/the_blend_and_snap
/quiz_blending.py
UTF-8
2,316
3.15625
3
[]
no_license
# Quiz Blending using Linear Regression and given slides # to optimize alphas (linear coefficients) for quiz import numpy as np import math from numpy.linalg import inv def get_data(): ''' Loads prediction data from desired models for blending. Returns matrix A = [A_0, A_1, A_2, ...A_M-1] where A_i is th...
true
15e7b8215540e511732074752aff7a9cbb660b56
Devanrio/myschoolproject
/URI/1011.py
UTF-8
86
2.609375
3
[]
no_license
R = int(input()) n = 3.14159 VOLUME = (4/3.0)*n*(R**3) print("VOLUME = %.3f" % VOLUME)
true
46445958a4626fd6bd85448cf6c99deaaefddd35
jorivero83/pipeline-oriented-analytics
/src/pipeline_oriented_analytics/transformer/count.py
UTF-8
561
2.828125
3
[ "MIT" ]
permissive
import pyspark.sql.functions as f from pyspark.sql import DataFrame from pyspark.ml import Transformer from typing import List class Count(Transformer): """Groups rows by given columns and adds group sizes in a new column.""" def __init__(self, group_by_cols: List[str], output_col: str): super(Count,...
true
e54e564522a916947ad15ac3f33984e335bda207
Rui000/-
/week-data.py
UTF-8
4,665
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- from pandas import read_csv from pandas import to_datetime import pandas as pd import sys reload(sys) sys.setdefaultencoding('utf8') def Week(database): origin = read_csv(database, encoding='gbk', low_memory=False) origin.sort_values(u"销售日期").head() origin[u'销售日期'] = pd.to_datetim...
true
c9e8f2d80fc3e2946c6f2afe1fc28e5a2db83b54
lyplcr/jlink
/ledCheck/testLed.py
UTF-8
1,432
2.515625
3
[]
no_license
from SimpleCV import * import time from ledDb import * from ledCalc import * try: cam = Camera() except: cam = Camera(1) display = Display() result = True db = ledDb() led_table = db.selectAllLed() for i in range(0,30): img = cam.getImage() for row in led_table: name = row[1] ...
true
39870b86d0d19db3c0a71776137dbf6a34e091aa
rudgks8092/Book
/CodingTest_with_Python/Chapter6_Sort/6-10(Practice).py
UTF-8
669
3.890625
4
[]
no_license
''' Problem : 위에서 아래로 수열의 내림차순 입력 조건 : 첫째 줄에 수열에 속해 있는 수의 개수 N (1~500) 둘째 줄부터 N+1번째 줄까지 N개의 수(1~100,000 자연수) 출력 조건 : 입력으로 주어진 수열이 내림차순으로 정렬된 결과를 공백으로 구분하여 출력 입력 예시 : 3 15 27 12 출력 예시 : 27 15 12 ''' # 기본 정렬 라이브러리 이용 n = int(inp...
true
cd5a69c9eb15df20622267f138a38450a37c1405
solinari27/test
/111/lixi.py
UTF-8
994
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- # @Author : Solinari # @Email : # @File : lixi.py # @Software: PyCharm # @Time : 2019/04/12 def cal(): total = 0 bank = 0.041 ben = 280 year = 20 li = 0.07 # inc = 1 inc = 1.04 kongzhi = 0.8 consume = 10 for i in range(0, year): total ...
true
07808245585e4ed2ecafb56582a6a5edc3766930
remowxdx/AoC-2019
/aoc.py
UTF-8
3,377
3.15625
3
[]
no_license
#!/usr/bin/env python3 import os.path class Debug(): def __init__(self, enable=True): self.enabled = enable def enable(self, enabled = True): self.enabled = enabled def disaable(self, disabled = True): self.enabled = disabled def __call__(self, *args, **kwargs): if s...
true
34d694fa9a649b249e62ab109de52818a7ab8260
DiegoDiBelardino/Local_Server
/main_host.py
UTF-8
488
2.84375
3
[]
no_license
import socket import connections.host as host #HOSTONE user_name = input("INSERISCI IL TUO USERNAME: ") #inizializzazione e connessione sock = socket.socket() port = 30000 #setup connessione print("SETUP CONNESSIONE") conn,addr = host.hosting(sock) #porta default = 30000 print("CONNESSIONE RIUSCITA") host.downlo...
true
2bf63722e634989fba0fc8048fa5831189ba9cb5
leekaka/Test_Travis
/get_weather_info.py
UTF-8
1,798
3.015625
3
[]
no_license
# !/usr/bin/env/ python # coding=utf-8 import requests import json from common import * # 聚合数据天气预报 api WEATHER_API = "http://t.weather.sojson.com/api/weather/city/{}" HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36" "(KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" }...
true
5c8ce54a695bc87fa2e214eed81bea061134739e
christianns/Curso-Python
/04_Coleccion_de_datos/06_Pilas.py
UTF-8
1,090
4.71875
5
[]
no_license
''' Pilas Son colecciones de elementos ordenados que únicamente permiten dos acciones: - Añadir un elemento a la pila. - Sacar un elemento de la pila. La peculiaridad es que el último elemento en entrar es el primero en salir. En inglés se conocen como estructuras LIFO (Last In First Out). Las podemos crear c...
true
5c8cdc6b1cdfc58bcecbe7a0f1b144aad66cb9e2
CrashedBboy/ILE5062_Computer_Vision
/hw2_frequency_and_filter/tiff_to_jpg.py
UTF-8
748
3
3
[]
no_license
import glob from PIL import Image DIR = './data/task3_colorizing' file_list = glob.glob(DIR + '/*') for file in file_list: ext = file.split('.')[-1] ext_lower = ext.lower() if ext_lower == 'tif' or ext_lower == 'tiff': try: img = Image.open(file) img.mode = 'I' # signed ...
true
57fa657255cdbdf55558a65964ddbf58af678cbc
Maciel-Dev/ExerciciosProg2
/Exercicio4.py
UTF-8
582
3.75
4
[]
no_license
def main(): lista = [] for i in range(5): #Possibilidade de definição do usuário inputUser = input("Digite um carcter ou numero: ") lista.append(inputUser) resUser = input("Digite o caracter a ser buscado: ") while resUser != "/": ocNum = 0 for element in lista: ...
true
d19e35881b55355b1e480ff1d8b47a0a433e5f4b
jagjitsjsu/epibook.github.io
/solutions/python/binary_tree_level_order.py
UTF-8
1,590
3.5625
4
[]
no_license
# Binary_tree_level_order.cc 4de4eafe35c9113838acae26df7caa75aab3c8eb import collections from binary_tree_prototype import BinaryTreeNode # @include def print_binary_tree_depth_order(tree): processing_nodes = collections.deque() processing_nodes.append(tree) num_nodes_current_level = len(processing_nodes)...
true
acaaeb5b8ef056f69587294d7c56a012b8567e74
Jmiller4/MusicalAuthorship
/main.py
UTF-8
8,912
2.9375
3
[]
no_license
import music21 import NGramModel import convert import piece import os import NGLearner import math def predict(piece, learners, n, chord_FB_split): bestMatch = "" bestProb = -99999999 totalChordGrams = 0 totalBassGrams = 0 for learner in learners.keys(): totalChordGrams += learners[learner].getChords().total_...
true
4e4240329d1192f91b8862b35fa5bb4f5ea2c19a
heuristicwave/TrainingGround
/acmicpc/DP/12865_평범한 배낭.py
UTF-8
717
3.125
3
[]
no_license
# O(NK), 냅색알고리즘 # 모든 무게에 대하여 최대 가치 저장! n, k = map(int, input().split()) dp = [[0] * (k+1) for _ in range(n+1)] for i in range(1, n+1): w, v = map(int, input().split()) for j in range(1, k+1): # dp 1부터 k까지 차례로 갱신, i(행)만큼 if j < w: dp[i][j] = dp[i-1][j] # 위에서 그대로 값 내림 else: ...
true
a3fa0e1dea6b098bf4417d1abd8c62969b879071
finish331/NBS
/Machine Learning/ExpectRank.py
UTF-8
5,260
3.015625
3
[]
no_license
import json import pandas as pd #計算球員屬性,回傳為一個List,順序會依照featureList def ComputePlayerFeature(playerData,seasonIndex): playerFeature = [] for feature in featureList: #當float轉型失敗時,會透過except接住,並將其值設為0,以利計算屬性時不將其納入計算 try: #判斷NaN if playerData[feature][seasonIndex] != playerDa...
true
696e42c3ff86cad76ec1691ce9e4928d354f2875
mthezeng/euler-solutions
/p012.py
UTF-8
952
3.828125
4
[]
no_license
import numpy as np from sys import stdout def print_backspace(n, prev): digits = len(str(prev)) delete = "\b" * (digits) print('{0}{1}'.format(delete,n), end="") stdout.flush() def triangle_number(): #returns the first triangle number to have over 500 divisors triangle_num = 1 five_hundred...
true
a89271ab76a58823f39b1557ac79901166873d99
tarasikwolski/test_python_repo
/oop_training_figures_11_13/figure.py
UTF-8
128
2.515625
3
[]
no_license
from abc import ABC, abstractmethod class Figure(ABC): @abstractmethod def get_area(self) -> float: return 0.0
true
f1dd97860a9d47971c10e525ecd0aeee5e370198
JoshRak/JoshJackManan_VideoGame
/data/chest.py
UTF-8
6,273
2.921875
3
[]
no_license
import pygame from PIL import Image, ImageOps import itertools # from interactiveObject import InteractiveObject class Chest(): def __init__(self, name, contents, contentAmount, chestType, x, y): #initalize Chest with the name of the item, its contents and amounts, whether its computer or tool, and its x and y ...
true
c8ffdd02162f75102e76f6b71d0a5b520c11be6c
acbarnett/advent-of-code-2020
/01/1b.py
UTF-8
402
3.28125
3
[]
no_license
with open("input-a.txt", "r") as f: all_entries = [int(line.rstrip()) for line in f] for i in range(0, len(all_entries)): for j in range(i+1, len(all_entries)): if all_entries[i] + all_entries[j] > 2019: continue for k in range(j+1, len(all_entries)): if all_entries[i] + all_entries[j] + all_en...
true
20403d2e408f22da688f9ed2a2c7e05196ff39bf
qchrisd/PiwerManager
/monitor.py
UTF-8
2,205
3.203125
3
[]
no_license
# # This program watches the status of the PowerBoost 1000C providing power to the Raspberry Pi. # # The main loop watches for a falling edge on the USB pin indicating the device has been unplugged. # The designated person is notified via email when the falling edge is detected. An email will be # sent to the designate...
true
d684315a09ff83a384d938e15bf879a545b2372f
pankaj0812/tesseract
/test_tesseract.py
UTF-8
6,225
2.703125
3
[]
no_license
import pytest from api import API from middleware import Middleware FILE_DIR = "css" FILE_NAME = "main.css" FILE_CONTENTS = "body {background-color: red}" # helpers def _create_static(static_dir): asset = static_dir.mkdir(FILE_DIR).join(FILE_NAME) asset.write(FILE_CONTENTS) return asset def test_basic_...
true
c4d89a8871bd31b38a0e4b3ca00662d09601300f
sanjkm/Quincy
/DBUpdates/fill_query_list.py
UTF-8
774
3.09375
3
[]
no_license
# fill_query_list.py # Lists the query conditions for all queries to be executed # 2/15/2018 # Queries to generate record deletion # Opens the inputted file which contains full query parameters on each line # The specifics of each query are collated, put into a dictionary, and each # dictionary is appended to query_li...
true
9f5026bf7d0b12248482885e3caa36bca4857694
kkrath/Trade-API
/app/models.py
UTF-8
722
2.703125
3
[]
no_license
# create models here import json class Trade: def __init__(self, id, type, user_id, symbol, shares, price, timestamp): self.id = id self.type = type self.user_id = user_id self.symbol = symbol self.shares = shares self.price = price self.timestamp =...
true
d31f18131c757f3c2cee3a0854aa5cc499c2434f
bpbirch/AnagramDetection
/src.py
UTF-8
6,059
4.03125
4
[]
no_license
#%% # some anagram detection stuff # %% import time import matplotlib.pyplot as plt import matplotlib import numpy as np import pandas as pd import math from itertools import permutations import pickle # %% # let's write some different algos for anagram detection # anagram: checkoff def checkOff(s1, s2): """ ...
true
30870f1c3512059fff58e220aa50a917e712991e
johnnyleitrim/python-mutation-testing-demo
/tests/test_simplenumber_incrementer.py
UTF-8
984
3.234375
3
[]
no_license
from simplenumber import SimpleNumber from unittest import TestCase from unittest.mock import Mock class Object(object): pass class TestSimpleNumberIncrememter(TestCase): def test_no_incrementer(self): number = SimpleNumber(1) same_number = number.increment(None) # Uncomment this lin...
true
c91334c699ba66820dfb877297b0bd54120af0bd
ykawamura96/sound_classification
/scripts/create_dataset.py
UTF-8
4,904
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # create dataset for training with chainer. # some data augmentation is executed for training data (not for test data) # directory composition # original_spectrogram - classA -- 001.png # | |- 002.png # | |- ... # ...
true
7677d5a5ac3f508d696e9847fcc907499e03609c
JamiuAfolabi/Diorep
/arrplot.py
UTF-8
336
3.03125
3
[]
no_license
import matplotlib.pyplot as plt def plotSignal(signal,name_signal=""): """ PARAMETERS ----------- signal: Audio Signal name_signal: Name of the Audio Signal """ plt.figure(figsize=(10,10)) plt.plot(signal) plt.xlabel('Samples') plt.ylabel('Amplitude') plt.title(f'PLOT OF {nam...
true
8942867aa578c479f06a8909f7d3ce6efbd0fda2
xfsala/Cool-ideas-python
/Standard_code_samples/FLAMES-josephus-problem.py
UTF-8
1,109
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 29 20:29:05 2019 @author: RUDRAJIT """ p1=list(input("Enter person 1 name:").lower()) p2=list(input("Enter person 2 name:").lower()) def remove_match(l1,l2): for i in range(len(l1)): for j in range(len(l2)): if l1[i]==l2[j]: ...
true
70f67dc5805cda9b8aeb91a335c84e188de1b937
Dinoryong/algo-dinner
/SEASON_3/Longest Common Prefix/Longest Common Prefix.py
UTF-8
485
3.03125
3
[]
no_license
""" [topics] string [sketch] """ # class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if len(strs) == 0: return("") if len(strs) == 1: return(strs[0]) pref = strs[0] len_p = len(pref) for s in strs[1:]: while pref != ...
true
1e0eeddf9e61d500a9d2b1131e6c26874a2a4c9c
diegofneves/ALGO_REDES_2016_2_LISTA4
/Questao 2.py
UTF-8
645
3.703125
4
[]
no_license
matriz = [[-7,-3],[4,8],[-1,-6]] cont_negativos = 0 soma_positivos = 0 cont_impares = 0 cont_pares = 0 for linhas in matriz: for numero in linhas: if numero < 0: cont_negativos = cont_negativos + 1 else: soma_positivos = soma_positivos + numero if n...
true
f1ec60532f05f0a900ce47919b31a98be1fb3e76
CrowbarKZ/chicho_invoice
/just_pdf_from_html.py
UTF-8
465
2.765625
3
[]
no_license
import os import pdfkit def main(): input_folder = 'html_output' output_folder = 'output' for filename in ('latest_en.html', 'latest_bg.html'): with open(os.path.join(input_folder, filename)) as f: html = f.read() pdfkit.from_string(html, os.path.join(output_folder, filen...
true
9e08d48e398e978a5a6f75980c7556630df5c9cb
georsara1/Various_projects
/UCI Credit Default/NN3.py
UTF-8
5,183
2.796875
3
[]
no_license
#Import modules import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers import Activation, Dense, Dropout from keras import optimizers, regularizers from sklearn.metrics impor...
true
4cf42a874fbcea41b52d465ead3dad01de5e5425
KiD21606/HackerRank
/python/Collections/collections.Counter().py
UTF-8
254
3.296875
3
[]
no_license
from collections import Counter input() shoes = Counter(map(int,input().split())) income = 0 for _ in range(int(input())): size, price = map(int,input().split()) if shoes[size] > 0: shoes[size] -= 1 income += price print(income)
true
ff9f055f0e3776a6aa52d26f458441d4dd8689e4
andreif/slackme
/slackme.py
UTF-8
2,910
2.59375
3
[]
no_license
#!/usr/bin/env python import argparse import json import logging import os import subprocess import sys PY3 = sys.version_info[0] == 3 if PY3: from urllib.request import Request, urlopen else: from urllib2 import urlopen, Request __version__ = '1.0.0' __log__ = logging.getLogger('slackme') def slack_notify...
true
de2efe412241d8482ad76943d8b58b2d77ddc58d
ankitkparashar/python
/ABTWithPython/3Functions/zigzag.py
UTF-8
581
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Oct 2 20:00:08 2020 @author: Ankit Parashar """ import time, sys indent = 0 indentIncreasing = True try: while True: print(' '*indent, end = '') print('********') time.sleep(0.1) if indentIncreasing: indent = indent...
true
705554412cd1489e0f6efdabac10c024bb368194
LucasWang2001/PenguRun
/FSE.py
UTF-8
42,146
3.015625
3
[]
no_license
#This game is meant to be a rage game, a game that induces anger in the player by being purposefully unfair or extremely difficult. There are no checkpoints, and the game is #almost impossible to complete (it has been done). Enjoy :) from random import * from tkinter import * from math import * from pprint impo...
true
41a1d8f9474c829dab2dbfad44b90460facc653f
e2tovar/instabot
/instabot.py
UTF-8
7,882
2.828125
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import re import random class Botsito(): """This class creates a bot for istagram """ def __init__(self, user, password): """Init method of the class Arguments: user {string} -- [your...
true
1af74b127ed913f987a345693b19d75b07cce24e
liuguoyou/deblur-devil
/utils/moving_averages.py
UTF-8
1,058
3.578125
4
[ "Apache-2.0", "BSD-3-Clause", "ISC", "MIT", "Python-2.0" ]
permissive
# Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de> class MovingAverage: postfix = "avg" def __init__(self): self.sum = 0.0 self.count = 0 def add_value(self, sigma, addcount=1): self.sum += sigma self.count += addcount def add_average(self, avg, addcount): ...
true
4efcda32ca0653669ef7dea4569d189354840d10
prashyboby/my-first-repo
/session_10.py
UTF-8
1,111
3.109375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 13 14:22:46 2020 @author: prasanthchakka """ import csv import json #%% # reading files with open("output.csv") as f: reader = csv.reader(f) for line in reader: print(line[0]) #%% lines = [["asdf","hell...
true
aaccbc3a282730bc131ff5418692892b28b616af
rajasekar-vel/python
/cowsNbulls.py
UTF-8
1,771
3.875
4
[]
no_license
import random def getInput(): "Collects a 4 digit number from the User" while True: try: num = int(raw_input("Enter a 4 digit number : ")) if num < 1000 or num > 9999: print "Please enter a 4 digit number" else: return num break except: print "Please enter a number" def ga...
true
b77237f49efc9baa4be7510e0e6354dc17e34230
AnuragAnalog/stats-nlp
/preliminaries.py
UTF-8
4,288
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import warnings import numpy as np import pandas as pd from matplotlib import pyplot as plt from collections import defaultdict, Counter, deque warnings.filterwarnings("ignore") # File paths data_path = './raw_data.txt' def default_count(): return 0 def make_zipf_plot(zipf): plt.title(r...
true
6e88cc76f25302cbfef43d9e4e5c7a3287d912bf
jtcrank/aoc
/2021/4/4_2.py
UTF-8
2,242
3.765625
4
[]
no_license
from itertools import groupby #################### # Bingo Card Class # #################### class BingoCard(object): def __init__(self, card_data): self.grid = [ [int(col) for col in row.split()] for row in card_data ] self.is_winner = False self.score = 0 # stamp the card if it has n...
true
0a145c1237c13afa4d9a30eba129d65fcac28435
jakesig/summertech2017
/Classes/restaurant.py
UTF-8
1,246
3.375
3
[]
no_license
''' Created on Aug 11, 2017 @author: coditum ''' class restaurant(object): def __init__(self,takingOrder,deliveringOrder,chefstatus,customers,mngr,isOpen):#Is or isnt self.takingOrder=takingOrder self.deliveringOrder=deliveringOrder self.chefstatus=chefstatus self.customers=customer...
true
6d8247693dcf6c71b343c86ba0dc6f89b7b0ddeb
Deadman1/RTLadder
/RTLadder/clot.py
UTF-8
10,384
2.578125
3
[]
no_license
from games import createGame from main import flatten import ConfigParser import logging import random import os.path from datetime import datetime from TrueSkill.trueskill import Rating, rate_1vs1 import operator #The template ID defines the settings used when the game is created. You can create your own templat...
true
8d686f8535fcf8cf15eff3322f511892a0878308
simple-framework/simple_grid_yaml_compiler
/simple_grid_yaml_compiler/compiler/lexemes.py
UTF-8
2,233
2.875
3
[ "Apache-2.0" ]
permissive
import re from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedSeq, CommentedMap def get_repo_list(site_level_configuration_file): all_urls = [] find_revision = False pending_url = None revision_line = None for line in site_level_configuration_file.readlines(): if find_rev...
true
35e896f5a16a6cb3e5c404ee82b8a593537661a0
janenie/lstm_issu_keras
/data_utils/utils.py
UTF-8
8,151
2.671875
3
[]
no_license
import sys, os, re, json import itertools from collections import Counter import time from numpy import * import math import pandas as pd def invert_dict(d): return {v:k for k,v in d.iteritems()} def flatten1(lst): return list(itertools.chain.from_iterable(lst)) def load_wv_pandas(fname): return pd.rea...
true
f67f12ba591fdc8f9330fed0d399ab4a875ba1f8
entanmo/etm-py-lib
/src/utils/buffer.py
UTF-8
1,867
3.5
4
[]
no_license
#!/usr/bin/env python # -*- encoding: utf-8 -*- from binascii import hexlify import struct class BytesBuffer(object): def __init__(self, capacity=1024, littleEndian=True): self._data = bytearray(capacity) self._capacity = capacity self._index = 0 if littleEndian: self....
true
5ca46d6c34881844d2873314ea864076437b6c61
andjelao/Zbirka2-15-zadataka
/str01_zad04.py
UTF-8
925
3.84375
4
[]
no_license
import math print("Unesite sljedece podatke o jednakokrakom trouglu: ") b = int(input("krak: ")) a = int(input("osnovica: ")) def rotacija_jednakokrakog_trougla_oko_osnovice(s, a): """ rotacijom nastaju dvije kupe k1 i k2 ulazni parametri : krak b -> postaje izvodnica s obje kupe ...
true
66c3667d501015fed5618e052252fce239567211
Ivan333/project-nlp
/get_html_content.py
UTF-8
2,333
2.71875
3
[]
no_license
import anydbm import difflib from bs4 import BeautifulSoup from mkText import MkTextChecker import cPickle checkerMk = MkTextChecker("wfl-mk.tbl") def mk_text_diff(lines): try: if len(lines) >= 4: final_lines = [] for line in lines: line = line[1:].strip() ...
true
82ebf59bcb186f13d2ee4dd2a55472204eec93f1
xfurna/pyathlon
/pro-euler/p9.py
UTF-8
187
3.265625
3
[]
no_license
for i in range(100, 900): for j in range(i, 900): for k in range(j, 900): if i+j+k == 1000 and i*i+j*j == k*k: print(i*j*k) break
true
438ae062b4dee05103c6e6ca9d76f80e29068b5a
mwhit74/practice_examples
/linuxtopia_python/C_to_F_Table.py
UTF-8
137
3.734375
4
[]
no_license
#Temperature Converstion Table print("Celcius\tFahrenheit") for c in range(-20, 30, 5): f = 32+(212-32)/100*c print("%r\t%r" % (c,f))
true
b083c83d08f13075add13d8f156abd68a4f958b9
nickkeesG/CSC_project
/main.py
UTF-8
3,892
2.921875
3
[]
no_license
import networkx import matplotlib.pyplot as plt import numpy as np import voting_mechanism as vm import network_generator as ng def iterated_voting(n): has_converged = False total_updates = 0 total_passes = 0 while not has_converged: (n, has_converged, n_updates) = vm.sequential_update(n) ...
true
467a7903b61ed3e6072eda2ca866f5ec95730fc8
TianhengZhao/LeetCode
/[剑指 Offer 61]扑克牌中的顺子.py
UTF-8
990
3.578125
4
[]
no_license
# 从扑克牌中随机抽5张牌,判断是不是一个顺子,即这5张牌是不是连续的。2~10为数字本身,A为1,J为11,Q为12,K为13,而大、小王为 0 ,可以看成任 # 意数字。A 不能视为 14。 # # # # 示例 1: # # 输入: [1,2,3,4,5] # 输出: True # # # # 示例 2: # # 输入: [0,0,1,2,5] # 输出: True # # # # 限制: # # 数组长度为 5 # # 数组的数取值为 [0, 13] . # leetcode submit region begin(Prohibit modification a...
true
215eeea76dc87c3ad1afec9d18536ab377535554
daniel-reich/ubiquitous-fiesta
/EFwDXErjDywXp56WG_24.py
UTF-8
105
3.390625
3
[]
no_license
def is_in_order(txt): x = '' for i in sorted(txt): x += i return True if x == txt else False
true
54936e803cbfd9265d9dd0a0a04b7efd40edb7bb
itandjaya/TensorFlow-MNIST-NN
/NN_digits_TF.py
UTF-8
2,447
3.421875
3
[]
no_license
## NN_digits_TF.py ## Neural Network - Digit Image Classification using MNIST data. ## Using TensorFlow Keras to model/prototype. from NN_Digits_Model import NN_Digits_Model; from random import randint; import tensorflow as tf; import numpy as np; import matplotlib.pyplot as plt; # To display digit imag...
true
c9847f6a2edd7d3c9e02e1043d87b3551b521c5c
marcellovictor/Hinan
/levels/lev1p1.py
UTF-8
13,293
2.859375
3
[]
no_license
from PPlay.window import * from PPlay.keyboard import * from PPlay.sprite import * from PPlay.gameimage import * from PPlay.sound import * """def ground_colliding(character_matrix, ground): colliding = False for line in character_matrix: for spr in line: if spr.collided_perfect(ground): ...
true
4b46db8fc743b0a9e5954320a860d8f7f33371f7
VinayRana5674/Python-Assignment
/Python_Q10.py
UTF-8
172
3.34375
3
[]
no_license
class Reverselter: def __init__(self,l): x=len(l) for i in range(x-1,-1,-1): print(l[i]) my_list=[8343,43432,3434,434] Reverselter(my_list)
true
9a25468d7de85a6ad2839b04e8e6c4787b577398
ilyakava/pyfst
/AP.py
UTF-8
5,817
2.921875
3
[ "MIT" ]
permissive
"""Attribute Profiles https://github.com/andreybicalho/ExtendedMorphologicalProfiles/blob/master/Remote%20Sensed%20Hyperspectral%20Image%20Classification%20with%20the%20Extended%20Morphological%20Profiles%20and%20Support%20Vector%20Machines.ipynb """ import numpy as np import tensorflow as tf # Opening and Closing b...
true
d66b278939e7015c256cba6444e103c28d76cabd
lindsaymarkward/cp1404_inclass_demos_2021_2
/lecture_04.py
UTF-8
1,016
4.8125
5
[]
no_license
""" DTN - count letters in name """ VOWELS = "aeiou" number_of_vowels = 0 name = "Bobby McAardvark" for character in name: if character.lower() in VOWELS: number_of_vowels += 1 print(f"Out of {len(name)} letters, {name} has {number_of_vowels} vowels") # Strings in a list # make names title case names = ["B...
true
b35951e75663660cd9761a78587fb15da4a79379
corydodt/Playtools
/playtools/test/test_search.py
UTF-8
5,069
2.796875
3
[]
no_license
""" Test search functionality """ from __future__ import with_statement import unittest import re from hypy import HDatabase, CloseFailed from .. import search, fact from . import gameplugin, pttestutil class SearchTest(unittest.TestCase): def setUp(self): self.index = HDatabase() with pttest...
true
4ba552ab9a9977ae12d75040899ba6db4e75aa5f
hrishitelang/100-days-of-python
/Day 7/Day-7-Hangman-3-Start-1.py
UTF-8
845
4.4375
4
[]
no_license
#Step 3 import random word_list = ["aardvark", "baboon", "camel"] chosen_word = random.choice(word_list) word_length = len(chosen_word) #Testing code print(f'Pssst, the solution is {chosen_word}.') #Create blanks display = [] for _ in range(word_length): display += "_" #TODO-1: - Use a while loop...
true
3340b4407ea1dc573c786136bce393765189f809
silverneko/HWs
/cryptography-and-network-security/hw3/code4.py
UTF-8
276
3.078125
3
[ "MIT" ]
permissive
from Crypto.Hash import keccak def hash(x): sha3 = keccak.new(digest_bits=256) sha3.update(x) return sha3.hexdigest() # sha3(146) = 0x313b2ea16b36f2e78c1275bfcca4e31f1e51c3a5d60beeefe6f4ec441e6f1dfc for i in range(256): msg = chr(i) print (i, hash(msg))
true
e51c7f9ce48c433e294f44cbb30a55f58e9bebe1
s-mrb/algorithms
/helper/4.fib.py
UTF-8
327
3.578125
4
[]
no_license
def fibIter(n): if n < 2: return n fibPrev = 1 fib = 1 for num in range(2, n): fibPrev, fib = fib, fib + fibPrev return fib import datetime begin_time = datetime.datetime.now() #Your statements here fibIter(27) # hour:minute:second:microsecond print(datetime.datetime.now() - begin...
true
2f4811374968cce57375e02b547654c756f2cf2e
Coolerhino/classes-pas
/email/get_emails.py
UTF-8
960
2.546875
3
[ "MIT" ]
permissive
import imaplib import getpass IMAP_SERVER_ADDR = '127.0.0.1' IMAP_SERVER_PORT = 143 def show_emails(server, port, username, password): mailbox = imaplib.IMAP4(server, port) resp, msg = mailbox.login(username, password) if resp != 'OK': print 'Auth error: %s' % msg[0] exit(1) resp, msg = mailbox.select...
true
135b43e375a524052d1c5a9794f4beab0e3aa4cf
MengdiWang124/thinkcspy
/Chap_8/06_rand_walk_for2_stay_in_screen.py
UTF-8
1,232
3.578125
4
[]
no_license
import turtle import random t1=turtle.Turtle() t2=turtle.Turtle() wn=turtle.Screen() t1.penup() t2.penup() leftBound=-(wn.window_width()/2) rightBound=wn.window_width()/2 topBound=wn.window_height()/2 bottomBound=-(wn.window_height()/2) t1.setpos(random.randrange(leftBound,rightBound),random.randrange(bottomBound,t...
true
f7408b600d49523825cc7842c81e2a632977bb1c
thakur-nishant/LeetCode
/101.SymmetricTree.py
UTF-8
3,048
4.15625
4
[]
no_license
""" Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following [1,2,2,null,3,null,3] is not: 1 / \ 2 2 \ \ 3 3 """ # Definition for a binary t...
true
65e9ce2e07495d7314540bb3e06988912348d50f
boostcampaitech2/image-classification-level1-37
/baseline/utils.py
UTF-8
3,176
2.875
3
[]
no_license
import torch import numpy as np from collections import Counter from sklearn.preprocessing import LabelEncoder from train_nni_cutmix import seed_everything """트레이닝에 필요한 다양한 함수가 있는 파일입니다. rand_bbox: cutmix를 위해 사진을 자르는 클래스입니다. 최석민 캠퍼분이 만든 클래스를 활용하여 만들었습니다. (https://stages.ai/competitions/74/discussion/talk/post/493) Ge...
true
6d82ae8e9d91d22739adfcf57a083994b9bb938e
kidusasfaw/addiscoder_2016
/labs/server_files_without_solutions/lab6/minElement/minElement_solution.py
UTF-8
369
3.46875
3
[]
no_license
import sys #The input for this function is a list of numbers. The function should return the smallest number def minElement(L): # student should implement this function ########################################### # INPUT OUTPUT CODE. DO NOT EDIT CODE BELOW. list = map(int,sys.stdin.readline().split()) ans = minE...
true
23e5c76e54f0cd4f66fa7270709c0b678c275512
anirudh1092/Pattern-Recognition
/Pattern Recognition/GenerateData.py
UTF-8
1,289
3.015625
3
[]
no_license
import pandas as pd;#python package to read and write the data to csv files import numpy as np;#python package to perform mathematical operations import random def genRandomList(num_attr,low,high): sampl = np.random.uniform(low, high, size=(int(num_attr),)) return sampl #This function is used to genrate the...
true
26d14aada09cee0609deceed5fe656980452cce4
jnhro1/CS_python
/지헌/99-4.py
UTF-8
484
4.15625
4
[]
no_license
''' 100 이하의 자연수 n을 입력받고 n개의 정수를 입력받아 평균을 출력하는 프로그램 (평균은 반올림하여 소수 들째자리까지 출력) ''' result = 0 num = int(input("자연수를 입력해주세요 : ")) if num > 100: print("100 이하의 자연수를 입력해주세요") exit() for i in range(1,num+1,1): num2 = int(input("정수를 입력해주세요 : ")) result += num2 avg = result / num print("%.2f"%avg)...
true
0653b80d50ed9524f19fade98a5e52616ddcafc3
google/google-ctf
/2020/quals/pwn-app-ads/app/janusify/janusify.py
UTF-8
4,029
2.8125
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # Copyright 2020 Google LLC # # 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
a4787ab88d946c6b627f76f9b0a9be28ab8353cc
musabedin/space_invaders_game
/star.py
UTF-8
528
3.390625
3
[]
no_license
import pygame from pygame.sprite import Sprite class Star(Sprite): def __init__(self, ai_game): #Gives reference to current instance and self reference super().__init__() self.settings = ai_game.settings #Load image and get its rect. self.image = pygame.image.load('images/star.bmp') self.rect = self.ima...
true
c97445b26ca914347508c6d8af51f7400048f2d7
mcgill-ecse211-f21/threading-tutorial
/project/threadexample.py
UTF-8
2,954
3.609375
4
[]
no_license
#!/usr/bin/env python3 """ Simple examples of using threads and sampling rates in the context of the BrickPi3. """ from collections import deque from statistics import mean from time import time, sleep from threading import Thread from types import FunctionType from utils.brick import EV3ColorSensor, EV3UltrasonicSe...
true
488da727a6e2329552476c38fa654f2c32aa048d
TakahasiRyota1/to-do1
/expect_number.py
UTF-8
444
3.65625
4
[]
no_license
import random random_num = random.randint(1,5) while True: num = int(input(&quot;1から5までの数字を入力してください。&quot;)) if num ==random_num: print(&quot;あたりです。&quot;) break else: print(&quot;外れました。&quot;) print(&quot;もう一度入力してください。&quot;) if count == 5: print("ゲームオーバー") ...
true