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
5e9c5983e41d8997ecea5a428640789e8103e959
jinmingda/MicroorganismSearchEngine
/mse/jsonify.py
UTF-8
1,302
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """This module contains rules to map data model objects into JSON.""" # This file can be safely deleted from your project if do not use JSON # controllers. # A JSON-based API(view) for your app. # Most rules would look like: # @jsonify.when("isinstance(obj, YourClass)") # def jsonify_yourclass...
true
7fc2764ff006c0dab1c3ebaebad83e8898a2cbd1
Sotaro-Okazaki/all_challenges
/challenge11.py
UTF-8
150
3.5625
4
[]
no_license
place = [] Hokkaido = ("42.772156", "140.893650") Okinawa = ("26.181282", "127.637786") place.append(Hokkaido) place.append(Okinawa) print(place)
true
d6d2d6d90efd7b3e7f81894ab13bc78edc868a8e
proximax-storage/python-xpx-chain-sdk
/xpxchain/models/account/account.py
UTF-8
5,798
2.625
3
[ "Apache-2.0" ]
permissive
""" account ======= Account private key, public key and address. License ------- Copyright 2019 NEM Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ht...
true
7134a3c7f50070cdc46e800a0fff822598949a81
Calvinjmin/StraightUpBE
/chalicelib/login.py
UTF-8
1,089
3.203125
3
[]
no_license
# Imports from botocore.exceptions import ClientError from dynamoVariables import dynamodb_table def verify_user(front_end_data, back_end_data): """ Verifying User Information :param front_end_data: Data from FE Form :param back_end_data: Data from Dynamo Database :return: Boolean value - Username...
true
1549ffebc8c86f48eb2978d8dc2fe44992accc02
brunolcarli/Black-Mage
/chatbot/schema.py
UTF-8
3,592
2.71875
3
[]
no_license
import graphene from chatbot.bots.bot import cid from chatbot.bots.nlp_bot import response, greeting, sent_tokens from users.utils import access_required class Query(object): show_me_the_sight_beyond_sight = graphene.List( graphene.String, description='This is an easter egg.' ) def re...
true
e4870abe3c69d701caabf581d083969687a18564
PhilippeGalvan/jinete
/jinete/models/positions.py
UTF-8
1,747
2.84375
3
[ "MIT" ]
permissive
from __future__ import annotations import logging from abc import ( ABC, abstractmethod, ) from typing import ( TYPE_CHECKING, ) from .abc import ( Model, ) if TYPE_CHECKING: from typing import ( Tuple, Sequence, Generator, Dict, Any, ) from .surfac...
true
97c401ad9074dd6228b26e2df8ed438e73c41b52
Zessi19/Tietokantasovellus-2019
/application/posts/models.py
UTF-8
1,447
2.609375
3
[]
no_license
from application import db from application.models import Base from sqlalchemy.sql import text class Post(Base): message = db.Column(db.Text, nullable=False) priority = db.Column(db.Integer, nullable=False) account_id = db.Column(db.Integer, db.ForeignKey('account.id'), nullable=False) thread_id = db.Co...
true
338c551da54e2b60bc1786445cd12acaf93a544a
LieutenantPorky/reducify
/backend/Receipt_Reader.py
UTF-8
377
2.53125
3
[]
no_license
import cv2 import pytesseract from PIL import Image path="test_receipt.jpg" # Open the image image = cv2.imread(path) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) #do some preprocessing gray = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] #gray = cv2.medianBlur(gray, 3) pil_img = Image.from...
true
99a4a360c7e91d9e0f0d1b08cb3dc630da14cfb2
mgbo/My_Exercise
/2018/Other/Urok_9_Пакеты_модули/primel/assert_1.py
UTF-8
96
3.515625
4
[]
no_license
# assert age = 34 assert age>= 0 , "how is your age?\n " print ("Your age is: %d "%(age))
true
3300036e23cc4279b89c07d65a24961906e6afc3
SocioProphet/Vida_Modeling
/Auxilary Files/WeeklyMobility_Santiago.py
UTF-8
7,840
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 15 20:59:15 2020 @author: jackreid """ import csv import dateutil from dateutil import rrule from datetime import datetime, timedelta # ============================================================================= # %% Calculate Daily Averages fo...
true
3c1906248b8f42ae0efbb9e25c70d0a020de40c4
Luis199/Python
/python_data_structures/dictionary.py
UTF-8
596
3.484375
3
[]
no_license
sal_info = {'Austin':91185, 'Bostion':90171} sal_info["New York City"] = 95002 sal_info["Miami"] = 100000 sal_data = dict() sal_data = {'Austin':91185, 'Bostion':90171} print(sal_data) if ('Austin' in sal_data): print(sal_data['Austin']) else: raise "Error!" for location in sal_data: print(sal_data[loca...
true
ddf3bfcf3c50e9bc86b65cda29dc30412be8ea1e
danjizquierdo/dsc-1-07-07-object-oriented-shopping-cart-lab-nyc-ds-career-012819
/shopping_cart.py
UTF-8
1,157
3.53125
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class ShoppingCart: # write your code here def __init__(self, emp_discount=None): self.total=0 self.employee_discount=emp_discount self.items=[] def add_item(self, name, price, quantity=1): for item in range(quantity): self.items.append(price) self.to...
true
ac99b7512db20ce52dcf0c6a4271273d8828b948
dimitriacosta/python-examples
/oop/dog_instance_methods.py
UTF-8
521
4.6875
5
[]
no_license
""" Instance method example """ class Dog: """Define a dog""" species = 'mammal' def __init__(self, name, age): self.name = name self.age = age def description(self): """Return dog's description""" return f"{self.name} is {self.age} years old." def speak(self, sou...
true
55260e2ba47a918c1e90d454c0852dba47f4e946
bkglobal/pythonCaseStudy
/mathwithRandom.py
UTF-8
183
2.765625
3
[]
no_license
import math, random print(math.ceil(20.4)) print(math.floor(20.4)) print(int(math.pow(2,4))) print(random.random()) print(random.randrange(6)) print(random.sample(range(1,49),6))
true
af1dc7596687475a24ead9a54b1a91032fd583f4
AdamZhouSE/pythonHomework
/Code/CodeRecords/2805/60787/237245.py
UTF-8
275
3.0625
3
[]
no_license
n=int(input()) list=[int(i) for i in input().split()] max=0 for i in range(0,n): temp=0 for j in range(i,n): if j==n-1: temp=n-i elif list[j]>=list[j+1]: temp=j-i+1 break if temp>max: max=temp print(max)
true
11786971325ee84a6f55cfdd5dd5d4a1f4d1defd
KaranP25/TravellingSalesmanProblem_genetic_algorithm
/main.py
UTF-8
4,089
3.40625
3
[ "MIT" ]
permissive
import csv from logic.City import City from logic.Salesman import Salesman from logic.Population import Population from logic.GeneticAlgorithm import GeneticAlgorithm from plot import Plot import time # import and add the distance data def import_distance(): distance_salesman = Salesman() with open('data/cit...
true
7e7bb34f763ac080784f174299f7a921fe995c07
thanhhff/VietAI-Foundation-Doc
/Assignment/vietai-assignment1/softmax_tf.py
UTF-8
3,573
2.84375
3
[]
no_license
""" This file is for multiclass fashion-mnist classification using TensorFlow Author: Kien Huynh """ import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from util import get_mnist_data from logistic_np import add_one from softmax_np import * if __name__ == "__main__": np.random.seed(2018) ...
true
4d203d0bcc1bfb60c758d4ff7c14e7d55854ad91
laurat-tech/IntroToProg-Python
/Assignment05.py
UTF-8
3,750
4.375
4
[]
no_license
# ------------------------------------------------------------------------ # # Title: Assignment 05 # Description: Working with Dictionaries and Files # When the program starts, load each "row" of data # in "ToDoToDoList.txt" into a python Dictionary. # Add the each dictionar...
true
7e611f110d1e9be9848ff02f3efb439ac6e19cf5
aku752/ejercicios
/ciclos/3_ejercicio.py
UTF-8
1,998
3.671875
4
[]
no_license
#3.- El Hospital Regional de la UCB está haciendo un estudio # del costo que representa la atención de pacientes en la # Unidad de Tratamiento Intensivo. Los pacientes están clasificados # en cuatro categorías (numeradas de 1 a 4), dependiendo # del tipo de atención que requieren. La categoría 1 # representa Bs. 1200 d...
true
88eaa7ab6f825003112a4272aaf8f9738b515a98
CIRSS/lod-project
/theater-collections/backend/motley/generateMotleyRDF.py
UTF-8
23,243
2.609375
3
[ "MIT" ]
permissive
import csv, json, re, urllib.request, os, sys class Entity(object): def __init__(self, fullname): # if there is a link if re.search('<(.*)>', fullname): name_link = re.match('(.*) (?:<(.*)>)', fullname).groups() fullname = name_link[0].strip() self.link = name_link[1].strip() else: self.link = None ...
true
d4467bbdc7b459aa70550a74069f45cede2b7c94
nikhiljagtap/track-python
/track/consumer.py
UTF-8
2,624
2.59375
3
[ "MIT" ]
permissive
import logging from threading import Thread from track.request import post, APIError import backoff try: from queue import Empty except ImportError: from Queue import Empty class Consumer(Thread): """Consumes the messages from the client's queue.""" logger = logging.getLogger('interakt') def __i...
true
b30edb8bfcdc3d18c4d597a0f288eb9785b9354e
lww2020/linux
/python/第三周/列表练习题/carts_2.py
UTF-8
1,176
3.4375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Author: davie products = [['Iphone8', 6888], ['MacPro', 14800], ['小米6', 2499], ['Coffee', 31], ['Book', 80], ['Nike Shoes', 799]] shopping_cart = [] exit_flag = False # 标志位 while not exit_flag: print('---------商品列表----------') for index,p in enumerate(products): pri...
true
bedb0bb9b4a36d8287b8ce93ab68ecf2e4b3322f
watsonjj/sstcam-sandbox
/sstcam_sandbox/d190514_csv/convert.py
UTF-8
743
2.828125
3
[ "BSD-3-Clause" ]
permissive
import argparse from argparse import ArgumentDefaultsHelpFormatter as Formatter import pandas as pd def main(): description = 'Loop over R0 or R1 file and plot camera images' parser = argparse.ArgumentParser(description=description, formatter_class=Formatter) parser.ad...
true
cb78696cc33d000523641ee15d0fc3e34396b10d
cha63506/childHood
/website/traffic_shapely_functions.py
UTF-8
2,721
3.25
3
[]
no_license
#Define a function to convert lat long coordinates to UTM coordinates def UTMconvert(points): import utm UTMpoints = [] pt = [points.x, points.y] UTMpoints.append(utm.from_latlon(*pt)) return UTMpoints #Define a function to convert UTM coordinates to lat long coordinates def LatLngConvert(UTMp...
true
42d666860f202d87640df30a887b51c614208080
Mehedee-Hassan/test_nl
/test2_train.py
UTF-8
330
2.90625
3
[]
no_license
from nltk.corpus import brown import nltk brown_tagged_sents = brown.tagged_sents(categories='news') print(brown_tagged_sents) brown_sents = brown.sents(categories='news') unigram_tagger = nltk.UnigramTagger(brown_tagged_sents) print(unigram_tagger.tag(brown_sents[2007])) print(unigram_tagger.evaluate(brown_tagged...
true
1b4acf8d493dc9bc4c337444fb7937f3502922b7
Mr-ZDS/Python_Brid
/Leetcode/L392 判断子序列.py
UTF-8
916
4
4
[]
no_license
''' 给定字符串 s 和 t ,判断 s 是否为 t 的子序列。 你可以认为 s 和 t 中仅包含英文小写字母。字符串 t 可能会很长(长度 ~= 500,000),而 s 是个短字符串(长度 <=100)。 字符串的一个子序列是原始字符串删除一些(也可以不删除)字符而不改变剩余字符相对位置形成的新字符串。(例如,"ace"是"abcde"的一个子序列,而"aec"不是)。 示例 1: s = "abc", t = "ahbgdc" 返回 true. 示例 2: s = "axc", t = "ahbgdc" ''' class Solution: def isSubsequence(self, s: str...
true
232d64a2dca2e22a0f21b8e9c798ff368f5e3b1e
kattsareva/hws
/ex1.1.py
UTF-8
213
3.484375
3
[]
no_license
a = int(input('Введите число: ')) b = int(input('Введите число: ')) print(a + b) print(a - b) print(a * b) print(a // b) print(a % b) c = str(input('Пишите: ')) print(c)
true
ce52dd7ff3300b9436ab7ee288fda472883b1ace
Nobregaigor/Robot-path-tracking-and-obstacle-avoidance-simulation
/catmull_rom_curve.py
UTF-8
2,733
3.4375
3
[ "MIT" ]
permissive
import numpy as np def catmull_rom_one_point(x, v0, v1, v2, v3): """Computes interpolated y-coord for given x-coord using Catmull-Rom. Computes an interpolated y-coordinate for the given x-coordinate between the support points v1 and v2. The neighboring support points v0 and v3 are used by Catmull-Rom ...
true
52079fba1314596b1308784081688db7ec1c18d5
keltoom/Python_programs
/hirst_painting/main.py
UTF-8
1,012
3.046875
3
[]
no_license
# import colorgram # rgb_colors=[] # colors = colorgram.extract('image.jpg', 25) # # for color in colors: # r=color.rgb.r # g=color.rgb.g # b=color.rgb.b # new_color=(r,g,b) # rgb_colors.append(new_color) # # print(rgb_colors) import turtle as t import random t.colormode(255) color_list = [(199, 17...
true
1d57d62d461442dc6751204000fec4c7758d0a08
jonmagnus/INF1910
/exercises/week03/test_e02_writing_bubble_sort.py
UTF-8
718
3.21875
3
[]
no_license
import nose.tools as nt from e02_writing_bubble_sort import bubble_sort @nt.raises(TypeError) def test_bubble_sort_type(): """Test TypeError-spotting for bubble_sort.""" bubble_sort(1) @nt.raises(TypeError) def test_bubble_sort_arguments(): """Test if bubble_sort rejects multiple arguments.""" bubble_sort(1,2,3) ...
true
3a320138e0b4c63ad7dc3fe217d9db3ba7361067
HugoooPerrin/semi-supervised-learning
/LapSVM.py
UTF-8
5,714
3.03125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- #========================================================================================================= #================================ 0. MODULE import numpy as np import math from numpy import linalg import sklearn from sklearn import datasets from sklearn.neig...
true
ee0026dc9b3e4322e7a21c106a4835a22d4a0047
JuanTorresUABC/proyecto1
/palindrome.py
UTF-8
1,041
4.53125
5
[]
no_license
def convertInputString(): rawInput = input("\nPor favor ingresa una palabra, una frase o una oracion \npara saber si es palindromo: ") rawString = rawInput.lower() rawList = list(rawString) return rawList def stripAnalphabetics(dirtyList): analphabeticList = [" ", "-", ".", ",", ":", ";"...
true
150822e5223bb76b372eef712576b24a1e81aec1
lscosta90br/firebird-junior-8k
/showroom-csv.py
UTF-8
1,797
2.828125
3
[]
no_license
import csv file_name = "showroom.csv" try: csvfile = open(file_name, 'rt') except: print("Arquivo não encontrado") csvReader = csv.DictReader(csvfile, delimiter=";") data = [cr for cr in csvReader] lines_data = len(data) + 1 cor_proxima = '' tamanhos = '' for num_line in range(lines_data): vendedor = dat...
true
d2a445520a87a7e912ccf9f9ab4b14610aabdbde
merry-hyelyn/Baekjoon-Online-Judge
/1000~1999/1000.py
UTF-8
148
3.09375
3
[]
no_license
# 1000번 # 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. A,B=map(int, input().split()) print(A+B)
true
313a757e3c8a13b382cf9e40d31afcbc4d28ffa6
makeTaller/Crash_Course_Excercises
/multi-10.py
UTF-8
185
3.671875
4
[]
no_license
multi = input("Enter a number any number: " ) multi = int(multi) if multi % 10 == 0: print("Yes this is a multiple of ten.") else: print("No this is not a multiple of ten.")
true
c425b2b26fdcf43574cc155a9e103b3b00696d23
AmirTavakol/Smart-Greenhouse
/platform/actuator.py
UTF-8
5,046
2.65625
3
[]
no_license
import dbconnection from datetime import date import ast import json db = dbconnection.db_connection() try: Et0 = float(db.getET0Value()[0][0]) except: print("cannot retrieve Evapotranspiration from database") #at this point we need to evaluate etc. try: """ INSERT HERE THE QUERY FOR DB TO GET THE CROP I...
true
370fb1af6f92dfd4c1ddeb57b84a14d2445b911f
Brandt-J/SpectraProcessing
/evaluationTest.py
UTF-8
6,063
2.578125
3
[]
no_license
from typing import List, Dict, Tuple, TYPE_CHECKING import time from specCorrelation import correlate_spectra, CorrelationMode from processing import normalizeIntensities from functions import compareResultLists from distort import * if TYPE_CHECKING: from specCorrelation import Database, CorrelationMode from...
true
ff708744f700383dd70ad7b4fc88b1df7814a01a
Terry071896/Cosmic_Ray_Elimination
/cr_elimination/cr_elimination.py
UTF-8
33,473
3.15625
3
[]
no_license
# Author: Terry Cox # GitHub: https://github.com/Terry071896/Cosmic_Ray_Elimination # Email: tcox@keck.hawaii.edu, tfcox1703@gmail.com __author__ = ['Terry Cox'] __version__ = '1.0.1' __email__ = ['tcox@keck.hawaii.edu', 'tfcox1703@gmail.com'] __github__ = 'https://github.com/Terry071896/Cosmic_Ray_Elimination' impor...
true
e0a449a5c193d1cd1860672cec0b9791350f7ad6
rogeriosilva-ifpi/teaching-tds-course
/programacao_estruturada/20192_186/Bimestral2_186_20192/Parte 2/adailton dia 2 rogerio/q5.py
UTF-8
605
3.375
3
[]
no_license
def programa(): veiculo = float(input('Digite o valor do veiculo: ')) taxa = float(input('Digite o valor da taxa: ')) valor_mensal = float(input('Digite o valor mensal de deposito: ')) taxa_mensal = (taxa / 12) / 100 contador_acumulo = 0 contador_tempo = 0 while contador_acumulo > veic...
true
cb2fbef35a2e5ba1381fed0761c3a54cac31ff24
limapedro2002/PEOO_Python
/Lista_04/Maria Clara/exe4.py
UTF-8
228
3.84375
4
[]
no_license
import módulo módulo.soma(1, 2, 3) módulo.acrescimo(1) módulo.concat("eli", "za", "be", "th") módulo.func(nome='Mary', sobrenome='styles') help(módulo.soma) help(módulo.acrescimo) help(módulo.concat) help(módulo.func)
true
8864e2af2560f13d682f20f3f91727b1b1925bee
lskywolfll/comprehensions_list_and_dicts_python
/debugging.py
UTF-8
567
4.15625
4
[]
no_license
divisors = lambda num: [i for i in range(1, num + 1) if num % i == 0] def get_input(msg): while True: try: result = int(input(msg)) if result < 0: print("No se admiten numeros negativos 😭\n") raise ValueError() else: retu...
true
380a73b7ffd584930d557f8d65de872cfdc9fbc7
Hilgon2/prog
/PE5/PE5_1.py
UTF-8
89
2.890625
3
[]
no_license
def som(getal1, getal2, getal3): return getal1 + getal2 + getal3 print(som(1, 5, 8))
true
edfe63a9b759f72af1bfaec152db52519aa9e202
kdigiorn/CompArchLabs
/Lab02/Lab 02 Files/01_SoftmaxModel_MNIST_Tutorial/softmax_mnist.py
UTF-8
7,576
3.171875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 24 09:29:16 2018 @author: mniemier """ ################################################################################################### # Import relevant Keras items, numpy, matplotlib ############################################################...
true
6d015f065e02004fa44f3ad683a397298ced8d2c
Iamsomenub/tic_tac_toe
/tic_tac_toe_guide.py
UTF-8
2,098
3.734375
4
[]
no_license
TEST_TRIPLES = [ (0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (6, 4, 2)] def play_one_round(): board = ["0", "1", "2", "3", "4", "5", "6", "7", "8"] available_positions = [0, 1, 2, 3, 4, 5, 6, 7, 8] player_toke...
true
fdde9e8daf0c99709d81f0b53d9fff439be9f096
mobydick46/show-me-the-code
/DailyTask/task0001.py
UTF-8
907
3.328125
3
[]
no_license
# -*- coding: UTF-8 -*- ''' Created on 2016年11月23日 生成应用的激活码 @author: mobydick46 ''' import string import random from __builtin__ import int def baseDic(): ''' 返回激活码生成的空间域:字母+数字 ''' return string.letters+string.digits def genActivateCode(len): ''' 根据给定的长度len生成一个激活码 ''' baseStr=baseD...
true
6ae025fc25e8eafde524c3b78bd710a5fb6d456a
FarhadZafari/Recommender
/IterativeRec.py
UTF-8
5,892
2.515625
3
[]
no_license
import numpy as np import ReadData as datareader import operator class IterativeRec: max_learning_repeats = 100 Users_Jobs = [] Users_Jobs_Train = [] Users_Jobs_Test = [] Users_Jobs_Train_Hash = {} Users_Jobs_Test_Hash = {} Users = set() Users_train = set() Users_test = set() J...
true
bea8143ca33ed2010983414db057b4d12c2811a3
duanbing/DLNotes
/example/mxnet/3.3.1_lr.py
UTF-8
1,357
2.984375
3
[]
no_license
# lr 适合连续样本分类 from mxnet import autograd, nd num_inputs = 2 num_examples = 1000 true_w = [2, -3.4] true_b = 4.2 features = nd.random.normal(scale = 1, shape = (num_examples, num_inputs)); labels = true_w[0] * features[:, 0] + true_w[1] * features[:, 1] + true_b print(labels.shape) labels += nd.random.normal(scale=0....
true
a98b80a971370a988ec5579fa8dfe956468eff48
javierartiga/tfm-clustering
/scripts/realtime/preprocessing_realtime.py
UTF-8
3,154
2.78125
3
[ "CC-BY-4.0" ]
permissive
#!/usr/bin/env python3 # # for each src_ip, aggregate info and calc metrics from its session-features-vectors. # when a src_ip has been reviewed, it can be excluded adding it to reviewed_ips.txt in a new line (format: "10.0.0.1: i checked it on 2020-10-22. it's from dev environment") # #usage: ./preprocessing_realtime....
true
d579c0f755218e55526c67580539fff70c11c01a
IMsumitkumar/CommOn-Developers-Community
/student_gp/meta_patterns.py
UTF-8
987
2.734375
3
[ "MIT" ]
permissive
# anyone who knows python here? meta1 = [ {'LOWER': 'anyone'}, {'POS': 'PRON', 'OP': '?'}, {'LOWER': 'knows'}, {'POS': 'PROPN', 'OP': '?'}, {'POS': 'ADV', 'OP': '?'} ] # do you know / do you know me meta2 = [ {'LOWER': 'do'}, {'LOWER': 'you'}, {'POS': 'VERB','OP':'?'}, {'POS': 'PRON...
true
cdba0812eadcfb3db5919697b7f15e09146a9772
tearuka/AoC_2020
/Day12.py
UTF-8
2,480
3.640625
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # read input inp = open("inp/input_12.txt").read().splitlines() instructions = [line[0] for line in inp] values = [int(line[1:]) for line in inp] ### Part 1 def navigate(data): x, y = 0, 0 # ship coordinates facing = 90 # ship facing east for i in range(len(instr...
true
9d71918fde023714a3b4e89db43cecebab2b071d
nugeat23/workspace
/01.python/ch04/ex04.py
UTF-8
360
4.03125
4
[]
no_license
s = 'korea' + str(2002) print(s) # 변환함수 # int() # float() # bool() # str() --> 항상 변환 가능 n1 = int(12.2) print(n1) # n1 = int('12.2') # print(n1) --> 불가능 # n1 = float('12.2') # n1 = int(n1) n1 = int(float('12.2')) print(n1) s = 'korea' + '2002' s = 'korea' + str(2002) # str(2002) --> '2002' s = 'korea' + 2002 ...
true
f8e44de974b29282a123d0eaf9f601caedd28d75
FelixZFB/Spider_scrapy_intensive_study
/009_asyncio协程_aiohttp异步爬虫/006_asyncio协程_多任务协程requests请求网页耗时_顺序请求耗时长.py
UTF-8
1,123
3.0625
3
[]
no_license
# -*- coding:utf-8 -*- # project_xxx\venv\Scripts python ''' Author: Felix WeiXin: AXiaShuBai Email: xiashubai@gmail.com Blog: https://blog.csdn.net/u011318077 GihHub: https://github.com/FelixZFB Date: 2020/5/26 18:59 Desc: ''' import asyncio import requests import time start = time.time() # #async创建一个协程函数 async de...
true
de4176c693388600d2aa6ec0e71e8ccca7091650
1frag/tsu-3cw-2021
/using-pyo3/test_using_pyo3.py
UTF-8
208
2.75
3
[]
no_license
import pytest import using_pyo3 @pytest.mark.parametrize("inp, out", [ (1, 2), (3, 5), (25, 29), (100, 101), (5591, 5623), ]) def test_next_prime(inp, out): assert using_pyo3.next_prime(inp) == out
true
d1e6325f19c8f3edd64002392e72a5d1bee4d1c7
BenjaminRacine/MH_MCMC
/ploter_MH.py
UTF-8
3,153
2.953125
3
[]
no_license
from matplotlib import pyplot as plt import numpy as np from matplotlib.ticker import NullFormatter from matplotlib.patches import Ellipse def determine_bin_size(array_in,method): """ returns the optimal binning, according to Freedman-Diaconis rule: see http://en.wikipedia.org/wiki/Freedman%E2%80%9...
true
5da7a1e31b70d03d9158f462e6965cad8514716a
jspfei/testpy
/jfpy/Numpy/numpyExample.py
UTF-8
2,064
3.171875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np from numpy import pi def ndarray(): a = np.array([2,3,4]) print a print a.dtype b = np.array([1.2,2.3,4.1]) print b.dtype # 二维的数组 b = np.array([(1.5,2,3),(43,22,1)]) print b # 创建时指定类型 c = np.array([[1,2],[3,4]],dtype=complex...
true
4d75631ce58965e3e3a6a9b0c23696bcd83e1f95
bhavik-knight/minesweeper
/texts.py
UTF-8
1,521
3.421875
3
[]
no_license
from constants import * class Fonts: # constructor def __init__(self, text, color, bg_color="black_bg"): # self.__window = win self.__text = text self.__color = colors[color] self.__bg_color = colors[bg_color] self.__text_size = font_size pygame.fon...
true
d0e930d625b2ddbcf8e9b1da9979bb42ccc84a21
v1c7or20/EDA_lab1
/knn.py
UTF-8
1,138
3.078125
3
[]
no_license
from sklearn.neighbors import KNeighborsClassifier import time import random features = [] labels = [] def read_dataset(name): f = open(name, "r") for i in f: x, y = i.split() point = [int(x), int(y)] features.append(point) labels.append(x+", "+y) f.close() read_dataset("dat...
true
9df36dd5137573acbb90a6bcafb8b988ed26ebdc
nstack/python-nstack
/nstack/__init__.py
UTF-8
1,934
2.515625
3
[]
no_license
import collections import contextdecorator as cd from events import Events import logging import six import threading events = Events(("send_event")) modules = {} def _loggingHandler(name, data): logging.getLogger("nstack.events").info("%s: %r", name, data) events.send_event += _loggingHandler def send_event(na...
true
ab68aa220e406895e3256a1bedce1366c8c7c687
fionaoriordan/52445_19_iris
/histpetalclass.py
UTF-8
2,678
3.859375
4
[]
no_license
# Fiona O'Riordan 07 April 2019 # Project Iris Data Set # Create histograms for the Iris Data Set with each of the 3 classes distinguished by colour. # Adapted from: # https://www.machinelearningplus.com/plots/matplotlib-histogram-python-examples/ [17] # import sys library so that we can use function sys.argv import s...
true
3d8c8cabca5c3c71ddd646528f5c8a75f7985340
VulpesHD/raidsignBot
/cogs/raidsigning.py
UTF-8
2,943
2.578125
3
[]
no_license
import discord from discord.ext import commands from .utils.globalfunctions import is_valid_class, sign_player, get_raidid from .utils import checks class Signing(commands.Cog): """ This category handles signing to raids. Most of the signing should be done via reacting or having the 'AutoSign' role. ...
true
65390430bee48a872fc810655ff43c40395f2fb0
nerevu/riko
/riko/modules/filter.py
UTF-8
9,293
3.09375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.modules.filter ~~~~~~~~~~~~~~~~~~~ Provides functions for filtering (including or excluding) items from a stream. With Filter you create rules that compare item elements to values you specify. So, for example, you may create a rule that says "permit items whe...
true
3bb04e0cdc198b046d2a3f107067f54980c9d52f
ElleryBaines/Genetic-Algorithm
/genetic_algorithm_implementation.py
UTF-8
14,828
2.796875
3
[]
no_license
# Ellery Baines import numpy as np import pandas as pd import random from sklearn.neural_network import MLPClassifier from sklearn.decomposition import PCA # parameters, warning: fragile code, combinations not thoroughly tested random_sampling = True # otherwise index order of sample printouts = True # see s...
true
fb58b5da0ab2a6794a1f080014dd5cf65ddd0b41
keys4words/k4w2
/app/forms.py
UTF-8
1,012
2.515625
3
[]
no_license
from flask_wtf import FlaskForm from wtforms import widgets, StringField, IntegerField, SubmitField, TextAreaField, SelectMultipleField from app.models import default_tags class MultiCheckboxField(SelectMultipleField): widget = widgets.ListWidget(prefix_label=False) option_widget = widgets.CheckboxInput() cl...
true
2646783e5baf90c35065291e657dce24d95b4291
bogger/captioning
/captioning/caption_distill_batch.py
UTF-8
2,727
2.515625
3
[]
no_license
import re import os import sys import json import nltk import time from nltk.tokenize import StanfordTokenizer from nltk.tag import StanfordNERTagger#try nltk binding for stanford NER filtered_items={'LOCATION':0,'ORGANIZATION':1,'PERSON':2,'DATE':3,'TIME':4} mask_strings=['','something','someone','',''] filtered_pred...
true
66a76aae292c1262eeeec3f795a2e119895c30dd
dianaparr/holbertonschool-higher_level_programming
/0x0B-python-input_output/9-student.py
UTF-8
716
3.9375
4
[]
no_license
#!/usr/bin/python3 """ Create a class called Student """ class Student: def __init__(self, first_name, last_name, age): """ Constructor method to initialize the attribute of the instantiated object with two optionals parameters: Args: param1 (first_name): Is a public attribute...
true
a96afb536d30ce7edeb7a5df6a74aca14b25fb2c
Maanasa25/Becomecoder-
/digicount.py
UTF-8
142
3.4375
3
[]
no_license
num=int(input()) dc=0 if num==0: dc=1 else: while num: r=num%10 num=num//10 dc+=1 print(dc)
true
5d6a555b59d68602d8bc7be7eba56a6af5858bda
EdisonDelgado/backend-ia
/app.py
UTF-8
1,709
2.546875
3
[]
no_license
import os import numpy import numpy as np # FLASK from flask import Flask, request, jsonify from werkzeug.utils import secure_filename # KERAS from keras.models import load_model from keras.preprocessing import image # from flask_cors import CORS, cross_origin app = Flask(__name__) # app.config['CORS_HEADERS'] = 'Co...
true
d234cff113c1667aefdd58760a4b499b95c9e5d4
alexgudi55/SoccerField
/Homography/Experiments/SemiCircle.py
UTF-8
4,057
2.703125
3
[]
no_license
import numpy as np import cv2 pointsImage = np.array([[1,1]]) pointsField = np.array([[1,1]]) def openImage(filename): try: img = cv2.imread(filename,1) except: print("Error reading image: ", filename) return None return img def SelectFedPoints(field, img): global pointsImage gl...
true
400f3ca6797b5757bacda3601be21904ad6bbca6
sinofeng/homework
/pcap2.py
UTF-8
3,138
2.640625
3
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys import string import struct import math def handlepcap(string_pcap,pkt_offset): pcap_header={} pcap_header['caplen'] = string_pcap[pkt_offset + 8:pkt_offset + 12] cap_len = struct.unpack('I', pcap_header['caplen'])[0] ip_header={} ip_header['v_...
true
d065f836e9adf786e2b83c6c3a79d3548600f45c
miguelabreuss/scripts_python
/CursoEmVideoPython/desafio42.py
UTF-8
622
4.09375
4
[ "MIT" ]
permissive
print('-='*20) print('ANALISADOR DE TRIÂNGULOS') print('-='*20) c1 = float(input('Digite o comprimento da primeira reta:[cm] ')) c2 = float(input('Digite o comprimento da segunda reta:[cm] ')) c3 = float(input('Digite o comprimento da terceira reta:[cm] ')) if c2 - c3 < c1 < c2 + c3 and c1 - c3 < c2 < c1 + c3 and c2 - ...
true
4326acc45ce4aa52e8891e1c1a0ee3b3f7d508aa
pirsquared/Advent-of-Code
/2017/Day08.py
UTF-8
559
2.65625
3
[]
no_license
import operator as op def parse(line): r, i, q, _, c = line.split(' ', 4) c_, op, v = c.split() return r, i, q, c_, op, v ops = {'==': op.eq, '<': op.lt, '<=': op.le, '>': op.gt, '>=': op.ge, '!=': op.ne} m = 0 data = {} for line in s.splitlines(): r, i, q, c, o, v = parse(line) q = int(...
true
5babd3e1f425496f0a182aa2e88dd075967e1981
giuseppefutia/BigDive2Gramsci
/source/insert_country_mongodb.py
UTF-8
478
2.6875
3
[]
no_license
# Insert the countries in MongoDB import fileinput from pymongo import MongoClient client = MongoClient() db = client.countries countries = {} i = 1 for line in fileinput.input(['GeoIPCountryWhois.utf8.csv']): row = [x.replace("\n",'').replace("\"",'') for x in line.split(',')] if not row[4] in countries: ...
true
2852718ad40c99f34fb1debfa0369813b111d022
frc2423/2014
/Qwiddtch/components/angle.py
UTF-8
555
3.046875
3
[]
no_license
try: import wpilib except ImportError: import fake_wpilib as wpilib angle_max = 360 class Angle(object): def __init__(self, angle_motor): '''init the angle motor ( a CANJaguar) and speed variable( speed of jaguar)''' self.angle_motor = angle_motor self.speed = 0 ...
true
a4e00bd6ea1b9f85bdee437c1a90b4115bf05259
protolambda/partial_fft
/other_partial_fft.py
UTF-8
4,410
2.953125
3
[]
no_license
from classic_fft import fft, inverse_fft, modular_inverse def other_partial_fft_base_case(odd_val: int, a: int, modulus: int, domain: int) -> (int, int): # In a regular FFT: # x = evens[0] # y = odds[0] # y_times_root = y*domain[0] # a = [(x+y_times_root) % modulus] # b = [(x-y_times_root) % mo...
true
026da696e44ecc162230a9a767b1e8e5b07c97dc
Cvargas17/LaboratorioPython
/PythonProgram/Labo1.py
UTF-8
191
3.59375
4
[]
no_license
#!/usr/bin/python3 letra = input("Letra:") cantidad = input("Numero:") Numero = int(cantidad) for i in range (Numero): for j in range (i+1): print (letra, end="") print()
true
fc2fabade4df002a8d74bbc9a4ebe8ac3e4057a9
elelias/idlabAssign
/processPerformance.py
UTF-8
3,123
2.671875
3
[]
no_license
import matplotlib.pyplot as plt import matplotlib.legend as lgnd def process_performance(name,stockHistory,traderPosition,portfolioValues,plotParameters={}): #parse the plot paramters symbol=plotParameters.get('symbol','SPY') # plotSymbol=plotParameters.get('plotSymbol',True) plotBuys=plotParameters.get('plo...
true
a539c0eb6553af26dac78fc1ac0e3d8c3023814b
jbsam2/algo_problem
/swea/D1/2047. 신문 헤드라인.py
UTF-8
44
3
3
[]
no_license
str_input = input() print(str_input.upper())
true
5f41c52bd47243e3f92f483632812941cb669ba3
drgmzgb/Python-Advanced-
/#5-Functions/Py Adv 5E6 arguments length.py
UTF-8
288
3.734375
4
[]
no_license
# Py Adv 5E6 arguments length # Create a function called args_length() # that returns the number of the arguments. # Submit only the function in the judge system. # print(args_length(1, 32, 5)) # output 3 def args_length(*args): return len(args) result = print(args_length(1, 32, 5))
true
3061536c6e6de1bc2887ec78df58978c405172cc
sethips/scripts
/genomics/misc/bak/lens/make_variants.py
UTF-8
1,545
2.65625
3
[]
no_license
import argparse import pysam parser = argparse.ArgumentParser() parser.add_argument('-b', '--bam', required=True) parser.add_argument('-c', '--contig', required=True) parser.add_argument('-p', '--pos', required=True) args = parser.parse_args() # ----------------------------------------------------------------------...
true
a76c68d0a47109f0c66e3647a7e5b841eeeb9e04
deekshithanand/PythonExcercises
/pg4.py
UTF-8
465
3.8125
4
[]
no_license
''' Q)Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically. Suppose the following input is supplied to the program: hello world and practice makes perfect and hello world again Then, the output should be...
true
956a40e1afa2a7c46d7c0a13a464c06217718090
cherylyli/100-days-of-algorithms
/algorithms/01_max_stock.py
UTF-8
1,016
3.125
3
[ "MIT" ]
permissive
# was difficult due to very large inputs # may be able to optimize, but perhaps with a different strategy #!/bin/python3 t = int(input().strip()) for a0 in range(t): N = int(input().strip()) prices = list(map(int, input().strip().split(' '))) if N == 0 or N == 1: print(0) else: #...
true
aff27d8636dce95df890583dd16365ec88ca37c0
XXJPanda/Python
/test2.py
UTF-8
3,924
3.203125
3
[]
no_license
# coding=utf-8 import csv import matplotlib.pyplot as plt class GetAvgFromCsv(): def __init__(self, filename, key, values): self.filename = filename self.key = key self.values = values self.data = {} def _get_dict_data_form_file(self, value): dict_data =...
true
bd00478c54f8329483feebc53faadad8caf25e51
krnets/codewars-practice
/beta/Sum of array's elements/index.py
UTF-8
681
4.84375
5
[]
no_license
# Beta - Sum of array's elements """ You will be given an array of integers. You will need to return an integer that is the sum of the elements multiplied by an incrementing constant. The first element in the array is multiplied by 1, the second element multiplied by 2, etc: a, b, c, d, ... => 1*a + 2*b + 3*c...
true
df990b525855c87e8fd12654e28f673c8380b99a
erdogancelik/eniyiben
/Lynda's Course Code/Python 3 Essential Training/12_decorators.py
UTF-8
873
3.390625
3
[]
no_license
class Material(): def __init__(self, **kwargs): self.variables = kwargs def get_variables(self, key): return self.variables.get(key, None) def set_variables(self, key, value): self.variables[key] = value def get_properties(self): return self.variables @property ...
true
43a2fce699acaf1c48dc1cb6e711ef175f9d734a
julianferres/Competitive-Programming
/CSES/Graph/building_roads.py
UTF-8
565
3.046875
3
[]
no_license
from collections import deque def bfs(ady, s, vis): q = deque([]) q.append(s); vis[s] = True; while q: v = q.popleft() for u in ady[v]: if not vis[u]: vis[u] = True q.append(u) n, m = map(int,input().split()) vis = {i:False for i in range(1,n+1)} ady = {i:set() for i in range(1,n+1)} for _ in range(m...
true
345d94d305e4159302b7472cc9361462148215c6
podhmo/individual-sandbox
/daily/20170826/example_exec/00localvar.py
UTF-8
86
2.75
3
[]
no_license
code = """ i = 3 L = range(10) print([x for x in L if x > i]) """.strip() exec(code)
true
fac7b1a930a8302e0a9c34daa36f5a711a574145
yanghaox/MachineLearning
/logistic_regression2.py
UTF-8
3,799
3.09375
3
[]
no_license
''' the dataset from the tatannic ''' import numpy as np import pandas as pd import seaborn as sb import matplotlib.pyplot as plt import sklearn from pandas import Series, DataFrame from pylab import rcParams from sklearn import preprocessing from sklearn.linear_model import LogisticRegression from sklearn.cross...
true
bf275e6439d577453a0a097c1831b43d3851beb8
nirkhut/15puzzle
/15Puzzle .py
UTF-8
12,338
3.265625
3
[]
no_license
import random import pygame import time #Can be changed according to user's choice: ROWLEN=0 N=ROWLEN+1 #CONSTANTS BLOCK=111 SPACE=9 WIDTH = BLOCK*9 HEIGHT = BLOCK*9 #max values for recrods (Smaller is better, so I chose very high numbers) record3 = 2**14 record4 = 2**14 record5 = 2**14 #Creates board wi...
true
2ed8774686ffacc08a5436365b613f7bc17ee041
mishaukr7/analize_image
/main.py
UTF-8
2,013
2.78125
3
[]
no_license
from numpy import * import scipy.io import pywt import matplotlib.pyplot as plt from PIL import Image def get_image_array(image): #return scipy.misc.imread(image, flatten='true', mode='RGB') return scipy.misc.imread(image, mode='RGB') #print(get_image_array('temp.jpg')) def get_image_array_with_noise(image, ...
true
bdb5dbcc051e60838692696baafbb9caf733ca26
yangluo0901/CodingDojo_Assignment
/Python/Django/test.py
UTF-8
77
3.28125
3
[]
no_license
a = { "a":1, "b":2 , "c":3} for key,value in a.items(): print str(value)
true
106b15b0ca84e0046dcef269fbcaefd3c07d237c
thageesan/ai_pipeline
/ai/data_pipeline/generate_corpus/__init__.py
UTF-8
1,116
3.03125
3
[]
no_license
from shared.tools.os import getenv from shared.tools.utils import pd from shared.tools.utils.text import clean_sentence, tokenize_sentence from numpy import array, save def extract_corpus(snippets, columns): """ Creates a list of tokenized sentences. Args: snippets: columns: Returns:...
true
9e1013ad6fe94c4245b02352eaf8acfa30b8d896
phisolani/optimal_wifi_slicing
/non_linear_optimization/gekko/backups/qos_aware_wifi_slicing_bkp_26_12_2019.py
UTF-8
14,596
2.515625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python __author__ = "Pedro Heleno Isolani" __copyright__ = "Copyright 2019, QoS-aware WiFi Slicing" __license__ = "GPL" __version__ = "1.0" __maintainer__ = "Pedro Heleno Isolani" __email__ = "pedro.isolani@uantwerpen.be" __status__ = "Prototype" ''' Python class for solving IEEE 802.11 network slicing ...
true
39965f38fdf899446cd5cc47a1f559ec5c09e142
aspnetcs/arxiv-topic
/dataset.py
UTF-8
2,622
3.1875
3
[]
no_license
# -*- coding: utf-8 -*- from gensim.corpora import Dictionary from preprocess import ArXivPreprocessor from utils import (load_arxiv_metadata, extract_abstracts, load_documents, load_object, export_object) class ArXivDataset: """A dataset for arXiv abstracts. Attributes ---------- ...
true
30f65787d883a037aadd744bddd136c43557642a
jeisson-Tellez/ciclo_1
/actividades_taller_clase_4/Ejercicio_3.py
UTF-8
365
3.171875
3
[]
no_license
#Escribir una función que calcule el total de una factura tras aplicarle el IVA. # La función debe recibir la cantidad sin IVA y el porcentaje de IVA a aplicar, # y devolver el total de la factura. Si se invoca la función sin pasarle el porcentaje # de IVA, deberá aplicar un 19%. def total_factura (cantidad_sin_iv...
true
a29a87909baf9ac7971bdb225f3b98ef274a35d0
ric2b/internet-architectures
/Seleque/test_interactive.py
UTF-8
452
2.953125
3
[]
no_license
import threading from client import Client def user_input(client): while True: message = input("Write a message:") client.send_message(message) def main(): client = Client() client.register("PYRO:server@localhost:47216") threading.Thread(target=user_input, args=[client]).start() ...
true
3e2b71cf109991eb6c4da1c42f7ef0b25df499db
SajjadDaneshmand/BahmanRbt
/src/data_catcher.py
UTF-8
1,996
2.53125
3
[]
no_license
# internal import settings # standard import json import time # selenium from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.webdriver.firefox.options import Options from selenium.webdriver.support.ui import WebDriverWait from selen...
true
4d2e23dc221e2bf811fc490884c0de838dc2d402
apri-me/python_class00
/Session7/test09.py
UTF-8
220
2.875
3
[]
no_license
def print_names(*args,**kwargs): print(args) for k, v in kwargs.items(): print(f"{k} is {v}") print(type(args)) print(type(kwargs)) print_names(1, 2, 4, 3,alireza='afroozi', mahdi='rahimbakhsh')
true
a9d3a098b7f73f4f928e3ae6599d8376159228c2
yantianpeng123/python
/beidouxingUI_Auto_Test/Auto_UI_Project/page_object/base_page.py
UTF-8
9,413
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # encoding: utf-8 ''' # @Time : 2021/1/23 1:11 下午 # @Author : yantianpeng # @Site : # @File : base_page.py # @Software: PyCharm ''' from beidouxingUI_Auto_Test.Auto_UI_Project.common.login_handler import log from beidouxingUI_Auto_Test.Auto_UI_Project import se...
true
e70440b59f3f538403b20b452cf4e404a628d561
xeooon/Learn-Python
/day02/day02 练习题和购物车作业.py
UTF-8
26,171
3.984375
4
[]
no_license
#! /usr/bin/env python # -*- encoding:utf-8 -*- """ 标题 : 24期周末班 - day02 - 习题和作业 作者 : 张志强 QQ号 : 1344683865 微信 : qingniaoxiaoqiang 邮箱 : Xeon@xeon.org.cn """ # ###################################### 练习题 ####################################### ''' 1、有变量name = "aleX leNb" 完成如下操作: name = "aleX leNb" ''' #...
true
5ea2fff731e2c2b305d9b4c52690d196cd771b59
EngTaian/Machine-Learning
/Python/scripts/knn_credit_data.py
UTF-8
1,306
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun May 3 17:49:14 2020 @author: taian """ import pandas as pd import numpy as np from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier fro...
true