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
582d80b8bd1d513cbc62ed7061a9c20716285de8
bshreeharasur/AI_ML_LAB_TERMWORK
/AI-ML-LAB-TERMWORK/AIML_LabTw/Part A/tw1.py
UTF-8
1,100
3.96875
4
[]
no_license
from collections import defaultdict class Graph: count = 0 def __init__(self): self.graph = defaultdict(list) def addEdge(self, u, v): self.graph[u].append(v) def dfid(self, v, target, max_depth): self.count += 1 print(v, target) if v == target: return True ...
true
d2206ccd11c7880852c5695edeb11c34f2583d30
dalejoroc11/holbertonschool-higher_level_programming
/0x06-python-classes/2-square.py
UTF-8
501
4.125
4
[]
no_license
#!/usr/bin/python3 """ Write a class Square that defines a square by: (based on 1-square.py) Private instance attribute: size Instantiation with optional size: def __init__(self, size=0) """ class Square: """class Square""" def __init__(self, size=0): """__init__ the data with error handling""" ...
true
5a3c4581e2a4a4c1fb293e73ff5bf8f0b0ca3429
kewitz/SAET2014
/File.py
UTF-8
1,656
3.578125
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2014 Leonardo Kewitz Exemplo de leitura e processamento de um arquivo CSV no Python. Neste exemplo um arquivo obtido no analisador de espéctro é lido, convertido e plotado. """ # Importa bibliotecas necessárias. from numpy import * import matplotlib.pypl...
true
303cb04307770ad2e0fa0f70d122b1e4ba7097b9
tovejungenfelt/advent2020
/day01/solution.py
UTF-8
458
3.484375
3
[]
no_license
import fileinput import itertools number_list = [] with fileinput.input(files=('input.txt')) as f: for line in f: number_list.append(int(line)) # PART 1 seen = set() for number in number_list: if 2020-number in seen: print((2020-number)*number) seen.add(number) # PART 2 comb_list = list(i...
true
d4628a8fd82edf8c59f5cb234cacf9aa48bbe39b
theChad/ThinkPython
/chap19/binomial.py
UTF-8
382
3.9375
4
[ "MIT" ]
permissive
# Exercise 19.1 def binomial_coeff(n, k): """Compute the binomial coefficient "n choose k". n: number of trials k: number of successes returns: int """ # Just put all three return possibilities into one statement. Could use parentheses if it # seems clearer. return 1 if k==0 else 0 if...
true
eebb79cc80abe6c19f057a27309743dd72d93399
kellsteph2002/SIP-FInal-Project
/quiz2.py
UTF-8
4,585
3.640625
4
[]
no_license
Q1 = ["The Body Shop?", "Correct! Is it a coincidence that it happens to be cruelty-free and vegetarian friendly? The Body Shop was previously owned by L'Oreal but was later sold to a very environmenty consciouse business Natura.", "The Body Shop was previously owned by L'Oreal but was later sold to a...
true
a254e5d03ccb1e65a399a1b7e28b7d28822b5a9a
AlterFritz88/pybits
/bite44.py
UTF-8
206
3.203125
3
[]
no_license
import random, string def gen_key(parts, chars_per_part): return '-'.join([''.join(random.choices(string.ascii_uppercase + string.digits, k=chars_per_part)) for x in range(parts)]) print(gen_key(5,5))
true
67da4d35da377dac168eab8885140317739c60aa
cocoa-maemae/leetcode
/algorithm/python/largest_values_from_labels.py
UTF-8
1,429
3.015625
3
[ "MIT" ]
permissive
import json import collections class Solution(object): def largestValsFromLabels(self, values, labels, num_wanted, use_limit): counts = collections.defaultdict(int) vl = sorted(zip(values, labels)) ans = 0 while num_wanted and vl: val, lab = vl.pop() if coun...
true
29c578f199ffdc55796a403bf84629caa794dbd3
jagrvargen/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/model_city.py
UTF-8
584
2.796875
3
[]
no_license
#!/usr/bin/python3 """ This module contains a class definition for City """ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from model_state import Base, State class City(Base): """ A class definition for the state model c...
true
018c720fca1742c2de32a1e3a488013776eee9b3
coderaksh-3/restaurant_online_booking
/Restaurant_Online_Booking.py
UTF-8
9,600
3.3125
3
[]
no_license
# || ----- HOTEL PROJECT ----- || print('|| WELCOME TO HOTEL - SHIVRAI ! ||') rlist = [] class Restaurant: def __init__(s, name='', email='', contact=0, password='', confirm_password='', veg_price=0, nonveg_price=0, total_bill=0): s.name = name s.email = em...
true
6f24172aef51be75acfa6e6ed745478afc1531b6
jmonlong/reppopsv
/src/flankRefSeq.py
UTF-8
1,687
2.515625
3
[]
no_license
import argparse from pyfaidx import Fasta # Define arguments parser = argparse.ArgumentParser(description='Retrieve the reference sequence flanking regions') parser.add_argument('-bed', dest='bed', help='the file with the regions coordinates') parser.add_argument('-ref', dest='ref', help='the reference genome fasta') ...
true
43ca0c84613509450f3176cfcd6ff5f7dd59ca9b
luyajie/python-projects
/DataStructures/CheckTuples.py
UTF-8
575
3.359375
3
[ "MIT" ]
permissive
#!/usr/bin/python3.6 def __get_tuple1(): return (123, 'VOD LN', 'Vodafone', 23.36000061) def __get_tuple2(): return (123, 'VOD LN', 'Vodafone', 23.36000061) def __get_tuple3(): return (123, 'VOD LN', 'Vodafone', 23.3600006009) tup1 = __get_tuple1() tup2 = __get_tuple2() tup3 = __get_tuple3() print('\n\...
true
3ab7f3d6b119e94323b93e28a6793a882b77a718
alextanhongpin/competitive-programming
/q3.py
UTF-8
3,168
4.3125
4
[]
no_license
# Nathaniel just broke up with Janice. Hence, Janice has become his Ex. In one # of Nathaniel’s computer science course “Mastering Boolean Expressions”, he # came across single-variable Boolean expressions, which are made up of: # # - The variable x # - The negation of variable x, X # - The constant False, 0 # - The co...
true
071284ed06a1212bad0cd6ea127f3e648426eb85
a-gil/SEM_Software
/preliminary_code_tuple_version.py
UTF-8
1,283
3.296875
3
[]
no_license
x_0 = 100. #starting x position y_0 = 35. fov = 2.408 #how many mm we'll move across x_n = 1 #dummy variable coords = () #empty tuple where we'll store the x vals n = 0 m = 0 while x_n >= 0: #dummy variable used to get...
true
343eb43630421774a891abbf0b4b19a02fcec726
DRCART03/CodeCombat
/Forest/ForestJogging/ForestJogging.py
UTF-8
736
4.25
4
[]
no_license
# https://codecombat.com/play/level/forest-jogging # Let's train your pet a little. # This function makes a pet run around. def runAround(event): while True: # First, move to the left mark: pet.moveXY(9, 24) # Next, the top mark: pet.moveXY(30, 43) # Move your pet to the rig...
true
eda39cffd045a0a88b2e33a97a11ad3103e3f92b
Aasthaengg/IBMdataset
/Python_codes/p02258/s530019190.py
UTF-8
157
2.53125
3
[]
no_license
n = int(raw_input()) R = [int(raw_input()) for i in xrange(n)] mn = R[0] ans = -1e10 for r in R[1:]: ans = max(ans, r - mn) mn = min(mn, r) print ans
true
81a7b9551020a13bf411eb8ba7f4e79ab0eef682
shpark-tenergy/battery-parameter-spaces
/figures/SI/cell_char/old/cell_char.py
UTF-8
5,916
2.625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 16 19:42:58 2019 @author: peter """ import numpy as np import glob import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import rcParams FS = 10 LW = 3 rcParams['pdf.fonttype'] = 42 rcParams['ps.fonttype'] = 42 rcParams['font...
true
b3793b7bb16fa4b2f7862e13b16d886bd118b66a
aryans14/fig4pm
/encoding.py
UTF-8
17,008
2.625
3
[]
no_license
# METHODS USED FOR ENCODING THE LOG'S TRACES AND VARIANTS import numpy as np # EVENT PROFILE ENCODING - 1 VECTOR PER TRACE: # Encoding of all traces in the log: def event_profile_encoding_all_traces(log): from general_methods import event_names event_names = sorted(event_names(log)) trace_encoding_event_...
true
0abf9df2962019bd4bb6870479d4a8931df0f718
RickyAndi/indonesia-alpr-backend-v2
/plate_number_character_detector_service/plate_character_detector.py
UTF-8
2,877
3.046875
3
[]
no_license
import cv2 import numpy as np from possible_char import PossibleChar class PlateCharacterDetector: def __init__(self, knn_k=1): self.i = 0 self.knn = cv2.ml.KNearest_create() self.knn.setDefaultK(knn_k) self.MIN_CHARACTER_RATIO = 0.25 self.MAX_CHARACTER_RATIO = 1 ...
true
c47a5336851698698986ddcc0ed43d220975de08
youtubeSam/Imnoo
/generateMeasurements/Plotter.py
UTF-8
2,208
2.71875
3
[]
no_license
#!/usr/bin/env python import numpy as np def plotAxis(ax,x0,dir,col): scaler=0.5 X=np.array([x0,x0 + dir*scaler]) X=np.reshape(X.transpose(),(3,2)).tolist() ax.plot(*X,linewidth=2,c=col) def plotAxis2d(ax,x0,dir,col): scaler=1 X=np.array([x0,x0 + dir*scaler]) X=np.reshape(X.transpose(),(2...
true
363367ce87c781a166edcff3f0f8150942423483
Ish95/Research-accelerometer-
/Phidgetcal.py
UTF-8
5,061
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Apr 18 15:21:37 2020 @author: ishat """ #Declerations of global variables from Phidget22.Phidget import* from Phidget22.Devices.Accelerometer import* import time import numpy as np import matplotlib.pyplot as plt import math x=[] #temporary vector to fill in phidget inp...
true
50b401e64cb46b3e40f2c209543aa24d11fde188
Sen2k9/Algorithm-and-Problem-Solving
/CTCI/4_10_check_subtree.py
UTF-8
2,651
4.25
4
[]
no_license
""" Check Subtree: T1 and T2 are two very large binary trees, with T1 much bigger than T2. Create an algorithm to determine if T2 is a subtree of T1. A tree T2 is a subtree of T1 if there exists a node n in T1 such that the subtree of n is identical to T2. That is, if you cut off the tree at node n, the two trees would...
true
f262bc8b703688e9b3e6b0bbe0869d8fe1780a28
colmanAI/disease_behavior
/python_code/src/questionnaires_analysis/titles.py
UTF-8
2,925
2.609375
3
[]
no_license
""" all titles in raw & edited questionnaires""" """ initial titles """ EMAIL_ADDRESS = 'Email address' TIMESTAMP = 'Timestamp' body_temp = "מדוד את טמפ' גופך באמצעות מדחום. מה הטמפ'?" used_drugs_today = "האם השתמשת היום בתרופות המפחיתות חום או כאבים?" used_drugs_recently = "האם השתמשת בארבעת השעות האחרונות בתרופו...
true
a4b147a65a0555d587db3039203e20463d5836ee
gayatri-p/python-stuff
/challenge/hcf_lcm.py
UTF-8
250
3.71875
4
[]
no_license
x = int(input('Enter 1st number: ')) y = int(input('Enter 2nd number: ')) a = max(x, y) b = min(x, y) while a % b != 0: a, b = b, (a % b) hcf = b lcm = int((x*y) / hcf) print(f'HCF of {x} and {y} : {hcf}') print(f'LCM of {x} and {y} : {lcm}')
true
ae2619cda2d0aa08b42d0d61a3cbce8d6b84ad76
kmakihara/2016-taxi-airline-analysis
/bigquery_export.py
UTF-8
3,704
2.609375
3
[]
no_license
# Helper script to export bigquery data import uuid import shapefile from google.cloud import bigquery from pyproj import Proj, transform from constants import NEWARK_ID, LAGUARDIA_ID, JFK_ID, PROJECT_ID def main(): # Instantiates a client bigquery_client = bigquery.Client(project=PROJECT_ID) # Import s...
true
6511b6bf3a90cb9512a52e79f922e52abc1b28a0
VaishnaviReddyGuddeti/Python_programs
/Python_Functions/DefaultParameterValue.py
UTF-8
288
4.1875
4
[]
no_license
# The following example shows how to use a default parameter value. # If we call the function without argument, it uses the default value: def my_function(country = "India"): print("I am from " + country) my_function("Uk") my_function("Ireland") my_function() my_function("Brazil")
true
2f4b4e55602f361c88abb35045100e23a3dfff18
waallf/find-work
/广播求两个矩阵的计算.py
UTF-8
292
2.796875
3
[]
no_license
import numpy as np def F(A,B): if A.shape[1]!=B.shape[1]: return 0 C = np.zeros((A.shape[0],B.shape[0])) for i in range(A.shape[0]): exA= np.expand_dims(A[i],0) C[i]= np.sum((exA-B)**2,axis=1) return C print(F(np.ones((3,3)),np.ones((4,3))))
true
11fc7f7f9046adc22d032c7fd0e105d90ec0965a
sylvesterwillis/PyReader
/rssreader/rssfeedreader/utils.py
UTF-8
4,911
2.71875
3
[]
no_license
# This file hosts helper functions for the views. import requests from bs4 import BeautifulSoup import HTMLParser from django.http import HttpResponseRedirect from django.template import RequestContext, loader from rssfeedreader.models import users, feeds from urlparse import urlparse class RSSItem: title = '' ...
true
f419f5cf18cff0f8525df191ce10f64f08fc917e
katiepicha/Extra-Credit
/DictionariesExercise.py
UTF-8
233
3.15625
3
[]
no_license
from textblob import TextBlob from pathlib import Path John = TextBlob(Path("book of John text.txt").read_text()) words = ['Father', 'God', 'Christ', 'Spirit', 'life', 'man'] for w in words: print(w + ':', John.words.count(w))
true
dfbaf54bb3d54961cc04d73633dddf5cfab91695
Rootny/-6
/prpy2.py
UTF-8
1,972
2.78125
3
[]
no_license
# Однослойные нейронные сети импортировать numpy как np import matplotlib . pyplot как plt import neuroolab as nl # Импорт билиотек # путь input_data = np . loadtxt ( "/qqq/Pr/neural_simple.txt" ) # Превращаем таблицу в 2 столбца с 2 метками data = input_data [:, 0 : 2 ] label = input_data [...
true
3c352e2611987cabe7dfad0671514261f73ee6cc
joeweaver/proces_seqs_qiime
/flatten_multiple_join_paired_ends.py
UTF-8
3,093
3
3
[ "MIT" ]
permissive
#!/usr/bin/python import argparse import os import shutil __author__ = "Joseph E. Weaver" __license__ = "MIT" __version__ = "0.1.1" __maintainer__ = "Joseph E. Weaver" __email__ = "jeweave4@ncsu.edu" ################################################################ #Flattens the output of multiple_joined_ends.py from...
true
0934a7dc5dfe57b145fd2162da6517bb31494fb1
aelve/codesearch
/scripts/ext_statistics.py
UTF-8
598
2.9375
3
[]
no_license
#!/bin/python import os PACKAGES = { "haskell": "../../data/packages/" , "rust": "../../data/rust/packages/" , "javascript": "../../data/js/packages/" } def stat_by_lang(lang): print("extensions for", lang, ":") cnt = dict() for root, dirs, files in os.walk(PACKAGES[lang...
true
136deddd206497cf193c8871f98a8e99201584f1
hoynackp/CSP_Folder
/picoCTF/picoCTF.py
UTF-8
175
2.625
3
[]
no_license
with open('./garden.jpg', 'r') as f: garden = str(f.read()) picoctf = '' for i in range(len(garden)): if kitters[i] != cattos[i]: picoctf += str(cattos[i])
true
1e6bd1760f865d0ad999a877c24e139259081bde
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_118/1629.py
UTF-8
542
3.3125
3
[]
no_license
x=input() def check(j): reverse=0 temp = j; while temp != 0: reverse *= 10 reverse +=temp % 10 temp /= 10 if j==reverse: return 1 else: return 0 def sqrt(x): ans = 0 if x >= 0: while ans*ans < x: ans = ans + 1 if ans*ans == x: return ans else: return 0 ...
true
dbdea55cd55314cdffa788429b84eb3a403c7750
naomi789/competetive-coding
/2018-10-20-cns/test.py
UTF-8
1,020
3.46875
3
[]
no_license
import string def read_asci(): file = 'test.txt' text_file = open(file, 'r') ascii = text_file.read() # print(ascii) data = ascii.replace(':', '') data = data.replace(' ', '') # data = data.replace('\n', '') return data def read_ascii_art(data): answer = '' # pr...
true
b207d2e9764344cbdbd74e0389deec9593d538fa
faithkane3/python-exercises
/advice.py
UTF-8
1,231
3.765625
4
[]
no_license
import random import string ## Generate a random string of specific characters def rand_string(): letter = 'abcdefghij' return random.choice(letter) def advice(): let = rand_string() advice_dict = { "a" : "Life really does begin at forty. Up until then, you are just doing research...
true
aa6b4ff246831ebacc0c686ece0e09312ec32929
DvirS123/Black_Jack_Game
/Options_page.py
UTF-8
4,731
2.90625
3
[]
no_license
import pygame import Classes_objects import Sound_effects import Developer_help from Developer_help import write text_box_block = Classes_objects.get_button('TEXT_BOX') player1 = Classes_objects.get_player('PLAYER1') vol0 = Classes_objects.get_button('VOL0') vol1 = Classes_objects.get_button('VOL1') vol2 = Classes_ob...
true
6d95d1b119c6ce1b479167f531eec5bf66a824bc
djoproject/dumpParser
/src/utils.py
UTF-8
6,581
2.875
3
[]
no_license
#!/usr/bin/python from logException import LogParseException from datetime import time def extractPosition(line): line = line.strip() splittedDoublePoint = line.split(":") if len(splittedDoublePoint) != 3 and len(splittedDoublePoint) != 2: raise LogParseException("(utils.py) extractPosition, ...
true
8637265ed95a7e35bd071dc0d45c45cb102a1702
MuthukumaranVgct/DroughtPrediction
/drought/calculations.py
UTF-8
28,634
3.046875
3
[]
no_license
import os,math import numba from math import * import numpy as np import scipy.stats def _pearson3cdf(value, pearson3_parameters): ''' Compute the probability that a random variable along the Pearson Type III distribution described by a set of parameters will be less than or equal to a val...
true
638311ad6321da6be91031e53fe2ee1f4800415e
Costadoat/Informatique
/Olds/TP_2020/TP11 Pivot de Gauss/Gauss.py
UTF-8
3,193
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Feb 2 18:04:23 2016 @author: G """ # Pivot de Gauss # on veut resoudre AX = B, A etant n x n et supposee inversible import numpy as np # recherche du pivot maximal dans la colonne i, en lignes i, i+1, ..., n # renvoie le numero de la ligne du pivot def ligneRef(A,i): ...
true
0b361fc567c891c262af3ac5d01bcd2058c154a7
drewcassidy/build-deploy
/src/ksp_deploy/aws/ssm.py
UTF-8
375
2.765625
3
[ "MIT" ]
permissive
import boto3 def get_ssm_value(param_name, ssl=True, region="us-east-2"): """Gets the value of an encrypted parameter from the AWS SSM""" client = boto3.client('ssm', verify=ssl, region_name=region) try: return client.get_parameter(Name=param_name, WithDecryption=True)["Parameter"]["Value"] exc...
true
123da0c0d8ff3e514d593bc00d8cec610bf8ccc1
priya-chaurasia/Python-3-GUI-using-Tkinter
/Menu Widgets/03.popup_menu.py
UTF-8
507
2.859375
3
[]
no_license
from tkinter import* root=Tk() w=Label(root,text="right click to show the result",width=50,height=25) w.pack() popup=Menu(root,tearoff=0) popup.add_command(label="Pause") popup.add_command(label="Copy") popup.add_separator() popup.add_command(label="Home") def do_popup(event): try: po...
true
7722d2070cbc8f5d4e208146ba14ed33889ce025
alexmadon/atpic_photosharing
/python/atpic/authenticate.py
UTF-8
9,576
2.640625
3
[]
no_license
#!/usr/bin/python3 """ Authentication functions It authenticates based on a session: no SQL needed. """ import hashlib import random import time import math import crypt import re import string import base64 from http import cookies import atpic.authenticatesql from atpic.mybytes import * import atpic.log xx=atpi...
true
005169e809fe6e667ce2965305e5c3d5257b4196
i-am-schramm/CTBTOcals
/createIMSresult.py
UTF-8
1,820
2.640625
3
[]
no_license
#!/bin/env python ''' this will cal the calib calculation and then write it to an output file''' ######################################################################## # script to create the calibrate result in IMS 2.0 for CTBTO stations # #inputs needed: # station,network,location,channel # calper - the period a...
true
7c40d1bcb79edff3da441b860e40a5c4d8d941c9
jinyitechli/PythonStudy
/yiren/yiren/spiders/yirenscrapy.py
UTF-8
908
2.53125
3
[]
no_license
import scrapy from urllib import request from bs4 import BeautifulSoup from yiren.items import ManhuaItem class ManhuaSprder(scrapy.Spider): name = 'manhua' allowed_domains = ['www.tohomh123.com'] start_url = ['https://www.tohomh123.com/yirenzhixia/'] def parse(self, response): bookmarks = r...
true
4207685f489ad10fa1423bca67cdce33284d2cf8
daniel-reich/ubiquitous-fiesta
/wZzZ9NtugwsnQEQeM_4.py
UTF-8
214
3.078125
3
[]
no_license
def golf_score(course, result): res = 0 dic = {"eagle" : -2, "birdie" : -1, "bogey" : +1 , "double-bogey" : +2, "par" : 0} for i in range(0, len(course)): res += course[i] + dic[result[i]] return res
true
946f7e2ba10c4a2cc20088bee58c8998c1fb9904
aidamuhdina/basic-python-batch-4
/string.py
UTF-8
374
3.921875
4
[]
no_license
a = "Hello, World!" print(a[1]) print(a[2:5]) #ambil dari indeks 2 sampai indeks ke 4 print(a[-1]) #ambil dari belakang print(a[3:]) #ambil seluruhnya dari titik yg ditentukan print(a[:6]) #ambil 6 karakter print(a[-1]) #ambil semua kecuali di indeks -1 print(len(a)) #panjang suatu string a = "Hello" b = "World" c = ...
true
2944067307baa573bf53483a8fe9cd380f2ac99d
kdkchy/Pawang-Ular
/04/latihan.py
UTF-8
172
3.234375
3
[]
no_license
a = {1 : "kadek", 2: "cahya"} a[3] = "wisnu" print(a) a.pop(3) print(a) print(a[1]) print() b = {"depan" : "Kadek", "belakang" : "Cahya" } print(b["depan"])
true
4c0ae3ac457a2062c09ef269f58d34aae442f065
simonw/datasette-configure-asgi
/test_datasette_configure_asgi.py
UTF-8
856
2.546875
3
[ "Apache-2.0" ]
permissive
from datasette_configure_asgi import asgi_wrapper import functools class FakeDatasette: def __init__(self, config): self.config = config def plugin_config(self, name): assert "datasette-configure-asgi" == name return [self.config] def test_asgi_wrapper(): app = object() wrap...
true
23386b01708d7a1c30a8808aec5d5ba400bc0ab7
ShnAlmighty/MyProjects
/practice/sqlitep.py
UTF-8
961
3.0625
3
[]
no_license
import sqlite3 as lite conn = lite.connect("test.db") print("Done") conn.execute('''CREATE TABLE if not exists COMPANY (ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), SALARY REAL);''...
true
6e634264fdf44513f2fbdbb2c83cc22925377ffb
AngryBuffel/Syntax
/PCC/Ex_C7_8_9_10.py
UTF-8
1,514
3.640625
4
[]
no_license
# VDLS - 12/23/18 - Excercises (7.8/7.9/7.10) Chapter 7 Python Crash Course # 7.8 Deli / 7.9 No Pastrami sandwich_orders = ['pastrami', 'tuna', 'ham', 'pastrami', 'meatballs', 'cheese', 'pastrami', 'italian', 'blt'] finished_sandwiches = [] # TODO: Change pastrami for a var, so any kind of sandwich can be removed from...
true
b46c1c2f0ca1020b4e3e750309a2e036503fcefb
zosopick/mawpy
/Chapters 1 to 5/Chapter 1/1-1 Square Dance.py
UTF-8
334
3.484375
3
[]
no_license
''' Excersise 1-1 Square Dance: Return to the myturtle.py program. Your challenge is to modify the code in the program using only the foward and right function so that the turtle draws a square ''' from turtle import * shape('turtle') forward(100) right(90) forward(100) right(90) forward(100) right(90) ...
true
9cad074eed04535e426679cbd0211ab74757d624
lhj940825/programming_exercises
/Data Science/sample_from_high_dim_unit_ball.py
UTF-8
1,313
3.3125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import matplotlib.pyplot as plt from scipy import stats # In[2]: class r_pdf(stats.rv_continuous): def _pdf(self, x, dim): return dim*(x**(dim-1)) def uniform_sample_from_d_dim_unit_ball(dim, num_points): # samples from multivaria...
true
7bca1e4b6c4bb95d8ede5c866ff8b08553f10808
KalaiselvanSivakumar/Competitive-Programming
/HackerRank/Algorithms/3. Strings/String_construction.py
UTF-8
435
3.71875
4
[]
no_license
#Python3 def stringConstruction(s): characters = [False] * 26 i = 0 copy_cost = 0 length = len(s) while (i < length): index = ord(s[i]) - ord('a') if (not characters[index]): characters[index] = True copy_cost += 1 i += 1 return copy_cost q = int...
true
3888dd3e087acf1a99e9162c1c62ca6c4b6a1451
lmedeiros/python-test
/helpers/checkline.py
UTF-8
875
3.015625
3
[]
no_license
from helpers.args import COL_SIZE from datetime import datetime def check_line(line: list, line_num: int): fields = { '0': 'date', '1': 'int', '2': 'float', '3': 'str', } if not line or len(line) != COL_SIZE: raise Exception('Error parsing line {0}: {1}'.format(lin...
true
18824d2a6dd270e4014991edc5ec8bd41c8540e5
ramalho/propython
/fundamentos/slides/marcoandre/pyMordida0-fontes/py54.py
UTF-8
122
2.84375
3
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- # Série de Fibonacci a = b = 1 while True: print a a, b = b, a + b
true
62f3aeacf8fe58d5acb04ddc26f58875cad0346d
cbienpourtoi/ANN_SED
/useful.py
UTF-8
842
3.109375
3
[]
no_license
__author__ = 'loic' import numpy as np def mad(arr): """ Median Absolute Deviation: a "Robust" version of standard deviation. Indices variabililty of the sample. https://en.wikipedia.org/wiki/Median_absolute_deviation """ arr = np.ma.array(arr).compressed() # should be faster to not use ma...
true
898205c23052e09f73b270accec3a1cea962d47b
ferdirn/intro-to-data-analysis
/lesson1.py
UTF-8
4,834
2.734375
3
[]
no_license
"""Enrollments.""" import unicodecsv from datetime import datetime def read_csv(filename): """Read CSV function.""" with open(filename, 'rb') as f: reader = unicodecsv.DictReader(f) return list(reader) def get_unique_students(data): """Get unique students function.""" unique_student...
true
7ff7c6eba9e259d76a079844c3cc84f719464457
Cornito/CP1804_Practicals
/prac_01/electricity_bill_estimator.py
UTF-8
1,207
3.4375
3
[]
no_license
print("Electricity bill estimator") TARIFF_11 = 0.244619 TARIFF_31 = 0.136928 #cents_per_kwh = int(input("Enter cents per KWh: ")) def tariff_choice(): tariff_choice = input("Which tariff? 11 or 31: ") if tariff_choice == 11: estimated_bill = TARIFF_11 * daily_use_kwh * numberOf_days_billing # ...
true
f267b00529579083d3e3f514c07a342e27a80cb4
wonjongchurl/github_test
/backtest.py
UTF-8
2,817
2.71875
3
[ "MIT" ]
permissive
import time import pyupbit import datetime import schedule from fbprophet import Prophet access = "5jDaNcH6wk8w504ilAmlmCX8cIgl6a8opxzFEel8" secret = "y8PhX8lz0Ims7ThOBb8dxaC8t7IkexnZBNkT5UWm" def get_target_price(ticker, k): """변동성 돌파 전략으로 매수 목표가 조회""" df = pyupbit.get_ohlcv(ticker, interval="day"...
true
5245fd3f30b5e14aaaf5ca907781aead9bee2517
jwbaker/projecteuler
/PE18.py
UTF-8
4,624
3.78125
4
[]
no_license
''' Created on 2013-04-02 Problem 18: By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23: *3* *7* 4 2 *4* 6 8 5 *9* 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: 75 95 64 17 47 82...
true
f750e4e86fcea73cea8c2f334e80dd9714240e0b
josegalarza/workflow-manager
/demo.py
UTF-8
1,173
3.125
3
[]
no_license
#!/usr/bin/env python3 from workflow import DAG, Node # Create workflow my_workflow = DAG('my_workflow', threads=2) # Create tasks task0 = Node(name='node-hello', task='echo "Hello world!"') task1 = Node(name='node-eat', task='echo "Start eating like crazy!"', dependencies=['node-hello']) task2 = Node(name='node-piz...
true
02a28b1b1436326699a0c62de156d69dca3c4493
v-jucosky/uri-online-judge
/1002.py
UTF-8
75
2.9375
3
[]
no_license
n = 3.14159 raio = float(input()) A = raio ** 2 * n print("A=%.4f" % A)
true
8efed9ccc961f722d6ef8774455859cd791f4929
MiT-HEP/ChargedHiggs
/script/lxplus.py
UTF-8
2,188
2.5625
3
[]
no_license
#!/usr/bin/env python #import os,sys from subprocess import call, check_output import re import threading import time from optparse import OptionParser, OptionGroup usage = "usage: %prog [options] exe1 exe2 ..." parser=OptionParser(usage=usage) parser.add_option("-c","--ncore" ,dest='ncore',type='int',help="Number o...
true
976d3091382bd35c231423e5d7a9482edcf688ab
rlyyah/1st_2nd_week
/PythonProjects/100doorsbis.py
UTF-8
255
3.40625
3
[]
no_license
doors = [False]*100 open_doors = [] for i in range(1,101): for x in range(i-1,100,i): doors[x] = not doors[x] print(doors) for i in range(len(doors)): if doors[i]==True: open_doors.append(i+1) print(open_doors)
true
db96c0c02c08db66e3262f0b3854731a77ddcfa3
Merlingot/Projet4
/Camera.py
UTF-8
6,866
2.921875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import cv2 from skimage.io import imread, imsave # import seaborn as sns class Camera: """ Input: -K : Matrice intrinsèque de la camera contenant (fx,fy,s,cx,cy) | np.narray() -R : Matrice de rotation pour le passage ent...
true
a98998ea1ee3473739b55e5e7fcd78f630762eda
garcia5/aoc-2020
/1/day1.py
UTF-8
385
3.296875
3
[]
no_license
input_dict = {int(k): 1 for k in open('input1', 'r').read().splitlines()} for year1 in input_dict.keys(): for year2 in input_dict.keys(): if year1 + year2 > 2020: continue if (2020 - year1 - year2) in input_dict.keys(): print(f'{year1} {year2} {2020-year1-year2}') ...
true
12915dfe04fe31f60a891f0f41c838204d0f5302
ArthurLorphelin/CarStore3000
/app/models.py
UTF-8
2,908
2.5625
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy import logging as lg from .views import app # Create database connection object db = SQLAlchemy(app) class Model(self): def create(self): db.session.add(self) db.session.commit() def update(self): db.session.commit() def delete(self): ...
true
21327d67c4f87ec5e14a7ac067e23ef79eb69640
mkeefe8/INET4710
/QUIZ1/mapreduce.py
UTF-8
933
2.6875
3
[]
no_license
from mrjob.job import MRJob from mrjob.step import MRStep class stdev(MRJob): def mapper_init(self): self.counter = 0 def mapper(self, _, line): words = line.split() words = [w.strip().lower() for w in words] words[-1] = float(words[-1]) out=(" ".join(words[:-1]),st...
true
0dd8eed27e5319625b13e51ca4acce9df801844f
daniel-reich/ubiquitous-fiesta
/u9mxp7LLxogAjAGDN_21.py
UTF-8
416
3.1875
3
[]
no_license
def factor_sort(lst): def factors_and_num(num): def factors(num, factor = 1): if 2*factor > num: return 1 greater_factors = factors(num, factor + 1) if num%factor == 0: return 1 + greater_factors return greater_factors ...
true
d9c8257246961827d9b3943b7537ea1cd64dd606
jikka/pythong
/exac.py
UTF-8
69
2.78125
3
[]
no_license
a,b=int(input()),input().split() print("".join(reversed(sorted(b))))
true
6c7357823573c235f418bb42f6be839e855ffb8f
branko-malaver-vojvodic/Python
/different_languages.py
UTF-8
245
3.75
4
[]
no_license
#Representation of each letter on the entered string in 4 kinds of language def name_encoding(name): print('Char Decimal Hex Binary') for i in name: code = ord(i) print(' {} {:7} {:4x} {:7b}'.format(i, code, code, code))
true
61643e5a650ba153b2d09ac1792588c76698f6a2
Robin745/Python-Problem-solvings
/ProblemSolving/string/11.py
UTF-8
238
3.640625
4
[]
no_license
def str_odd_index_remove(word): new = "" word = [char for char in word] new = [word[char] for char in range(len(word)) if char % 2 == 0] # getting even index value return "".join(new) print(str_odd_index_remove("python"))
true
2454c8164b6dd4d02e1e001433046c68cd05f396
AntonelaMalii/DinningHallServer
/dinning.py
UTF-8
9,169
2.71875
3
[]
no_license
# Lab 1 submission import queue import random import time from flask import Flask, request import threading import requests time_unit = 1 menu = [{ "id": 1, "name": "pizza", "preparation-time": 20, "complexity": 2, "cooking-apparatus": "oven" }, { "id": 2, "name": "salad", "preparatio...
true
3c3d8673f313a9c6027c24cb8a21bb206fbd6068
ilegorreta/Automatic-Fetal-Brain-Quality-Assessment-Tool
/evaluate_model.py
UTF-8
4,167
2.515625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Developed by: Ivan Legorreta Contact information: ilegorreta@outlook.com ''' import nibabel as nib import os import numpy as np import pandas as pd import h5py import time import csv from tensorflow import keras import tensorflow as tf from keras.utils import to_cate...
true
4bdd8db7ac1496d32b7e0d7cf12ed6495e3cf83b
chunin1103/nguyentuananh-c4e22
/Fundamentals/session1/homework/age.py
UTF-8
67
3.21875
3
[]
no_license
yob = input("Your year of birth?") age = 2018 - int(yob) print(age)
true
415ff303375da6c4291b71b46ac3b70e8154ab73
kokchun/Stocky-code-along
/load_data.py
UTF-8
2,390
3.609375
4
[]
no_license
import requests import pandas as pd class StockDataAPI: """Class with methods to get and process stock data from Alpha Vantage""" def __init__(self, api_key, data_function: str = "TIME_SERIES_DAILY") -> None: """ Args: api_key: a unique API key from here: https://www.alphavantage...
true
0c4670b31828bfedb4381c97557fe7ce53a5152e
jianguo77/prosyn3_files
/cam.py
UTF-8
3,682
2.609375
3
[]
no_license
#user = input() #user = str(user) import numpy as np from keras.preprocessing import image from keras.models import model_from_json import time import tensorflow as tf #GG #load model model = model_from_json(open("Model_Weights/fer238.json", "r").read(), custom_objects={'softmax_v2': tf.nn.softmax}) #load weights mod...
true
39fc9640006d328c1cc0d07fe5310db7dffa8b8a
Crox-3/PIA-PC
/PIA-PC/Metadata_Script.py
UTF-8
3,233
2.84375
3
[]
no_license
# -*- encoding: utf-8 -*- import os import sys import traceback try: from PIL.ExifTags import TAGS, GPSTAGS from PIL import Image except ImportError: os.system('pip install -r requirements.txt') print('\nInstalando los paquetes indicados en "requirements.txt"...') print('Ejecuta de nuevo el script....
true
b6a7e929119035f22f37e29a06e8e336fed6bc74
jlmcdonough/Intro-To-Programming
/Labs/tictactoe.py
UTF-8
2,234
4.21875
4
[]
no_license
# CMPT 120 Intro to Programming # Lab #7 - Lists and Functions # Author: Joseph McDonough # Created: 2018-11-08 symbol = [ " ", "x", "o" ] mark = [" "," "," "," "," "," "," "," "," "] def printRow(row): output = "|" for cell in row: output+= " " + symbol[cell] + "|" print(output) def printBoar...
true
652a30bfc28934d056aa81560821419b8b1480f2
timrogers/avios-python-exercises
/2_functions/solution.py
UTF-8
924
4.46875
4
[ "MIT" ]
permissive
# 1. def print_greeting(name, age_in_years, address): age_in_days = age_in_years * 365 age_in_years_1000_days_ago = (age_in_days - 1000) / 365 print("My name is " + name + " and I am " + str(age_in_years) + " years old (that's " + str(age_in_days) + " days). 1000 days ago, I was " ...
true
4a77013e2f65d9eb7fb1ced405999534f394dd41
kpoznyakov/hktn
/barrier/check_is_auto_comes.py
UTF-8
2,133
2.90625
3
[]
no_license
import os import random from time import sleep import psycopg2 import requests params = { 'dbname': 'parking', 'user': 'postgres', 'password': 'qweasdzxc', 'host': '100.100.148.215', 'port': 5432 } def search_plate(plate): conn = psycopg2.connect(**params) cur = conn.cursor() cur.exe...
true
d722c552de702317a0b71dabef17fca03bef36c6
brunaPrauchner/CoalitionFormationForMAS
/DissertationProject/experiment/scripts/jobIntervalHistogramMean.py
UTF-8
1,568
2.65625
3
[]
no_license
import glob import sys import argparse import matplotlib.pyplot as plt import pandas as pd import seaborn as sns parser = argparse.ArgumentParser(description='Generate the interval between jobs chart.') parser.add_argument('outputFile',default="Teste",help='path to chart file') parser.add_argument('experimentFolder',h...
true
ee219f2923dccca1a17627783dbc6983acd61c77
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/3995/codes/1636_2728.py
UTF-8
109
3.515625
4
[]
no_license
d=float(input("distancia:")) t=input("qual o tipo? A/B") if(t=="A"): y=d/8 else: y=d/12 print(round(y , 2))
true
744e2c462f835a94872cb7e626dd6be91ce1433b
anthonyjpesce/clinics
/clinics/data/scraper.py
UTF-8
4,239
2.84375
3
[]
no_license
import urllib2, socket, time, json from bs4 import BeautifulSoup from datetime import datetime from json import dumps def parseTimes(day): daystartstr = day[day.index(':')+2:day.index(' - ')].replace('\r','').encode('utf-8') dayendstr = day[day.index(' - ')+3:].replace('\r','').encode('utf-8') try: ...
true
4b9ec1eabc50b38aecdc7e9d83bec9c6e792cc69
mfwarren/FreeCoding
/2015/05/fc_2015_05_29.py
UTF-8
227
2.625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # imports go here import statistics import random # # Free Coding session for 2015-05-29 # Written by Matt Warren # numbers = [random.randrange(1000) for i in range(1000)] print(statistics.pstdev(numbers))
true
4fa34d8bda7846c2283111bdf11b26d084daa1e2
abusamrah2005/Saudi-Developer-Organization
/Week4/thirdLesson.py
UTF-8
763
3.546875
4
[]
no_license
# dictionary jsonData = { 'name': 'waseem', 'email': 'businesswassim@gmail.com', 'phone_number': '00966534551890', 'twitter_account': 'wDayili', 'telegram_account': 'vvvn1' } # print all keys of the jsonData dictionary print('All keys are:') for x in jsonData: print(x) print('All values of the kyes are:') fo...
true
4f0ca8c55ed396bbffeba13ab35c147f75cf1bfd
eevelweezel/bueller
/sumPrimeCons.py
UTF-8
624
3.421875
3
[]
no_license
#!/usr/bin/env python # prime number under 1000000 that may be expressed as the longest sum of consecutive pri def main(): nums = [x for x in range(2,1000001)] s = 0 for n in nums: c = 2 print(str(c)) print(str(n)) while c < int(n/2)+1: if (n % c == 0) and (n !=...
true
caa99976cedf2ed01cbde1c1ab4927c858ad626d
OtchereDev/python-mini-project
/guess_game.py
UTF-8
547
3.890625
4
[]
no_license
import random play_game= 'y' while (play_game=='y'): answer= random.randint(1,50) try_number=int(input("Guess a number between 1 and 50: ")) counter=1 while try_number!=answer: if try_number>answer: print("Your guess is too large") if try_number<answer: print(...
true
9f6f30395ca12417cbf25477ba72d604a63c06a3
leeyates71/leeyates71.github.io
/_projectwork/mongodb/fp_finddocString.py
UTF-8
1,116
3.078125
3
[]
no_license
#Lee Yates #CS-340 #11/28/2019 #7-1 Final Project #Operations in Python #Find a document with string input in MongoDB import json from bson import json_util from bson.json_util import dumps from pymongo import MongoClient #make a connection to the MongoDB market, collection stocks connection = MongoClient('localhost'...
true
86b12ee1a9d5043425953bd2b432416c2c597469
AK-UGlas/week_04_day_2_hw_music_library
/console.py
UTF-8
1,406
2.734375
3
[]
no_license
import pdb from models.artist import Artist from models.album import Album import repositories.artist_repository as artist_repository import repositories.album_repository as album_repository # create artists metallica = Artist('Metallica') weird_al = Artist('"Weird Al" Yankovic') # save artists artist_repository.sav...
true
3e20f22566d2129c0ea70d564bb946105185f523
Evaldo-comp/Processing
/Mod_Python/coordenadas/exemplo2.pyde
UTF-8
452
3.3125
3
[ "MIT" ]
permissive
def setup(): size(200, 200) background(255) smooth() line(0, 0, 200, 0) # desenha eixos line(0, 0, 0, 200) pushMatrix() fill(255, 0, 0) # quadrado vermelho rotate(radians(30)) translate(70, 70) scale(2.0) rect(0, 0, 20, 20) popMatrix() pushMatrix() ...
true
1264fcb6b38e5a0ff7905ecbf0a2a96ba5fa2b64
seantrott/nlp_cancer_metaphor
/gofundme_analysis/exploration/v2/model.py
UTF-8
2,520
2.75
3
[]
no_license
import os.path as op from tqdm import tqdm import pandas as pd import numpy as np import transformers import torch as tt import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, Dataset DATA_PROCESSED = '../../data/processed' class InstancesData(Dataset): def encode(sel...
true
4ae5388bd855da79f4815707440e3e6181600755
y23124/perry
/train.py
UTF-8
2,693
2.65625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.chrome.options import Options from PIL import Image import pytesseract import time driver_path = r'C:\Users\ADMIN\PycharmProjects\chromedriver.exe' web_url = r'url' driver = webdriver.Chrome(driver_path) driver.get(web_url) driver.maximize_window() #瀏覽器最大化 time....
true
3d2b06c3c87bad4bf044f9c598b1e0f364bb7286
Mario263/Python-Projects
/covidvaksinasi.py
UTF-8
1,575
2.953125
3
[ "MIT" ]
permissive
import requests import json # API by : # https://covid19.mathdro.id/api/ # https://cekdiri.id/vaksinasi/ def vaksin(): url = requests.get("https://cekdiri.id/vaksinasi/", headers={'User-Agent': 'Mozilla/5.0'}).text data = json.loads(url) for vksn in data['monitoring']: print("\nTanggal Vaksinasi => ", vksn['da...
true
9cf4d167ae940efea55aafcb47c8f4eeb16ff45c
shin04/audio_gan
/sample.py
UTF-8
1,579
2.515625
3
[]
no_license
import torch from torchsummary import summary import librosa import numpy as np import os import time import hashlib import soundfile from pathlib import Path from models.Generator import Generator from models.Discriminator import Discriminator def save_sounds(path, sounds, sampling_rate): now_time = time.time(...
true
3bb56b70493e3148b5eeea96ca94c0ea8fde9428
dionyziz/advent-of-code
/2019/02/2.py
UTF-8
919
3.15625
3
[]
no_license
OP_ADD = 1 OP_MUL = 2 OP_HALT = 99 with open("2.txt") as f: program = f.read() program = list(map(int, program.split(','))) def run(program, input): memory = {} for i, instruction in enumerate(program): memory[i] = instruction memory[1] = input[0] memory[2] = input[1] pc = 0 whil...
true
1f896baaa380ea8afc9c9c31f8d2899dc68c0619
Tubbz-alt/gearman-geodis
/gearman_geodis/threaded_geodis_worker.py
UTF-8
3,092
2.640625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
#! /bin/python ''' This is a gearman worker that resolves (latitude, longitude) tuples to locations using the geodis library. See usage in main function for more. ''' import sys import redis import os import traceback import re import signal from gearman_geodis.GeodisWorker import GeodisWorker from gearman_geodis.Wor...
true
34fa4c37e5ae439dd295933195f260e980fa6df2
mygit20031984/py100exercises
/76_100/97.py
UTF-8
442
3.34375
3
[]
no_license
i = [] while True: line = input("Enter Value:") file = open("../user_data_append.txt", 'a+') if line == "CLOSE": for e in i: file.write(e + '\n') file.close() break elif line == "SAVE": for e in i: file.write(e + '\n') file.close() ...
true
b49c8540a4222ab4e62f6068addc83ef246128f6
LeynilsonThe1st/python
/cp/uri/Accepted/1170.py
UTF-8
258
3.140625
3
[]
no_license
""" __author__: Leynilson José "Snake" """ # Blobs | accepted def calcDias(consumo): i = 0 while consumo > 1: consumo /= 2 i += 1 return i n = float(input()) while n > 0: n -= 1 c = float(input()) print(calcDias(c), "dias")
true