blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
90e424e9023bd0611e728e0215300995286c96d2
Python
siporter43/python-class
/pythonclass/misky/blackjack.py
UTF-8
2,549
3.9375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Blackjack Game https://bicyclecards.com/how-to-play/blackjack/ - Objective: Each participant attempts to beat the dealer by getting a count as close to 21 as possible, without going over 21. - Card Values: - Ace is worth 1 or 11 - Face cards are 10 ...
true
effae4acf56172441f06b04b7e07afc1308bca07
Python
bbw7561135/ml_cr_aniso
/src/src_sample.py
UTF-8
11,018
2.921875
3
[ "MIT" ]
permissive
""" The script reads a file like `data/sample_D3.5Mpc_Emin56EeV_1000nuclei.txt` obtained with `psample.py` and then creates a sample of "UHECRs" coming from a particular source, using "nucleus_NNNEeV.txt.xz" obtained with galback.py and located in a directory that corresponds to the selected Nside and the GMF model (e....
true
7b56875df3c778e65456dc70f4570807b0a494ad
Python
AnishN/dupylicate
/dupylicate/ui/directory_widget.py
UTF-8
2,025
2.671875
3
[]
no_license
from PyQt5.QtWidgets import * class DirectoryWidget(QWidget): def __init__(self, box_name): super().__init__() self.setup_dialog() self.setup_buttons() self.setup_list() self.setup_layout(box_name) def setup_dialog(self): self.dialog = QFileDialog(options=QFile...
true
e39c820b2d531f7a7788bffae88f1c8e7f1f6cc4
Python
ulno/ulnoiot
/lib/integriot/thingi.py
UTF-8
5,497
2.59375
3
[ "MIT" ]
permissive
# base Thing Interface (Thingi) classes # # Author: Ulrich Norbisrath (http://ulno.net) # Created: 2017-10-05 class _Thingi(): def __init__(self): self.status = None class Thingi(_Thingi): def __init__(self, mqtt_client, main_topic, qos=0): self.mqtt_client = mqtt_client self.main_to...
true
abc3970df0426d856ffaba19ae03dc43aac6e9fc
Python
cash2one/xai
/xai/brain/wordbase/nouns/_stem.py
UTF-8
984
2.59375
3
[ "MIT" ]
permissive
#calss header class _STEM(): def __init__(self,): self.name = "STEM" self.definitions = [u'a central part of something from which other parts can develop or grow, or which forms a support', u'the stick-like central part of a plant that grows above the ground and from which leaves and flowers grow, or a smaller ...
true
844cf330f163bfae2b4c9c1b1e9bd68248e23b31
Python
mmagnuski/Biology-of-Brain-and-Behavior
/experiment/we_are_neurons.py
UTF-8
3,363
2.59375
3
[]
no_license
from psychopy import core, visual, event from matplotlib import pyplot as plt from PIL import Image import datetime as dt import seaborn as sns import pandas as pd import numpy as np # settings reps_per_cond = 3 # create a window instance win = visual.Window(fullscr=True) # create welcome message welcome = 'Welcome t...
true
e52fd1ff647dd4ed71bb9ea56846de63d133eded
Python
alexandrasalem/nlp_coursework
/HW7/bleu.py
UTF-8
1,926
3.0625
3
[]
no_license
#!/usr/bin/env python -O # basic BLEU score implementation # Kyle Gorman <gormanky@ohsu.edu> from __future__ import division from math import exp, log from collections import Counter MAX_GRAM_SIZE = 4 # helpers def ngrams(tokens, order): """ Generate n-grams of order `order`, with no padding """ ...
true
0aa71140e205fe90dc957e3378e51fe861fa9cef
Python
civio/presupuesto-arroyomolinos
/loaders/arroyomolinos_payments_loader.py
UTF-8
1,471
2.640625
3
[]
no_license
# -*- coding: UTF-8 -*- import datetime from budget_app.loaders import PaymentsLoader from budget_app.models import Budget class ArroyomolinosPaymentsLoader(PaymentsLoader): # Parse an input line into fields def parse_item(self, budget, line): policy_id = line[1].strip()[:2] # First two digits of th...
true
97ce50649a27d8bea791d975201c612cd7b7cfbd
Python
preslee/UCIL20122
/Optimizer.py
UTF-8
2,592
3.09375
3
[]
no_license
#This class is the optimizer for the Neural Network of Titanic dataset from InputWidget import * from IPython.display import display import numpy as np import tensorflow as tf import keras class Optimizer: #Define the constructor def __init__(self, InputWidgetObject1, InputWidgetObject2, InputWidgetObject3, Dr...
true
ddaa6330082f4554eb2c3f7ef715d787c4e09c5d
Python
huawei-noah/xingtian
/zeus/datasets/transforms/pytorch/ToPILImage_pair.py
UTF-8
1,523
2.65625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the...
true
eb15f0d95ff69e36fd5b307c6f8c83471973c2ff
Python
pmoe7/Shopify-SWE-Image-Repo
/app.py
UTF-8
3,710
2.78125
3
[]
no_license
# app.py # Mohammed Perves # April 30, 2021 from flask import Flask, render_template, url_for, request, flash from werkzeug.utils import secure_filename import os from object_dection import detect import mysql.connector UPLOAD_FOLDER = 'static/uploads/' ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'} host='loca...
true
d60bdfa15a466c6f1263b66ca98009bf8be3d1ae
Python
udwivedi394/misc
/powerRemainder.py
UTF-8
1,289
3.3125
3
[]
no_license
def powerRemainder02(A,B,C): x,n,d = A,B,C if d==0: return -1 if x==0: return 0 x = x%d if x < abs(d-x): sign = True else: sign = False if n%2!=0 else True x = abs(d-x) mult = 1 cycle = 1 cycleLookup = {} cycleSet = set() #print x,a...
true
81b078f7f0561eaef937dd4546d36f1071301d05
Python
Bznkxs/term
/snake.py
UTF-8
13,978
2.53125
3
[]
no_license
import copy import json import time import typing import random import ansi from non_blocking_input import nbprepare, nbclose import atexit import sys, os nb = nbprepare() atexit.register(nbclose) l_snake = [] dangerous_grids = set() bw = 2 _size: typing.Optional[typing.Tuple] = None _display_size: typing.Optional...
true
3f32f11f6afb5efa037918eaf7322f24a57c3a38
Python
gabriellaec/desoft-analise-exercicios
/backup/user_339/ch42_2019_09_04_13_18_57_548246.py
UTF-8
155
2.875
3
[]
no_license
def quantos_uns(n): s = 0 i = 0 x = list(str(n)) l = len(x) while i < l: if '1' in x[i]: s += 1 i += 1 print(s)
true
a96fe7aa43962e623c6d90044d9d7813a3714c10
Python
zkyseeker/openexposer
/Software/tools/slicer/extensions/svg.py
UTF-8
9,812
2.5625
3
[]
no_license
__author__ = 'mariolukas' from xml.dom import minidom class Extension(): y_precision = 10 x_precision = 10 print_bed_width = 330 print_bed_height = 160 layers = [] g_code_file = [] def __init__(self, file): self.file = file self.svg_do...
true
88cb40f2a9195985b6e7c77f0185dc525853e4e5
Python
mmeyer/pysymbolscanner
/src/pysymbolscanner/infobox.py
UTF-8
9,133
2.6875
3
[ "MIT" ]
permissive
import re import pycountry import gettext from unidecode import unidecode from pysymbolscanner.stock import Stock from pysymbolscanner.word_score import get_best_match from pysymbolscanner.const import long_to_short from pysymbolscanner.const import fallback_location class Infobox: def __init__( self, nam...
true
1dab36128aba554714bedf6b8f33e863867ffacb
Python
hank/AOC2018
/Python/day2_part2.py
UTF-8
1,193
3.109375
3
[]
no_license
import sys import string from profilehooks import timecall def find_oneoff(inventory, b): for o in range(0, len(b)): # Try for each letter subbed at this position for c in string.ascii_lowercase: candidate = b candidate = candidate[0:o] + c + candidate[o+1:] if c...
true
bd349cd74ef1491a1b10415af634504f8eab6075
Python
Rajahx366/Codewars_challenges
/6kyu_Break_camelCase.py
UTF-8
446
4.03125
4
[]
no_license
""" Complete the solution so that the function will break up camel casing, using a space between words. Example solution("camelCasing") == "camel Casing" """ import re def solution(s): first_word = re.findall('[^A-Z]*[A-Z]',s) words = re.findall('[A-Z][^A-Z]*',s) words.insert(0,first_word[0][:-1...
true
af5b2ffcabe5193c0c2972c16a5ffcc366a6acf5
Python
bakowroc/network-optimization
/algorithm/Topology/Topology.py
UTF-8
1,443
3.375
3
[]
no_license
from Link import Link from Logger.Logger import Logger from Node import Node from Path import Path class Topology: def __init__(self): self.links = [] self.nodes = [] self.paths = [] def add_link(self, link: Link): self.links.append(link) def add_node(self, node: Node): ...
true
3720cbdc02bd220b0f846526abc026ae7d1047a4
Python
fonsp/SCG-analyse
/notebooks/poisson/poisson_clustering.py
UTF-8
8,705
2.953125
3
[]
no_license
from pathlib import Path import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.stats import datetime from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() import ipywidgets from IPython.display import display, clear_output, Javascript, Markdown def su...
true
a77a18e24b9192da7530ad1f5314056c20355b90
Python
LKWBrando/CP1404
/practical1/loops.py
UTF-8
169
3.484375
3
[]
no_license
for i in range (1,21,2): print(i, end=' ') print() for i in range (0,101,10): print(i, end=' ') print() for i in range (20,0,-1): print(i, end=' ') print()
true
038de139fca9d934c9b70a756c8a72ab9bf9b6b5
Python
CarlBlacklock/EECS6432Project
/Python Implementation/pipeTest.py
UTF-8
939
2.96875
3
[]
no_license
import multiprocessing, csv def f(pipe): while not pipe.poll(): pass x = pipe.recv() y = x * x pipe.send(y) def g(pipe): while not pipe.poll(): pass print(pipe.recv()) pipe.close() def h(pipe): while not pipe.poll(): pass tup = pipe.recv() ...
true
8e26324411df078aee6ae6cd424a1612bea761f9
Python
filzamazahir/QueueSimulation
/ECE610ProjectFilzaMazahir.py
UTF-8
29,761
3.0625
3
[]
no_license
# ECE610 Project - Queue Simulation # Filza Mazahir - 20295951 - fmazahir@uwaterloo.ca # Import libraries import random import numpy as np from math import log, inf from collections import deque import matplotlib as mpl mpl.use('TkAgg') import matplotlib.pyplot as plt import time # Open an output text file to out...
true
fc88655ddaf61e8dff96eaa49ab37ca59da652f6
Python
plusx2012/Network_Automation_with_Python
/Master Network Automation with Python for Network Engineers - Course Resources/Serial Connection Scripts/myserial.py
UTF-8
982
2.859375
3
[]
no_license
import serial import time def open_console(port='com3', boudrate = 9600): console = serial.Serial(port='com3', baudrate=9600, parity='N', stopbits=1, bytesize=8, timeout=8) if console.isOpen(): return console else: return False def run_command(console, cmd='\n', sleep=2): ...
true
3a320ccfb8ad2ceaf94da21d08e7cbcc4f493365
Python
ryantillis/Movie-Website
/entertainment_center.py
UTF-8
2,676
2.671875
3
[]
no_license
import fresh_tomatoes import media interstellar = media.Movie("Interstellar", "A brilliant NASA physicist is working on plans to save mankind by transporting Earth's population to a new home via a wormhole.", "https://t1.gstatic.com/images?q=tbn:ANd9GcRf61mker2o4...
true
ae94ff8b4ae40ddd787a5447bab87adb1ce668a5
Python
YibaiMeng/CNMCM2018
/Paper/figures/random_distribution.py
UTF-8
938
2.859375
3
[]
no_license
# since starting a new engine really consume time, it's recommended to connect to a shared MATLAB session # to shared the session in MATLAB GUI, just call this in MATLAB ------------------ `matlab.engine.shareEngine` # I found that if there's no shared sessions, it will automatically create one and then delete, whic...
true
ede1ad4f725918c7a90d881341b8a404647c85d3
Python
primrose101/CS322
/InputHandler.py
UTF-8
1,795
3.265625
3
[ "MIT" ]
permissive
import Tokens import StatusTypes import math class InputHandler: def __init__(self) -> None: self.status = StatusTypes.STATUS_OK # assumes token_stream has only every variable separated by comma def assign_inputs(self, token_stream, inputs, variables): inputs = [i.strip() for i in input...
true
9fea72ef6d697aa2ffc05a866c2e9c4fe719acfb
Python
udhayprakash/PythonMaterial
/python3/18_aws_cloud/a_AWS_Lambdas/d_practical_utility_functions/c_generate_hash_strings.py
UTF-8
381
2.8125
3
[]
no_license
import hashlib def lambda_handler(event, context): text = event["text"] md5 = hashlib.md5(text.encode()).hexdigest() sha1 = hashlib.sha1(text.encode()).hexdigest() sha256 = hashlib.sha256(text.encode()).hexdigest() return {"statusCode": 200, "body": {"md5": md5, "sha1": sha1, "sha256": sha256}} ...
true
1ad395f771ed4798dc80d71db1667d05f60cbae1
Python
crea1/knowit-julekalender
/2016/13/13.py
UTF-8
967
3.328125
3
[]
no_license
#!/usr/bin/env python import re grid_size = 10000 grid = [[False for x in range(grid_size)] for y in range(grid_size)] with open('instruksjoner.txt') as fil: for line in fil: m = re.match(r'^\D*(\d*),(\d*)\D*(\d*),(\d*)', line, re.M | re.I) x_from = int(m.group(1)) y_from = int(m.group(2))...
true
5b9419a368c07519c503db5f29086f79bfb6b4c7
Python
nmlorg/metabot
/metabot/modules/help.py
UTF-8
2,549
2.53125
3
[]
no_license
"""Return the list of commands and other bot features.""" import collections ALIASES = ('command', 'commands', 'help', 'start') def moddispatch(ctx, msg, modconf): # pylint: disable=missing-docstring if ctx.type in ('message', 'callback_query') and ctx.command in ALIASES: return default(ctx, msg, modco...
true
a3405efc58de6767dafdbbe3c620968e691f0f0f
Python
dingdavid555/ecg_processing
/Heartbeat_visualizer.py
UTF-8
3,226
3.046875
3
[]
no_license
# DAVID DING # SEPTEMBER 18TH 2019 # THIS FILE IS USED TO GENERATE WINDOWS FOR ML ALGORITHMS TO DETECT HEARTBEATS GIVEN .EDF FILES FOR PROCESSING # ======================================== IMPORTS ======================================== import numpy as np import pandas as pd import matplotlib.pyplot as plt from Bitt...
true
fec1c846edf57af55a221975f13deb631b5bf7d5
Python
erwindebrouwer/simple
/test_simple.py
UTF-8
356
3.171875
3
[]
no_license
import unittest from simple import Analyze_Number # class test_simple(unittest.TestCase): def test_Analyze_Number(self): self.assertEqual(Analyze_Number(100),"No way! That's exactly 100!") self.assertEqual(Analyze_Number(101),"Wow! That's higher than 100!") self.assertEqual(Analyze_Number(99...
true
78670a3da52a0dcc55228016c028344b5d82b35e
Python
akeryilmaz/MachineLearningProject
/Source/playlist_exp.py
UTF-8
2,217
3.0625
3
[]
no_license
import numpy import matplotlib.pyplot as plt from mlxtend.plotting import plot_decision_regions from sklearn import svm import random # Change this to 'from readFile import *' if you are using Python 2.* from readFile import * # Returns the train and test data as well as labels for train data. # Trains the model usin...
true
2ba4964b38386b5bccaae1e8c04893276bcab164
Python
dquejim/PythonPOO_DavidQuesada_2DAM
/Ejercicio03/Videojuego.py
UTF-8
1,729
3.328125
3
[]
no_license
class Videojuego: titulo = '' horas_estimadas = 10 entregado = False genero = '' compania = '' entregados_totales = 0 def __init__(self,titulo,horas_estimadas,genero,compania): self.titulo = titulo self.horas_estimadas = horas_estimadas self.entregado self.ge...
true
b1061661ad5ea0ab3dd491c7b0adbb737ce75e99
Python
xaneon/PythonProgrammingBasics
/comprehensions/comprehensions.py
UTF-8
675
3.96875
4
[]
no_license
""" Normierung einer String-Liste auf Klein- buchstaben. Drei Wege die zum Ziel führen werden demonstriert. """ # Input answers = ['Yes', 'yes', 'No', 'no', 'maYbE'] # Weg 1: Die klassische for-Schleife normalized = [] for x in answers: normalized.append(x.lower()) # Weg 2: Lambda und map() normalized2 = list(map...
true
a529da79d4c4af6cee4000aea0a36f5b152243a3
Python
zhaoxx063/pyids
/checksums.py
UTF-8
4,048
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: iso-8859-15 -*- """ Module responsible of generating the checksum database and checking if checksums have changed. """ import md5 import pickle from config_parser import getDatabaseFile from config_parser import getChecksumFileList import myexceptions import progress def crear_bd(f...
true
a3007f2bdbfcee4045ff527998ed8e0da2719408
Python
Connectomics-Classes/hackwicket-silverbacks
/cutImageNAnnotations.py
UTF-8
4,800
2.828125
3
[ "Apache-2.0" ]
permissive
import ndio import ndio.convert.png as ndpng import ndio.remote.OCP as OCP import numpy as np def getRaw(x1,x2,y1,y2,z1,z2): """ Retrieve mitochondria image volume from neurodata given x,y,z parameters Arguments: x1/y1/z1: starting value for cut x2/y2/z2: ending cut value Returns: 3D Numpy Array of imag...
true
12624491afb3838c2362d0f8eec3e05ec704f4a3
Python
cpaggron/Spam-Shop
/Spam Shop/src/music.py
UTF-8
9,157
2.71875
3
[]
no_license
import discord from discord.ext import commands import pafy import youtube_dl from youtube_search import YoutubeSearch import os from discord.utils import get import asyncio client = commands.Bot(command_prefix="s-") client.remove_command("help") @client.event async def on_ready(): print("Bot is ready") await...
true
f7229d4528042233c89faed492b7a8b3634e6278
Python
XKHoshizora/Some-Everyday-Tools
/M_heating_time.py
UTF-8
731
4.0625
4
[]
no_license
# 加热时间转换器 def heat_upTime(P1, P2, t1): ''' 将微波炉在某初始功率下的加热时间, 转化为转化后功率下加热所需时间, 并打印结果(单位:分钟) :param P1: 初始功率(单位:W) :param P2: 转化后功率(单位:W) :param t1: 初始功率下所需时间(单位:分钟) :return: 无 ''' W = P1 * (t1 * 60) t2 = (W / P2) / 60 print('{0}W功率下需加热{1}分钟'.format(P2, t2)) return Non...
true
fe8bcccf5b33b18a38068a39fe39582d95a736a8
Python
kuanhungchen/Spring-2019-Machine-Learning
/final/classifier.py
UTF-8
12,589
2.65625
3
[]
no_license
import numpy as np import csv import os from collections import defaultdict from sklearn.ensemble import RandomForestClassifier class Classifier(object): def __init__(self, base=0, criterion='entropy', random_state=5, n_estimators=340, min_samples_split=2, special=None, data_split=20622): ...
true
1063c0d8326a22300f5c1c23b5582ec67bdc4255
Python
kpranshu/python-demos
/07-Oops/bankclient.py
UTF-8
1,130
3.875
4
[]
no_license
from bankmodel import Bank b=Bank() while(True): print("1. Create Account") print("2. Change Name") print("3. Change Branch") print("4. Deposit Amount") print("5. Withdrawl Amount") print("6. Check Balance") print("7. Check Branch") choice=int(input("Enter Choice : ")) ...
true
39108b2ff8b86a3753428a5744dad789d2f4deb8
Python
katarzynawozna/learnpythonthehardway
/ex3.py
UTF-8
839
4.4375
4
[]
no_license
# Priting sentence. print("I will now count my chickens:") # Printing and counting. print("Hens", 25 + 30 / 6) print("Roosters", 100 - 25 * 3 % 4) # Again printing. print("Now I will count the eggs:") # Now just counting. print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6) # Printing without counting as it all is one string. ...
true
f7ce9cbad0080c16a4f8ff87af7876f5e5734ab5
Python
pranshu798/Python-programs
/Data Types/Sets/Removing elements using remove() or discard() method.py
UTF-8
590
4.8125
5
[]
no_license
#Python program to demonstrate Deletion of elements in a Set #Creating a Set set1 = set([1,2,3,4,5,6,7,8,9,10,11,12]) print("Initial Set: ") print(set1) #Removing elements from Set using remove() method set1.remove(5) set1.remove(6) print("\nSet after Removal of Two elements: ") print(set1) #Removing elements from Se...
true
33b8569225cee86a773c8c66540e6f2f9838dd0a
Python
Praveen-485/BecomeCoder2021SkillUp
/PronicNumber.py
UTF-8
170
3.21875
3
[]
no_license
from math import * def pronic(n): m=int(sqrt(n)) if n==m*(m+1): return "True" else: return 'False' n=int(input()) print(pronic(n))
true
385367baf537a8234bc6cd92ebae4acb24b8fa16
Python
eladkoren1/polyrizeAssignment
/venv/main.py
UTF-8
135
2.859375
3
[]
no_license
from magicList import MagicList, Person a = MagicList() a[0]=5 print (a) b = MagicList(cls_type=Person) #b[0].age=1 print (b[0].age)
true
d22be6e97e1b568c7e539f9e7132ca2d152881f7
Python
Hersonmei/ExerciciosPY
/Automatize tarefas maçantes/Listas/test.py
UTF-8
612
3.1875
3
[]
no_license
import random numberOfStreaks = 0 for experimentNumber in range(100): resultList = [] for i in range(100): result = random.randint(0,1) resultList.append(result) counterzero = 0 counterone = 0 for res in resultList: if res == 0: counterzero+=1 counter...
true
91c9917f438bf94a4be433452d9b0a05532c3bb6
Python
NotConfident/EthereumGasPriceAlert
/TelegramBotEthGas.py
UTF-8
3,170
2.703125
3
[]
no_license
import json import requests import time import urllib TOKEN = "" URL = "https://api.telegram.org/bot{}/".format(TOKEN) chatIDs = [] offset = 0 def get_url(url): response = requests.get(url) content = response.content.decode("utf8") return content def get_json_from_url(url): content = get_url(url) ...
true
af049be0a008a8affedf755535f2200673bbc064
Python
emhashef/words-reminder-bot
/handlers/snooze_news_query.py
UTF-8
602
2.515625
3
[]
no_license
from utils.decorators import have_access from telegram.ext import CallbackQueryHandler from datetime import datetime,timedelta @have_access def snooze_news_query(update,context,user): query = update.callback_query hour = query.data.split()[1] if not hour and hour.isnumeric(): return user.ready...
true
3f27b20125fd68fc848aaa745399270a3b11bf84
Python
Rocksus/keep-typing-and-nobody-explodes
/modules/password/test_solver.py
UTF-8
384
2.875
3
[ "MIT" ]
permissive
import unittest from .solver import solve_password class TestPassword(unittest.TestCase): def test_solve_password(self): self.assertEqual(solve_password([ ['a','b','c','d','e','f'], ['o','e','h','t','a','b'], ['e','h','l','i','o','u'], ['a','b','c','p','z','o...
true
35a9740247627ebff8c26f138a5e60757b626da7
Python
pyokagan/carparkdata
/process.py
UTF-8
1,140
2.984375
3
[]
no_license
import os import os.path import json # str -> List[Entry] # Entry = (lot_type, total_lots, lots_available, ...) carparks = {} for x in os.listdir('raw'): print(x) with open(os.path.join('raw', x), 'r') as f: y = json.load(f) for carpark_data in y['items'][0]['carpark_data']: carpark_number...
true
1435ffa7243446b9a8aeb6cb23df0c46dc8083e6
Python
xiaoxiae/Leetcode
/problems/31.next-permutation.py
UTF-8
621
2.9375
3
[]
no_license
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ j = len(nums) - 1 while j > 0 and nums[j - 1] >= nums[j]: j -= 1 # go till the first half for i in range(((len(nums)...
true
b8a5b8f66d85989372f70b76476d61c35d07754b
Python
qiaohaijun/my-leetcode
/python_solution/0139-word-break-dp1.py
UTF-8
784
3.21875
3
[]
no_license
class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ # 初始化 dp = [False]*(len(s)+1) # 动态规划状态 dp[i]表示在 i 是否可以切分. dp[0] = True # [leet] 字典为[le,et] #...
true
a04ff601eeae5339d994f3f6ee8d8ee064a0bff7
Python
R11happy/misc
/leetoj/25.py
UTF-8
1,916
3.765625
4
[ "MIT" ]
permissive
#! /usr/bin/env python #encoding=utf-8 # Reverse Nodes in k-Group # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # def __str__(self): # return '{%d}'%self.val # def printList(head): # s = '' # while head is not...
true
733e02fb58c713c6f03a38d8935fa43938424515
Python
mccornet/dynamic-programming-examples
/08.py
UTF-8
1,173
3.296875
3
[]
no_license
def find_max_sum_subarray(array: list[int]) -> int: # edge case if not array: return 0 prev_chunk = -float('inf') best_chunk = -float('inf') for num in array: if prev_chunk < 0: chunk = num else: chunk = prev_chunk + num # update the running maximum...
true
23e77a5c1a399fb2eb1e24181f3c9a082d629b4b
Python
ktisha/object_class_recognition
/src/tester.py
UTF-8
1,949
3.125
3
[]
no_license
__author__ = 'avesloguzova' import logging class Tester(object): @staticmethod def default_quality(actual, excepted): return float(sum(map(lambda x: x[0] == x[1], zip(actual, excepted)))) / len(actual) @staticmethod def f1_score(actual, excepted, label): true_positives = 0.0 ...
true
c90afcbc2822e42b77dab716e4a7f7aeef0d7a69
Python
Sweetcharge/python
/PlexRentals Scrape/webscraping.py
UTF-8
2,023
3.453125
3
[]
no_license
''' # # Script: webscraping.py # Author: Samuel Belarmino # Date: January 9th, 2019 # Purpose: First webscraping script # ''' ''' Things to research on: # - Urllib # ''' ### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ### THINGS TO DO: ADD URLS TO EACH PRODUCT ### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Ask the user...
true
ded0c1c7c5199d5730d5ede7cd55f2a2b423133f
Python
nyonnguyen/rbfgenerator
/MyProject/Libs/MyCustomizedLibrary/keywords/elementkeywords.py
UTF-8
1,579
2.6875
3
[]
no_license
from SeleniumLibrary.base import keyword, LibraryComponent from SeleniumLibrary.keywords import ElementKeywords as SeleniumElementKeywords from selenium.webdriver.common.keys import Keys class ElementKeywords(LibraryComponent): def __init__(self, ctx): LibraryComponent.__init__(self, ctx) ...
true
00c5f349ac85b20f334abc1accb04afd7f6edb8e
Python
asdwsxzc123/python
/advanced/12数据提取/04funck.py
UTF-8
449
2.78125
3
[]
no_license
from parse_url import parse_url import re class Jandan: def __init__(self): self.url = 'http://jandan.net/duan' self.header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"} def run(self): html_str = pa...
true
8356f4fa8a966f420ec9130203ba9e20b6cb2eb7
Python
openUniverse/singularity
/BensPractice/ArkMatCalc.py
UTF-8
1,841
3.765625
4
[ "MIT" ]
permissive
class StoneCost: def __init__(self, thatch, wood, stone): self.thatch = thatch self.wood = wood self.stone = stone def __mul__(self, other): return StoneCost(self.thatch * other, self.wood * other, self.stone * other) def __add__(self, other): return StoneCost(self...
true
c10bdde0527f0b2ad86829666d63e785b651b417
Python
zf109/algorithm_practice
/coding_dojo/reverse_string.py
UTF-8
316
3.90625
4
[]
no_license
def reverse_string_recursion(string): if len(string) <= 1: return string string[0], string[-1] = string[-1], string[0] string[1:-1] = reverse_string_recursion(string[1:-1]) return string if __name__ == "__main__": string1 = list('I am reversed') reverse_string_recursion(string1)
true
27a2fdcc43d06f027ccc06dfde4fded348cd0e82
Python
wandb/artifacts-examples
/detectron2/create_dataset_coco_format.py
UTF-8
1,865
2.578125
3
[]
no_license
import argparse import os import sys import coco import json import wandb parser = argparse.ArgumentParser( description='Create a dataset artifact using the COCO format.') parser.add_argument('name', type=str, help='Name for this dataset') parser.add_argument('json_file', type=str, ...
true
e9a73da2b878fa9a17c1825aff8d72a8816fd7f9
Python
junion/LGus
/Samplers.py
UTF-8
10,871
3.296875
3
[]
no_license
"""Various samplers @var _version: Version of this module @type _version: String """ from Models import BN import random _version = '$Id: Samplers.py,v 1.6 2008/10/07 09:14:21 jc Exp $' class MultinomialSampler(object): """ For sampling from multinomial distributions @ivar _cumprobs: Discrete cumu...
true
7a79e67c8c815819a7e0d655f78ae5c5990648f0
Python
Guilt-tech/PythonExercices
/Exercices/Secao04/exercicio17.py
UTF-8
199
4.03125
4
[ "MIT" ]
permissive
print('Digite um comprimento em centímetros, que será convertido em polegadas') C = float(input('Comprimento: ')) P = C / 2.34 print(f'O comprimento em centímetros é: {P} e em polegadas é: {C}')
true
6ec3acfeb6452cbb34a88aa9ad992e6305540b8f
Python
DanielaDuncker/beginners_take_a_break
/beginners_take_a_break.py
UTF-8
407
2.765625
3
[]
no_license
import time import schedule import webbrowser total_breaks = 7 break_count = 0 print("This program started on " + time.ctime()) while break_count < total_breaks: time.sleep(3600) webbrowser.open("https://www.youtube.com/watch?v=ZbZSe6N_BXs") break_count = break_count + 1 schedule.every().day.at("09:00")....
true
dab07e56958e1948f207b5e2cb358d0f367f3489
Python
JirenJin/leetcode-problems
/python/test_summaryRanges.py
UTF-8
951
3.234375
3
[]
no_license
import unittest from summaryRanges import Solution class summaryRangesTests(unittest.TestCase): def test_continuous_nums(self): nums = [0,1,2,3] s = Solution() result = s.summaryRanges(nums) self.failUnless(result == ["0->3"]) def test_two_parts_continuous_nums(self): ...
true
d770ce391f0542ad86680c2968d1df70f4f40ede
Python
jerryWTMH/ECE-590
/project1/project1.py
UTF-8
4,897
3.640625
4
[]
no_license
""" Math 560 Project 1 Fall 2021 Partner 1: Ching-Hang Hsu (Netid: ch450) Partner 2: Zhuoer Li (Netid: zl328) Date: 10/23 """ """ SelectionSort Author: Ching-Hang Hsu Date: 10/23 """ def SelectionSort(listToSort): index = 0 min = 0 #pick the smallest element from the unsorted array ...
true
d064392c7d6e9aef9c625d6db7f1888994f61111
Python
developmentgtscol/mype_web
/mype/ficheros/gestion_de_archivos.py
UTF-8
1,282
3.109375
3
[]
no_license
# libretias necesarias import math import os.path # clase que valida y crea el archivo donde se guardara la info class Archivo: # metodo que gestiona la validacion y creacion del archivo def asignar_archivo(self, carpeta): # tomamo la ubicacion de los archivos esto devuelve una lista con los no,bres de los arc...
true
4a2c42976d0c43c372fd8e0781e224bb822eef2f
Python
drequivalent/dude
/dude.py
UTF-8
3,965
3.09375
3
[]
no_license
#!/usr/bin/python # 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, or # (at your option) any later version. # # This program is distributed in the hope that it w...
true
3fffd39ee85fc4d901ba4c86da34d8bb2e64bd5f
Python
entbappy/Real-Time-Notification-System-of-COVID-19
/main.py
UTF-8
1,379
3.15625
3
[]
no_license
""" Author : Bappy Ahmed Email : bappymalik4161@gmail.com Date : 10 sept 20 """ from plyer import notification #For getting notification import requests import time from bs4 import BeautifulSoup #To pull the data in a different manner # This function will give me the notification def notifyMe(title,message): ...
true
8567bec98529815950b4ad59944d3e12e852e250
Python
gapGit01/python-tests
/assignmet/8-5.py
UTF-8
214
3.453125
3
[]
no_license
def describe_city(city, country): """ Details about the city""" print (f"\n{city} is in {country}\n") c = {'dhili':'insia', 'tokyo':'japan', 'kandy':'sri lanka'} for i in c: describe_city(i, c[i])
true
c03c503609d14f5955de4acc52a5be93838b419a
Python
8563a236e65cede7b14220e65c70ad5718144a3/introduction-python-programming-solutions
/Chapter10/0006_change_file_extensions.py
UTF-8
741
3.84375
4
[]
no_license
""" Program 10.4 Change the File Extension from .txt to .csv of All the files (including from Sub Directories) for a Given Path """ import os import glob def rename_files_recursively(directory_path): print("File extension changed from .txt to .csv") for file_path in glob.glob(directory_path + r"/**/*.txt", re...
true
713d95d02af4a995f474d95302d12930c5de5878
Python
VanOvermeire/epigraphical-machine-learning
/helpers/writers.py
UTF-8
82
2.96875
3
[ "MIT" ]
permissive
def write_to_csv(csv_file, values): csv_file.write(','.join(values) + '\n')
true
72ee7e4abfc2cbcbeea8f0c9c66f2809c4911162
Python
maurya20/assignment1
/conclusion.py
UTF-8
703
2.953125
3
[]
no_license
import numpy as np from datetime import datetime import matplotlib.pyplot as plt import pandas as pd # reading csv file from project folder file = pd.read_csv("Vibration.csv") vibr = file["Vibration_Az"].values # Finding top 10 vibration magnitudes idx = (-vibr).argsort()[:10] print('Top 10 vibration magnitudes',vibr[...
true
1808af24b6c1115439a4e3a78cd1158710dc8731
Python
deepakkarki/pruspeak
/src/userspace_lib/legacy_code/fifo_server.py
UTF-8
1,133
2.703125
3
[ "MIT" ]
permissive
import pru_speak import os script = False pru_speak.SCRIPT_CODE = '' def handle_inst_fifo(bs_code): ''' handles the BS command that comes in one by one. maintains state in case of SCRIPT ''' global script bs_code = bs_code.strip() #only single BS inst print "bs_code : ", bs_code ...
true
fa6a43e2bcedab2bff8d9f43adf58b740763d74f
Python
chusk2/python-code
/snake.py
UTF-8
371
3.53125
4
[]
no_license
from turtle import Turtle, Screen src = Screen() src.setup(height=600, width=600) src.bgcolor('black') src.title('Snake Game') snake = [Turtle() for i in range(3)] for i in range(3): block = snake[i] block.shape("square") block.color('white') # default turtle size is 20px block.penup() # move each block 20px ba...
true
68a3031f6ee5acc0c81ce75b0dc542f0300c5f92
Python
NurlanKhamzin/python-project-lvl2
/gendiff_folder/gendiff.py
UTF-8
711
2.96875
3
[]
no_license
import json def generate_diff(file1, file2): file3 = {} for key, value in file1.items(): if key in file2.keys(): if value in file2.values(): file3[f' {key}'] = value if value not in file2.values(): file3[f'- {key}'] = value if value not ...
true
7404598646069db993480b8cf33cdc857c46d055
Python
CiaranHagen/farmbot_move_absolute
/FARMWARE.py
UTF-8
653
2.734375
3
[ "MIT", "BSD-2-Clause" ]
permissive
import os from farmware_tools import log from farmware_tools import send_celery_script import CeleryPy as cp class MyFarmware(): def __init__(self,farmwarename): self.farmwarename = farmwarename def move(self, posx, posy, posz, spd): """ pos = [x:Int ,y:Int ,z:Int] spd...
true
c8460b3931a3dac1e575bb07b576d3e3e15c32f5
Python
erichhasl/sockets
/python/client.py
UTF-8
4,244
2.875
3
[]
no_license
import socket import struct import ssl from threading import Thread import select class SocketClient: NO_BUFFERING = 0 LENGTH_BUFFERING = 1 DELIMITER_BUFFERING = 2 def __init__(self, ssl_cert=None, buffering=LENGTH_BUFFERING, delimiter='\n'): self.terminated = False ...
true
744cbace88b56658492158ba265059f4c0b5a310
Python
prasanna1695/python-code
/1-4.py
UTF-8
525
4.25
4
[]
no_license
#Write a method to decide if two strings are anagrams or not. def areStringsAnagrams(s1,s2): return set(s1.lower().replace(" ","")) == set(s2.lower().replace(" ","")) print "Test1: 'hello' & 'olhel'" print areStringsAnagrams('hello','olhel') == True #not specified if Caps or Spaces matter but I assume they do not. ...
true
41f9498f1fc87bf867531604349509420c770eaa
Python
Mohamed-Farag/scaner-and-parser-of-Tiny-Language
/parser.py
UTF-8
7,722
3.046875
3
[]
no_license
from Tree import * from tkinter import * #temp = parseTree.Add_node("const" + "\n" + " (" + token1 + ")", "cir") #parseTree.Add_edge(parent, left_child) # connecting parent to left_child #parseTree.Add_edge(parent, right_child) # connecting parent to right_child # important notes #1) make txt file in E ...
true
7ec4b7a58367715f720741366994ddd64f2dffba
Python
JrobT/PyFaceProject
/sort_database/sortDataset.py
UTF-8
1,332
3.03125
3
[]
no_license
#!/usr/bin/env python3 """Python script to combine datasets. I needed my dataset to be large enough to justify my results, therefore I decided I would combine several sources of images together. """ import os import time # Start the script. script_name = os.path.basename(__file__) # The name of this script print(...
true
89aff5fb6147fbb835fd74e36447cbacebc4e367
Python
lenka0813/br_process_control
/weight_gen/test/network_engine.py
UTF-8
7,177
2.6875
3
[]
no_license
''' network distribution calculate engine ''' import numpy as np import threading import cyclequeue as cycle # MAX_WORKER_NUM=8 class exector(object): def __init__(self, num): # worker thread num self.worker_num = num self.is_ok = False self.is_pause = True self.is_task_se...
true
f720a86f842d0726c28154e09c556c04e4b6ffe4
Python
JustinSaintil/MadLib
/MadLib.py
UTF-8
973
2.921875
3
[]
no_license
#! /usr/bin/env python import wx from buttonmodule import * from TextBox import * from CheckBoxes import * # * imports everything in the module vehicle = random.choice(vehicles) names = random.choice(names) objects = random.choice(objects) animals = random.choice(animals) place = random.choice(places) verb = random....
true
5435201005ddd40e2ac76977670344e3cac0dad1
Python
uncl3armen/Autonomous_Land_Vehicle
/FileOps.py
UTF-8
588
3.375
3
[]
no_license
lats = [] lons = [] numofCoord = 0 # Read the Contents of the File def ReadFile(path): file = open(path, "r") data = "" text = file.readlines() global numofCoord for data in text: lat,lon = data.strip().split(',') lats.append(float(lat)) lons.append(float(lon)) numo...
true
07b142d46d6fd011e0eeb0681a7a4d3705c29eb7
Python
JDima/graph-search-contest
/tasks/task2/task.py
UTF-8
288
2.828125
3
[]
no_license
def news_dissemination(n: int, m: int, groups: list) -> list: """ Parameters: :n (int): number of peoples :m (int): number of groups :groups (list): list of list user in groups :return: list of number of people who received the news for each user """ pass
true
21a4262d85626e627d8f6a25b9a435eb77a9bc83
Python
gin2010/python_study
/web/re_test/re_is_right.py
UTF-8
473
3.234375
3
[]
no_license
# -*- coding: utf-8 -*- # File : re_is_right.py # Author: water # Date : 2019/12/15 import re def main(): # 最后三个变量名是不正确的 names = ['age','_age','1age','a_age','age_1_','age1','age!','a#123'] for name in names: ret = re.match(r'[a-zA-Z_][a-zA-Z0-9_]*$',name) if ret: print("att...
true
ff1cd5ca261b8162bef485baf7a55f691cc71fdf
Python
LizaKoliechkina/python-workshop-082021
/DAY-1-FunctionalProgramming/closure.py
UTF-8
799
4.28125
4
[]
no_license
# Design Pattern - FACTORY # CLOSURE - func object that allows access to variables outside local scope def power_n(n): def inner(x): return x ** n return inner power_2 = power_n(2) power_3 = power_n(3) print(power_2(10)) print(power_3(10)) def sentence(name): age = 32 # not used in inner funct...
true
7d3795ddd494a6046e58e6a0e1b3ec65179c60fb
Python
Salihcan29/Reinforcement-Learning
/Q learning maze solver/yazlabgame.py
UTF-8
4,676
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pygame import random import Player class Environment: def __init__(self, m, n): self.observation_space_n = m*n self.action_space_n = 4 # 8 for 8 sides self.n = n self.m = m self.width = m*10 self.h...
true
fa8f5698c160f7e4f4c20c31d0ccec1b83abd745
Python
hixio-mh/HeyLo
/user.py
UTF-8
6,656
3
3
[]
no_license
import operator from abc import ABC, abstractmethod from collections import OrderedDict import re import os import json class User(ABC): username = "" words = OrderedDict() interests = OrderedDict() tweets = "" emojis = OrderedDict() metrics = {} def __init__(self, username): self...
true
761905e3e740266d283eccee281b880d135345f3
Python
xiasiliang-hit/leetcode
/factory_pattern.py
UTF-8
1,440
3.5
4
[]
no_license
from __future__ import generators import random import abc class Factory(object): # Create based on class name: def getShape(type): #return eval(type + "()") if type == "Circle": return Circle() if type == "Square": return Square() # assert 0, "Bad shape creation: " + type # ...
true
aca3f701863cb459237c1987de138c83d8c11c0c
Python
AloshkaD/thunderhill
/PID/tools/twittle.py
UTF-8
1,834
2.78125
3
[]
no_license
import subprocess as sub def run(p): p = sub.Popen(['./runRobot.sh', str(p[0]), str(p[1]), str(p[2])], stdout=sub.PIPE, stderr=sub.PIPE) output, errors = p.communicate() return float(output) def twiddle(tol=0.2): p = [0, 0, 0] dp = [1, 1, 1] best_err = run(p) err = best_err ...
true
779d3291e3070991ce7a16af06f31e570e213c85
Python
toto9230/algorithm_study
/이코테/구현/12-8. 문자열 재정렬.py
UTF-8
459
4.09375
4
[]
no_license
s = input() numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] alphabet = [] number = 0 for word in s: if word in numbers: #반대로 알파벳인지 체크할 때는 그냥 isalpha()함수 쓰면 됨. number += int(word) else: alphabet.append(word) alphabet.sort() if number != 0: alphabet.append(str(number)) #숫자의 합이 0일때...
true
91d71ea876f6fa9f820af1e4e8ff67b31ddef4b0
Python
rodtoll/BlueTracker-Py
/BluetoothDevice.py
UTF-8
2,876
2.78125
3
[]
no_license
__author__ = 'rodtoll' import BluetoothConstants from datetime import datetime class BluetoothDevice: def __init__(self, path, properties, device_present_callback=None, device_property_callback=None): self._is_present = False self._path = path self._name = "" self._rssi = 0 ...
true
cf48ec7b3850664ace40c1e602e1f27faae96abc
Python
KingsleyDockerill/SimpleParser
/parser_.py
UTF-8
2,853
3.0625
3
[]
no_license
from node import * from tokens.token import TokenTypes from error import* class Parser: def __init__(self, toks): self.toks = iter(toks) self.tok = None self.advance() def advance(self): try: self.tok = next(self.toks) except StopIteration: self.tok = None def lparen_missing(self...
true
b29aa0ca3f0686ba732916287e52dcffed332b6b
Python
lorenzo85/python-playground
/boids/bootstrap.py
UTF-8
673
2.6875
3
[]
no_license
from threading import Event from boids import BoidsModel from datatransfer import DataTransfer from gui import GUI WIDTH = 1000 HEIGHT = 600 class Controller: def __init__(self, model): self._model = model def on_down(self): self._model.on_scatter() def main(): thread_events = Event() ...
true
aaba76b4a5775904e7a27abd23c1f95357d71efb
Python
Jyoti1706/Algortihms-and-Data-Structures
/AlgoExpert.io/single_cycle.py
UTF-8
563
3.28125
3
[]
no_license
def getNextIdx(currentIdx, array): jump = array[currentIdx] next_idx = (currentIdx+jump)%len(array) if next_idx >= 0: return next_idx else: return len(array)+next_idx def hasSingleCycle(array): n = len(array) numElementVisited=0 currentIdx = 0 while numElementVisited < ...
true
0596751fc68cd3807483f0cbf8220bc531f5f816
Python
mariocrrt/COVID_Tracker
/app.py
UTF-8
3,352
2.796875
3
[]
no_license
from flask import Flask, render_template, request import requests from dotenv import load_dotenv from bs4 import BeautifulSoup import os from flask_sqlalchemy import SQLAlchemy from googletrans import Translator translator = Translator() # LOADING AND ASSIGNING ENV FILES load_dotenv() API_KEY = os.getenv('API_KEY')...
true
69ed89bb8e68261ec215c6fe1bf427e29d097dbd
Python
Aasthaengg/IBMdataset
/Python_codes/p03003/s544813024.py
UTF-8
736
2.578125
3
[]
no_license
MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): n,m = map(int,input().split()) s = list(map(int,input().split())) t = list(map(int,input().split())) dp = [[0] * (m + 1) for _ in range(n + 1)] if s[0] == t[0]: dp[1...
true
b41573e69bc61b667e60d8181fc19047b7cfa573
Python
vandermeerlab/nept
/tests/test_analogsignal.py
UTF-8
7,186
2.78125
3
[ "Apache-2.0", "MIT", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import numpy as np import pytest import nept def test_analogsignal_time_slice_1d(): data = np.array([9.0, 7.0, 5.0, 3.0, 1.0]) time = np.array([0.0, 1.0, 2.0, 3.0, 4.0]) analogsignal = nept.AnalogSignal(data, time) start = 1.0 stop = 3.0 sliced_analogsignal = analogsignal.time_slice(start, s...
true
57678c82e35d8775d2d06d33a6e4d3075d68e422
Python
Ryuji357/FEIALL
/TCC/Modelo_laser/ray/teste.py
UTF-8
303
2.875
3
[]
no_license
import math class raio: posicao = (0, 0) vetor = (0, 0) velocidade = 1 # Simulação (não condizente com a realidade) def set_vetor(self, angulo): self.vetor = (math.cos(angulo), math.sin(angulo)) def movimento(self): pass class objeto: posicao = (0,0)
true