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
66a9c30b57bfc80ad5e98da9b6b3963512304029
zz2liu/mixhmm
/mixhmm/transition.py
UTF-8
1,271
2.921875
3
[]
no_license
"""transition.py - construct transition matrix (A). 11/09/08 created by zongzhi liu 11/14/08 use number of snps instead of number of regions for off-diag ps, following Ao's suggestion. Deprecated: use hmm.py todo: in make_aiot, init can be inferenced by mean_nums? """ from __future__ import div...
true
ba98a8b8792e38727e53346740489059ce7d254a
mapost/zookeeper
/Problems/Desks/main.py
UTF-8
355
3.5
4
[]
no_license
# put your python code here class_1 = abs(int(input())) class_2 = abs(int(input())) class_3 = abs(int(input())) class_1_desks = int(class_1 / 2) + int(class_1 % 2) class_2_desks = int(class_2 / 2) + int(class_2 % 2) class_3_desks = int(class_3 / 2) + int(class_3 % 2) desks = int(class_1_desks + class_2_des...
true
68fc8bd40c7f35370cb5dbf1e7bf452e226f6a29
mkramer45/PythonCluster3
/Ch16_DefaultFunctionParameters.py
UTF-8
287
3.859375
4
[]
no_license
def optional_parameter(first_parameter = 0): # defining our function ... argument is we are defaulting first_param to 0 print(first_parameter + 8) # here is our function's command, where we are telling to print the first param of the argument + an integer (8) optional_parameter()
true
2fed61c0ef008237ecde3b8f03448868aa768515
Tearrockster/Prepro---Python
/Sublime pt/0007.py
UTF-8
227
3.03125
3
[]
no_license
""" More functions """ def main(): """ Main function """ myfunction() def myfunction(): """ My function """ text = input() print(text) main() main() main() main() main() main() main() main() main() main()
true
defb487284f6bd78cbf7e3a6f2c014c34cd36ea8
Farrah05/CW36
/app.py
UTF-8
164
3
3
[]
no_license
from human import Human from cat import Cat def walking(any_mammal): any_mammal.walk() h1 = Human() c1 = Cat() c2 = Cat() walking(h1) walking(c1) walking(c2)
true
935d66e1f2878c42fd438aecca452c71e6f03868
GMBueno/firenation
/current_price.py
UTF-8
1,673
2.8125
3
[]
no_license
import json from bs4 import BeautifulSoup import time from selenium import webdriver from selenium.webdriver.common.keys import Keys def get_prices(start_date, end_date, onclick_value, file_name): chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--start-fullscreen") driver = webdr...
true
133bee3b745435b2ea44658863a07794429cf169
gyupro/korean_ads_downloader
/kobaco_video_crawler.py
UTF-8
3,194
2.71875
3
[ "MIT" ]
permissive
from bs4 import BeautifulSoup import urllib from urllib.request import urlopen import os import argparse from threading import Thread from queue import Queue from get_cpu_count import available_cpu_count from progress import print_progress import sys parser = argparse.ArgumentParser() parser.add_argument('-s','--save...
true
407913b45230e66e53358afa1a6a17c5291d7351
open-mmlab/mmagic
/tools/dataset_converters/bgm/preprocess_bgm_dataset.py
UTF-8
4,163
2.703125
3
[ "Apache-2.0" ]
permissive
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp from itertools import cycle import mmengine def generate_json(data_root, seg_root, bg_root, all_data): """Generate training json list for Background Matting video dataset. Args: data_root (str): Backgroun...
true
c970b584f8a231b45b15b48df6531b6de650d531
esokolov/ml-course-hse
/2017-fall/homeworks-practice/homework-practice-01-templates/functions.py
UTF-8
1,407
3.34375
3
[]
no_license
def prod_non_zero_diag(x): """Compute product of nonzero elements from matrix diagonal. input: x -- 2-d numpy array output: product -- integer number Not vectorized implementation. """ pass def are_multisets_equal(x, y): """Return True if both vectors create equal multisets. ...
true
2b3078512f286352977ce85dcf6fb3bb954d74f9
zimmermanc/rl-toolbox-lambda
/rl_lib_general.py
UTF-8
5,539
2.6875
3
[ "MIT" ]
permissive
import json import os.path import sys import csv # --Description-- # # Redlock General Helper library. Used to contain the general useful shared functions. # --End Description-- # # --Configuration-- # # Settings file name DEFAULT_SETTINGS_FILE_NAME = "rl-settings.conf" DEFAULT_SETTINGS_FILE_VERSION = 2 # --End Con...
true
1e4d3de58d25812831af2b4dbe9fa1d22a00ca20
SeanBartosik/python-practice-from-scratch
/HashMaps/Two Sum.py
UTF-8
661
4.0625
4
[]
no_license
# Task: Return a list of the two indexes of the two numbers in a list that # add up to the target value. i.e. for a target of 4 in nums = [1,3,5,7] # returns [0,1]. If no combination exists, return None class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :typ...
true
d76602a4ba3f1386810b14ed5a153ed3ce398a5f
kamillys/cucs_demo
/examples/is_sorted.py
UTF-8
282
3.078125
3
[]
no_license
#!/usr/bin/python import os,sys import fileinput prev = 0 isSorted = True fails = 0 for line in fileinput.input(): cur = int(line, 2) if prev > cur: isSorted = False; fails = fails + 1 prev = cur print isSorted if not isSorted: print "Fails", fails
true
055e51d705f9d59a35887d48183848d5d07be922
louai-h5g/pyfileseq
/fileseq.py
UTF-8
8,925
3.46875
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python """ PyFileSeq, a library for working with file sequences. This library will find file sequences in a directory (or another source) and return them as a list of FileSequence instances. The FileSequence class provides useful functionality for further manipulating a sequence; slicing, generation ...
true
69b5dbc5428116361cd0da3e5ab26beddc51b69c
KhalilGorsan/Reacher-Udacity-Deep-RL-project
/train.py
UTF-8
2,049
2.765625
3
[]
no_license
import random from collections import deque import gym import matplotlib.pyplot as plt import numpy as np import torch from core import ReacherWrapper from ddpg_agent import Agent def ddpg(env, agent, n_episodes=1000, max_t=10000, print_every=100): scores_deque = deque(maxlen=print_every) scores = [] fo...
true
a05920811fa8594421c4405a874d847ccfee2951
OsamaAl-Wardi/SDDSpider
/src/sddspider.py
UTF-8
5,246
2.53125
3
[]
no_license
# -------------------------------------------------------------------------- # This code is a part of a Bachelor Thesis written by Osama Al-Wardi. # # Please refer to the repository https://github.com/OsamaAl-Wardi/SDDSpider # for the latest version of SDDSpider. # # May 2020, Osama Al-Wardi, Bermen, Germany # For ques...
true
3c25671299902eb051e861b21a3c8672bf173aab
gvrousto/Project-JARVIS
/jarvis-features/GPS AI/makeDailySummary.py
UTF-8
1,088
2.921875
3
[]
no_license
import clustering as cl import gps import datetime def make(): #Set up current day now = datetime.datetime.now() nowYear = now.year nowMonth = now.month nowDay = now.day fileName = "DailySummaries/dailySummary_" + str(nowMonth) + "_" + str(nowDay) + "_" + str(nowYear) + ".txt" file = open(fileName,"w+") #Ge...
true
4a7c07cfc0626e4398c56ad6053c61927071f811
maicat11/Exercism
/python/bank-account/bank_account.py
UTF-8
1,178
3.453125
3
[]
no_license
import threading class BankAccount(object): def __init__(self): self.balance = 0 self.is_open = False self.lock = threading.Lock() def get_balance(self): self.check_open_status(True) return self.balance def open(self): self.check_open_status(False) ...
true
7ca603750197bd3d044ad6f77027a4e250084d9c
JamesMYoung/Daily-Coding-Problems
/2019-10 (October)/10_08_2019.py
UTF-8
886
4.65625
5
[]
no_license
# Good morning! Here's your coding interview problem for today. # # This problem was asked by Jane Street. # # cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. # # Given this implementatio...
true
127e800726bf4d12c8589962a9e18a4f8ac23a0b
vpc20/python-basics
/WhileLoops.py
UTF-8
157
3.546875
4
[]
no_license
s1 = 'abcdefghij' i = 0 while i < len(s1): print(s1[i], end=' ') i += 1 print(' ') i = len(s1) while i > 0: i -= 1 print(s1[i], end=' ')
true
20cececb5e5cac68e0dd4c2dbf0521b9412d4fd5
keerow/python-Q2
/Ex5 - Dictionnary & Destructuring/shoppingListDictNoBreak.py
UTF-8
746
3.828125
4
[]
no_license
#Script qui permet de faire une liste de courses grâce aux entrées de l'utilisateur liste_courses = {} print("Tapez 'fini' lorsque vous avez fini") #Simulation de DO WHILE sur python produit = input("De quel produit avez-vous besoin? ") while produit != 'fini' : quantité = int(input("De quel quantité avez-vous b...
true
51e66550d3deae63d4bd4af4fda5d5616e90bcab
elexie/Codeeval-python
/easy/FibonacciSeries.py
UTF-8
308
3.296875
3
[]
no_license
import sys def fib(n): ans=0 if n<=2 : if n==0 : ans=0 else : ans=1 else : ans=fib(n-1)+fib(n-2) return ans filename="practice\\fib.txt" with open(filename,'r') as test_cases: for test in test_cases: print(fib(int(test.strip())))
true
cdfa9aa6412152ebb10a07b6fa757496fde6a3d0
wangleiphy/UCAS_QMteaching
/root_solver.py
UTF-8
345
3.234375
3
[]
no_license
from scipy.optimize import bisect from math import tan, sqrt, pi r = 2.0 def func(x, n): return x * tan(x - n*pi/2) - sqrt(r**2 - x**2) for n in range(2): alpha = bisect(lambda x: func(x, n), n*pi/2, min((n+1)*pi/2, r)) beta = sqrt(r**2 - alpha**2) energy = -2*beta**2 print 'alpha, beta, energy...
true
f144a2fa3aea99fc51e2d4acc75c579b58a79b02
rafaelblira/python-progressivo
/func_maior_menor.py
UTF-8
625
4.71875
5
[ "MIT" ]
permissive
#Faça um programa que recebe três números do usuário, e identifica o maior através de uma função e o menor número através de outra função. def maior(a, b, c): if a > b and a > c: return a elif b > a and b > c: return b else: return c def menor(a, b, c): if a < b and a < c: ...
true
d0cd4a6c198a4bb5df4e0380544e82db477d7e3b
flintlovesam/FundsData
/funds_data/funds_download.py
UTF-8
538
2.5625
3
[ "Apache-2.0" ]
permissive
import urllib2 from settings import WEB_PAGES def download_all_webpages(): for i in sorted(WEB_PAGES.keys()): try: url = WEB_PAGES[i]["url"] target_file = WEB_PAGES[i]["file"] print "Downloading %s......" % url f = urllib2.urlopen(url) with open...
true
ad95c543ebb951b46db91c7d922ccbec2d0fb5f5
HaoSungogogo/EECS495_Machine_Learning_Foundation
/HW8/9.1/9.1 sub.py
UTF-8
2,661
2.921875
3
[]
no_license
from __future__ import division import numpy as np import numpy.matlib import matplotlib.pyplot as plt def compute_euclidean_distance(point, C): return np.sqrt(np.sum((point[0] - C[0]) ** 2 + (point[1] - C[1]) ** 2)) def assign_label_cluster(distance): minVal = min(distance, key=distance.get) return min...
true
1d45e0b044718f27ba14a66cfab76e0cc507072a
rmcmillan34/AutomateBoringStuff
/5. Creating a program from scratch/guess.py
UTF-8
759
4.21875
4
[]
no_license
# Guess the number game from Automate the Boring Stuff from memory # By Ryan McMillan Dec 2019 import random TITLE = 'GUESSING GAME' print(TITLE) print(len(TITLE) * '-') print('What is your name?') name = str(input()) secret_number = random.randint(1, 20) print('What is your first Guess?') for guess_number in range...
true
580d68e1cc3220bfcc04a5f69b3393367ad60f6a
kimnakyeong/changeToAWS
/Dr.Foody/scraper/rakuten/make_csv.py
UTF-8
396
2.84375
3
[]
no_license
import csv def save_to_file(jobs): file = open("coupang_reviews.csv", "w", -1, newline='', "utf-8") #file을 열고 file 변수에 저장 writer = csv.writer(file) #writer 작성 writer.writerow(["product", "review", "nation", "user_name", "coupang_survey"]) for job in jobs : writer.writerow(list(job.value...
true
bc61bf9516efb8a02bd829d0cc96f5c7ba7bd774
Andalu30/US-SSII-PAI2
/client.py
UTF-8
3,070
2.96875
3
[]
no_license
import socket import select import errno #Para codigos de errores import sys import hashlib import hmac import datetime def recojeInformacionTransferencia(): def getAlgo(string): if string == "SHA3_512": return hashlib.sha3_512 elif string == "SHA1": return hashlib.sha1 ...
true
88ce3beaeb7dcb3b9f64a5a34c3a012cbbf8d1b1
HyeongD/binaryapi
/binaryapi/ws/chanels/cashier.py
UTF-8
1,917
2.765625
3
[]
no_license
"""Module for Binary cashier websocket channel.""" from binaryapi.ws.chanels.base import Base from typing import Any, Optional # https://developers.binary.com/api/#cashier class Cashier(Base): """Class for Binary cashier websocket channel.""" name = "cashier" def __call__(self, cashier: str, provider: ...
true
6fbc213a94d267fee4f5bf74b24d538231f6624a
Priyankasaggu11929/Hacker-rank-practice
/mixlist2.py
UTF-8
764
3.6875
4
[]
no_license
#!usr/bin/env python3 N=int(input()) def fib(n): n1,n2 = 0,1 f=[] if n==1: f.append(n2) return f if n>=2: f.append(n2) for i in range(2,n): next=n1+n2 f.append(next) n1=n2 n2=next return f def prime(N): prime...
true
03ed0b75884564e79bcdd17a925f4ecfb5a4278e
bbdavidbb/A_Star-Search-Algorithm
/graph.py
UTF-8
8,993
4.03125
4
[]
no_license
import math from collections import deque from puzzle import coord_of_tile, gen_puzzle_n, printPuzzle, up, down, left, right from bisect import insort, bisect_left from queue import PriorityQueue class Node: """" Represents a puzzle node in the graph Attributes: state: A 2D list representing the puzz...
true
1011a2ad0d35329f524e7fbcf1486468e19d1598
TheHermitman/SimulatorCore
/src/Agent/Agent.py
UTF-8
1,020
2.859375
3
[]
no_license
class Agent(object): '''An abstract class for user and object agent models.''' def __init__(self, id): self.id = id pass def build(self): '''Query StatProxy to get model attributes.''' pass def step(self, currentTime, timeStep): ''' The step() function ...
true
653465845a97fdfa57e58ceba025632a455fd91a
jenniferwx/Programming_Practice
/TreeReverseLevelOrderPrint.py
UTF-8
1,122
3.578125
4
[ "BSD-3-Clause" ]
permissive
''' This is very similar to the previous post level order print. We again print the tree in level order, but now starting from bottom level to the root. ''' class Node: def __init__(self,val = None): self.left, self.right, self.val = None, None, val def ReverseLevelPrint(tree): if not tree: re...
true
1b5475892af4b6d33adf83bcb51cdb23888afc1f
nvms/booker
/booker/__init__.py
UTF-8
18,681
2.796875
3
[ "MIT" ]
permissive
import re import time import datetime import threading first_epoch = time.time() verbose = False daemonize = True class Task(object): def __init__(self, english=None, function=None, label=None): self.english = english self.function = function self.label = label class Schedule(object): ...
true
a3cf4b4be3b990a80494a0d603ce999b40175417
fredizzimo/VibrationCompensation
/vibration_compensation/chandrupatla.py
UTF-8
4,835
2.703125
3
[ "MIT" ]
permissive
import numpy as np #TODO replace this with native scipy version when it becomes available def chandrupatla(f, x0, x1, verbose=False, eps_m=None, eps_a=None, maxiter=50, return_iter=False, args=(), ): # adapted from an earlier implementation of mine # as written in htt...
true
a4525e0962147bb4aa3ebc63273c5c0afb41c7e8
kusma/samsung_multiroom
/tests/samsung_multiroom/service/test_playeroperator.py
UTF-8
8,207
2.5625
3
[ "MIT" ]
permissive
import abc import unittest from unittest.mock import MagicMock from samsung_multiroom.service import REPEAT_ALL from samsung_multiroom.service import REPEAT_ONE from samsung_multiroom.service import Player from samsung_multiroom.service import PlayerOperator from samsung_multiroom.service.player_operator import NullPl...
true
6adb12d71faed11886c8b90f92a9eeac92c24184
softwarethreads/ca
/residential/Initialize.py
UTF-8
2,266
2.671875
3
[]
no_license
# Created on September 6, 2020 # Copyright (c) 2020 - Software Threads, Inc. import sqlite3 import time from sqlite3 import Error from elasticsearch import Elasticsearch from Database import Database from Elastic import Elastic class Initialize: def __init__(self): self.index_name = None self.c...
true
659d8bc925b87c464cb8a3f035175dcc57890263
4dv3ntur3/bit_seoul
/keras/keras61_7_iris_conv1d.py
UTF-8
4,672
3.1875
3
[]
no_license
#2020-11-19 #LSTM vs Conv1d: iris #2020-11-18 (8일차) #iris -> LSTM #꽃잎과 줄기를 보고 어떤 꽃인지 판별하는 데이터, 다중분류 #x column=4 y label:1 import numpy as np from sklearn.datasets import load_iris from tensorflow.keras.utils import to_categorical from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers imp...
true
b177b7f671195f7e16b10bcba30851d3b955f828
GetKismet/FacebookDOS
/fb_dos/fb_dos_thread.py
UTF-8
1,362
2.84375
3
[]
no_license
#!/usr/bin/env python import threading, urllib, json, types class FbDosThread (threading.Thread): def __init__(self, access_token, target_uid, source_uid, uids): super(FbDosThread, self).__init__() self.access_token = access_token self.target_uid = target_uid self.source_ui...
true
0b6a4c0936e457d7ea0c283c5e1fab205e715630
morningspider/projecteluer
/PE549.py
UTF-8
1,603
2.734375
3
[]
no_license
from math import factorial as f from totient import * from numtheory import isPrime from collections import Counter import time from sympy import sieve from collections import defaultdict from math import sqrt, factorial def s(n): k = 1 m = 1 while m%n != 0: m *= k k += 1 return k-1 de...
true
bf9ce18b39c71308e53b5d78b30b8f71dbbcef42
martpeeters/ICT_P2
/lz77_huf_acc.py
UTF-8
3,604
3.359375
3
[]
no_license
import huffman as huf import lz77 as lz import string def compute_codeword(s_buffer, la_buffer, L): """ Finds the longest prefix in la_buffer that begins in s_buffer, and computes the appropriate codeword (d, l, c) Parameters ---------- s_buffer: str Search buffer containing the past o...
true
2cbc6b1f3023683b09b59eead9ada66c5e573eba
qsong9527/sdet17
/lidezheng/pythonifelse.py
UTF-8
330
4.03125
4
[]
no_license
a =int(input("请输入第一个数字:")) b =int(input("请输入第二个数字:")) if a < b: print(f"{a} < {b}") elif a > b: print(f"{a} > {b}") else: print(f"{a} = {b}") # if a == b: # print(f"{a} = {b}") # else: # if a > b : # print(f"{a} > {b}") # else: # print(f"{a} < {b}")
true
15e9778744197b47f55b1e9a7624df4c75285202
webs397/RADar
/led_control/test2.py
UTF-8
327
2.703125
3
[]
no_license
from control import * import time import RPi.GPIO as GPIO inp = None led_controller = LEDCONTROLLER(13,6,5) while True: try: print("distance: ") inp = int(input()) led_controller.led_array(inp) except Exception as e: print('There was an error:', e) GPIO.cleanup() ...
true
4cf731a6129a5fc4dd2443dd072bd7262c01bb7b
davidvrj/EvidenciaBedu
/Análisis de datos con Python/proyecto Covid/cleaning.py
UTF-8
2,898
3.171875
3
[]
no_license
#%% import pandas as pd import janitor #%% raw = pd.read_csv("data/210228COVID19MEXICO.csv", dtype={"ENTIDAD_NAC":str, "ENTIDAD_RES":str,"MUNICIPIO_RES":str}) #%% # Describiendo el conjunto de datos raw.head() #%% raw.shape raw.size raw.columns # Como se puede ob...
true
dba29b9f22b9ff98fe031794ae6b2a0b5c0845f0
omatveyuk/interview
/quick_sort.py
UTF-8
1,595
3.65625
4
[]
no_license
"""Quick sort. The first element in a sub-array should be used as a pivot. Divide array into two subarrays (left: are numbers smaller than pivot, right: numbers are greater than pivot), along with the pivot, are merged together. Partition the left side before partitioning the right side. The pivot ...
true
e90ea5f6bcffd55742ab248c035ebbe7af015050
tamasgal/awkward-1.0
/tests/test_0866-getitem_field-and-flatten-unions.py
UTF-8
803
2.546875
3
[ "BSD-3-Clause" ]
permissive
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE import pytest # noqa: F401 import numpy as np # noqa: F401 import awkward as ak # noqa: F401 def test_getitem_field(): a1 = ak.zip({"a": [[1], [], [2, 3]], "b": [[4], [], [5, 6]]}, with_name="a1") a2 = ak.zip({"a": [[7...
true
afa3819c668334e954e11106890561333dee7bee
NskB3/PewdzInfector
/pewdsinfector.py
UTF-8
1,914
2.515625
3
[]
no_license
#!/usr/bin/env python2 import time, sys, os def print_leet(text): print("%s" % text) class vars: autorun = """ [autorun] open=dist\pewd.exe """ def launch(): print_leet(""" Welcome to ______ _ _____ __ _ | ___ \ | | |_ _| / _| | | | |_/ /____ ...
true
d4615313de04229c37b2266359a408df9b3edb50
wangqinNick/Deep-Learning-Tensorflow
/13HighLevel/main.py
UTF-8
775
3.015625
3
[]
no_license
import tensorflow as tf """ where scatter_nd meshgrid """ """ Where(tensor) tensor = True """ a = tf.random.normal([3, 3]) # [[True, True, False], [False, True, False], [True, False, True]] mask = a > 0 a1 = tf.boolean_mask(a, mask=mask) # 1D l=5 array indices = tf.where(mask) a2 = tf.gather_nd(a, indices=indices...
true
373fac3d5b72ac99263a523c674b5f50e0f991d9
13jqq/alphago
/examples/play_noughts_and_crosses.py
UTF-8
1,931
3.78125
4
[ "MIT" ]
permissive
"""This program plays noughts and crosses using Monte Carlo Tree Search and a trivial evaluator. For nonterminal states, the evaluator returns the uniform probability distribution over available actions and a value of 0. In a terminal state, we back up the utility returned by the game. """ import numpy as np from alph...
true
f4becb5f4eb36f11dadae0c7ce757ff198b3f547
alifgiant/tugas-Sisrek-2015
/GUI.py
UTF-8
2,880
2.6875
3
[]
no_license
from Tkinter import BOTH, W, N, E, S, Canvas from PIL import ImageTk, Image from ttk import Frame, Button, Label, Style, Entry class GUI(Frame): def __init__(self, parent, control): Frame.__init__(self, parent) self.mode = 0 self.parent = parent self.addressViewer = None se...
true
ce710e60bccf0e0b30835ab016531bf1b4af4c21
davidheintz/MLBScheduler
/main.py
UTF-8
3,631
3.25
3
[]
no_license
import pandas as pd # for use of dataframes import matplotlib.pyplot as plt # for plotting location and travel for teams import numpy as np # for np array manipulation import engine # for use of methods written in engine teams = pd.read_excel("mlb_teams.xlsx") # plot city coordinates for all teams (check i...
true
051035b4c2fd0032276cf2258f6e437b68ee62f3
artem690/robotics_final_project
/controllers/controller_base/controller_base.py
UTF-8
15,613
2.8125
3
[]
no_license
"""robot controller.""" import math import copy from controller import Robot, Motor, DistanceSensor import supervisor import numpy as np from collections import defaultdict import matplotlib.pyplot as plt import sys class Node: def __init__(self, pt, parent=None, path_from_parent=[]): self.point = pt # n-...
true
a26d43ad642f8940d62388c495a69b1cbdad6432
tomlepaine/cudaconvnet-fork
/tp_detect_tools.py
UTF-8
4,599
2.78125
3
[]
no_license
# tp_detect_tools.py import numpy as np import pickle import tp_tools as tp import scipy.misc as misc class LocationMaskStore(): def __init__(self, filename, mask_size=24): self.filename = filename self.mask_size = mask_size images_info = pickle.load(open('%s.pickle' % filename,'rb')) annotations = [image_in...
true
7c5ff654f33b6fc2fccda1615b1a39574452ef9f
xyla-io/micra_store
/micra_store/command_base.py
UTF-8
2,530
2.5625
3
[ "MIT" ]
permissive
import shlex import click from typing import TypeVar, Generic, List, Callable from enum import Enum from moda.style import Styling, Color, Font, Styled, Styleds, CustomStyled class CommandCategory(Enum): info = 'info' normal = 'normal' caution = 'caution' destructive = 'destructive' @property def style(s...
true
e91efd69776b4af115005a1ab8fab532f380b8c0
hyeokju1313/LostArkFishingMacro
/fishing_image.py
UTF-8
1,835
3.046875
3
[]
no_license
import os import time import sys import pyautogui as pa import configparser # - 주모니터의 화면의 Center 를 Return - def getCenterOfScreen(): tup = pa.size() tup = (int(tup[0]/2), int(tup[1]/2)) return tup # - 느낌표를 검출할 영역을 지정 - def makeRegion(center, width, height): x = center[0] y = center[...
true
f668445d418c25adad73c236c481165fa013d8c4
hugomcff/FichasTrabalho
/FT1/FT1.ex4.py
UTF-8
209
3.484375
3
[]
no_license
raio = int(input("Introduza o raio: ")) PI = 3.14 perimetro = 2 * (PI * raio) area = PI * (raio * raio) print("O perimetro da circunfrencia é : " , perimetro ) print("A area da circunfrencia é : " , area )
true
cf3ee92b312f9ddee6428eeec91aef2cdc215e0e
aifighter/leetcode
/1-100/49.py
UTF-8
375
3.03125
3
[]
no_license
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: d = {} ret = [] for word in strs: letters = tuple(sorted(word)) if letters in d: d[letters].append(word) else: d[letters] = [word] for key ...
true
27eec4aa7935768f8b5923f7dad5f9755910919b
lukehare/sciml-bench
/sciml_bench/core/system.py
UTF-8
23,788
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # system.py # SciML-Bench # Copyright © 2021 Scientific Machine Learning Research Group # Scientific Computing Department, Rutherford Appleton Laboratory # Science and Technology Facilities Council, UK. # All rights reserved. """ System info and monitoring """ import...
true
d9e8c7cc2bbddfe1ad81e453b71f9a232eb2ec23
Matt-Deacalion/Polski
/polski/main.py
UTF-8
6,327
3.078125
3
[ "MIT" ]
permissive
# coding=utf-8 """Usage: polski [--insert | --report] [--database=<path>] polski (-h | --help | --version) Options: --version show program's version number and exit. -h, --help show this help message and exit. -i, --insert insert new word iterations, starting from today. ...
true
8fc4b58daff9086a76186959e712d5ecf34af93c
CalvineHicks/School
/Algorithms/closestPoints/divConquerAlg.py
UTF-8
3,132
3.65625
4
[]
no_license
# Input: A set of points in 2D # Output: the closest pair from __future__ import print_function import sys import math import time import matplotlib.pyplot as plt def distance(a,b): return math.sqrt((b[1] - a[1])**2 + (b[2] - a[2])**2) def readPointsFromFile(fName): try: inpFile=open(fName,'r') ...
true
4eeb9bd10b8d966aebc92c93fd0daddf87e3db22
adithak/qq
/kk.py
UTF-8
157
3.15625
3
[]
no_license
q,e=input().split() count=0 q=set(q) e=set(e) for i in q: if i in e: count=count+1 if(count>=2): print('yes') elif(count<2): print('no')
true
7cb2aba9adf2498a1a69ce73804c53c44a8bda09
milan674/penzerme_szamlalo
/run.py
UTF-8
3,672
2.9375
3
[]
no_license
import numpy as np import cv2 from matplotlib import pyplot as plt from tkinter import filedialog import tkinter as tk def Resize(img): (h,w) = img.shape[:2] print ("Az eredeti kep merete: ", (h,w)) new_width=1024 ratio = new_width /w dim = (new_width,int(h * ratio) )...
true
ba58364ee8ad0a41c9a38e4c6fe07dbf29244d64
gennsev/tclass
/word2vec/word2vecVectorizer.py
UTF-8
1,234
2.921875
3
[]
no_license
import sys import numpy as np import pandas as pd from gensim.models import KeyedVectors class Word2VecVectorizer: def __init__(self): print("Loading in word vectors...") self.word_vectors = KeyedVectors.load_word2vec_format( 'word2vec/GoogleNews-vectors-negative300.bin', binary=True ) p...
true
faa33e10edc8205e7657f552a0828a0408c3a384
h3abionet/h3agwas
/assoc/bin/gemma_man.py
UTF-8
3,393
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd import sys inp = sys.argv[1] pheno = sys.argv[2] base = sys.argv[3].replace("/np.","-").replace("/","").replace(".","-").replace("_","-") out_man = "%s-gemma-man.pdf"%base o...
true
a1cad34506fe23cb4f343665beeb8625bd7e2706
dlmelendez/superannotate-python-sdk
/superannotate/input_converters/converters/yolo_converters/yolo_to_sa_vector.py
UTF-8
2,674
2.515625
3
[ "MIT" ]
permissive
from glob import glob import os import cv2 import numpy as np def _create_classes(classes): classes_loader = [] for id_, name in classes.items(): color = np.random.choice(range(256), size=3) hexcolor = "#%02x%02x%02x" % tuple(color) sa_classes = { 'id': id_ + 1, ...
true
06855354b75c875545fa51025bb53518766d8bd1
hellstrikes13/sudipython
/remove_punc.py
UTF-8
264
3.140625
3
[]
no_license
import string def remove_punc(st): print 'original string:',st st_free_punc = "" for letter in st: if letter not in string.punctuation: st_free_punc = st_free_punc + letter return st_free_punc s = remove_punc("sudee{\?}--p") print 'clean string:',s
true
f6e3aed8fda33d062ed9c2d19b0c058e98942287
sailfishos-mirror/setuptools
/setuptools/_distutils/tests/test_ccompiler.py
UTF-8
2,947
2.515625
3
[ "MIT" ]
permissive
import os import sys import platform import textwrap import sysconfig import pytest from distutils import ccompiler def _make_strs(paths): """ Convert paths to strings for legacy compatibility. """ if sys.version_info > (3, 8) and platform.system() != "Windows": return paths return list(...
true
48b7917a1b0f8ee0692bab95c31243bd5d0f3692
silvestri1774987/RegressionSeminar
/regre.py
UTF-8
3,187
2.921875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn import metrics from tkinter import * root = Tk() root.geometry("600x600") root.title(" Regression ") def Take_input(): INPUT =...
true
3354a1880650fc724f3f1dda80af11f776a54dd9
isabellahuang4/fireflies
/simplefly/draw_pattern.py
UTF-8
2,246
3.1875
3
[]
no_license
import turtle as t import matplotlib.pyplot as plot import csv import numpy as lumpy from PIL import Image #given list of patterns as list of integers, draws in turtle def draw(patterns): t.setup(1010,1010,0,0) t.fillcolor('#ffff00') t.penup() y = 410 # for p in patterns: # p += p for p ...
true
5119a63950beabd27bf18231a32fd51f8f168e6c
alq666/deskapi
/src/deskapi/models.py
UTF-8
7,227
2.8125
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
import csv import json import os.path import requests class DeskSession(object): _CLASSES = {} _COLLECTIONS = {} def __init__(self, sitename=None, session=None, auth=None): if sitename is None: raise Exception() self._sitename = sitename self._BASE_URL = 'https://%...
true
4a54f6ce644eda167701f94d9a289bfce3015a95
pacellyjcax/ProgrammingChallenge
/URI/1263 - Aliteração.py
UTF-8
342
3.140625
3
[]
no_license
def cont(s): a = s.split() ls = [x[0] for x in a] t = 0 checa = True for i in xrange(len(ls)-1): if ls[i] == ls[(i+1)] and checa: t+=1 checa = False else: checa = True return t while 1: try: print cont(raw_input().lower()) ...
true
b1544d65187dda432674f4f3a9b00402a1ebd5e9
JulioCe98/Networks_Monitory
/Guias/Semestre 2020-I/Semana 6/TCP Python/Server.py
UTF-8
1,962
2.9375
3
[]
no_license
import socket HOST = "127.0.0.1" PORT = 5000 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: print("Server is waiting for a client...") s.bind((HOST, PORT)) s.listen() while True: conn, addr = s.accept() try: print('Connected by', addr) while True: ...
true
a67c612b7b1658bfbb15b7cfd4b76e00d6156aa3
caro-barreto/ParadigmasIFTS-TP2
/TP 2 Paradigmas Carolina Barreto.py
UTF-8
3,539
3.296875
3
[]
no_license
import operator from tkinter import * import random from tkinter import messagebox from openpyxl import Workbook from operator import itemgetter #configuracion de la raiz root= Tk() root.config(width=360, height=380, bg="peach puff") root.title('Ingreso de participantes') datos = [] def guardar(): id = random.r...
true
d8b8455430355e6ddcee763cf9bd5350f3efb401
YtrioSalmitoAzevedo/URI-Online-Judge
/Iniciante/1079 Médias Ponderadas.py
UTF-8
227
3.140625
3
[]
no_license
loops = int(input()) resultado = [] for x in range(loops): numbers=raw_input().split() a, b, c = numbers a, b, c = float(a),float(b),float(c) r = (a*2+b*3+c*5)/10 resultado.append(r) for y in resultado: print "%0.1f" %y
true
d5e5f4ed93124371abb4ad56b21824ba0b1d19a0
vince1589/PixelDB_decorate
/merge_frag_fast.py
UTF-8
10,296
2.71875
3
[]
no_license
#This script stich fragment together using graph based method! import glob import sys import re import numpy as np import os from collections import defaultdict #Some function def get_peptide(PDB,chain="B"): tempPep = [] for res in PDB: if res["cha"] == chain: tempPep.append(res) retur...
true
0f5a0a46434dffc266edc7b43f1f5460edac99c4
namelessan/the-shell
/intek-sh.py
UTF-8
17,735
2.796875
3
[]
no_license
#!/usr/bin/env python3 from os import chdir, environ, getcwd, kill from os.path import dirname, exists, isdir from shlex import split from signal import SIG_DFL, SIG_IGN, SIGINT, SIGQUIT, SIGTERM, SIGTSTP, signal from string import ascii_letters from subprocess import Popen from exit_code import error_flag_handle fro...
true
8ca0463b9a25fc9628660f9ec64d8670d2c0fed1
jbird996/computer-vision-and-image-processing
/Assignment1/Code/PA1-2.py
UTF-8
2,121
3.375
3
[]
no_license
#Jason Hatfield - 29163434 #CSE473 Summer 2017 #PA1 - Question 2 import numpy as np import cv2 from matplotlib import pyplot as plt #Import image img = cv2.imread('lena_gray.jpg',0) result = cv2.imread('lena_gray.jpg',0) #Get image dimensions rows = img.shape[0] cols = img.shape[1] #Initialize plot data img_hist =...
true
9732f9b5f945d754ea1a4981bc659aea4d835175
erichanslee/PyPlasmaOpt
/profiling/profile_biot_savart.py
UTF-8
1,399
2.640625
3
[]
no_license
import numpy as np from pyplasmaopt import CartesianFourierCurve, BiotSavart, StelleratorSymmetricCylindricalFourierCurve coil = CartesianFourierCurve(10, np.linspace(0, 1, 80, endpoint=False)) coil.coefficients[1][0] = 1. coil.coefficients[1][1] = 0.5 coil.coefficients[2][2] = 0.5 coil.update() ma = StelleratorSymm...
true
615e064e248633c5ac4d0a33d332de575e7143fb
moveaxlab/sdk-boilerplate-py
/sdkboil/cache.py
UTF-8
682
2.9375
3
[]
no_license
from abc import ABC, abstractmethod class CacheInterface(ABC): """ Interface to be implemented by a cache adapter. """ @abstractmethod def get(self, key): raise NotImplemented('Subclasses must implement this method') @abstractmethod def set(self, key, value): raise NotImp...
true
62b603a882f2155597d5c8ae48af8722854609db
cjswo672/Algorithm_python
/programmers/기둥과_보_설치.py
UTF-8
2,374
3.3125
3
[]
no_license
def solution(n, build_frame): answer = [] frame = [[0 for _ in range(n + 1)] for _ in range(n + 1)] pilar = [[0 for _ in range(n + 1)] for _ in range(n + 1)] # col, row, {0: p, 1:f}, {0: remove, 1: build} for col, row, type, cmd in build_frame: row = n - row # 구조물을 설치한다. ...
true
cf64bb90e5faab581830185846dd0fae6a96a023
JhonataAugust0/Python
/Areas/Data_science/população.py
UTF-8
1,170
3.84375
4
[ "MIT" ]
permissive
import matplotlib.pyplot as plt x = [] y = [] titulo = "Crescimento da população brasileira 1980-2016" legenda_x = "Ano" legenda_y = "População * 100.000.000" def leitura_de_dados(arquivo): for i in range(len(arquivo)): if i != 0: linha = arquivo[i].split(';') x.append(int(linha...
true
5226ea8f1e89a976c3fed3d5004fa47e4a3185ec
slavkoSenkiv/Projector-marketing-video-library-content-parser
/checkProjector.py
UTF-8
1,814
2.796875
3
[]
no_license
import requests, bs4, openpyxl def skipBlank(text): return ' '.join(text.split()) lectureNum = 1 wb = openpyxl.Workbook() sheet = wb.active mainUrl = 'https://prjctr.online' libUrl = 'https://prjctr.online/library' for pageNum in range(2, 17): #290 lectures = 17 pages print(libUrl) res = requests.get(lib...
true
fbfc73df3c881d0f35eb1874a5ca2d19a2cb7eac
proggeo/geojson
/script.py
UTF-8
864
2.84375
3
[]
no_license
import json import geojson import math from area import area # for roads file_name = 'yardsGeo.json' with open(file_name) as infile: json_file = json.load(infile) my_feature_collection = geojson.FeatureCollection([]) categories = ["open", "hard to reach", "unreachable"] for row in json_file: print row ...
true
a1ac7aca47cd70a5c535b54a617d8b6cc0850a72
jxhangithub/leetcode
/solutions/python3/172.py
UTF-8
182
2.5625
3
[ "MIT" ]
permissive
class Solution: def trailingZeroes(self, n): """ :type n: int :rtype: int """ return 0 if n == 0 else n // 5 + self.trailingZeroes(n // 5)
true
44d234fc4f8272ec8b1e09052046e1ed24ac7caf
Pawl0/theoneexperiments
/python/latencyAvg.py
UTF-8
1,670
2.859375
3
[]
no_license
import os import sys import pathlib import matplotlib.pyplot as plt param = sys.argv[1] def calcAverages(algorithm): averages = [] # changes directory to given path os.chdir(os.getcwd()+"/"+algorithm+"/"+param+"/latency") os.getcwd() directory = os.fsencode(os.getcwd()) print(dir...
true
fb9c85c55bb820aa1c07f91c1de6a04a431a3a83
vinaybommana/worrydream-pages
/RFID.py
UTF-8
1,166
3.25
3
[]
no_license
RFID_code = str(input("Enter the code: ")) # print(RFID_code) event_ids = { '1': "Code N Code", '2': "Ensemble", '3': "Model Presentation", '4': "Circuitry", '5': "Trouble Shooting", '6': "Technical Quiz", '7': "Photography and Short films", '8': "Paper Presentation" } first_name = str(input("Enter fi...
true
97d1c1021005e97f5f52b956c721d55c836f77e3
domanchi/gitfu
/gitfu/standalone/remove_git_branch.py
UTF-8
6,895
2.578125
3
[ "MIT" ]
permissive
import argparse import subprocess import sys from ..core import color from ..core import git def main() -> int: args = parse_args() if args.prune: try: prune_branches(args.remote) except subprocess.CalledProcessError: return 1 elif not args.branch: _print_...
true
76b12c5eaf0df4e65e8e3568133f3e1f3f04a2d8
Wizmann/ACM-ICPC
/LintCode/python/Hex Conversion.py
UTF-8
337
3.03125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
class Solution: """ @param n: a decimal number @param k: a Integer represent base-k @return: a base-k number """ def hexConversion(self, n, k): if n == 0: return '0' res = '' while n: u = n % k res = '%X' % u + res n /= k ...
true
37580eae5109a8da1016af30f05ea70e5b6dcd2f
yorkypy/selise-intervie
/shortcuts/lis_com.py
UTF-8
701
3.859375
4
[]
no_license
#Square print([i**2 for i in range(10) if i>3]) #Odd/Even print([i for i in range(10) if i%2!=0]) print([i for i in range(10) if i%2==0]) #Multples of 10 print([i*10 for i in range(10)]) #Printing all numbers from a string s='Nima is 24 years old and w33k5' print(''.join([i for i in s if i.isnumeric()])) #Printing...
true
873ad6669c131f22a8bbf2f0f587b352ca8cf02b
PhoenixizFire/Simplon_2020-08-11
/app/models.py
UTF-8
1,323
2.703125
3
[]
no_license
## URL pour faire des tables easy : http://ondras.zarovi.cz/sql/demo from datetime import datetime from app import db,login from werkzeug.security import generate_password_hash,check_password_hash from flask_login import UserMixin class User(UserMixin,db.Model): id = db.Column(db.Integer,primary_key=True) user...
true
1667ee8670976871403d76ede01240bb1a7edfbb
yurydelendik/cloudlibc
/src/libc/time/convert_zdump_to_tests.py
UTF-8
1,729
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
#!/usr/bin/env python # Copyright (c) 2015 Nuxi, https://nuxi.nl/ # # SPDX-License-Identifier: BSD-2-Clause import datetime import sys last_t2 = None last_isdst = 0 def printline(t1, t2, isdst, abbreviation, consistency): ts1 = int((t1 - datetime.datetime(1970, 1, 1)).total_seconds()) print 'TESTVECTOR(%d, %d, ...
true
90b5a007343344bd502e6ffe48f79b566398aad9
fadisoo/class-work
/chapter6.py
UTF-8
155
3.03125
3
[]
no_license
# Chapter 6 Exercises: str = 'X-DSPAM-Confidence:0.8475' atpos = str.find(':') print(atpos) close_up = str[atpos + 1:] numb = float(close_up) print(numb)
true
095a0a4f2e40ef1fa10c7a65df8ccb5ef0543179
kataoka0824/Graduation-thesis-appendix
/Serial_stepper.py
UTF-8
787
3.484375
3
[]
no_license
# coding:utf-8 import serial import time import tkinter as tk import sys ser = serial.Serial('/dev/ttyACM0', 115200) def close(): sys.exit() def move_left(event): ser.write(b'l') def move_right(event): ser.write(b'r') def move_up(event): ser.write(b'u') def move_down(event): ser...
true
6c56da3027234fd9e965701ce2b406925004ac4f
noahmelngailis/python-exercises
/word_puzzle.py
UTF-8
1,988
4.0625
4
[]
no_license
# Take the word EASY: Its first three letters — E, A and S — are the fifth, # first, and nineteenth letters, respectively, in the alphabet. If you add 5, # 1, and 19, you get 25, which is the value of the alphabetical position of Y, # the last letter of EASY. # Can you think of a common five-letter word # that wor...
true
66780068e15b76a5a7c267d64648e933c78523dd
josekang/refresher
/class_method_staticmethod.py
UTF-8
699
3.828125
4
[]
no_license
class Student(): def __init__(self, name, school): self.name = name self.school = school self.grades = [] def average(self): return sum(self.grades) / len(self.grades) @staticmethod def go_to_school(): print("i am going to school") jose = Student("Joseph Kang'ethe", "Zetech University") pato = Student...
true
d4593c11911bdb8de5a846a63c6f354d67352ccb
Sherloclee/cloud-platform
/cloudplatform/host/dataStructure.py
UTF-8
605
3.234375
3
[]
no_license
class Link_list: def __init__(self): self.head = None self.tail = None self.list = Link_node() self.len = 0 self.head = self.list self.tail = self.list def append(self, meta): new_node = Link_node(meta) self.tail.next_node = new_node self...
true
c6fc570e43effb4153f4b88394b75dcfd2ddea8b
blegloannec/CodeProblems
/CodeJam/Practice/12/12.1B.C.Equal_Sums.py
UTF-8
2,694
3.625
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- '''Solution pour la LARGE input uniquement. L'astuce consiste a remarquer qu'il y a TOUJOURS une solution de taille 6 ! En effet, par principe des tiroirs : la valeur de toute somme d'un sous-ensemble est bornee par 500*10^12. Or il y a 2^500 (> 500*10^12) sous-ensembles possi...
true
535129463b929aa8792118e87d5fc1c641fe5dad
albertmonarrez/macro-maker
/DetectKeypress.py
UTF-8
6,617
2.703125
3
[]
no_license
import win32api import win32con import ctypes import time import mouse import itertools import keyboard as k from keyboard import codes as c from configobj import ConfigObj import config def key_in_down_state(key_state): """Checks the passed in key state list of integers or single integer. Returns True or F...
true
bef76c7f2ac52515a2799ec22c290aafc7cfdc22
avrae/draconic
/draconic/types.py
UTF-8
13,686
2.8125
3
[ "MIT" ]
permissive
import collections.abc import operator as op from collections import UserList, UserString from .exceptions import * from .string import JoinProxy, PRINTF_TEMPLATE_RE, TranslateTableProxy from .versions import PY_39 __all__ = ("safe_list", "safe_dict", "safe_set", "safe_str", "approx_len_of") _sentinel = object() #...
true
69aeed5484e6855fb60df02c2ad0e21f39003c15
sybahk/ICNS-Federated-Learning-Demo
/backend/test.py
UTF-8
1,528
3.078125
3
[]
no_license
from numpy import newaxis import argparse from keras.models import Sequential, load_model from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from keras.preprocessing.image import array_to_img # fl_path = os.path.abspath('.') # if fl_path not in sys.path: # sys.path....
true