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
81e5e3a715c492548d14305b6b630b33b91aa12d
dapob1/faveMovies_Udacity_PS1
/PycharmProjects/Udacity/entertainment_center.py
UTF-8
1,897
3.59375
4
[]
no_license
import media # Import media to create instances of movie object import fresh_tomatoes #Import fresh_tomatoes that will be used to display HTML of my favorite movies page """Create instances of movie object for my favourite movies. This is represented with the title, story, image, trailer url, and director...
true
359256bbe53c7f4170a64f62cfbf2f3a23477f94
gabriellaec/desoft-analise-exercicios
/backup/user_019/ch16_2020_10_07_15_49_47_475457.py
UTF-8
128
3.171875
3
[]
no_license
conta = float(input("Qual o valor da conta? ") total = conta * 1.10 print("Valor da conta com 10%: {0.2f}".format (total))
true
d58e8769d789590667890479982c726250d3ea5f
Akhilian/Advent-of-code-2020
/day_7_bags/rules_test.py
UTF-8
6,726
2.984375
3
[ "MIT" ]
permissive
from common.file_reader import FileReader from day_7_bags.rules import parse_rules, \ count_bags_options, \ count_required_bags class TestRules: def test_should_parse_a_single_rule(self): # given rules = parse_rules(["shiny aqua bags contain 1 dark white bag."]) # then ass...
true
ae7a561ba4f259f3ca87160a73397ae652363743
marcho/PythonWSB
/zgadywanka.py
UTF-8
454
4.1875
4
[]
no_license
#!/usr/bin/env python3 #-*- coding: utf-8 -*- import random liczba = random.randint(1,49) #print("Wylosowana liczba: ", liczba) for i in range(6): print("Próba: ", i+1) odp = input("Jaką liczbę od 1 do 49 wylosowano? ") if liczba == int(odp): print("Hura!") break else: print("No niestety!") if int(odp) ...
true
8b5fd4309c9adde3b2f661a68dbf301b254d3210
uncertainty-toolbox/uncertainty-toolbox
/tests/test_utils.py
UTF-8
4,588
2.703125
3
[ "MIT" ]
permissive
""" Test for util functions. """ import pytest import numpy as np from uncertainty_toolbox.utils import ( assert_is_flat_same_shape, assert_is_positive, trapezoid_area, ) def test_is_flat_same_shape_wrong_type(): wrong = [1, 2, 3] with pytest.raises(AssertionError): assert_is_flat_same_s...
true
b38ef4826e5ab6e5364be8bb2114603dad81fc9c
dglol/msgfuse
/msgfuse/scripts/rsg.py
UTF-8
226
3.28125
3
[ "MIT" ]
permissive
import sys, random charset = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789' def generate(): strlist = [] for i in range(5): strlist.append(random.choice(charset)) return ''.join(strlist)
true
c2fd160f37706a290756632e763aa36b495b7199
Aasthaengg/IBMdataset
/Python_codes/p03042/s721671297.py
UTF-8
231
3.359375
3
[]
no_license
s=(input()) s1=int(s[:2]) s2=int(s[2:]) if 1<= s1 <=12 and 1<= s2 <= 12: print("AMBIGUOUS") elif 0<= s1 <=99 and 1<= s2 <= 12: print("YYMM") elif 1<= s1 <=12 and 0<= s2 <= 99: print("MMYY") else: print("NA")
true
30da56c935149f807bc9893a7f160863dc59f1db
xidchen/MONAI
/monai/data/nifti_writer.py
UTF-8
6,409
2.640625
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 MONAI Consortium # 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 agreed to in writing, s...
true
839007d5299a647a8989ab1b7f82758637d4834b
be320/Ask-Banky-Classifier
/venv/bot.py
UTF-8
1,077
3.296875
3
[]
no_license
import re import pandas as pd def text_normalize(text): text = str(text) # denoise noise = re.compile(""" ّ | # Tashdid َ | # Fatha ً | # Tanwin Fath ُ | # Damma ٌ | # Tanwin ...
true
90f29f82741743eb9863602e548f105098adba96
CanadianPirate/Stock_Info_Emailer
/Base/External_File.py
UTF-8
167
2.875
3
[]
no_license
file = open("Tickers.txt", "r").readlines() line_number = len(file) Tickers = [] for i in range(line_number): line = file[i] Tickers.append(str.strip(line))
true
d0e6d3894e5cdbb3911dba6782d434a6c645e283
rsheftel/pandas_market_calendars
/tests/test_nyse_calendar_early_years.py
UTF-8
141,237
2.65625
3
[ "MIT", "Apache-2.0" ]
permissive
import pytz import pandas as pd from pandas.testing import assert_index_equal from pandas.tseries.offsets import CustomBusinessDay from pandas_market_calendars.exchange_calendar_nyse import NYSEExchangeCalendar nyse = NYSEExchangeCalendar() def test_time_zone(): assert nyse.tz == pytz.timezone('America/New_York...
true
8dc3dff40ec0d3644876aad717b8b94995f99520
niolabs/nio
/nio/testing/condition.py
UTF-8
1,690
3.203125
3
[]
no_license
from threading import Event from time import sleep from nio.util.threading import spawn class ConditionWaiter(object): def __init__(self, event, callback, *args, sleep_step=0.001, **kwargs): self._event = event self._callback = callback self._sleep_step = sleep_step self._args = a...
true
3276dc8dd8b66d40850c80e46cf85d3371b17cec
ZANHAODA/shijie_bishe
/RBLTF_model_db32_3.py
UTF-8
7,240
2.96875
3
[]
no_license
import numpy import matplotlib.pyplot as plt from pandas import read_csv import math import os os.environ['KERAS_BACKEND']='theano' from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_absolute_er...
true
57c2978c99d2a87338409b43113487f17767ab8f
coralisland-git/web-spider-cloud
/original/chainxy/spiders/instagram.py
UTF-8
2,290
2.515625
3
[]
no_license
# from __future__ import unicode_literals import scrapy import json import os from scrapy.spiders import Spider from scrapy.http import FormRequest from scrapy.http import Request from chainxy.items import ChainItem from lxml import etree from selenium import webdriver from lxml import html import usaddress import pdb ...
true
1e7b93f8ec87043881fd1a05bbe991baf76b4d05
bradyzp/TideSQSDaemon
/src/restapi.py
UTF-8
2,210
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from datetime import datetime from flask import Flask, jsonify, request from flask_restful import Api, Resource from marshmallow import Schema, fields, post_load import tidegravity as tg app = Flask(__name__) api = Api(app) class Location: def __init__(self, **kwargs): self.lat...
true
8675a5a61c363693da06319a14093bba30d92a72
RubeusH/Python_Learning
/Chapter-05/Algorithm-Workbench/10-first-name.py
UTF-8
215
3.78125
4
[]
no_license
''' Write a function named get_first_name that asks the user to enter his or her first name, and returns it. ''' def get_first_name(): return input("Please enter your first name here: ") print(get_first_name())
true
dd72f0d5e18f7dd502fb8a5d9d033b9d8d47038d
YTsuchimoto/EC21
/210708/2210104022/SPX.py
UTF-8
1,178
2.75
3
[]
no_license
import numpy as np try: from collections.abc import Sequence except ImportError: from collections import Sequence from itertools import repeat def cxSimplexCrossover(inds): P = np.array(inds) G = np.sum(P, axis=0) eps = np.sqrt(len(P) + 1) x = G + eps * (P - G) r = np.array([0] + [np.ran...
true
848a6dbeb5d40500960df8a1de1e1417073a3f04
vijayyevatkar/project_lc
/Easy/Reverse_Linked_List.py
UTF-8
560
3.25
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: prevNode = None traversalNode = head nextNode...
true
46f0cfc6b0afb515e45080e2376b9c5deb9542cd
MelonIs45/CSSbot
/extensions2/info_commands.py
UTF-8
2,606
2.78125
3
[ "MIT" ]
permissive
import discord import os import json import datetime from discord.ext import commands cwd = os.path.dirname(__file__) jsonPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "config2.json") config = json.loads(open(jsonPath, "r").read()) class Info_commands(commands.Cog): def __init__(self, cli...
true
3709fd23d7e57286232b02e2367f12649921448c
Jenni-Foued/holberton-system_engineering-devops
/0x16-api_advanced/1-top_ten.py
UTF-8
605
3.09375
3
[]
no_license
#!/usr/bin/python3 """ Contains one function top_ten """ import requests def top_ten(subreddit): """ queries the Reddit API and prints the titles of the first 10 hot posts listed for a given subreddit """ url = 'http://www.reddit.com/r/{}/hot.json'.format(subreddit) headers = {'User-Agent': '...
true
a8c493116cb19d9f7f78dfa9a5b2c72c8f62c8bc
skirby1996/FoundationsOfML
/csv_fixer.py
UTF-8
233
2.65625
3
[]
no_license
original = open('winequality-white.csv', 'r') new = open('winequality.csv', 'w') lines = original.readlines() for line in lines: vals = line.split(';') line = ','.join(vals) new.write(line) original.close() new.close()
true
3981707c25df453068492254f4b0de242ad8fc9b
diegohabarbosa/Basics-Projects
/CursoemVideo/Curso_de_Python/Mundo2_40hs/Exercícios/ex053.py
UTF-8
427
4.03125
4
[ "MIT" ]
permissive
#053 - Detector de Palíndromo for c in range(0,1): f = str(input('Insira uma frase para idenficar se é um Palíndromo: ')).strip() fr = format(f.replace(' ','')).upper() rf = fr[::-1] if fr == rf: print('O inverso de {} é {}'.format(fr,rf)) print('Essa frase é um Palíndromo') else: ...
true
b8848faa83c94dfffae933790b8435d97ad65029
aizwellenstan/mmdpaimaya
/pykakasi/genkanwadict/mkkanwa.py
UTF-8
2,161
2.6875
3
[]
no_license
#!/usr/bin/env python from zlib import compress import re from marshal import dumps try: from cPickle import dump except: from pickle import dump try: import anydbm as dbm except: import dbm class mkkanwa(object): records = {} def run(self, src, dst): for line in open(src, "rb"): ...
true
b033f629982db058a4e7198077ba5c818cde63f0
Rlmuniz/toa
/toa/models/aero/lift_coef_comp.py
UTF-8
5,553
2.53125
3
[]
no_license
import numpy as np import openmdao.api as om from toa.data import Airplane from toa.data import get_airplane_data class LiftCoeffAllWheelsOnGroundComp(om.ExplicitComponent): def initialize(self): self.options.declare('num_nodes', types=int) self.options.declare('airplane', types=Airplane, ...
true
0d29d6749782b3a9a8bc847c76023937ad4049f6
Drop-N-Code05/python-fundamentals-course
/PythonFundamentals/Chap_05/Test.py
UTF-8
177
3.171875
3
[]
no_license
def favorite_city(name): print("One of my favorite cities is", name) favorite_city("Los Angeles, California") favorite_city("New York") favorite_city("Las Vegas, Nevada")
true
16705e2805e5378e2714b63a013a4a15851d662b
625781186/PyQt
/界面美化/水波纹进度条/ProgressBar.py
UTF-8
5,167
2.96875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created on 2018年4月1日 # author: Irony # site: https://github.com/892768447 # email: 892768447@qq.com # file: ProgressBar # description: __Author__ = """By: Irony QQ: 892768447 Email: 892768447@qq.com""" __Copyright__ = 'Copyright (c) 2018 Irony' __Version__...
true
dca42c5a185f6f0a7c7a27e4833836b2c790971a
ilkergurcan/GANs
/CGAN/main.py
UTF-8
4,251
2.53125
3
[]
no_license
import torchvision import cv2 from tensorflow.keras.datasets import mnist import numpy as np from generator import generator from discriminator import discriminator import torch.nn as nn import torch as T from torch.utils.data import DataLoader device = T.device('cuda:0' if T.cuda.is_available() else 'cpu') f...
true
f0f5782317522a32786e28ea32c5b38b2b763c67
humantl1/full-stack
/code/python/intermediate-python/intermediate-python-project/intermediate_python_project.py
UTF-8
934
3.796875
4
[]
no_license
# 1. prompt for user input: which pokemon # [offer selection of poke, use api offset to display 20 pokes at a time] # 2. create dynamic url based on step 1 # 3. fetch data from url made in step 2 # 4. convert json data into dictionary # 5. print data # [print basic data. offer additional data via prompt] i...
true
a1a23d645ea00491a6df02460890c6ef607ee8f8
Qix-/py-starbound
/export.py
UTF-8
1,734
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import optparse import os import sys import starbound def main(): p = optparse.OptionParser() p.add_option('-d', '--destination', dest='path', help='Destination directory') options, arguments = p.parse_args() if len(arguments) != 1: raise ValueError('On...
true
1210e9fd492724a631ad25d3c5a99ffde58ce61c
Rinkikumari19/python
/while_loop/pattern.py/star_pattern.py
UTF-8
105
3.5
4
[]
no_license
a=1 while a<5: b=5 while b>a: print("*",end="") b=b-1 print(" ") a=a+1
true
2daa1e48182faa9fb01659ac57536439a8e9ad15
FRC2914/aerial-assist
/python vision stuff/pyballfinder/ballFinder.py
UTF-8
4,996
2.890625
3
[ "BSD-2-Clause" ]
permissive
import cv2 import numpy as np import math import ConfigParser import socket import sys """ looks for blobs. calculates the center of mass (centroid) of the biggest blob. sorts into ball and bumper, then send over tcp """ #parse config stuff config = ConfigParser.RawConfigParser() config.read("../vision.conf") exp...
true
413a18d0fbd75433f69b9887e2155685c08cdccd
jiaying777/DATA-STRUCTURES-AND-ALGORITHMS
/HW4/hash_table_05113009.py
UTF-8
2,262
3.265625
3
[]
no_license
class ListNode: def __init__(self, val): self.val = val self.next = None class MyHashSet: def __init__(self, capacity=5): self.capacity = capacity self.data = [None] * capacity def add(self, key): temp = self.MD5(key) temp = int(temp,16) index = temp...
true
fbfdc13319d2fe1d1bd7caa523108a81622d1323
adityaa30/translate
/translate/utils.py
UTF-8
5,876
2.96875
3
[]
no_license
import unicodedata import re import io import pickle import os import errno import logging import matplotlib.pyplot as plt import matplotlib.ticker as ticker import tensorflow as tf import translate.constant as constant LOGGER = logging.getLogger(__name__) K = tf.keras KP = tf.keras.preprocessing # Converts the u...
true
8ae4b55463a13eb0109f98ff761fa47fd691825e
dmswjd9501/startcamp
/day2/os_intro.py
UTF-8
327
3.015625
3
[]
no_license
import os ls = os.listdir('.') # ls와 같은 동작을 한다. listdir : ls # 현재 디렉토리에 있는 파일 및 폴더들 print(ls) pwd = os.getcwd() # getcwd (get current working directory) : pwd # 현재 파일이 실행된 디렉토리 (작업하고 있는 디렉토리) print(pwd) os.chdir(r'./dummy') print(pwd)
true
61b469785ee1a9d89550b5c8166f991a4eef7f70
tjwei/HackNTU_Data_2017
/Week01/q0.py
UTF-8
82
2.921875
3
[ "MIT" ]
permissive
x = np.linspace(-1,1,11) plt.plot(x, x**2+1, "g^", x, x**3, 'ro', x, x**2+1, 'b');
true
27e35b786101b094fde84b0c6cc4a702a0ac44ec
dhendon101/Pygame-Framework
/constants.py
UTF-8
281
2.75
3
[]
no_license
import pygame #Keyboard K_UP = pygame.K_UP K_DOWN = pygame.K_DOWN K_LEFT = pygame.K_LEFT K_RIGHT = pygame.K_RIGHT K_ESC = pygame.K_ESCAPE K_RETURN = pygame.K_RETURN #Color BLACK = (0,0,0) WHITE = (255,255,255) RED = (255,0,0) GREEN = (0, 255, 0) BLUE = (0, 0, 255)
true
ef63e3c5048cfcc0c1c657a566dfdcd5baad81ec
FanWu-fan/Cs_231n
/chapter1/quciksort.py
UTF-8
312
3.4375
3
[]
no_license
def quicksort(arr): if len(arr) <=1: return arr pivot = arr[int(len(arr)/2)] left = [x for x in arr if x<pivot] middle = [x for x in arr if x==pivot] right = [x for x in arr if x > pivot] return quicksort(left) + middle + quicksort(right) print(quicksort([3,6,58,9,1,1,4,7,8,9]))
true
fb8dd92b94f08b28109a92a5f450dd437bf7d8f4
mbellitti/lp
/sodium_chloride.py
UTF-8
348
2.78125
3
[]
no_license
from visual import sphere, color L = 1 RNa = 0.3 RCl = 0.2 for i in range(-L, L + 1): for j in range(-L, L + 1): for k in range(-L, L + 1): if (i + j + k) % 2 == 0: sphere(pos=[i, j, k], radius=RCl, color=color.magenta) else: sphere(pos=[i, j, k], rad...
true
5463b6d014de63ee59ca22535b7890c6784db0f4
lisabang/weare
/weare/juanbatista.py
UTF-8
536
3.6875
4
[]
no_license
flag = True print("I'm a chatbot. Talk to me because you have no friends.") print("The only way this pointless conversation is ending is if you tell me to go away!") while flag == True: user_response = input() user_response = user_response.lower() if 'go away' == user_response: flag = False el...
true
02b10f6a263927385d4a1cded07d5b2d0a074387
legg2710/python-lists-loops-programming-exercises
/exercises/02.4-One_last_looping/app.py
UTF-8
161
2.71875
3
[]
no_license
my_sample_list = ['Esmeralda','Kiko','Ruth','Lebron','Pedro','Maria','Lou','Fernando','Cesco','Bart','Annie'] #Your code here: for i in range(my_sample_list):
true
f32ef4573d4c2b25fc501f37a17df38651e73e69
Shakarbek/week8
/3cycle1/2E.py
UTF-8
63
3.125
3
[]
no_license
n=int(input()) s=1 k=0 while n>s: s*=2 k+=1 print(k)
true
f367cfb9bf9b6754c4c6ad4cc6fa849d702100ea
keimasunaga/IUVS_py
/lib/Pyuvs/miscellaneous.py
UTF-8
1,730
3.515625
4
[]
no_license
import time import numpy as np def clear_line(n=100): """ Clears a previously-printed line in the terminal output. Parameters ---------- n : int Number of characters to clear (defaults to 100). Returns ------- None. """ print(' ' * n, end='\r') def mirror_...
true
4e1d7d57428e0e9f2ef2f5910bc9070b24f4efba
onlytiancai/codesnip
/python/sprace.py
UTF-8
1,601
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- ''' 实验目的:测试单核CPU需不需要加锁 count = count + 1 这个语句不是一个原子的操作,多个线程/协程在不加锁的情况会造成竞争条件。 但实际结果是: 1. 用python自带的线程测试,出现竞争条件问题,多次测试每次结果都不是5000000 2. 用gevent的协程测试,就没有问题,最终用结果都是5000000 结论: 1. 尽管python有GIL,同一时间只有一个线程执行,但不用锁是不安全的。 2. gevent的协程可能实现的有问题,不会再一条语句执行半拉时做上下文切换,所以不加锁也不会有问题。 3. 可能好些语言的协程也做不到像真正的操作系统线程...
true
e7c71e0fbec5077b7a0c2137508ef5ddae6d8375
OpenTransitTools/gbfsdb
/ott/gbfsdb/stations.py
UTF-8
2,187
2.78125
3
[ "Apache-2.0" ]
permissive
from ott.gbfsdb.gbfs_client import GbfsClient import logging log = logging.getLogger(__file__) class Stations(object): """ combine stations @see https://github.com/NABSA/gbfs @see https://github.com/NABSA/gbfs/blob/master/systems.csv """ _station_cache = None def __init__(self, base_url):...
true
3089a6f36388180c2171df3c4d0e9b2fedaddc5c
bahtman/socialdata
/dynamic_plotting.py
UTF-8
4,372
2.8125
3
[]
no_license
import pandas as pd import numpy as np import folium import folium.plugins from folium.plugins import HeatMap import plotly.express as px from filtering import * def filterdf(temp, humid, vis, wind): filtered_df = full_df[full_df['Temperature'].between(temp[0],temp[1])].copy() filtered_df = filtered_df[filte...
true
31931b8293d2d03b28df48430902d3e6cdda20ff
tianhaiv/oa_project
/page/ec.py
UTF-8
1,418
3.296875
3
[]
no_license
#coding:utf-8 from selenium.webdriver.support import expected_conditions as EC from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait import time class find_element(): def __init__(self,by,value): self.by=by self.value=value def __call__(self,driver): e...
true
6498bf580de51421effe9a54f59ebf229fa2fa7f
teyden/llist
/testSuite.py
UTF-8
9,349
3.828125
4
[]
no_license
from A4Q1e import * def main(testLevel): if testLevel == 1: L = LinkedList() print "\n\n\tTESTLEVEL = 1\n\n" # # # Test constructor __init__ print "***Test __init__ ***" if L.head == L.tail and L.tail == None: print "Passed test 1, __init__: ...
true
342eb844acb995b5bcdd7084fd2b27cc0b73fe84
addercop/knapsack
/src/random_instance.py
UTF-8
645
3.578125
4
[]
no_license
#!/usr/bin/python '''Helper script to generate problem instances and write them to stdout.''' import sys import knapsack def print_random_problem(size): '''Print out a random problem instance of the given size.''' problem = knapsack.get_random_problem(size) print problem.knapsack_capacity for item in ...
true
aff7927811714cd4f3879ea03562d7a06c6f3e21
fand/gakushu
/updateQ.py
UTF-8
2,031
2.578125
3
[]
no_license
# -*- coding:utf-8 -*- import pytetris as pt from egreedy import get_reward from qlearning import add_state import lists # updateQ:価値の更新。疑似コード等を参考に def updateQ(c_state, action, alpha, gamma): num_s = add_state(c_state) num_a = lists.action_list.index(action) reward = 0 #get_reward() piece = c_state[1]...
true
6fd0513788ae054c97f483fb9b98299f52796d89
Jscott-2k/Bot-PokemonTRPS-Python
/cogs/Play.py
UTF-8
937
2.75
3
[]
no_license
from discord.ext import commands from discord.message import Message from Main import Client from Game import Game class Play(commands.Cog): def __init__(self, bot): self._bot:Client = bot @commands.command(name="play", pass_context=True) async def play_normal(self,ctx, *, message=None): ...
true
74bcdc9fd5a64be8c24e40da0b970da2b6a15c05
Berchon/trybe-exercises
/modulo4/bloco35/dia2/example/example-base.py
UTF-8
1,350
4.21875
4
[]
no_license
# Suponha que você precisa criar um software que gera Relatórios de Vendas. # Nosso programa tem que conter toda uma lógica para ler dados e criar o # relatório e, ao final, vamos gerar um arquivo imprimível com tais dados. # Um JSON, por exemplo. Como estamos trabalhando com orientação a objetos, # vamos pensar! Qual ...
true
d97380ef6cdb4c3d7e3b0311c6278d4f6fc7d074
labulakalia/note
/python_notes/一些代码/线程进程协程/进程/sem_process.py
UTF-8
763
3.265625
3
[]
no_license
# 信号量 Semaphore # 互斥锁,同时只允许一个进程更改数据 # Semaphore 信号量是同时允许一定数量的线程更改数据 # from multiprocessing import Process, Semaphore import time import random def run(sem, user): sem.acquire() print('%s 进程' % user) time.sleep(random.randint(0, 3)) sem.release() if __name__ == '__main__': sem = Semaphore(3)...
true
3398975099f657c41edd46b4791e2da45526405e
ThomasKluiters/dronetect
/src/main/python/process_video.py
UTF-8
521
2.53125
3
[]
no_license
import cv2 import scipy.io.wavfile as wav import sys import audio def process(videopath, audiopath, database): """Process a 2 second long video and decide if it is a category 2 scene""" cap = cv2.VideoCapture(videopath) samplerate, samples = wav.read(audiopath) audio_label = audio.process(sam...
true
ed8f7545047cf1f9982c3fa24ad3228ed6ad02e9
harmanpunn/ds-algo
/leetcode-explorecards/dp/maximumScore.py
UTF-8
474
2.84375
3
[]
no_license
from functools import lru_cache def maximumScore(nums, multipliers): @lru_cache(2000) def dp(i, left): if i == m: return 0 mult = multipliers[i] right = n - 1 - (i - left) return max(mult * nums[left] + dp(i+1, left+1), mult * nums[right] + dp(i+1, left))...
true
2e7c84763e6b503530bc3834c563c820ead0f6c1
mohammads19849/NaiveBayes_Using_GaussianPDF
/naiveBayes.py
UTF-8
4,799
3.03125
3
[]
no_license
import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split import math #Getting Data iris = datasets.load_iris() X = iris.data[:, :4] y = iris.target #Splitting into testing and training sets X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_s...
true
516b6ce1b1b766680ca1a36f3b24dfa1a6cd6132
pabadrubio/toshl_sync
/legacy/csvfile.py
UTF-8
1,474
3.046875
3
[ "Apache-2.0" ]
permissive
# Pablo Abad 2017 # # Toshl database program import csv import datetime class CSVTransfer: def __init__(self, date, effectiveDate, account, message, purpose, amount): self.date = date self.effectiveDate = effectiveDate self.account = account self.message = message self.purp...
true
4402e3fd8ffc69af3f301c7d945944bced06614b
Patsch36/Algorithmen-und-Komplexitaet
/VL02/Komplexitätsklassen.py
UTF-8
2,477
3.21875
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt import matplotlib.pyplot as plt # ignore numpy warnings by calculating logarithms from 0 import warnings warnings.filterwarnings("ignore", category=RuntimeWarning) if __name__ == "__main__": # x_values also corresponds to n- row x_values = np.arange(0, 1...
true
bb135092011b28e8416e36b2cd454d7d20845f57
HankTsai/Smart__Fridge
/Image_Detect/Transfer_learning_inceptionv3/predict.py
UTF-8
2,334
2.84375
3
[]
no_license
from tensorflow.keras.models import load_model import numpy as np import os import cv2 class inception_retrain(object): def __init__(self,img_path): self.label = ['banana', 'cabbage', 'egg', 'eggplant', 'onion', 'tomato'] self.img_path = img_path #'FinalData_250/test/' self.model=load_mod...
true
f65097ba9eba189f640b31430c6d4f87f57da2cd
mnihatyavas/Python-uygulamalar
/Brian Heinold (243) ile Python/p11008.py
ISO-8859-9
1,080
3.484375
3
[]
no_license
# coding:iso-8859-9 Trke print ("10x10'luk arpm cetveli:") for i in range (1,11): for j in range (1,11): print ('{:4d}'.format (i*j), end='') print() bayrak = True x = -49 while -50<x<50 and bayrak: y = -49 while -50<y<50 and bayrak: if 2 * x + 3 * y ==4 and x - y == 7: ...
true
c9d4b331f77b53ba6c6e1744bb91763e3faef862
kpranshu/python-demos
/15-Map, Reduce and Filter/filter-3.py
UTF-8
306
3.140625
3
[]
no_license
#List of All Prouducts whose price is above 50000 import requests url="http://gadgetworld.000webhostapp.com/getproducts.php?cid=8" data=requests.get(url) products=data.json() result=list(filter(lambda x: float(x['price'])<50000,products)) for product in result: print("Name : " + product['name'])
true
1b495c80c68ed631717ab542520f0ca6473efa05
tsroten/dragonmasher
/dragonmasher/data.py
UTF-8
1,245
2.890625
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
"""Data functions and classes for dragonmasher.""" from __future__ import unicode_literals from dragonmasher.sources import BaseSource from dragonmasher.utils import update_dict def mash(*args, **kwargs): """Mashes data sources together. :param dragonmasher.sources.BaseSource *args: Two or more child class...
true
77251e0720226237138fb40faa609fee08d8279c
made-ml-in-prod-2021/bulaevvi
/online_inference/app.py
UTF-8
2,445
2.625
3
[]
no_license
import os import pickle from typing import List, Union, Optional import pandas as pd import uvicorn from fastapi import FastAPI from pydantic import BaseModel from sklearn.preprocessing import FunctionTransformer, MinMaxScaler from sklearn.pipeline import Pipeline, FeatureUnion from sklearn.ensemble import RandomFores...
true
f784314c05a900ae2e10e70b2e525ee485ab4340
johanBlad/topic-modeling
/src/results/metric.py
UTF-8
1,640
2.75
3
[]
no_license
from gensim.models.coherencemodel import CoherenceModel import numpy as np def get_metric_cv(topics, texts, gensim_dict): cm = CoherenceModel(topics=topics, texts=texts, dictionary=gensim_dict, coherence='c_v', topn=12) coherence = cm.get_coherence_per_topic(with_std=True) # Return format list of coherence...
true
6021f9782a83f8dc6b52347350e3e068d986a0a4
ElvisRodriguez/Courses
/CS241-Discrete_Structures/Lab3/cartesian_product.py
UTF-8
560
3.734375
4
[]
no_license
def cartesian_product(A, B): result = [] for i in range(0, len(A)): for j in range(0, len(B)): temp = [] temp.append(A[i]) temp.append(B[j]) temp = tuple(temp) result.append(temp) return result #These test lists are the sets (E x F) and G ...
true
7b812bb3e80f92e2c86346d70f3d635c2b0c61a5
TestingPertama/testing-project
/function/soal1.py
UTF-8
445
3.421875
3
[]
no_license
def ganjilGenap(angka) : if(angka % 2 == 0) : return 'Genap' return 'Ganjil' def ubahJadiGanjilGenap(listAngka) : return list(map(ganjilGenap, listAngka)) list1 = [1,3,4,5] list2 = [22,17,19,20,14] list3 = [1,3,5] list4 = [2,4,6] list1 = ubahJadiGanjilGenap(list1) list2 = ubahJadiGanjilGenap(list...
true
d1edcc232cdc976a4a2d0c75907b2b43a1fbcd83
abjugard/advent-of-code-2019
/src/day17-set_and_forget.py
UTF-8
1,461
2.6875
3
[]
no_license
from santas_little_helpers import day, get_data, timed, alphabet, submit_answer, base_ops from santas_little_utils import run_vm, get_last today = day(2019, 17) offsets = [ (0, 1), (-1, 0), (0, -1), (1, 0) ] m = [] def is_intersection(x, y): height = len(m)-1 width = len(m[0])-1 for x2, y2 in [(x + xdiff,...
true
63e249a59f113ca8951fa1d45ad187cfc281592e
terry-gjt/csp_python
/st201703-1.py
UTF-8
363
2.578125
3
[ "MIT" ]
permissive
# 分蛋糕 def st170301(): n,k = list(map(int,input().split())) numbers=list(map(int, input().split())) temp=0 num=0 for i in numbers: temp+=i if temp>=k: # print(temp) temp=0 num+=1 if temp==0: print(num) else: print(num+1) if _...
true
f9aafb6d2fd62389755f2b86e5c66e1ace342037
alteredtech/BioModeling
/test/test.py
UTF-8
1,973
2.859375
3
[]
no_license
import numpy as np import math np.set_printoptions(precision = 4, suppress=True) pi = math.pi def Copper(LengthStep, TimeStep, alpha, TotalLength): numberOfLengthSteps = int(TotalLength/LengthStep)+1 storageArray5 = np.zeros((2,numberOfLengthSteps)) storageArray5[0] = [0, 100, 100, 100, 100, 100, 100, 100...
true
1619d38183476694d6b753d2464b80657108126c
miriamlam1/csc349
/asgn7-miriamlam1/subgraph_isomorphism.py
UTF-8
1,964
3.828125
4
[]
no_license
"""Naive brute force solution to the subgraph isomorphism problem.""" # NOTE: Do not alter this file. # CSC 349 Assignment 7 import argparse import itertools from typing import Optional from graph import Graph parser = argparse.ArgumentParser() parser.add_argument('g_file') parser.add_argument('h_file') ...
true
a62cf01513a0b50ca3f4362d765eafdfa2e3a25f
phlalx/algorithms
/leetcode/1213.py
UTF-8
669
2.921875
3
[]
no_license
#TAGS merge # easy class Solution: def arraysIntersection(self, arr1: List[int], arr2: List[int], arr3: List[int]) -> List[int]: n = len(arr1) p = len(arr2) q = len(arr3) i = 0 j = 0 k = 0 res = [] while i < n and j < p and k < q: if arr1[...
true
081dedf97fcc38df81709f2905aa2ff61bc56609
unolight/MatrixFactorization
/m2.py
UTF-8
5,171
2.515625
3
[]
no_license
from numpy.random import laplace, normal, exponential, random_integers from numpy import sqrt, exp import numpy as np import sys N = 943 # users M = 1682 # items K = 8 # latent features, between 20 to 100 P = 1e9 maxr = 5 # max rating score minr = 1 # min rating score alpha=0.01 beta=0.001 epi = 1e9 Ratings = np.z...
true
7f48c322a5dcc24234ba21dea6b41362fabcfadb
apsistech/Solarium
/Cellular/src/check_network.py
UTF-8
343
2.703125
3
[]
no_license
#!/usr/bin/python import time, datetime import urllib2 def check_connect_to_github(): try: urllib2.urlopen('https://github.com/', timeout=5) return True except urllib2.URLError as err: return False while 1: print datetime.datetime.utcnow().isoformat() + 'Z', check_connect_to_githu...
true
a25b52cddeca62a71db6222ff073f687e6a19bae
mcarter/csp
/cspacceptor/protocol.py
UTF-8
1,423
2.609375
3
[]
no_license
import http import config import error try: import json except: import simplejson as json class Session(object): def __init__(self, key): self.key = key self.sentEventId = 1 def send(self, data): packet = json.dumps([[self.sentEventId,0, data]]) self.sentEventId += ...
true
ee05745cf49ce059708af4413aa9361dceb50985
project-72/uk-companies-house-parsers-public
/process_company_appointments_data.py
UTF-8
7,636
2.78125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import csv import os import sys COMPANIES_OUTPUT_FILENAME_TEMPLATE = "companies_data_%s.csv" PERSONS_OUTPUT_FILENAME_TEMPLATE = "persons_data_%s.csv" SNAPSHOT_HEADER_IDENTIFIER = "DDDDSNAP" TRAILER_RECORD_IDENTIFIER = "99999999" COMPANY_RECORD_TYPE = '1' PERSON_RECORD_TYPE = '2' def process_header_row(row): head...
true
f96a7f94a13ad89dcac55ed03b6c8cbb383fdaa6
ck-china/pythonjc
/mon2/p04/gun.py
UTF-8
1,126
2.953125
3
[]
no_license
class peo: def __init__(self,name): self.name=name self.blood=100 self.guns=[] def chiqiang(self,qiang): self.qiang=qiang self.guns.append(self.qiang) def __str__(self): return '正前方有%s,悠闲的挑逗这你家的哈士奇,老王有%d血量'%(self.name,self,blood) def zhuangdan(self,): ...
true
ba5bf0caaaec021d43f3dda9493b7112914a9366
cffppa/webdriver_location_colloction-master
/python/level2.py
UTF-8
2,758
3.375
3
[]
no_license
#coding=utf-8 from selenium import webdriver from time import sleep import os import random file_path = 'file:///'+os.path.abspath('locator.html') dr = webdriver.Chrome() dr.get(file_path) ''' #task 2.1 Select all the checkboxes checkboxes = dr.find_elements_by_css_selector('input[type="checkbox"]') for checkbox in c...
true
09c4f4316787bab9b42a1a70555205bf84132339
EdwaRen/Competitve-Programming
/Leetcode/760-find_anagrams.py
UTF-8
272
3.109375
3
[ "MIT" ]
permissive
class Solution(object): def anagramMappings(self, A, B): arr = {} for i in range(len(B)): arr[B[i]] = i return [arr[k] for k in A] l1 = [12, 28, 46, 32, 50] l2 = [50, 12, 32, 46, 28] a = Solution() print(a.anagramMappings(l1, l2))
true
1891952417a8676645153c462c19a0d8ff6398c2
Gatesby/Python
/Exercise_Charpter6.py
UTF-8
9,215
3.484375
3
[]
no_license
'''import string alphas = string.letters + '_' nums = string.digits print 'Welcome to the Identifier Checker V1.0' print 'Testees must be at least 2 chars long' myInput = raw_input('Identifier to test?') if len(myInput) > 1: if myInput[0] not in alphas: print invaild: first symobl must be ...
true
b5a0f0e48df0207d7c1d1d75e76a58fd8d25c990
zhuzhengren/sklearn
/4_16.py
UTF-8
350
2.84375
3
[]
no_license
import gensim model = gensim.models.KeyedVectors.load_word2vec_format('') embdding = model.word_vec('cat') print("dimmensions: %s" % embdding.shape) print(embdding) print(model.most_similar(positive=['puppy','cat'], negative = ['kitten'],topn=1)) for i in model.most_similar(positive=['saddle','painter'],negative=...
true
fa88b296d07997d70624c609325c3ab0e5debcfb
NabilAbdHadi/early-stage-depression-screening-tool
/text_preprocessing.py
UTF-8
4,727
3.015625
3
[]
no_license
#import malaya as my import json from malaya import spell, preprocessing, normalize, stem, pos import string import re import pandas as pd import re import database class TEXT_PREPROCESSING: """ initialize all models of malaya """ def __init__(self): self.corrector = spell.probability() self...
true
bb3d95002d46da2d47dd0ec5784b9316b62b7091
rpm1995/LeetCode
/549_Binary_Tree_Longest_Consecutive_Sequence_2.py
UTF-8
1,031
3.015625
3
[ "MIT" ]
permissive
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def longestConsecutive(self, root: TreeNode) -> int: def helper(node): if not node: ...
true
006addfb248c4d0edf74940544c313fff4863ad8
Aasthaengg/IBMdataset
/Python_codes/p02743/s003037978.py
UTF-8
127
3.078125
3
[]
no_license
a, b, c = map(int, input().split()) if 2*(a*b + (a+b)*c) < a**2+b**2+c**2 and c > a + b: print('Yes') else: print('No')
true
6d6a74d89ec52ca1fa7d5fdd0c401fd17aeb2142
CateGitau/Python_programming
/ace_python_interview/sort_search/find_two-nums_add_to_n.py
UTF-8
2,047
4.375
4
[]
no_license
'''In this problem, you have to implement the find_sum(lst, n) function which will take a list lst and number n as inputs and return two numbers from the list that add up to n.''' #my dumb solution def find_summ(lst, n): for i in range(len(lst)): diff = n - lst[i] if diff in lst: retur...
true
63f41ab315c9c922fcf9e0eb39de88da6d1a2348
g12mcgov/WIN
/loggings/loggerConfig.py
UTF-8
675
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/python # Name: WIN # File: WIN/loggings/loggerConfig.py # # Author(s): Grant McGovern & Gaurav Sheni # Date: Wed 11 March 2015 # # URL: www.github.com/g12mcgov/WIN # # ~ Description: # - Defines a configLogger() method which allows a global # logger (with specific names) to be used throughout the...
true
13dd34423882a3b178fdc988523d2af6021ee6d9
thelaughingada/xivapi-py
/pyxivapi/models.py
UTF-8
672
2.9375
3
[ "MIT" ]
permissive
from .exceptions import XIVAPIInvalidFilter class Filter: """ Model class for DQL filters """ comparisons = ["gt", "gte", "lt", "lte"] def __init__(self, field: str, comparison: str, value: int): comparison = comparison.lower() if comparison not in self.comparisons: ...
true
0b8b73b1798621736a48be78d67498f9ae144f68
leilacey/LIS-511
/Chapter 2/name_cases.py
UTF-8
646
4.59375
5
[]
no_license
#2-3 Personal Message name = "Leiya" print("Hello " + name + ", would you like to learn some Python today?") #2-4 Name Cases name = "Dennis Ruggerio" print(name.lower()) print(name.upper()) print(name.title()) #2-5 Famous Quotes name = "Shaun Spencer" quote = "Don't be a gooey chocolate chip cookie." pri...
true
c46af211b26a002345210653919eb26b71222962
roiei/algo
/leet_code/873. Length of Longest Fibonacci Subsequence.py
UTF-8
1,086
3.078125
3
[]
no_license
import time from util.util_list import * from util.util_tree import * import copy import collections class Solution: def lenLongestFibSubseq(self, A: [int]) -> int: most = max(A) dp = [1]*2 i = 2 while dp[-1] < most: dp.insert(i, dp[i-1] + dp[i-2]) ...
true
18f7369bfbdea74fed069dc3f74795c0c4a68df5
modanwan/ResearchAssistant_Build_sLDA
/code/slda/sLDAPython_Modan.py
UTF-8
5,487
2.578125
3
[]
no_license
# coding: utf-8 # In[ ]: import os import numpy as np from slda.topic_models import SLDA from scipy.sparse import csc_matrix """ DIRECTORY: directory where you save your input and output files VOCAB: vocabulary data MULT_TRAIN: MULT_TEST: DEPVARS_TRAIN: DEPVARS_TEST: """ DIRECTORY = "/.../c...
true
c3ef8e18a3e4212864dfc46bfcf2246eb712570e
pedrohenriqueab/AgendaApp
/Telefone.py
UTF-8
167
2.609375
3
[]
no_license
class Telefone(object): def __init__(self, codigoPais, ddd, numero): self.codigoPais = codigoPais self.ddd = ddd self.numero = numero
true
f94bb8fe2b6b539797fe4b8ff3a0cbd92b9f0f33
adam-dziedzic/Generalized-ODIN-Implementation
/parameters.py
UTF-8
3,444
2.609375
3
[]
no_license
import argparse from getpass import getuser user = getuser() def print_args(args, get_str=False): if "delimiter" in args: delimiter = args.delimiter elif "sep" in args: delimiter = args.sep else: delimiter = ";" print("#########################################################...
true
83195ff6a600f0fe01d4cfbd45a8f5b7e3dfe793
RedHenDev/python
/ursina dev/legacy tutorials/python_solarSystem_tut_2021/tut_ursina_5_solar.py
UTF-8
2,700
2.859375
3
[]
no_license
""" Tutorial for a solar system using Ursina """ from ursina import * #from ursina.prefabs.first_person_controller import FirstPersonController import random as ra import numpy as np app = Ursina() window.color = color.black # color.rgb(0,0,0) # Our list of planets. planets = [] # Data from the real solar system! ...
true
4e2f613838223f9d005ce3db0888c3b4abc97669
Rochan2001/python_stuff
/web scraping/bs4_ex1.py
UTF-8
1,095
2.78125
3
[]
no_license
import requests from bs4 import BeautifulSoup source = requests.get( "https://www.newegg.com/Video-Cards-Video-Devices/Category/ID-38?Tpk=graphic%20cards") page_soup = BeautifulSoup(source.content, "html.parser") containers = page_soup.find_all('div', class_="item-container") out_filename = "graphics_cards.csv" hea...
true
49e75297b9e47d3ef25bcfcdc5d731547c34baa5
aratakokubun/programatic-programmer
/ex5/PaintAppCommandExecutor.py
UTF-8
800
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """Execute commands for paintg app.""" # Imports from ConcreteCommandFactory import CommandFactory from PenCommand import SelectPenCommand, DownPenCommand, UpPenCommand from MoveCommand import MoveNorth, MoveEast, MoveSouth, MoveWest from CommandParser import CommandParser from ConcreteReader ...
true
97bb2fa90da1c55cae77aee40f1f7ae79f2a7993
SidG404/Course-Work
/OPEN SOURCE/WEEk 3/7.py
UTF-8
204
2.953125
3
[]
no_license
import csv def parse_csv(filename, delimiter): with open(filename,'r')as f: data = csv.reader(f, delimiter=delimiter) for row in data: print(row) parse_csv('data.csv', ',')
true
203f95cbae01e98f549f5470b4e404e2a07a0b4f
rigved-sanku/sentinelhub-py
/tests/test_sentinelhub_batch.py
UTF-8
3,662
2.546875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
""" A module that tests an interface for Sentinel Hub Batch processing """ import datetime as dt import itertools as it from sentinelhub import SentinelHubBatch, SentinelHubRequest, DataCollection, BBox, CRS, MimeType def test_iter_tiling_grids(config): tiling_grids = list(SentinelHubBatch.iter_tiling_grids(conf...
true
f6615c7b9535fc6ee282a896afa5e1b5d2fedc08
alxarsnk/NLP
/sixthLesson.py
UTF-8
4,287
2.609375
3
[]
no_license
import pandas import pymorphy2 from itertools import islice import math import keras from keras.models import Sequential from keras.layers import Dense, Dropout from keras.utils import to_categorical import pickle from sklearn.metrics import classification_report import keras_metrics def writeToFile(dictionary): ...
true
e9f38452bd1de0cd60455f18dc76dfea0d47a81b
FreshMax9000/drone_detection
/src/detection.py
UTF-8
8,725
2.984375
3
[]
no_license
"""This file contains the 3d detection of the drones (the last stage of the system). """ import logging import time import math from typing import List from itertools import combinations import numpy as np from numpy.lib import average from .single_auswertung import Spot, BildAuswertung class DetectionMaker: d...
true
aeeaeccd0366965dd1e8e89f3e2217b8d2996cc1
allenkim67/blackjack
/Player.py
UTF-8
425
3.15625
3
[]
no_license
class Player: def __init__(self): self.bankroll = 1000 self.hand = [] def hand_value(self): hand_sum = 0 card_values = sorted([card['n_value'] for card in self.hand]) for card_value in card_values: if card_value == 11 and hand_sum + card_value > 21: ...
true
c3ae76b5fb79f4f32c2500e23f836ece75fbb77c
Rainlv/LearnCodeRepo
/Django_L/template_filer_demo/template_filer_demo/views.py
UTF-8
2,513
2.859375
3
[]
no_license
from django.shortcuts import render from datetime import datetime def index(request): return render(request, 'index.html') def addAndCut(request): content = { 'value1': [1, 2, 3], 'value2': [7, 8, 8], 'str1': 'abc', 'str2': 'jkl', 'int_str1': '1', 'int_str2': ...
true
b466e801c43c7aec3ca6f4e3b764a8b702258a9d
dakotahawkins/MCSchematicIntersection
/SchematicIntersect.py
UTF-8
4,795
2.859375
3
[ "MIT" ]
permissive
"""Intersects two minecraft schematics, provided they are the same size. """ import argparse import json import os import shutil import subprocess import tempfile from io import TextIOWrapper from pathlib import Path from typing import Dict, List, Tuple class Options(argparse.Namespace): # pylint: disable=too-few-pu...
true