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
bdd8143b08c173532c29d0df6211dd4f17aba11a
joanillo/CNED
/T1/regressio_exponencial.py
UTF-8
1,550
3.34375
3
[]
no_license
# Joan Quintana Compte-joanillo. Assignatura CNED (UPC-EEBE) ''' AF-73: Regressió exponencial. Simulació de la descàrrega del condensador La regressió exponencial es fa treient logaritmes als dos costats, i aleshores és una regressió lineal V = Vo * exp(-t/RC) cd /home/joan/UPC_2021/CNED/apunts/python/T1/ PS1="$ " pyt...
true
e6a4db16ec33bc6255b5ccc039426f91369c2a2d
SalernoNicola/Character-Recognition-using-CNN
/Character_Recognition_using_CNN/conv_2_tfrecord/pconv/pool.py
UTF-8
875
2.609375
3
[]
no_license
import multiprocessing as mp # inizializzo i vari task per ogni processo della macchina class PoolCore(mp.Process): def __init__(self, tasks, results): mp.Process.__init__(self) self.tasks = tasks self.results = results def run(self): while True: new_task = self.ta...
true
229cc9e90360d5e40ce15f1f1cb4cef0245314a2
Rivarrl/leetcode_python
/leetcode/1501-1800/1705.py
UTF-8
1,378
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- # ====================================== # @File : 1705.py # @Time : 2021/1/11 18:35 # @Author : Rivarrl # ====================================== from algorithm_utils import * class Solution: """ [1705. 吃苹果的最大数目](https://leetcode-cn.com/problems/maximum-number-of-eaten-apples/) ...
true
764ed38527cdb7418594eea0538450741112a2bf
PatLor77/zadanie-6-wd
/zadanie5.py
UTF-8
74
2.890625
3
[]
no_license
import numpy as np a=np.arange(6).reshape(2,3) b=np.cos(a) print(b)
true
1fcfe0fbc2e662588b030feb6e28c41306bb2334
akashdgoswami/explanations-matrix-factorization
/python-pmf/shmarray.py
UTF-8
5,414
2.59375
3
[]
no_license
''' shmarray.py Shared memory array implementation for numpy which delegates all the nasty stuff to multiprocessing.sharedctypes. Copyright (c) 2010, David Baddeley All rights reserved. ''' #Licensced under the BSD liscence ... # # Redistribution and use in source and binary forms, with or without # modification, ar...
true
c082640cf3cffc2757deafceb85198b2ec38bee9
ferpoletto/Estudos-Python
/primeira_lista_exercicios/ex10.py
UTF-8
359
3.609375
4
[]
no_license
#10 - receba três notas de um aluno e informe se ele passou ou reprovou. def verifica_aprovacao(n1, n2, n3): if ((n1 + n2 + n3) / 3) >= 7: print('Aprovado') else: print("Reprovado") verifica_aprovacao(float(input("Digite a N1: ")), float(input("Digite a N2: ")), ...
true
a9e4f5a6df2c99e8884bf2711cc712eec44fa0c9
rabeehk/hypothesis-only-NLI
/src/util/plot-length.py
UTF-8
4,155
2.71875
3
[]
no_license
import pdb import argparse import pandas as pd def get_args(): parser = argparse.ArgumentParser(description='Sentence lengths.') parser.add_argument('--gold_lbl', type=str, help='The gold train labels file') parser.add_argument('--pred_lbl', type=str, help='The predicted labels file') parser.add_argument('--hy...
true
f0d4b14a697a9298847efc17b13bb981a527757b
silpapravin/Fergusexercises
/pattern.py
UTF-8
284
2.71875
3
[]
no_license
#from functions1 import* import functions1 import functions2 import functions3 print("Calling function 1") functions1.print_pattern() functions1.print_name("gukkuttan") print("calling function 2") functions2.print_pattern("*") print("calling function3") functions3.print_patt("%",8)
true
bd915146509b716d24e0f6cb5a66b6b1e1dfc52b
IharSha/my_projecteuler
/problem_3_prime_factors.py
UTF-8
337
3.25
3
[]
no_license
import time number = 600851475143 def primes(start, n): if n >= start: for i in range(start, n + 1): if n % i == 0: print(i) n /= i start = i break primes(start, int(n)) timer = time.time() primes(2, number) print(time....
true
7747e6c87a28a2547773c925d5098e30b1a15a16
ivychenhy/Scrapy
/spider-BaiduIndex-master/bdindex.py
UTF-8
1,459
2.609375
3
[]
no_license
import requests,json,time def get_index(keyword,cook): headers={ 'Accept': 'application/json, text/plain, */*', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Connection': 'keep-alive', 'Cookie': cook, 'Host': 'index.baidu.com', 'R...
true
cd132cba1f045f337a895ab769cb3d371942e66e
Kimdonghyeon7645/python_school-study
/보안프로그래밍/04_EICAR_virus_killer_plus_search.py
UTF-8
1,669
3.59375
4
[]
no_license
import os def check_file(file_path: str, scan_all: bool): scan_index = 0 if scan_all else int(input("검색할 시작 위치(인덱스)를 입력하세요 : ")) with open(file_path, "r", encoding="utf-8") as file: target = file.read() for virus in virus_dict.values(): out_index = target.find(virus, scan_index) ...
true
f4ab2f9508909f968e556f32444b4968cc0e8072
nieznanysprawiciel/KWTK
/tests/test.py
UTF-8
812
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- import cv2 import os print "Working directory: " print os.getcwd() imagesDir = "images/" thresholdDir = "thresh/" filePath = imagesDir + "auto000.jpg" images = os.listdir( imagesDir ) if not os.path.exists( thresholdDir ): os.makedirs( thresholdDir ) print "Created directory: " + thresh...
true
f1ddda02f887903fe43fa7af888fc2aea120d287
SeanFoley123/Logging1
/calls_module_using_logging.py
UTF-8
267
3
3
[]
no_license
import logging import module_using_logging #Testing out the name keyword. logging.basicConfig(filename = 'output.txt', filemode = 'w', format = '%(name)s:%(message)s') logging.warning('This is a file') logging.info('I knew that!') module_using_logging.whats_my_name()
true
6ea65e9deb859522e90cbb8c31221fc86290698b
PriestTheBeast/RLRunner
/rlrunner/termination/simple_tc.py
UTF-8
739
3.03125
3
[ "MIT" ]
permissive
from rlrunner.termination.base_termination_condition import BaseTerminationCondition class SimpleTC(BaseTerminationCondition): """ This is a simple termination condition By default, the run ends after 200 episodes """ # 199 because it starts at 0 def __init__(self, number_of_episodes=199): super().__init__()...
true
8df7a4a909c58c968f3b8bbaa2f9274c2d5c7de3
bardes/T1-AA
/color.py
UTF-8
7,444
3.40625
3
[]
no_license
#!/usr/bin/python3 # Evita "stack overflow" import argparse import sys import re sys.setrecursionlimit(1100) COLORS = frozenset({'Azul', 'Verde', 'Vermelho', 'Amarelo'}) class Node: def __init__(self, name, color=None): if not isinstance(name, str): raise TypeError("Node name must be a strin...
true
ca537b704534ef3e48d983a894f9f202a2769d46
Akshay-Ijantkar/ExKMC
/ExKMC/Tree.py
UTF-8
18,787
2.75
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd from collections import Counter from sklearn.cluster import KMeans from .splitters import get_min_mistakes_cut from .splitters import get_min_surrogate_cut try: from graphviz import Source graphviz_available = True except Exception: graphviz_available = False BASE_TR...
true
2a3a87746f4af571d8de176c6159b87115ce05f3
delaramghaemmaghami/OnlineShop
/Manager.py
UTF-8
19,035
2.890625
3
[]
no_license
import re import csv import hashlib import logging import FileHandler import random import datetime from barcode import EAN8 from prettytable import PrettyTable phone_regex = "(\+98|0)?9\d{9}" pass_word_regex = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!#%*?&]{6,20}$" def password_hashing(p...
true
1eef3ba6f06a2a32d35547dc99e6faa1b5d6ed1f
AddleseeHQ/incremental-asr-evaluation
/disfluencies.py
UTF-8
1,798
2.578125
3
[ "Apache-2.0" ]
permissive
from metrics import full_wer import sys system = sys.argv[1] code = sys.argv[2] if system == "microsoft" or system == "msoft": system = "msoft" sub_dir = "msoft/" elif system == "ibm": sub_dir = "ibm/" elif system == "google": sub_dir = "google/" else: print("System not implemented") ## TODO Add e...
true
e42758f21d48025988696f0b4ee1e1be3cf1f84d
aneesh-joshi/mars_city
/servers/biometric_signal_sensor_interface/src/anomaly_detector/bdac.py
UTF-8
3,966
2.8125
3
[ "BSD-2-Clause" ]
permissive
""" This file is a Python implementation of the file easytest.c from the open source ECG analysis software from EPLimited by Patrick Hamilton <http://www.eplimited.com/confirmation.htm> <http://www.eplimited.com/osea13.pdf> Please refer to easytest.c for further documentation. IMPORTANT: The file 'osea.so', which is a...
true
2d62ae081a0db222d3151152f5c01df14c37e993
dulajkavinda/chatbot-SGD-DL
/main.py
UTF-8
2,073
2.65625
3
[]
no_license
import nltk import pickle import json from nltk.stem import WordNetLemmatizer lemmetizer = WordNetLemmatizer() import numpy as np import keras from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.optimizers import SGD import random words = [] classes =[] documents =[] ign...
true
d7cdcd14637f8b349005c6e29e8d6e8e9de96b78
kovacs-roland2/beer_dashboard
/recipes_cleaning.py
UTF-8
11,305
2.546875
3
[]
no_license
import xlsxwriter with open('/Users/roland/Downloads/recipes_full.txt', encoding="utf-8") as f: recipes = list(f) #exclude ratings current = 0 for recipe in recipes: for i in range(len(recipe)): if recipe[i:i+9] == '"rating":': begin_rating = i if recipe[i:i+8] == '"views":': ...
true
423fff18422012736d0c7e708ef4215bd9a797d5
Baihanu/pybrasil-exercicios
/1.EstrutraSequencial/Ex17.py
UTF-8
1,559
4.25
4
[]
no_license
""" Faça um Programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para cada 6 metros quadrados e que a tinta é vendida em latas de 18 litros, que custam R$ 80,00 ou em galões de 3,6 litros, que custam R$ 25,00. Info...
true
39083935a0ad9412eeac04a602e86538cef2dce8
CedricMx/Tools
/file_changename/test2.py
UTF-8
841
3.109375
3
[]
no_license
#只访问子文件夹中的重命名 import os def rename(Path): file_dir=Path for root, dirs, files in os.walk(file_dir): for d in dirs: filelist = os.path.join(root, d) filelist1=os.listdir(filelist) for file in filelist1:#遍历子文件夹下的所有文件 Olddir=os.path.join(filelist,file);#原来的文件路径 if os.path.isdir(Olddir):#如果是文件夹则跳过 ...
true
b37f2d092c0211f4f2bb007a33862072f414858d
RakeshKumar045/interviewbit-solutions-python
/Dynamic Programming/Jump1.py
UTF-8
573
3.140625
3
[]
no_license
class Solution: # @param A : list of integers # @return an integer def canJump(self, A): if len(A) == 1: return 1 i = len(A) - 1 while i >= 0: reachable = False dist = 1 j = i - 1 while j >= 0 and not reachable: if A[j] ...
true
a02d4427760305cbad13c2253ebfc48084a3cc13
drone115b/cog
/tests/__init__.py
UTF-8
347
2.609375
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
# import all files in the directory # reference: http://stackoverflow.com/questions/1057431/loading-all-modules-in-a-folder-in-python # from os.path import dirname, basename, isfile, join import glob TESTPATH = dirname( __file__ ) __modules = glob.glob(join( TESTPATH, "test_*.py")) __all__ = [ basename(f)[:-3] for f in...
true
fb4b4ffeace318de26924aee975fadec2f40685d
evodify/population-genetic-analyses
/calculate_iHSproportion.py
UTF-8
4,655
3.109375
3
[ "MIT" ]
permissive
#! /usr/bin/env python ''' This script calculates fractions of SNPs with iHS values above 2.0 over genomic windows of specified size. #Example input: #CHROM POS iHS chr1 14548 -3.32086 chr1 14670 -2.52 chr1 19796 0.977669 chr1 19798 3.604374 chr1 29412 -0.308192 chr1 29813 2.231736 chr1 29847 0.6594 chr1 29873 -2.0...
true
84b3836f5fee1db62f38813dd68c80e816e3bf11
webclinic017/autotrader-demo
/strategies/template.py
UTF-8
1,115
2.828125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class StrategyClass: ''' AutoTrader Strategy Template ---------------------------- ''' def __init__(self, params, data, instrument): ''' Define all indicators used in the strategy ''' self.name = "Strategy Name" self.dat...
true
d51c3b0afc9065e162e25ae3e6bc006f403d3564
peraktong/testing-2016-fall
/The Cannon 2 v6.py
UTF-8
2,717
2.515625
3
[]
no_license
'''Import the mathematica tools''' import matplotlib.pyplot as plt from multiprocessing import Process, freeze_support import cPickle import csv import numpy as np from numpy import genfromtxt '''import the model---TheCannon 2''' from astropy.table import Table import AnniesLasso as tc '''import t...
true
6b29bc00e0d1e4d72b8a970d706887601957024d
arydwimarta/python3-dummie
/test.py
UTF-8
121
3.875
4
[]
no_license
name = input ('What is your name ?'); colour = input ('What is your favorite colour ?'); print (name, 'likes ' + colour);
true
2042686c417c71a8384e585337ab2fb5f538f9bf
sunyihuan326/Data_Lab
/tt/test0.py
UTF-8
851
3.65625
4
[]
no_license
# coding:utf-8 ''' created on 2019/3/18 @author:sunyihuan ''' # if None: # print(1) # else: # print(2) # # import sys # # # def fibonacci(n): # a, b, counters = 0, 1, 0 # while True: # if counters > n: # return # yield a # a, b = b, a + b # counters += 1 # #...
true
bd2ba5c9c24475a33fd056e210d81c8782872625
grebessi/weather
/app/weather/resources.py
UTF-8
3,077
2.765625
3
[]
no_license
"""Resources for the weather.""" from flask import jsonify from flask_restful import Resource from sqlalchemy import func from app.initialize import appwrapper as app from .climatempo import ClimaTempoAPI from .models import City from .models import WeatherEntry class RetrieveCityWeather(Resource): """Retrieve t...
true
ee35b05aabaa9cf8761fff0f9529d7320f4fc029
Panchenko-Lab/Supplementary-data-for-Peng-et-al-2021
/Scripts_for_analyses/Tail_residence_time_analysis/Full_tail_residence_time.py
UTF-8
9,092
2.59375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 10 14:48:45 2019 @author: pengy10 """ import pandas as pd ## Different sets of simulation runs Model_list = ["ModelA", "ModelB", "ModelC", "ModelD", "ModelD_gromacs_run1", "ModelD_gromacs_run2"] for file_name in Model_list: ## unbound state ...
true
ceda9b5cd2d4d61cc2be31c5a165442db03ca1b5
yogistudio/study2018-python
/Lesson0424_2.py
UTF-8
2,252
4.3125
4
[]
no_license
""" 邮校学习 0424 类对象 """ import time class Person(object): def __init__(self, name, birth): self.name = name self.brith = birth def greeting(self): print("Hi ,I'm ", self.name) def __str__(self): return '<Persion: %s> ' % self.name @property def age(self): r...
true
33b7f91e0619b420be6d4cd3b6586eec47d7bf03
sadofnik/basics_python
/Урок 6. Объектно-ориентированное программирование/1.py
UTF-8
1,820
4.125
4
[]
no_license
# 1. Создать класс TrafficLight (светофор) и определить у него один атрибут color (цвет) и метод running (запуск). # Атрибут реализовать как приватный. В рамках метода реализовать переключение светофора в режимы: # красный, желтый, зеленый. Продолжительность первого состояния (красный) составляет 7 секунд, # второго (ж...
true
893846684a6bc48641e75f4da11246a92e84b41d
dpattayath/algo
/dynamic_programming/coin_change.py
UTF-8
1,339
3.8125
4
[]
no_license
""" memoization approach (top down) """ def coin_change_recursive(coins, money, index, memo): if money == 0: return 1 if index >= len(coins): return 0 key = str(money) + '-' + str(index) if memo.get(key, 0) != 0: return memo.get(key) amount_with_coin = 0 ways = 0 w...
true
3ff714e2c5b46ea220db4ccf0e4829fa3e1eaa16
Sajanader/amman-python-401d2
/data_structures_and_algorithms_python/challenges/Insertion_sort/test_Insertion_sort.py
UTF-8
162
2.765625
3
[]
no_license
from Insertion_sort import InsertionSort def test_Insertion_sort(): actual = InsertionSort([2,4,0,3]) expected = [0,2,3,4] assert actual == expected
true
122b0681a25c45b66b89c7f99c1b562d6e44ffbd
lbedogni/iot
/thesis/DavideCrestini/tesi-crestini/Piattaforma/services/managers.py
UTF-8
1,413
3.046875
3
[]
no_license
class MyUserManager(BaseUserManager): def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """ Creates and saves a User with the given email, date of birth and password. """ if not email: raise ValueError('Users must ha...
true
f00f1035c40077b2a498d0d52b24cdb179cbf1c4
dimkh/GeekBrains
/course06/hw03/task01.py
UTF-8
611
3.984375
4
[]
no_license
# Итоговый список с результатами res_lst = [0] * 8 # Пробегаем по всем натуральным числам диапазона for i in range(2, 100): # Каждое число проверяем на кратность for j in range(2, 10): # Кратно - добавляем 1 в итоговый список if i % j == 0: res_lst[j - 2] += 1 # Вывод результатов i...
true
6914824a1782e1a927841acd7fd0407d88edd949
DaButter/RTR108
/py4e_uzd/score_calculator.py
UTF-8
274
3.859375
4
[]
no_license
# 3.3 programming task score = input("Enter Score: ") sc = float(score) if sc > 1 or sc < 0: print('Error') elif sc >= 0.9: print('A') elif sc >= 0.8: print('B') elif sc >= 0.7: print('C') elif sc >= 0.6: print('D') elif sc < 0.6: print('F')
true
44d22f3ba521af4fe96c530f8d3a78a1d5f6ca43
akulahemasanthoshidaughterofmurty/python
/Missing Numbers.py
UTF-8
245
2.875
3
[]
no_license
n=input() test_list=n.split() test_list = [int(i) for i in test_list] i=0 total=0 result=[] while(i<=len(test_list)-1): total=total+1 if(total!=test_list[i]): result.append(total) else: i=i+1 print(result)
true
cbf4f969076e21fd21c21c8068bc7a71f3f9ab31
bmonikraj/pca-face-recognition
/PCA_facerecogntion.py
UTF-8
8,744
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Feb 01 15:04:35 2018 @author: STUDENT1 """ from PIL import Image from skimage import exposure import numpy as np import matplotlib.pyplot as plt import os #variance covariance matrix with rows as obseravtions and columns as features (mXd) def covariance(X): ...
true
62fff40d16e9a12e36f57baf56e64afaf8f1f6c5
lucbouge/Python_Library
/System/cache.py
UTF-8
1,905
2.84375
3
[]
no_license
import os from .file import load_file_to_data, dump_data_to_file, test_file_exists from .print import eprint class Cache: def __init__(self, *, cachedirname=None, cachename=None, interval=100): self.update_counter = 0 ## assert isinstance(interval, int), interval self.interval = in...
true
99c3816999f17faec6e1f4a7616630c73b771e8b
BurnsAndy/aoc-2020
/1-1/1-1.py
UTF-8
264
3.4375
3
[]
no_license
#Get info from file with open("input.txt", "r") as file: input_lines = [line.strip() for line in file] for line1 in input_lines: for line2 in input_lines: if(int(line1) + int(line2) == 2020): print(line1) print(line2) print((int(line1) * int(line2)))
true
e66acde45df2b71973c5d879cbb7fab3cece982a
Mowdinger/DataProcessing
/matlab/Magnet_Parallel_position.py
UTF-8
2,009
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jan 22 16:00:51 2018 @author: brucelau """ import numpy as np import matplotlib.pyplot as plt from pylab import * A = np.array([1000,1000,0,0,500,500,-500,-500,200,1000,1000,-100,-200,-300,-1000,-1000,-100,100])+100 B = np.array([8,7,7,6,6,5,5,4,4,4,3,3,3,3,3,2,2,2]) fi...
true
08b7427b428a814c74afe53ff0600b0b33ab9b1e
aalto1/crypto
/viff/inlinecb.py
UTF-8
2,998
2.609375
3
[]
no_license
from itertools import imap from viff.runtime import Share, gatherShares from viff.util import wrapper from twisted.python.failure import Failure from twisted.internet.defer import Deferred, _inlineCallbacks, returnValue class pc_wrapper(object): """ Decorator inside which the program counter is forked. """ def...
true
1c3b61b61c1606ee9bfdb930badc090f5e17f9ca
FJRH03/PythonCourse
/ReadFiles/WriteFile.py
UTF-8
253
2.75
3
[]
no_license
''' Author: @XXXKaos (GitHub) Francisco Ramirez Twitter: @DeNyJaviier ''' #Opening and saving file into a variable file = open("file.txt" ,"a") #Writing data into the file file.write("\nEva - Human Resources") file.write("\nKaos - Human Resources")
true
30e26a46af0735e97d7035b0aa649f51ac925981
jiaojiejie/learngit
/格式化输出.py
UTF-8
541
3.71875
4
[]
no_license
# __author:jiaojiejie # date:2019/3/24 name = input("Name:") age = int(input("Age:")) job = input("Job:") salary = input("Salary:") if salary.isdigit(): #判断长得像不像数字,比如“200d”长得就不像数据,“200”像数据 salary = int(salary) else: #print() exit("must input digit") #退出程序 msg = ''' -------info of %s-------...
true
3a67850d45945f63fc3852d0973dd40240c4f9f5
qiaojingwei/selenium_learn
/alert.py
UTF-8
2,258
3.40625
3
[]
no_license
#Alert(driver).accept() # 等同于点击“确认”或“OK” #Alert(driver).dismiss() # 等同于点击“取消”或“Cancel” #Alert(driver).authenticate(username,password) # 验证,针对需要身份验证的alert,目前还没有找到特别合适的示例页面 #Alert(driver).send_keys(keysToSend) # 发送文本,对有提交需求的prompt框(上图3) #Alert(driver).text # 获取alert文本内容,对有信息显示的alert框 #示例1:switch_to.alert , accept()...
true
a82bccea5c5c4cc1ca2716eb0cac2dc273a11c8e
Walters8657/Fibonaccis
/python.py
UTF-8
2,916
3.609375
4
[]
no_license
import tkinter results = [] #Holds list of all result objects #def fib(n): def fib(): for result in results: result.destroy() f1, f2, i = 0, 1, 1 n = 0 try: n = int(userInput.get()) except: result = tkinter.Label( scrollableFrame, text="What are yo...
true
627cd425e879d32e93aa0ca398a3d6d64fc09ea1
Mayeen4536/UniversityManagementSystem
/human/person.py
UTF-8
286
3.203125
3
[]
no_license
class Person(): def __init__(self, id, name): self.id = id self.name = name self.blood = '' self.contact = None pass def log(self): print(self.__dict__) def __str__(self): return f'ID:{self.id}, Name:{self.name}'
true
506b18196bae78375366761cfe1fa63827ff6b39
parkchanjong/algorithm-python
/head.py
UTF-8
54
2.921875
3
[]
no_license
def head(lst): return lst[0] print(head([1, 2, 3]))
true
5863089663819f5cff970eeedfefdbc9261aae8d
gorebhaven7/DSA-EASY
/6.Binary_Search_Tree/1.Traversal/Tra.py
UTF-8
572
3.703125
4
[]
no_license
class Node: def __init__(self,val): self.left = None self.val = val self.right = None def buildTree(root,key): if root is None: return Node(key) else: if root.val == key: return root elif key < root.val: root.left = buildTree(root.left,key) else: root.right = buildTree(root.r...
true
ca480425f0daef9aafc4f5d62c7c841e73c4003b
paujh/Producto
/MenuCliente.py
UTF-8
881
3.53125
4
[]
no_license
from Producto import* from Cliente import* from Tienda import* class MenuCliente: def __init__(self): pass def registrarCliente(self): #Este método es para que el cliente interactue con el MenuCliente y así obtener sus datos print("Bienvenido.") print("Ingrese su nombre: ") nombre = input() ...
true
405008ac3bc680ad8426cbf71a65721cd2a095d2
Adasumizox/ProgrammingChallenges
/codewars/Python/7 kyu/AlternateCapitalization/capitalize.py
UTF-8
112
3.53125
4
[]
no_license
def capitalize(s): s = ''.join(c if i%2 else c.upper() for i,c in enumerate(s)) return [s, s.swapcase()]
true
203063d23d390ad3f80e147818cdcbc480ae4c5d
rhoenkelevra/python_simple_applications
/class-notes/fukushu/F0714_singular-count.py
UTF-8
1,786
3.8125
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Jul 14 09:39:10 2021 @author: user15 """ # ============================================================================= # input enter data "q" for quit # ask until q # output data count # output singular data count # count empty and not empty # =============================...
true
1ec5f38d6f3999f95db40d5afcc5095f7a29c614
haileqin/ProjectEuler_HaileQin
/p019/p019.py
UTF-8
1,367
3.359375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # week 1-7 sun-sat # month 1-12 # year 1901-2000 week_day=2 def week_calculate(week_day, days): week_day=(week_day+days)%7 return week_day for x in xrange(1901,2000+1): for y in xrange(1,12+1): print x, y, 1, week_day if y==1: #31 if ...
true
f384c044125df93bfd21c64f718d28afc4effa18
luizferreira/cmed
/src/wres.archetypes/PasteDeploy-1.3.4-py2.6.egg/tests/test_config_middleware.py
UTF-8
496
2.515625
3
[]
no_license
from nose.tools import assert_raises from paste.deploy.config import ConfigMiddleware from paste.fixture import TestApp class Bug(Exception): pass def app_with_exception(environ, start_response): def cont(): yield "something" raise Bug start_response('200 OK', [('Content-type', 'text/html')]) ...
true
19c6910d50e38b220ac3ee6fbc161c6ca75a6310
bob2827/tubes
/tubes/__init__.py
UTF-8
3,816
3
3
[]
no_license
import sqlalchemy as sqla import shlex import json import csv valid_types = ["str", "int", "real", "time", "blob"] def lex_schema(schema): s = shlex.shlex(schema) fields = {'names': [], 'types': []} while True: fieldtype = s.get_token() name = s.get_token() comma = s.get_token() ...
true
5ae5ef02effc710b1c404f6501f95e24640c4a7b
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_81/187.py
UTF-8
891
2.671875
3
[]
no_license
f = open("in", "rb") tt = int(f.readline()) l = [] def avg(ll, i): summ = 0 ssh = 0 for j in range(len(ll)): if (j!=i): if ll[j] != '.': ssh += 1 summ += int(ll[j]) return float(summ)/ssh def tong(ll): t = 0.0 for i in ll: if i != '.': t += int(i) return t def sssh(ll): t = 0.0 for i in ll: ...
true
96f023a9df960fcb492367314ec97b69103db03a
sarahsyarifahh/Mengenal-Indonesiaku
/Final Project - Mengenal Indonesiaku.py
UTF-8
15,535
2.71875
3
[ "CC-BY-4.0" ]
permissive
import pygame, math, random # Set up pygame pygame.init() # Set up for project screen WIDTH, HEIGHT = 800, 500 SCREEN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Mengenal Indonesiaku") # Set up color WHITE = (255,255,255) GREY = (30, 30, 30) ...
true
7462b8cafeb1d1247ed0018ae8404a927f733a3a
ahedayat/Resnet-AE
/dataloaders/pascal_voc2012/voc12_loader_utils.py
UTF-8
1,399
2.765625
3
[]
no_license
import xml.etree.ElementTree as ET def read_xml_file(ann_xml_address): """ img_size: (width, height, depth) objs: [ (cat, x_min, y_min, x_max, y_max) for all bndboxes ] <<return>> : img_size, bndboxes """ ann = ET.parse(ann_xml_address).getroot()...
true
0f5d9dd39737a3403ce03e7b1a9d7bce367f4ddb
SandroWissmann/Bricks-Py
/src/bricks/types/angle.py
UTF-8
4,353
3.84375
4
[ "MIT" ]
permissive
"""Representation of an Angle from 0 - 360 degree.""" from enum import IntEnum from numpy import deg2rad class Quadrant(IntEnum): I = 0 II = 1 III = 2 IV = 3 class Angle: """ Representation of an Angle in cartesian coordinate system. Attributes ---------- value : float ...
true
75ec92a2f130cac7b91b75529e1a9c2c2a073444
awslabs/sagemaker-debugger-rulesconfig
/smdebug_rulesconfig/profiler_rules/utils.py
UTF-8
874
3.40625
3
[ "Apache-2.0" ]
permissive
invalid_boolean_error = "{0} accepts only boolean values for {1} " invalid_key_format_error = "Key {0} does not follow naming scheme: <rule_name>_<parameter_name>" invalid_rule_error = "{0} is an invalid rule name! Accepted case insensitive rule names are: {1}" invalid_param_error = "{0} is an invalid parameter name! A...
true
24304d9c4b67a0e501a36acf309270a9e8e2beb9
jyx11011/cs4246-project-1
/agent/expert_agent.py
UTF-8
3,717
2.65625
3
[]
no_license
try: from runner.abstracts import Agent except: class Agent(object): pass import torch import numpy as np from models import RTrailNetwork RTRAILNET1_MODEL_PATH = 'rtrailnet1.model' RTRAILNET2_MODEL_PATH = 'rtrailnet2.model' def get_agent_pos(state): for lane in range(10): for x in range(50): ...
true
766e47a16b32d76cd85030f04a2d70d278a6296a
gacima/study
/webscraping/jsonparsetest.py
UTF-8
282
3.453125
3
[]
no_license
import json jsonString = '{"arrayNums": [{"number": 0}, {"number": 1}, {"number": 2}], "arrayOfFruits": [{"fruit": "apple"}, {"fruit": "banana"},{"fruit": "pear"}]}' jsonObj = json.loads(jsonString) print(jsonObj) print(jsonObj.get("arrayNums")) print(jsonObj.get("arrayNums")[1])
true
4ac55fe88350f7c7ede43a27a623cd59e8920a55
Aasthaengg/IBMdataset
/Python_codes/p02613/s777876909.py
UTF-8
112
3.21875
3
[]
no_license
N = int(input()) S = [input() for _ in range(N)] for a in ['AC','WA','TLE','RE']: print(a, 'x', S.count(a))
true
78a578ebde5629ddf57cdf9701625b115361ff2e
Amirmst/ipo-prediction
/scrapers/column_inspect.py
UTF-8
638
3.140625
3
[]
no_license
import csv import pandas as pd def check(name): filters = ['closed', 'highd', 'opend', 'lowd', 'volumed'] for filter in filters: if filter in name: return False return True with open('../data.csv', mode='r', encoding='utf-8') as csv_file: csvreader = csv.reader(csv_file) fields...
true
1cacc3719c46eb4ab9ab284a159a5f35d967858d
rpsingh2/fss16rtr
/code/8/NSGAII.py
UTF-8
9,223
2.578125
3
[]
no_license
from __future__ import print_function import sys import operator import numpy as np from fastNDOM import fast_nondominated_sort as fastNdom from a12 import a12 from DTLZ1 import * def say(*lst): """ Print without going to new line :param lst: """ print(*lst, end="") sys.stdout...
true
0ef41994fb71755748e4d639ca84ee7315c3e6ed
Ultra-Seven/StreamAssignments
/src/prototype/py/ds.py
UTF-8
11,677
2.734375
3
[ "MIT" ]
permissive
import bsddb3 import struct import json import flask import time from threading import Thread from Queue import Queue from StringIO import StringIO from sqlalchemy import text from sqlalchemy.sql.elements import TextClause from table_pb2 import * from itertools import product, chain, combinations from dct import * de...
true
8c29393836bdfe324d3647cd58fea39ab9c49c35
manifest/flax-extra
/src/flax_extra/checkpoint/_summary_logger.py
UTF-8
1,678
2.671875
3
[ "Apache-2.0" ]
permissive
r"""Logging a summary to stdout.""" from typing import Optional from functools import reduce from flax_extra import console from flax_extra.checkpoint._summary import Summary, Metrics # pylint: disable=too-few-public-methods class SummaryLogger: r"""The writer prints summaries to stdout.""" def __init__(self...
true
e66b272278fe7767f350d16f68b4b687c2b665b1
jeancharlles/CursoOM
/For/for_startswith.py
UTF-8
192
4.0625
4
[]
no_license
variavel = ['Jean', 'Isabella', 'Claudia'] for valor in variavel: if valor.startswith('J'): print(f'{valor} começa com J') else: print(f'{valor} não começa com J')
true
c5fada0fc03b3f263080a91b1851df4a051c54dc
UnstoppableGuy/MNA-4-SEM
/lab6/main2.py
UTF-8
1,763
3.28125
3
[ "MIT" ]
permissive
import sympy import numpy import matplotlib.pyplot as plt from matplotlib import pylab list_x = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] f = {list_x[0]: 4, list_x[1]: 4.41, list_x[2]: 4.79, list_x[3]: 5.13, list_x[4]: 5.46, list_x[5]: 5.76, list_x[6]: 7.04, list_x[7]: 7.3, list_x[8]: 7.55, l...
true
d2e2b7bce077785464c528cd95e4aa9b07a05baf
CISVVC/cis83-examples
/object_oriented_programming/draw/point.py
UTF-8
524
4.03125
4
[]
no_license
#!/usr/bin/env python3 import math class Point: ''' Point class demonstrates modeling a Cartesian point ''' # Constructor def __init__(self,x,y): self.x = x self.y = y def distance(self,otherpoint): return math.sqrt((self.x - otherpoint.x)**2+(self.y-otherpoint.y)**2) de...
true
d2c8f2c1342b3fdcf89c5a0c1e166b8d683792e1
arthur322/montanha
/Ex2-Montanha.py
UTF-8
1,143
4.125
4
[]
no_license
tamanho = int(input('Digite o tamanho do vetor: ')) vetor = [0] * tamanho ###################################### def entre10e40(vet): y = [] for i in vet: if i >= 10 and i <= 40: y.append(i) return y def posicoesPares(vet): w = [] for i in range(len(vet)): if i % 2 == 0: w.append(vet[i])...
true
f46cc9a39c2f3546f035566b1e44aaa9d37797fc
sabina30r/datamining_lab1
/graphics_2.py
UTF-8
1,409
3.34375
3
[]
no_license
from collections import Counter import csv from matplotlib import pyplot as plt import numpy as np SPAM = 'spam' HAM = 'ham' MESSAGE_TYPE = "v1" MESSAGE_KEY = "v2" def avg(d): x = 0 y = 0 for v in d: c = v[1] x += v[0] * c y += c return x / y def main(): with open('resou...
true
608ce3b5dab051292538849f83e57fa8aea39b05
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
/problems/LC723.py
UTF-8
2,021
3.5625
4
[]
no_license
# O((n*m)²) # n = len(board) | m = len(board[0]) class Solution: def candyCrush(self, board: List[List[int]]) -> List[List[int]]: didCrush = True while didCrush: didCrush = self.crush(board) self.gravity(board) return board def crush(self, board): didCr...
true
62acf5774eb75ea4912289122cd04a361048f608
adrbed/python_poczatek
/mod_2/lesson_6/ex_4_workaround/main.py
UTF-8
329
2.828125
3
[]
no_license
from estudent.school import create_school_with_students def run_example(): school = create_school_with_students("Hogwart") student = school.students[0] student.add_final_grade(3) print(student._Student__final_grades) school._School__promote_lucky_students() if __name__ == '__main__': run_e...
true
73e533476efe4f1ba5c7ed45875dc92ab22280ce
shrutisaxena0617/Data_Structures_and_Algorithms
/all/queueArray.py
UTF-8
1,038
3.671875
4
[]
no_license
class queueArray: def __init__(self, capacity): self.capacity = capacity self.rear = capacity - 1 self.front = self.size = 0 self.myqueue = [None]*self.capacity def isEmpty(self): return self.size == 0 def isFull(self): return self.size == self.capacity def enqueue(self, elem): if se...
true
e50d3b22010ece99c090cb44cb54e72765a46c9d
JeongSuIn/classproject
/Python/Class/section_2_2_013.py
UTF-8
148
3.765625
4
[]
no_license
# section_2_2_013 # 연산자 우선 순위 x = 5 x = x + 1 * 10 # x = x (1 * 10) print(x) y = 42 - 1 + 1 - 10 print(y) z = (x + y) * 6 print(z)
true
40ef60aa66abf5230d0c9248b8f41eb321a2352f
quadrixm/Machine-Learning-in-Python-Examples
/tensor_flow/intro.py
UTF-8
401
3.03125
3
[ "MIT" ]
permissive
import tensorflow as tf # creates nodes in a graph # "construction phase" x1 = tf.constant([[5., 6.], [2., 3.]] ) x2 = tf.constant([[4., 7.], [3., 8.]] ) result = tf.matmul(x1, x2) print(result) # defines our session and lanuches graph with tf.Ses...
true
992adbb356a08a8070eb365d6df4d5ba10786225
armandoordonez/notebook2flask
/loader.py
UTF-8
392
2.828125
3
[]
no_license
import pandas as pd import numpy as np import pickle from sklearn.linear_model import LinearRegression filename = 'trained_model3.sav' # This file can go to the Web application loaded_model = pickle.load(open(filename, 'rb')) data = {'highway-mpg':['29']} X1 = pd.DataFrame (data, columns = ['highway-mpg']) precio=l...
true
3b2fbf6c4f3820c2ac01ad5870e7d515bdc75a7e
klavinslab/hp
/translate.py
UTF-8
1,486
2.6875
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class Translate(nn.Module): def __init__(self,encoder,decoder): super(Translate,self).__init__() self.encoder = encoder self.decoder = decoder def forward(self, sequence): return self.decode(self.encode(seq...
true
8e65c2706bd9f3c8ace7a455796a6b3eb4e066ff
dandumitriu33/codewars-Python
/set1/validparantheses.py
UTF-8
1,414
3.625
4
[]
no_license
def valid_parentheses(string): if first_para(string) is False: return False if last_para(string) is False: return False if parse_string(string) is False: return False else: return True def first_para(string): i = 0 first_para = '' while i < len(string): ...
true
81db6d54628f4852474a23677845204e9efb000c
lucastruong/route-engine
/src/routing/routing_data.py
UTF-8
5,453
2.703125
3
[]
no_license
import sys from typing import List, Tuple from src.problem.problem_adapter import ProblemAdapter from src.problem.problem_helper import distance_two_points from src.problem.problem_location import ProblemLocation, create_problem_location from src.problem.problem_time import ProblemTime def create_data_locations(adapt...
true
4ec0c00c0cea0791c22fb526c0c6b8028ff1792f
TaoGrolleau/Bigdata-project
/src/Dictionnary_Article.py
UTF-8
395
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import Parser_Article as p def dictionnaries(): list_word_dictionnaries = [] with open('../resources/dict_eng.txt', 'r', encoding='utf-8') as dictionnary_en: all_en_words = dictionnary_en.read() words = all_en_words.split('\n') for w in words[1:]: list_word_dictionnaries.append(w) #...
true
8cb88ec3cd529d674fc303cf83176e1fbebd44ca
orenlivne/euler
/euler/problem140.py
UTF-8
1,606
3.734375
4
[]
no_license
''' ============================================================ http://projecteuler.net/problem=140 Consider the infinite polynomial series AG(x) = xG1 + x2G2 + x3G3 + ..., where Gk is the kth term of the second order recurrence relation Gk = Gk1 + Gk2, G1 = 1 and G2 = 4; that is, 1, 4, 5, 9, 14, 23, ... . For this ...
true
b0321b6b9768e8e0c837666fc01b40ec03fa3455
legacyvashist/my_first_rep
/listloop.PY
UTF-8
305
3.375
3
[]
no_license
fruits = ['apple', 'mango','bannana','date'] pocket_item = ['coins','wallet','cards'] empty_list = [] for fruit in fruits : print(f"this is :{fruit}") for item in pocket_item : print(f"items are: {item}") for i in range(0,10) : empty_list.append(i) for things in empty_list : print(f"{things}")
true
1c3a70aa8fbb143924914d3ad4f568f454386cb0
HENRIQUESOUZ/tutorial-haar-cascade
/PreProcessing.py
UTF-8
4,275
3.25
3
[]
no_license
#!/usr/bin/env python """ These methods provides ways to pre processing images, the main objective is to encapsulate methods that will be used in the main projects. @author Thiago da Silva Alves @version 1.0, 23/12/16 """ import os import cv2 as cv import numpy as np def compare_images(image1, image2): ""...
true
46979e43233f6eff38215ba2310c762dc6f150c8
JeevanMahesha/python_program
/college/gradeOfStud.py
UTF-8
403
3.9375
4
[]
no_license
""" 0-40 U 41-50 D 51-60 C 61-70 B+ 71-80 B 81-90 A 91-100 S """ num = int(input('Enter the total mark of that student\n')) if num<=40: print('U') elif num<=50: print('D') elif num<=60: print('C') elif num<=70: print('B+') elif num<=80: print('B') elif num<=90: prin...
true
5b907b5b6f897770a439befac6bd5226d4698a1e
amolkokje/coding
/python/int_onsite_0/large_file.py
UTF-8
2,634
3.203125
3
[]
no_license
import sys, os # NEEDED ONLY TO GENERATE THE INPUT def create_big_file(filename, one_large_sentence): sentence = 'My name is Amol Kokje. ' with open(filename, 'w') as fh: fh.write(sentence) for _ in range(10 ** 5): with open(filename, 'a') as fh: if one_large_sentence: ...
true
868621e364b1f5be205c47234693c00212bb6e33
falconandy/composer
/composer/aws/handshake/ssm.py
UTF-8
1,844
2.625
3
[]
no_license
import boto3 from botocore.exceptions import ClientError import logging from typing import * DEFAULT = "_default" def _ssm(): session = boto3.Session(region_name='us-east-1') ssm = session.client('ssm') return ssm def _full(profile: str, path: str) -> str: return "/Open990/%s/%s" % (profile, path) d...
true
228e6ee236c5332b6d53f533e39a29cc410c3729
jsanon01/python
/weather.py
UTF-8
1,503
3.28125
3
[]
no_license
import requests import datetime now = datetime.datetime.now() api_address = 'https://api.openweathermap.org/data/2.5/weather?appid=426767ea170627f14a06a5979bea2de4&q=' city = input('\nplease enter the city name: '.title()) unit = '&units=imperial' url = api_address + city + unit json_data = requests.get(url).jso...
true
f5e2447c57efdda53f1c3658b0a8699fdba1e6bd
vad-popov/WebScraper
/Topics/Writing files/Animals/main.py
UTF-8
297
3.265625
3
[]
no_license
# read animals.txt # and write animals_new.txt with open('animals.txt', 'r') as file_animals: animals = file_animals.readlines() amimals_with_spaces = [i.replace('\n', ' ') for i in animals] with open('animals_new.txt', 'w') as new_animals: new_animals.writelines(amimals_with_spaces)
true
a57fb0131fdf6efac79fe1e91113f76df6510234
amitfld/amitpro1
/loop_targilim/loop5.1.py
UTF-8
397
2.890625
3
[]
no_license
oreh = int(input('enter oreh: ')) #קולט אורך ורוחב ומדפיס מלבן rohav = int(input('enter rohav: ')) rohav_str = '' oreh_str = '' for i in range(rohav): rohav_str += '* ' print(rohav_str) for i in range(oreh): oreh_str += '*' for n in range(rohav*2-3): oreh_str += ' ' oreh_str += '*' ...
true
7aa6d6c840fe18e1b85c9cbb2b413f093a39c03e
BryanNilsen/C40-Python-StudentExercises
/instructor.py
UTF-8
958
3.546875
4
[]
no_license
from nssperson import NSSPerson class Instructor(NSSPerson): """ Represents an instructor object Inherits from NSS Person: first_name (str): instructor's first name last_name (str): instructor's last name slack (str): instructor's slack handle cohort (str): instructor's coh...
true
8f6b48fb7794ad6f77b113119e6dbc157d370e87
rafasapiens/estudos_programacao
/Player.py
UTF-8
6,279
2.84375
3
[]
no_license
import pygame import random import os from Kamaelia.Util.Graphline import Graphline from Kamaelia.UI.Pygame.BasicSprite import BasicSprite from Kamaelia.Physics.Behaviours import bouncingFloat, cartesianPingPong, loopingCounter, continuousIdentity, continuousZero, continuousOne from Kamaelia.UI.Pygame.EventHandler im...
true
e818f5195b7ff4a932bbb46c5ebdceb82b21c114
MrHamdulay/csc3-capstone
/examples/data/Assignment_8/hnnnic004/question1.py
UTF-8
613
4.46875
4
[]
no_license
'''program to find palindromes using recusrion nicole henning due 9 may 2014''' string = input("Enter a string:\n") def palindrome(string): if len(string) < 2: #if word contains only one or no letters/characters,true print("Palindrome!") elif string[0] == string[-1]: #if end and beginning...
true
27fd517c31a85f4a2aaee32e2d12bcd91ee9d2a7
20120315PRF/20120315PRF_BT2
/models/delegate_info.py
UTF-8
558
2.703125
3
[]
no_license
## Creates a delegate info object factory class DelegateInfoFactory: def generate_delegate (self, name): delegate = {} delegate['name'] = name delegate['position'] = '--' delegate['uptime'] = '--' delegate['approval'] = '--' delegate['status'] = DelegateInfoStatus.ST...
true
0b5567f8034e569b500e75f94d5863749266b48f
emnity3/NiNJA
/check_addresses.py
UTF-8
1,495
2.53125
3
[]
no_license
import requests import json import time import pickle from sha_btc import Address, save_objects with open("addresses.pickle", 'rb') as pkl: addresses = pickle.load(pkl) updated_addresses = list() def check_addy(add): phrase = add.pass_phrase pk = add.u_prk for address in [add.u_addy, add.c_addy]: ...
true
519eb17fa9bfc5bdc9d796c3230bab71a686dec6
gabriellaec/desoft-analise-exercicios
/backup/user_395/ch25_2019_03_30_21_25_07_684443.py
UTF-8
173
3.546875
4
[]
no_license
d = float(input('Qual a distância que você deseja percorrer (em Km)?')) if d <= 200: print (d * 0.5) else: print(200*0.5 + (d-200)*0.45) print ('{:.2f}'.format(v))
true