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
6dafe52043bbbfb99ce5df3a927e5b8ccd21876c
tomguy04/Algo_Repo
/miniMax.py
UTF-8
380
3.328125
3
[]
no_license
def miniMaxSum(arr): low = 0 high = 0 sum = 0 lowhigh=[] for i in range (len(arr)): sum+=arr[i] low = sum- (max(arr)) high = sum- (min(arr)) lowhigh.append(low) lowhigh.append(' ') lowhigh.append(high) print map(str,lowhigh) return...
true
37fb71245bb8b53d646ef5318958076563d5054b
luisjariego/scikit-optimize
/performance.py
UTF-8
2,655
2.796875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python import sys import numpy as np from skopt.plots import plot_convergence import matplotlib.pyplot as plt if len(sys.argv) < 2: print ("Por favor, introduce el fichero de errores medios para hacer el plot.") print ("\tpython3 performance.py <fichero_medias> <<opt:fichero_stds>> <<opt:n_runs>>"...
true
f99b6dd6765b81d4eb7ad1018a827025072dba5d
Aasthaengg/IBMdataset
/Python_codes/p03400/s041616358.py
UTF-8
177
2.640625
3
[]
no_license
n=int(input()) d,x=map(int,input().split()) a=[int(input())for i in range(n)] res=x for i in range(n): for j in range(d): if j%a[i]==0: res+=1 print(res)
true
8ac528ef31a70097626bb6c52c3ee146dd4f3ca4
elliotwaite/rl
/algos/keyboard_agent.py
UTF-8
8,292
2.75
3
[ "Apache-2.0" ]
permissive
import argparse import collections import time import gym import numpy as np from utils import env_window UP_ARROW_KEY_CODES = 273, 65362 DOWN_ARROW_KEY_CODES = 274, 65364 LEFT_ARROW_KEY_CODES = 276, 65361 RIGHT_ARROW_KEY_CODES = 275, 65363 DEFAULT_KEY_MAP = { (): 0, (ord('1'),): 1, (ord('2'),): 2, ...
true
c2ddbe2253f86545c7edd5657df658931d22fc27
Razg93/Self-balancing-robot-tracking-tennis-ball
/bt.py
UTF-8
1,196
3.71875
4
[]
no_license
import serial ser = serial.Serial('/dev/rfcomm3',baudrate=115200) # open serial port j=str(5) # check which port was really used b = j.encode() # write a string ser.write(b) import serial # Module needed for serial communication import time # Module needed to add delays in the code # Set the port name a...
true
a17c7eadfd7323f3d203692959224b4dd8f8d957
wudayu940214/Hack
/sentimentAnalysisNaiveBayes.py
UTF-8
3,964
2.65625
3
[]
no_license
from __future__ import division import re from numpy import ones, array from numpy.lib.scimath import log from nltk import * def loadDataSet(): pos=open("demo.txt",'r') neg=open("demo.txt",'r') lst_all=[] classVec=[] for i in range(700): classVec.append(i%2) for i in range...
true
fd0a0705d29ec2e50e44e898f04c2d8f65550b1f
AnandD007/Amazing-Python-Scripts
/Github-Automation/install.py
UTF-8
1,207
2.6875
3
[ "MIT" ]
permissive
from shutil import copy, copyfile import os dir = os.getcwd() files = [ file for file in os.listdir(dir) if file.endswith('.py') and file != 'install.py' ] files.append('tmp.json') print(files) def checkForIgnore(dst): return os.path.isfile(os.path.join(dst, '.gitignore')) def addToIgnore(dst): wit...
true
399a0e499083dd18b9fac012ac22e042d55f34a3
TorryTheMaltese/python-algorithm-test
/섹션 5/3. 후위표기식 만들기/AA.py
UTF-8
713
2.96875
3
[]
no_license
import sys # sys.stdin = open("in2.txt", "rt") prefix = list(map(str, input())) stack = list() result = "" # print(*prefix) for pre in prefix: if pre.isdecimal(): result = result + pre elif pre=='(': stack.append(pre) elif pre == '+' or pre == '-': while stack and stack[-1] != '('...
true
fd9c1407a854872f16142f25384c7419bf73d2c5
darknesschieftain/dns-random-subdomains-ddos-attack
/utils/data.py
UTF-8
1,118
2.9375
3
[]
no_license
import urllib.request import os from tqdm import tqdm import hdf5storage class DownloadProgressBar(tqdm): def update_to(self, b=1, bsize=1, tsize=None): if tsize is not None: self.total = tsize self.update(b * bsize - self.n) def download_url(url, target_folder, filename): # check...
true
56fbfd00c7d93dc17e2ed3d80030870af6241ca8
cytochromewangdong/Elevator
/client/helper/monitor.py
UTF-8
3,747
3.03125
3
[]
no_license
""" Copyright (c) 2018 VMware, Inc. All rights reserved. -- VMware Confidential """ # This class helps to pase the elevator stats retrieved from server side, # and maintain status table for all 3 elevators at client side. # It can also help to find out any foul elevator. class ElevatorMonitor(object): def __init_...
true
3372c30cd07ad7fd13b24f563310ebcba355959c
CREATE-knowledge-planning/Sensing_planning_framework
/binary_HT_1d/Gd_comp.py
UTF-8
3,716
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jul 28 17:48:51 2020 @author: Zhaoliang """ import numpy as np import Gaussian_dist as Gd import Gd_stat as Gd_statis import utility_functions.convert_data as cnvdata def mean_cov(sample): sam_mean = np.mean(sample) sam_cov = np.cov(sample) return sam_mean, sam_...
true
5ffeacc3e4dbf4189b4acb292100f396b4fce421
Christopher-Polloni/cus1166_lab1
/mymodules/math_utils.py
UTF-8
234
3.140625
3
[]
no_license
from mymodules.models import Student def average_grade(roster): sum_grades = 0 for i in range(10): sum_grades = sum_grades + Student.get_grade(roster[i]) class_average = sum_grades / 10 return class_average
true
a83a4a97fb0249b848b29b5f9759cdf874678c29
daniel-reich/ubiquitous-fiesta
/aW8mz7Tky3gGiuQsX_5.py
UTF-8
254
3.15625
3
[]
no_license
def is_powerful(n): divisors = [a for a in range(1, n) if n % a == 0] pdiv = [a for a in divisors if len([i for i in range(1, a+1) if a % i == 0]) == 2] count = 0 for i in pdiv: if i**2 not in divisors: count += 1 return count == 0
true
84b93ee154790c8db353f8a8c69ffd14beecd99c
YoshiBrightside/Ode-to-my-Failures
/Codeforces/19_08_11/C.py
UTF-8
183
2.53125
3
[]
no_license
# 1200C # Round Corridor from fractions import Fraction fst = list(map(int,input().split())) for _ in range(fst[2]): route = list(map(int,input().split())) frac1 = route[0]
true
45cb6e782a615ec0939325595494c62358fe92d4
wenjie1070116/Leetcode
/383-Ransom-Note/solution.py
UTF-8
547
2.96875
3
[]
no_license
import collections class Solution(object): def canConstruct(self, ransomNote, magazine): """ :type ransomNote: str :type magazine: str :rtype: bool """ if not ransomNote: return True if not magazine: return False count = collections.Counter(magazine) ...
true
ef78d79a66fd58de24b8b315c99e922300c69bb3
learnerjiahao/leetcode-solve
/previously_completed/1-30/24-SwapNodesinPairs.py
UTF-8
1,513
3.796875
4
[]
no_license
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None def __str__(self) -> str: return (str(self.val) + '->' + str(self.next)) if self.next != None else str(self.val) class Solution: def reverseKNodes(self, headNode, K): i...
true
8100a6473a167285179ccd569e3e557afcd41a05
lcmonteiro/space-helper
/vectorization/sliding_window.py
UTF-8
1,075
3.1875
3
[ "MIT" ]
permissive
import numpy as np def sliding_window(data, axis, step, shape): from numpy.lib.stride_tricks import as_strided # cast strides & shapes & steps dsd = np.array(data.strides) dsh = np.array(data.shape) isp = np.array(step) ish = np.array(shape) # take stride & shape psd = np.take(dsd,...
true
77cb62cc4f81a832418a85e9b347f5f97421dd80
kien6034/AI----CS50-Harvard-Course
/Language/questions/questions.py
UTF-8
5,172
3.265625
3
[]
no_license
import nltk import sys from os import listdir from os.path import isfile, join import string import time import math FILE_MATCHES = 1 SENTENCE_MATCHES = 3 start_time = time.time() def main(): # Check command-line arguments if len(sys.argv) != 2: sys.exit("Usage: python questions.py corpus") ...
true
2a1795279793441c732a161f78f9dd24fc05858a
waitalone/ad_examples
/ad_examples/timeseries/timeseries_shingles.py
UTF-8
6,877
2.515625
3
[ "MIT" ]
permissive
import os import logging import random import numpy as np import numpy.random as rnd import tensorflow as tf from sklearn.ensemble import IsolationForest from sklearn.neighbors import LocalOutlierFactor from ..common.utils import ( dir_create, get_command_args, configure_logger, read_resource_csv, get_sample_f...
true
e7286cc4f9876343aa2b25479a48eb9c441bc250
PetrPrazak/AdventOfCode
/2015/08/aoc2015_08.py
UTF-8
1,381
3.375
3
[]
no_license
# http://adventofcode.com/2015/day/8 from __future__ import print_function def is_hex_char(s): return s.isdigit() or s in 'abcdef' def unescape(line): s = "" iterline = iter(line) for c in iterline: if c == '\\': c = next(iterline) if c == 'x': h1 = ne...
true
dc7968b9adf1cb133617986fa2a5a59f5ecf49c8
2gisprojectT/terehov-soundcloud
/Day1007_GetStarted/test_numbers.py
UTF-8
1,575
3.53125
4
[]
no_license
from Day1007_GetStarted.class_numbers import Numbers __author__ = 'Alexey' import unittest class NumbersTest(unittest.TestCase): def test_init(self): num = Numbers(1, 2, 3) self.assertEqual(1, num.a, "Wrong a value") self.assertEqual(2, num.b, "Wrong b value") self.assertEqual(3,...
true
9ffcd9a26fee3fa975fca68b310a56b52caebc21
roy4801/RHframework
/test/test.py
UTF-8
2,130
2.859375
3
[]
no_license
import pygame, os sys.path.append("../") display_width = 640 display_height = 480 gameDisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption('test') clock = pygame.time.Clock() running = True PATH = 'asset/' ASSET = {} ASSET_NUM = {} ASSET_NOW_FRAME = {} def loadAssets(name, fi...
true
0971aa9c2c83c503932a20a5aee62117cc5333cf
bobbf/fbcrawler
/recv.py
UTF-8
607
2.796875
3
[]
no_license
import socket import json sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('127.0.0.1',1234)) def getJsonFromUrl(urlString): #print(urlString) response = urllib.request.urlopen(urlString).read().decode() responseJson = json.loads(response) return responseJson while 1: data, add...
true
7dcac6e73425c2e27c11dade4aea967821ad94ce
alexandredct/estudo_python
/eXcript/aula 9 - indentacao.py
UTF-8
287
3.171875
3
[]
no_license
if True:#Aqui há um escape sequence \n dizendo para o interpretador que a instrução acaba ali print("Teste")#instrução vinculada ao if; print("Teste2")#raiz da hierarquia print("Mensagem 1");print("Mensagem 2");#o ; também delimita o fim da instrução, mas não é recomendado
true
dd1efa8530d1590a2e8e383ed6acf3d06979961a
feihong/chinese-ebooks
/zhuixun/generate_json.py
UTF-8
1,171
3.65625
4
[ "MIT" ]
permissive
""" Parse plain text file and output the book's contents as JSON """ import re import json import util def get_lines(): with util.input_file.open('r') as fp: for line in fp: line = line.strip() if line: yield line class Chapter: def __init__(self, title): self.title = title self.bo...
true
0628686661307a34ef5dcaa01ed6245ea6fed772
mchlp/ICS2O1
/Exercises/PuM_ForLoops/ForLoopsEx2.py
UTF-8
187
3.6875
4
[]
no_license
#Michael Pu #2016/11/01 #ICS2O1 #Ms.Strelkovska #For Loops Exercises - 2 #Input num = int(input("How many multiples of 13? ")) #Calculations for x in range(1, num+1): print (x*13)
true
008e958ea461dfde2194b8467d5318c8c5507833
Milind-Blaze/EE2703_Applied_Programming_Lab
/assignment7/ee16b025_7.py
UTF-8
8,704
3.703125
4
[]
no_license
# coding: utf-8 # # Abstract # # This work pursues the use of scientific python, particularly the use of the scipy library to study the transfer functions of a few systems. Bode plots and time domain responses of the system are obtained and studied using inbuilt tools. # # Introduction # # The report pursues broa...
true
42f3a2d508a61502546c1a1413fb25485c7f128e
waldry/estructura2021ene
/codigo_python_estruct/clase07_estruct_abstractas/pila.py
UTF-8
197
2.984375
3
[]
no_license
from collections import deque cola = deque() cola.append("Ricardo") cola.append("Enmanuel") cola.append("Pedro") print(cola.pop()) # https://leetcode.com/problems/valid-parentheses/solution/
true
6d1978f8974ecafe36aba5b1cde714b0ab2ea749
ekjellman/interview_practice
/ctci/16_16.py
UTF-8
1,128
3.953125
4
[]
no_license
### # Problem ### # Given a list of integers, write a method to find m and n such that if you # sorted elements m through n, the entire list would be sorted. Minimize # n - m (to find the smallest subrange) ### # Work ### # Length of the list? # What if the entire list is sorted? # def subrange(numbers): for i in ...
true
f86783e168c7af7a5783e49a8c686afa2bbd4394
Philani1/pre-bootcamp-challenges
/find_max_06.py
UTF-8
342
3.96875
4
[]
no_license
def find_max(num1, num2, num3): numbers_list = [num1, num2, num3] max_no = num1 for i in range(len(numbers_list)): num = numbers_list[i] if num > max_no: max_no = num return max_no if __name__ == "__main__": maximum_number = find_max(3, 4, 5) print(f"Maximum value i...
true
85a33b6d949fdc7ca3c6fff575939650e710dcbc
Nilipopo/Python
/ex14.py
UTF-8
368
3.3125
3
[]
no_license
import numpy as np pi=np.pi def cal_r(cir):# Function: calculate radius return cir/(pi*2) from sys import argv script,first=argv cir=float(first) r=cal_r(cir) if r>3396 and r<4887 or r<3396: #4887=(3396+6378)/2 print "It's nearly Mars!" elif r<6378 and r>4887 or r>6378: print "It's nearly Earth!" else: ...
true
aff7a7df76c4401e5773b8fb22d7ccdfc1876f87
varshamishra-ca/Cargurujiselenium-python
/CarGurujiPOM/Pages/SigninPage.py
UTF-8
551
2.828125
3
[]
no_license
class SigninPage(): def __init__(self,driver): self.driver = driver self.Email_xpath = "//input[@id='email']" self.pwd_xpath = "//input[@id='passwd']" self.submit_xpath = "//button[@id='SubmitLogin']" def enter_signin(self,mail,password): self.driver.find_element_by_x...
true
9ca87b6aea44440d218d3463d40698a6df6af1cc
Harpuneet/FlaskSchoolApp
/flaskSchoolApp.py
UTF-8
3,656
2.671875
3
[]
no_license
''' flaskSchoolApp.py - For parsing school data ''' from flask import Flask, render_template, jsonify import requests, csv app = Flask(__name__) @app.route('/api/schools/<int:school_id>', methods=['GET']) def get_schoolsData(school_id): school_data = {"schoolId":None, "name": "", "telephone": None, "fax": None,...
true
dfd5e59695a3c0b22e4de13e282c1725a164e24a
GerardMaggiolino/Driving-Env
/gym_driving/resources/__init__.py
UTF-8
461
3.21875
3
[]
no_license
''' Provides system independent module path for resources. ''' import os def getResourcePath(filename): ''' Returns an absolute path to the resource specified by filename. Parameters ---------- filename : str The filename under the resources module (directory). Returns ----...
true
ad5515ce895b658dbfc032dc45973f61ad33f5d5
leofmandrade/EP2--Dessoft
/extrai naipe.py
UTF-8
284
3
3
[]
no_license
def extrai_naipe (baralho): letras_e_numeros=['A','2','3','4','5','6','7','8','9','10','J','Q','K'] naipes=['♣', '♦', '♥', '♠'] for i in letras_e_numeros: for e in naipes: if e in baralho: return e print(extrai_naipe('A♦'))
true
dea3c5385fd74b43c3a93a9d4447115b6f9d328d
anuja-14/SimpleWeb
/text_box.py
UTF-8
2,364
3.515625
4
[]
no_license
from Tkinter import * import tkMessageBox def displayText(): """ Display the Entry text value. """ global entryWidget if entryWidget.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a text value") else: tkMessageBox.showinfo("Tkinter Entry Widget", "Text valu...
true
884c9f86afdece7549fdb95df6fb1ccb7f59a886
mcavalca/uri-python
/2845.py
UTF-8
311
3.390625
3
[]
no_license
n = int(input()) duende = input().split() for x in range(n): duende[x] = int(duende[x]) duende.sort() maior = int(duende[n-1]) + 1 while True: for x in range(n): if (maior % duende[x]) == 0 and duende[x] != 1: maior += 1 break if x == n-1: break print(maior)
true
e4fca478f80d3d5d9f09df4d5d6652fbdbf3e264
leonpri/py-service-wrapper
/sample_project/testproject/api_module.py
UTF-8
3,195
2.890625
3
[ "Apache-2.0" ]
permissive
from typing import Dict, Optional from pydantic import BaseModel from typing import Union import asyncpg from minio import Minio import io dsn_str = f"postgresql://postgres:postgres@postgres:5432/postgres" class MinioClient: _client = None def init(self): if self._client is None: self._c...
true
b839586aa94b3bd2afe4d46317bb78560e498762
miaozaiye/PythonLearning
/miaozaiye/introcs-python/twentyquestions.py
UTF-8
1,753
4.125
4
[ "MIT" ]
permissive
#----------------------------------------------------------------------- # twentyquestions.py #----------------------------------------------------------------------- import stdio import random # Generate a random integer. Repeatedly read user guesses from # standard input. Write 'Too low' or 'Too high' to standard o...
true
44f4639f3b37742de23753d132d0ac6d95225be2
IndiaCFG2/team-8
/user/utils-google.py
UTF-8
338
2.734375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
import speech_recognition as sr from googletrans import Translator filename = "hindi.wav" r = sr.Recognizer() with sr.AudioFile(filename) as source: audio_data = r.record(source) text = r.recognize_google(audio_data,language='hi-IN') print(text) result = translator.translate(text, src='hi', dest='en') p...
true
9e45528ce480b1284666ed30483ee9b1c6439102
brunoleej/study_git
/ML,DL, RL/Reinforcement Learning/RL Basic/01. OpenAI Basic/atari_test.py
UTF-8
502
2.890625
3
[]
no_license
import gym if __name__ == '__main__': env = gym.make('SpaceInvaders-v0') observation = env.reset() total_reward = 0.0 total_stpes = 0 while True: env.render() action = env.action_space.sample() observation,reward, done, info = env.step(action) total_re...
true
7a74cdd54ddf479c521cdeaa7e37ded97bae558c
changqing1234/Defending-Neural-Backdoors-via-Generative-Distribution-Modeling
/lib/trigger.py
UTF-8
5,206
2.75
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt import torch import copy class Trigger: def __init__(self, dataset_name, content, target, type_=0, args={}): self.name = dataset_name self.content = content # CHW float numpy array, 0. to 1. self.content_img = (self.content.transpose(1,2,0)...
true
60389616caa7858e28f3d44cb02936c3d1791970
dpdicken/critters
/Critter.py
UTF-8
1,613
3.328125
3
[]
no_license
class Critter(): # Methods students will be implementing def eat(self): return false def fight(self, opponent): return ATTACK_FORFEIT def getColor(self): return "grey" def getMove(self): return DIRECTION_CENTER def toString(self): return "?" # E...
true
2d8ea7b5a89374fa8aafc0835dcb00c182990771
bs3537/DS-Unit-3-Sprint-3-Productization-and-Cloud
/module3-adding-data-science-to-a-web-application/basilica_service.py
UTF-8
501
2.859375
3
[ "MIT" ]
permissive
import os from dotenv import load_dotenv import basilica load_dotenv() BASILICA_API_KEY = os.getenv("BASILICA_API_KEY", default="OOPS") sentences = [ "This is a sentence!", "This is a similar sentence!", "I don't think this sentence is very similar at all...", ] connection = basilica.Con...
true
a1a53809ac8d17d60298c5647a3a41d3d373ca71
joaocaldeira/advent-of-code
/day06p2.py
UTF-8
639
3.171875
3
[]
no_license
import csv with open('input6.txt') as file: orbits = list(csv.reader(file)) orbit_dict = {} for orbit in orbits: orbited, orbitee = orbit[0].split(')') try: orbit_dict[orbitee].append(orbited) except KeyError: orbit_dict[orbitee] = [orbited] start = orbit_dict['YOU'] end...
true
1862cd6b3a8454e48ac4cffaebcb8ae25e2dcbb5
DennisGoldfarb/MS-Demix
/scripts/parseTide.py
UTF-8
636
2.8125
3
[]
no_license
#!/usr/bin/env python import sys infile = open(sys.argv[1]) writeHeader = sys.argv[2] header = infile.readline().strip().split("\t") numCol = len(header) numCharges = numCol - 17 newHeader = header[0:9] + header[9:9+numCharges] for i in xrange(numCharges+1, 6): newHeader.append("Charge"+str(i)) newHeader += ...
true
c5d733d44f74006cbb20fb5a83c0e323f75bd246
lottev123/Visualization-HWLV
/Assignment 2/3_Positions_Mismatches_ArtistAndAlbumLists.py
UTF-8
7,529
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Dec 22 15:05:04 2017 @author: s134277 """ import pandas as pd import os import numpy as np import ast working_dir = r'C:\Users\s134277\Documents\Top40 dataset\ ' os.chdir(working_dir) artists_top40 = pd.read_csv("artists.csv", engine='python', delimiter="\t") songs_top40 = ...
true
b7c24dbc638b2c6a07de52f644fe72cb7ae0f2e9
gusha987/via-piudzpa-helper-files
/asteroids/worker_2_db.py
UTF-8
11,109
2.65625
3
[]
no_license
import logging import logging.config import mysql.connector import requests import json import datetime import time import yaml from datetime import datetime from configparser import ConfigParser from mysql.connector import Error def init_db(): global connection connection = mysql.connector.connect(host=mysql_conf...
true
2f90577f94d9f68f28795b5a7ec6a8733b0939fa
pibarull/Teor_Prog
/lab2.py
UTF-8
1,826
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np # число точек N = 10000; fundel = 100; # пределы R = 1; x1 = -R; x2 = R; y1 = -R; y2 = R; func = lambda x, y: 2 * (x ** 2) + 1 * (y ** 2) # поиск максимума fmax = 0; for i in range(fundel + 1): ny = np.sqrt(1 - ((i * (x2 - x1) / fundel) + x1) ** 2) ny1 = -ny ny...
true
7dca3d1d9ccc3612994d6c8f6e76511a4d8f561e
jeromexlee/CS289A
/HW5/random_forest.py
UTF-8
5,485
2.84375
3
[]
no_license
from Decision_Tree import DTree import numpy as np from sklearn import tree, ensemble from main import segmentor, entropy_impurity, gini_impurity, load_data, computeCV_Score def create_forest_data(trainingData, trainingLabels): # It works - I checked trainingComplete = np.array(zip(trainingData, trainingLabels...
true
1c7ffda964301829ce114284c0bac082c9568896
ajr15/CustodiPaper
/commons.py
UTF-8
10,508
2.5625
3
[]
no_license
# ======================================================= # # FILE WITH COMMON FUNCTIONS FOR CALCULATIONS # # ======================================================= import pandas as pd import numpy as numpy import tensorflow as tf from time import time import settings import sys; sys.path.append(settings.torin...
true
89c79c24ca9323aa438da438bdd80f2173fcfc81
bravecollective/jabber-auth
/brave/jabber/test.py
UTF-8
81
2.875
3
[ "MIT" ]
permissive
import sys while 1: line = sys.stdin.readline().rstrip("\n") print line
true
d6103bb1dcbe5ac95d5873a0b265e37d3eb2ad5d
Shiyuan-Huang-23/code_quest_2017
/Prob09/Prob09.py
UTF-8
608
2.890625
3
[]
no_license
def main(): with open("Prob09.in.txt") as f: myList = [line.rstrip('\n') for line in f] n = int(myList[0]) for i in range(1, n + 1): message = list(myList[2 * i - 1]) keyword = list(myList[2 * i]) spaces = 0 for j in range(len(message)): ...
true
7b1e5de3887f9add12619cce5f291864b378599a
rajeshsvv/Lenovo_Back
/1 PYTHON/2 COREY SCHAFER/PART 2/37_classes_and_instances.py
UTF-8
1,574
4.5625
5
[]
no_license
# classes and instances # classes logically group our data and function in a way thats easy to reuse # when i say data and functions are associated with a specific class we call those attributes and methods # when i say methods i mean function associated with a class. # class is a blueprint for creating instances. # i...
true
a608ffa890f6a7087becfbf2355161dcfc63d354
jhs851/algorithm
/sparta/week_4/homework/02_get_count_of_departments_cleaned_by_robot_vacuum.py
UTF-8
1,972
3.171875
3
[]
no_license
from collections import deque current_r, current_c, current_d = 7, 4, 0 current_room_map = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0,...
true
443652fc996e60b898e4a97920bf4018a4da7fd1
romulovieira777/Programacao_em_Python_Essencial
/Seção 05 - Estruturas Lógicas e Condicionais em Python/Exercícios da Seção/Exercício_16.py
UTF-8
867
4.875
5
[]
no_license
""" 16) Usando switch, escreva um programa que leia um inteiro entre 1 e 12 e imprima o mês correspondente a este número. Isto é, janeiro se 1, fevereiro se 2, e assim por diante. """ month = int(input('Enter the number between 1 and 12: ')) if (month > 0) and (month < 13): if month == 1: print('January') ...
true
db41f8cbefa8318e8689e409f92553db88fd9ccd
yyassif/codinginterviewquestions
/algorithms/680. Valid Palindrome II.py
UTF-8
1,029
3.4375
3
[]
no_license
#greedy run-O(n), space - O(1) class Solution: def validPalindrome(self, s: str) -> bool: def valid(a,b): for i in range(a,b): if s[i]!=s[b-i+a]: return False return True n=len(s) success=True for i in range(n//2): ...
true
5102b6aa49ca043ad2a8350546665a7fe84dadfe
ahmedmassalha2/lab2
/genetic.py
UTF-8
8,374
2.75
3
[]
no_license
from __future__ import division import time from random import randint, random, sample, shuffle import numpy as np import operator import re from functions import * import copy GA_ELITRATE = 0.4 maxIterations = 16384 populationSize = 2048 GA_MUTATIONRATE = 0.3 nCitits = 0 initPoint,capacity, graph, demand,...
true
4584a285c2e746f7c4ce09f8186a4be346986c0a
yorickreum/thesis-pde-nn
/laplace/quadratic.py
UTF-8
2,276
3.109375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import torch import torch.optim as optim import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class Net(nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Net, self).__init__() self.hidden =...
true
2713a580dabb8853fce454ed1c68b39fadebc59a
lih627/python-algorithm-templates
/LeetCodeSolutions/LeetCode_0010.py
UTF-8
329
2.84375
3
[ "MIT" ]
permissive
class Solution: def isMatch(self, s: str, p: str) -> bool: if not p: return not s pre = s and p[0] in ['.', s[0]] if len(p) > 1 and p[1] == '*': return self.isMatch(s, p[2:]) or pre and self.isMatch(s[1:], p) else: return pre and self.isMatch(s[1:]...
true
0582a30bfb3006bfc2afd37e06ce6e2b201d00f4
Noupin/INAC
/preprocessing.py
UTF-8
6,019
2.71875
3
[]
no_license
#pylint: disable=C0103, C0301 """ The functions needed to preprocess the data and make the data usable for AI training """ __author__ = "Noupin, W&B" #Third Party Imports import os import librosa from sklearn.model_selection import train_test_split import numpy as np from tqdm import tqdm import tensorflo...
true
9b1edfbb117e4cf2ee17fcd8e3000bfbc5901910
kryogenica/model_validation
/extract_low_threshhold.py
UTF-8
1,031
2.578125
3
[]
no_license
import numpy as np import sys import os import time os.system("rm modeled.pdb") Num = open("numbers.log",'r') numbers = Num.readlines() Num.close() Let = open("letters.log",'r') letters = Let.readlines() Let.close() original = open("output.pdb",'r') lines = original.readlines() original.close() print "Number of...
true
6dbbd31802a89e13f5563b2732a69f685c5782d7
vedk21/hadoop-playground
/MapReduce/PopularMoviesBreakdown.py
UTF-8
710
2.75
3
[]
no_license
from mrjob.job import MRJob from mrjob.step import MRStep class PopularMoviesBreakdown(MRJob): def steps(self): return [ MRStep(mapper=self.mapper_get_movies, reducer=self.reducer_avg_movies), MRStep(reducer=self.reducer_count_movies) ] def mapper_get_movies(self, _, line): (userID, movieI...
true
fd45c5625f9cf77961d9d042924bad84e3c27916
IE-NITK/Image-Recog-by-CNN-SMP-2019
/Week_One/Assignment_Submissions/keshavsingh/tictactoe.py
UTF-8
1,424
3.4375
3
[]
no_license
#INCOMPLETE PROGRAM #RANDOM.CHOICE ERROR import random,sys list1=[' '] for var in list(range(1,10)): list1.append(' ') def reset(): list1=[' '] for var in list(range(1,10)): list1.append(' ') def struct(list1): print("--------------------------------------------------") for i in list(range(1...
true
a31065b929d2330c609276f86b9908fab0a7f31c
arossbrian/my_short_scripts
/scraping_script.py
UTF-8
1,226
3.203125
3
[]
no_license
#!/usr/bin/python3 import requests from bs4 import BeautifulSoup from pprint import pprint result = requests.get("https://www.whitehouse.gov/briefings-statements/") # print(result.status_code) # print(result.headers) source = result.content soup = BeautifulSoup(source, "html.parser")# Using Bs4 links = s...
true
fd69535529422c07a61f3272a43a72c68c6fd54a
Baiyun-u-smartAI/OpenCV_examples
/2022/OpenCV4 tutorial/Hough Transform/lines.py
UTF-8
3,671
2.828125
3
[ "MIT" ]
permissive
import cv2 as cv import numpy as np def main(): src = cv.imread("circles.jpg", cv.IMREAD_GRAYSCALE) dst = cv.Canny(src, 50, 200, 3) cdst = cv.cvtColor(dst, cv.COLOR_GRAY2BGR) cdstP = np.zeros(cdst.shape, dtype=np.uint8) np.copyto(cdstP, cdst) lines = cv.HoughLines(dst, 1, np.pi / 180, 150, 0...
true
8306f1c58cbb26e4ad49f1573ecac3e8dfbb540d
nrusty/masters
/tpot_best_pipeline.py
UTF-8
5,056
2.65625
3
[]
no_license
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer from sklearn.utils import resample from sklearn.tree import export_graphviz from subprocess import call # Display in jupyter no...
true
c102a01143a0f03a39ad2008713226fbfadb3d72
16-sanalmishra/TKinter-Basics
/Label.py
UTF-8
299
2.515625
3
[]
no_license
from tkinter import * window = Tk() window.title("Movie Recommendation System") window.configure(background="grey") l1 = Label(window, text="Movie Recommendation System", bg="#FFFFAA", fg="blue", font="Times 20 bold underline") l1.pack() bt = Button(window, text="Login").pack() window.mainloop()
true
a0f24dd5cf15494589e537920a72c3f842e70e20
BrentNolan/Deep-Space-Derelict
/objects/GameObj.py
UTF-8
616
3.109375
3
[]
no_license
##class: CS467 ##group: Sagitta ##members: Robert Erick, James Wong, Brent Nolan ##date: 4/17/2017 ##import os ##import platform class GameObj(object): def __init__(self): self.otherObjects=None self.long_description='' self.short_description='' self.name='' self.alternate_...
true
ee7c80a046686da1ad54db95c8a2469af6ea78be
cdelzotti/DiscordPersonalAssistant
/modules/botModule.py
UTF-8
3,955
3.109375
3
[]
no_license
from modules.module import Module import discordSignalitics class BotModule(Module): """ A module handling bot configuration """ # Set a human friendly-name for your module name = "BotModule" # Define the string used to call this module command function commandTrigger = "bot" # Define ...
true
995064a56312c6514a5d794b349b5b001c646f08
zohaibafridi/Scripts_of_Data_Exploration_and_Analysis_Book
/Volume III/4-Matplotlib/Code_Scripts/4.4-Subplots.py
UTF-8
813
3.5
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # ### Subplots # In[1]: import matplotlib.pyplot as plt fig,a = plt.subplots(2,2) import numpy as np x = np.arange(1,5) a[0][0].plot(x,x*x) a[0][0].set_title('square') a[0][1].plot(x,np.sqrt(x)) a[0][1].set_title('square root') a[1][0].plot(x,np.exp(x)) a[1][0].set_title('exp'...
true
a82cb2555e1d392b32d3cf8f8480087efb8b8714
tapaskumarpaul84/Cdac-Noida-Assignment
/Numpy/Numpy Assignment_1.py
UTF-8
5,297
4.09375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 12 14:25:10 2020 @author: TAPAS KUMAR PAUL """ ###1. Write a NumPy program to get the numpy version and show numpy build configuration. import numpy as np print("Version of the numpy is:",np.__version__) print("Configuration of numpy:") print(np.show_config(...
true
52a35c2a18fab761992e91afd41aa93782cbfdb9
liyangjie/MANtpp
/method/methods.py
UTF-8
8,987
3.390625
3
[]
no_license
# -*- coding=utf-8 -*- # @Author: Yangjie Li import math def method_1(a, b, c, d): S = a / (a + b + c) return S def method_2(a, b, c, d): S = 2 * a / (2 * a + b + c) return S def method_3(a, b, c, d): S = 2 * a / (2 * a + b + c) return S def method_4(a, b, c, d): S = 3 * a / (3 * a + b...
true
38402b9c03f4bc91261d976c00eae9b4983bbea5
mufraswid/julius
/classic/superenc.py
UTF-8
1,428
3.234375
3
[]
no_license
import classic.vigenere PAD = 'Z' def encrypt(plaintext, key_col, key_vigenere): ''' For encrypting plaintext with Super Encryption (Vigenere Standard + Transposition) ''' #padding dulu sama special character di akhir if len(plaintext) is not divisible by k while(len(plaintext) % key_col != 0): ...
true
405c06c4a045e3975f776322016975302e7c031a
SiyiGuo/Titan-V
/AlphaPubg-Zero/Arena.py
UTF-8
6,392
3.09375
3
[]
no_license
import numpy as np from pytorch_classification.utils import Bar, AverageMeter import time # def records_saver(records): # with open ("records", 'wb') as fp: # pickle.dump(records, fp) # def records_reader(filename): # with open(filename, 'rb') as fp: # records = pickle.load(fp) # return r...
true
7382ad917d396a36a721bb9bf03fa8dbf99f6069
marinabar/guessthenumbergame
/jeunombre.py
UTF-8
358
3.796875
4
[]
no_license
import random n = random.randint(0,50) on = "" while True: number = input("Try to guess the number I chose between 0 and 50 ") number = int(number) if number == n: on = "Right" print(on) break elif number < n : on = "More" print(on) else : ...
true
adbd32cdd61be1108a243c0d3e0688fbc4500091
Zomega/thesis
/Wurm/PyWurm/Leg.py
UTF-8
2,825
2.96875
3
[ "MIT" ]
permissive
from ControlledSystem import ControlledSystem from math import sin, cos, sqrt, pi # The leg can only enter and exit stance at I_max class Leg(ControlledSystem): def __init__( self, I_min, I_max, I_dot_max, a, k, c, phi, b ): # Used to validate states and controls... self.I_min = I_min self....
true
b114ac87a29f336e3894e847d254294d008ebf14
afzal-xyz/GTEdx_6040
/Week 4 Homework/part1.py
UTF-8
7,342
4.09375
4
[]
no_license
# coding: utf-8 # # Part 1 of 2: Processing an HTML file # # One of the richest sources of information is [the Web](http://www.computerhistory.org/revolution/networking/19/314)! In this notebook, we ask you to use string processing and regular expressions to mine a web page, which is stored in HTML format. # **The ...
true
db2130a95a1a3d8379a8fe295f4938956e4fc78b
liu-yuxin98/Python
/chapter9/9-7.py
UTF-8
888
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- # 2020-02-04 # author Liu,Yuxin from tkinter import * class GridManagment(): def __init__(self): window = Tk() window.title('Grid Management') message = Message(window, text='these message ocuppy three rows and two columns') # grid message.grid(row=1, ...
true
30c531a14a8c1c82ee3b3134b8e897ac626b67ff
sreelakshmikp/LuminarDjangoPython
/LuminarPython/oops/inheritance_demo.py
UTF-8
748
3.71875
4
[]
no_license
# single inheritance class Parent: def phone(self): print("phone method") class Child(Parent): pass ch=Child() ch.phone() print(ch) # multilevel inheritance class Parent: def m1(self): print("inside parent") class Child(Parent): def m2(self): print("inside child") class Subchild...
true
9a070e425048b3d763a2e96340876aca54aedad1
MinjiKim77/bigdata2020
/examples/MinjiKim/minji_tour/tour/views.py
UTF-8
986
2.609375
3
[]
no_license
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse,HttpResponseRedirect from django.core.paginator import Paginator from .models import TourInfo # 메인뷰 def index(request): tourlist = TourInfo.objects.all() page = request.GET.get('page') #파라미터로 넘어온 현재 페이지값 paginator ...
true
4e4d3122dc2ed43b0b2cd42b0aefcaaf7acee634
ZubinGou/Learn-Python3-The-Hard-Way
/ex49/tests/ex49_test.py
UTF-8
788
3.28125
3
[ "MIT" ]
permissive
from nose.tools import * from ex49.ex49 import * def test_Sentence(): sentence = Sentence(('noun', 'apple'), ('verb', 'eat'), ('direction', 'good')) assert_equal(sentence.subject, 'apple') def test_peek(): peek1 = peek([('noun', 'apple'), ('verb', 'eat'), ('direction', 'good')]) peek2 = peek(...
true
71a5430293b81a24e1c1066a08abc3ea25c8e5e5
YashSaxena75/Python_Data_Science
/5.py
UTF-8
518
2.71875
3
[]
no_license
import pandas as pd df1=pd.DataFrame({'HPI':[80,85,88,85], 'Rate':[2,3,2,2], 'GDP':[50,55,65,55]}, index=[2001,2002,2003,2004]) df2=pd.DataFrame({'HPI':[80,85,88,85], 'Rate':[2,3,2,2], 'GDP':[50,55,65,55]}, index=[2005,2006,2007,2008]) df3=pd.DataFrame({'HPI':[80,85,...
true
4b89d7b33e032c2377d738b510fc2cc3b460b783
LoadingByte/socorepo
/socorepo/config/toml_dict.py
UTF-8
7,478
2.71875
3
[ "MIT" ]
permissive
from __future__ import annotations import logging import os import re import sys from typing import List, Type, Pattern import toml log = logging.getLogger("socorepo") class TomlDict: _filename: str _dict: dict _prefix: List[str] @staticmethod def load(file: str) -> TomlDict: return To...
true
70cd181966dc7269958aba0a0a261c3e67237ea6
gabrielwry/InterviewPractice
/Algorithm/Basic/Sorting&Searching/BinarySearch.py
UTF-8
507
3.921875
4
[]
no_license
# Given a sorted array arr[] of n elements, write a function to search a given element x in arr[]. arr = [1,2,3,4,5,6,7,8,91,100] def search(arr_,element,low,high): mid = arr_[int((low+high)/2)] if low+1 < high: if mid < element: low = int((low+high)/2) return search(arr_,element,low,high) if mid > element:...
true
d2252a7eafdd6e98f1f6f0a2c2e0dd550e9fa4a3
mosquito/asynctest
/test/test_mock_await.py
UTF-8
750
3.171875
3
[ "Apache-2.0" ]
permissive
# coding: utf-8 # add a new-style coroutine to the Test class: def patch_Test_Class(klass): class Test(klass): async def an_async_coroutine(self): pass return Test # wrap the coro in a new-style coroutine def transform(coro): async def a_coroutine(*a, **kw): return await cor...
true
a9e4e560080c5cc4e6a7bb68735a9ea2e2340318
mzboito/Newton-Raphson_hardening
/scripts/parser/process.py
UTF-8
3,068
2.796875
3
[]
no_license
#!/usr/bin/env python import sys import os import csv import re import collections import parseUtils import glob def processErrors(errList): errLimitList = [0.1,0.2,0.3,0.4,0.5,1,2,3,4,5,8,10,12,15] csvHeader = list() csvHeader.append("numberIterationErrors") csvHeader.append("maxRela...
true
abe33bc1fb241828498d0b75377df70deb2dde51
alfonsocv12/orator-validator
/orator_validator.py
UTF-8
6,990
3.265625
3
[ "MIT" ]
permissive
import re import time import json class Validator(object): _validation_init = True __errors__ = {'code':200, 'errors':[]} def process(self, key, exist=False, not_exist=False, **args): ''' This function is created to add new functionality, if a model value of a nullable filled exist...
true
d3f611a2cabd85de546880dd9eeada701e3f2a2c
jcockbain/ctci-solutions
/chapter-04/Q10_check_subtree.py
UTF-8
1,248
3.65625
4
[]
no_license
import unittest class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def check_subtree(t1, t2): t1_pre_order = pre_order_traversal(t1) t2_pre_order = pre_order_traversal(t2) return array_contains(t1_pre_order, t2_pre_o...
true
63336e4c988576a6a05d7bbdb39127e072ce98aa
Sprytile/Sprytile
/rx/concurrency/historicalscheduler.py
UTF-8
1,932
3.390625
3
[ "MIT" ]
permissive
from datetime import datetime from .virtualtimescheduler import VirtualTimeScheduler class HistoricalScheduler(VirtualTimeScheduler): """Provides a virtual time scheduler that uses datetime for absolute time and timedelta for relative time.""" def __init__(self, initial_clock=None, comparer=None): ...
true
fe83e4bdc6c026de98d79cc4c4f7f1e3210acd73
joaofig/trip-graph
/geo/spoke.py
UTF-8
2,223
3.328125
3
[ "MIT" ]
permissive
import numpy as np from geo.math import vec_haversine, num_haversine class GeoBrute(object): def __init__(self, locations: np.ndarray): self.lats = locations[:, 0] self.lons = locations[:, 1] def query_radius(self, location: np.ndarray, r: float) ->...
true
2521b56540b36303f20399a02b3971ef9b1ef2b5
tanaypatil/code-blooded-ninjas
/applications_of_number_theory1/find_the_good_sets.py
UTF-8
1,386
3.640625
4
[]
no_license
""" Find the good sets! Send Feedback You are given array a consisting of n distinct integers. A set s of numbers is called good if you can rearrange the elements in such a way that each element divides the next element in the order, i.e. 'si' divides 'si + 1', such that i < |s|, where |s| denotes size of set |s|. Find...
true
59cf02c38ba509a68a5d745598ab67e6cfafee54
nasa-itc/OrbitInviewPowerPrediction
/scripts/ground_station.py
UTF-8
10,943
2.703125
3
[]
no_license
import geocoder from datetime import datetime, timedelta from pytz import timezone from configuration import Configuration from ground_station_schedule_directory import GroundStationScheduleDirectory ############################################################################### # Python module to make it easy to work...
true
024a69c67ba26d73850b824594581432518fb7ef
bombsandbottles/THESIS
/Code/mir_utils.py
UTF-8
714
2.984375
3
[]
no_license
from __future__ import division import numpy as np import scipy def import_audio(filepath): """ filepath: string pointing to audio file on disk Simple function to quickly read audio data into numpy array returns: data = audio in samples across time data_l / _r = left and right channels seperated fs = sa...
true
5d67631b5be6bc5df12e84be547d637792d666d8
snoutRS/Python-Web
/app1.py
UTF-8
1,184
2.890625
3
[ "MIT" ]
permissive
from flask import Flask,render_template app = Flask(__name__) @app.route('/') def hello_world(): return 'hello_world' @app.route('/demo') def tempdemo(): return render_template('demo.html',name='aaa',msg='asdf') @app.route('/demo1') def tempdemo1(): dict1={"name":"罗小黑","msg":"asdf"} return render_tem...
true
c2fa5c8fc164599906b3be318dfdb697854d781d
clschroeder/Algoritmos-Python
/ordenacao.py
UTF-8
317
3.890625
4
[]
no_license
C1 = int(input("Por favor, digite o primeiro número inteiro:")) C2 = int(input("Por favor, digite o segundo número inteiro:")) C3 = int(input("Por favor, digite o terceiro número inteiro:")) if C1< C2 and C2 < C3 and C1< C3: print ("crescente") else: print ("não está em ordem crescente")
true
5ba931451a9f70ff62acbe2034d247b60c773fa2
mruss22/Comp_Phylogenetics
/seqManip.py
UTF-8
6,521
3.828125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 20 11:27:37 2015 @author: Marisa_29 """ # define a DNA sequence (taken from # https://github.com/jembrown/CompPhylo_Spr2015/blob/master/CodingSeq.txt) """*** Sequence Manipulation Exercise *** - Create a new Python script (text file) - At the beginning of the script, def...
true
8bdcb842280cd70fb2e692197d684b4812b14e9f
mmmmeng/Python
/Start/HelloWorld.py
UTF-8
101
2.640625
3
[]
no_license
# coding=utf-8 # 第一个注释,向世界问好 print("Hello World!") print("你好,世界!")
true
699eeafeb43938885350b8d5556f87812fb5925c
dgcastillof/mercantil
/page_objects/seguros_personales/hogar.py
UTF-8
4,043
2.796875
3
[]
no_license
from page_objects.base_page import Page from page_objects.seguros_personales.properties.locators import HogarLocators from selenium.webdriver.common.by import By class Hogar(Page): def __init__(self, driver): super().__init__(driver) self.__locators = HogarLocators() def click_cotizar(self): ...
true
5ee8828bab35106964352fdca1c1eea2ec47112c
muaddibA/labs
/main.py
UTF-8
411
3.28125
3
[]
no_license
array1 = [0, 3, 6, 26, 823] array2 = [1, 8, 78] def medians(nums1, nums2): o = sorted(nums1 + nums2) if len(o) % 2 == 0: m = ((o[len(o) // 2 - 1] + o[len(o) // 2]) / 2) print(f'{m} - медиана списка {o}') return m else: m = o[len(o) // 2] print(f'{m} - меди...
true