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
461bc71dcde59537a7b73011981478a2a7dd57a7
appym005/Lenny
/encrypt.py
UTF-8
747
2.71875
3
[]
no_license
import hashlib import json def encrypt(path, key, filename, pasd): try: with open('hiden/files', 'r') as handle: s = json.load(handle) if filename in s: return "filename exists" else: with open('hiden/files', 'r') as handle: s = json.load(handle) n = {filename: hashlib.sha224(pasd.encode())....
true
fc6a53c4d919f2c0bddd9cd87ee4474f29aacaf6
Jstar-s/Unsupervised-Single-Image-Dehaze-via-Disentangled-Representations-
/grad_conv.py
UTF-8
1,158
2.546875
3
[ "Apache-2.0" ]
permissive
import torch import torch.nn as nn from torch.nn import Conv2d import numpy as np # horizontal gradient, the input_channel is default to 3 def grad_conv_hor(): grad = Conv2d(3, 3, (1, 3), stride=1, padding=(0, 1)) weight = np.zeros((3, 3, 1, 3)) for i in range(3): weight[i, i, :, :] = np.array([[...
true
c4f8f0d9eee2f2a68af2ddf092915f85c57dda0c
AjanthaB/geoname-to-mongo
/data.python.py
UTF-8
3,266
2.765625
3
[]
no_license
from pymongo import MongoClient import requests import time import sys URL = "http://www.geonames.org/childrenJSON" client = MongoClient("mongodb://localhost:27017") db = client["geoData"] PARAMS = {"geonameId": "6295630", "username": "ajanthab"} def mapToCOntinet(continet): return { "name": continet["na...
true
ab0056c3c81889316c3d3b91bb53cb1ab76e1ca2
brills/tfx-bsl
/tfx_bsl/tfxio/dataset_options.py
UTF-8
2,771
2.703125
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 Google LLC # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
true
3c98d895dea0714111602e157debc88b2e5f2556
Nicolasdvl/P7
/app/gmaps.py
UTF-8
765
2.90625
3
[]
no_license
import requests import os from dotenv import load_dotenv load_dotenv() class Gmaps_requests: """Contain requests of gmaps API.""" def __init__(self): """Initialise.""" self.key = os.getenv("GMAPS_KEY") self.params = { "key": self.key, "inputtype": "textquery",...
true
478bf605581f53c5153a1321440c3ea6905fd882
bela127/prelim
/src/generators/smote.py
UTF-8
1,553
2.78125
3
[ "MIT" ]
permissive
import numpy as np from imblearn.over_sampling import SMOTE import warnings from src.generators.rand import Gen_randu class Gen_smote: def __init__(self): self.X_ = None def fit(self, X, y = None): self.X_ = X.copy() return self def sample(self, n_samples = 1): parss = 'n...
true
4fc55caf384b4dd4abfe3ded7cfbaa8f9321fa46
pko89403/google_translate_api
/QuickStart_V3.py
UTF-8
1,278
2.765625
3
[]
no_license
from google.cloud import translate import os credential_path = os.path.join(os.getcwd(), "google_credential.json") os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = credential_path print(credential_path) def sample_translate_text(text, target_language, project_id): """ Translating Text Args: text The...
true
3342ee58c697c46f157fb1f880d7677c9f4f0513
heqiang/PythonCore
/python3-cookbook/第四章 迭代器与生成器/序列索引值的迭代.py
UTF-8
108
3.234375
3
[]
no_license
from random import randint my_list = [x for x in range(15)] for x,v in enumerate(my_list): print(x,v)
true
d92380d27e4639b3d1ba13c636edd44a01001d6f
DiscreetAI/ben-decentralized-chatbot
/chatbot/get_train_data.py
UTF-8
2,944
2.8125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- __author__ = 'Oswaldo Ludwig' __version__ = '1.01' import numpy as np np.random.seed(1234) # for reproducibility import pandas as pd import os import csv import nltk import itertools import operator import pickle import numpy as np from keras.preprocessing import sequence from scipy impor...
true
366d1f67dafeade610e215e49c7d8f6ec13ff717
lehigh-icpc/Kattis-Solutions
/playingtheslots/playingtheslots-john.py
UTF-8
638
3.53125
4
[]
no_license
coords = [] N = int(input()) for i in range(N): coords.append([float(x) for x in input().split(" ")]) minoverall = float('inf') for i in range(N): [x0, y0] = coords[i-1] [x1, y1] = coords[i] # get line in the form of ax + by + c = 0 a = (y0-y1) b = (x1-x0) c = x0*y1 - x1*y0 # find largest distanc...
true
1d9e67e46eaf0b8666ac347f2352a60189ca480e
DillenLee/RydbergConstant
/rydbergAnalysis.py
UTF-8
3,908
3.03125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 26 09:12:57 2021 @author: ___ _ ____ __ / _ \(_) / /__ ___ / / ___ ___ / // / / / / -_) _ \ / /__/ -_) -_) /____/_/_/_/\__/_//_/ /____/\__/\__/ """ #import the necessary packages import numpy as np import ...
true
52402335f7c2f95e91ececefdff42b6c6ad27854
usnistgov/OOF3D
/TEST3D/GUI/generics.py
UTF-8
19,326
2.890625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
# -*- python -*- # This software was produced by NIST, an agency of the U.S. government, # and by statute is not subject to copyright in the United States. # Recipients of this software assume all responsibilities associated # with its operation, modification and maintenance. However, to # facilitate maintenance we as...
true
504b5247895ef36c7ff62afb36444246e91eba34
codeboy101/algorithms
/algo.py
UTF-8
1,480
3.4375
3
[]
no_license
class Fraction(object): def __init__(self, num, den): self.num = num self.den = den def __str__(self): return '{}/{}'.format(self.num, self.den) def __add__(self, other_fraction): numerator = self.num*other_fraction.den + self.den*other_fraction.num denominator = self.den * other_fraction.den common =...
true
bc76363c19a62462d06c87f31899a92aa9ffd8bc
hidd6n/Python-projetcs
/ARQUIVO 2.py
UTF-8
107
3.125
3
[]
no_license
nome = input ('Qual o seu nome?') print(nome,', seja bem-vindo ao curso de python do "Curso em Vídeo"')
true
458563df52b142b0bdd90f9382223e9b8ad90b87
missbelinda/Modul-1-Purwadhika
/Notes/trial04.py
UTF-8
1,362
3.953125
4
[]
no_license
# angka = 1 # while (angka<=10): # print (angka) # angka+=1 # z = "" # for item in range (5): # for item1 in range (0, item + 5): # z.remove ("* ") # z += "\n" # print (z) #dictionary andi = { "name" : "Andi", "age" : 22, "is_married": False, "job": "PNS", "address" : { ...
true
7a06dab5fd5567189e26fbbdd08f3826205271d2
josenaldo/python-learning
/exercicios/extras/ex-2.3-potencia-com-while.py
UTF-8
734
4.15625
4
[]
no_license
# Dados números inteiros n e k, com k >= 0, calcular n elevado a k. Por exemplo, # dados os números 3 e 4 o seu programa deve escrever o número 81. # Link: https://panda.ime.usp.br/aulasPython/static/aulasPython/aula02.html def main(): n = int(input('Informe o número: ')) k = int(input('Informe a potênci...
true
80de6cfbed61e9ea9c87f3b521364b7f451a68b7
mikesinouye/ece529project
/software/small_sample_auto_tuner.py
UTF-8
5,676
3.15625
3
[]
no_license
import numpy as np def perform_dft(input_size, input_sample): dft_input = np.zeros(input_size) # dft manually for k in range(input_size): # generate dft exponential n = np.arange(input_size) dft_exp = np.exp(-2 * np.pi * 1j * k * n / input_size) summand = np.multiply(input_...
true
d423ea2636b6cf19d1571e25fe9e8a50c8b9428c
gsimjamale/stroke-tissue-prediction
/playground/roy_playground/register_images.py
UTF-8
7,381
3.140625
3
[]
no_license
""" register_images.py This module is used to perform a registration upon a moving image onto the coordinate axis of the fixed image. Image Registration with SimpleITK USAGE: python2 register_images.py FIXEDIMAGEPATH DIRECTORYPATH Export Function: register_images Author(s): Roy Lin Date Created: May 25th, ...
true
5e36170af1209383fed6749d2c7302971cd6c354
dhalimon/Turtle
/race.py
UTF-8
1,883
4.46875
4
[]
no_license
import turtle import random player_one = turtle.Turtle() player_one.color("green") player_one.shape("turtle") player_one.penup() player_one.goto(-200,100) player_two = player_one.clone() player_two.color("blue") player_two.penup() player_two.goto(-200,100) player_one.goto(300,60) player_one.pendown() player_one.circl...
true
0f873ae4289b700e72c774c08ca71ab58fb996da
sagarnikam123/learnNPractice
/tutsPlus/gettingStartedwithPython/files/language.py
UTF-8
156
3.09375
3
[ "MIT" ]
permissive
#! /usr/bin/env python language = raw_input('Please enter a programming language : ') if language not in ['C++','Python','Java']: print language,"rocks"
true
64dd7a6947b5abd6ef6def6952f80a922a50e0aa
evezor/Edge_Boards
/tools/dump_lables.py
UTF-8
347
2.578125
3
[ "MIT" ]
permissive
# dump_lables.py """ Prints the lables? of a kicad map? that begin with / Might be a way to seed a manifest. """ # https://github.com/realthunder/kicad_parser from kicad_parser import KicadPCB pcb = KicadPCB.load("CONTROLLER/GENERIC_CAN.kicad_pcb") for i in pcb['net']: if i[1][0] == "/": label = i[1][1...
true
5dcd5e38cbd85bce411a01a61698d51771531996
Rheemster/WavyBot
/Translate.py
UTF-8
772
3.21875
3
[]
no_license
TranslateToFullwidth = str.maketrans( '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[]^_`{|}~', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!゛#$%&()*+、ー。/:;〈=〉?@[]^_‘{|}~') def fullwidth(s): return s.translate(TranslateToFullwidth) def brokenTra...
true
53869542a2336706d496017db5a6b18e69131376
ATMontague/nn-examples
/cnn.py
UTF-8
7,225
2.84375
3
[]
no_license
import torch from torch import nn, optim import torch.nn.functional as F from torchvision import datasets, transforms import numpy as np from torch.utils.data.sampler import SubsetRandomSampler from torch.utils.data import DataLoader # define the CNN architecture class Net(nn.Module): def __init__(self): ...
true
3a448d6af1339675fb6063865e5090eab6dc251f
anettepaula/mayork
/mayork07.py
UTF-8
316
3.65625
4
[]
no_license
#coding: utf-8 x = input("Escriba un número:") y = input("Escribe un número mayor que",x ":") if (y<x): y = input(y, "No es mayor que",x,"Intentelo again:") z = input("Escriba un número entre",x,"y",y) suma = 0 while (z>x) and (z<y) : z = input("Escriba un número entre",x,"y",y) suma = suma + z if
true
558bb6281fa154b73f8b47911100c681272a0379
katatohuk/python
/learning_python_hardway/ex19_1.py
UTF-8
434
3.921875
4
[]
no_license
#Lets write function to open file and then write some stuff in it. #This is the same was done in ex17.py but using a function def read_write(output_file, input_file): indata = open(output_file).read() print(f"Reading text from file {output_file}") print(f"The following text will be copied :\n", indata) outdata = o...
true
f556a5e8375555c7a95520e3c7e092f79fcfca53
angsy/pylnqft
/main.py
UTF-8
5,932
2.765625
3
[]
no_license
# Standard Library Imports from typing import Any, Callable, Tuple, Type, Union import os import socket import time import traceback import subprocess import sys dir_program = os.path.split(__file__)[0] filename_error_log = f".error_log" def print_cls(disp: str) -> None: print(f"\u001B[2J\u001B[0;0H{disp}") def ...
true
dee8848563366470278e7f0490673ae07dd03ed0
Diva-Pant/OpenCV
/rescale.py
UTF-8
942
2.84375
3
[]
no_license
import cv2 as cv #Reading images img = cv.imread('Photos/cat.jpg') cv.imshow('Cat',img) def rescaleFrame(frame, scale=0.20): width = int(frame.shape[1]*scale) height = int(frame.shape[0]*scale) dimensions = (width,height) return cv.resize(frame, dimensions, interpolation=cv.INTER_AREA) #R...
true
4de7446a8ee9675d6985afab0bffd835a09405e9
jayhebe/Python_100ex
/ex005.py
UTF-8
193
4.125
4
[]
no_license
# **输入三个整数x,y,z,请把这三个数由小到大输出。 x, y, z = input("Please enter 3 integers and seperated by comma: ").split(",") print(sorted([int(i) for i in (x, y, z)]))
true
0c1a427b9391e2145629092d94c8dfce0f1c7e9a
toomanybugs1/StaticsGrapher
/graphs.py
UTF-8
7,350
3.390625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np class ShearDiagram(): def __init__(self, beam_length): self.__beam_length = beam_length; # the index of each list represents the point on the beam! self.__loads = [] #list of tuples (int, float) self.__supports = [] #list of tuples...
true
23128d751d7764d544d9284d933baf73d3439065
h-ikeshita/python-99
/P32/main.py
UTF-8
129
3.09375
3
[]
no_license
def gcd(origin,division): while division != 0: origin,division = division,origin%division return origin
true
3807eaf3b9eaf1328e2215f732e7a600f60becea
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_85/115.py
UTF-8
698
2.875
3
[]
no_license
from collections import * from itertools import * def solve(l, t, n, c, ds): tt = [0] for d in islice(cycle(ds), n+1): tt.append(tt[-1] + d) def boost(cc): s = 0 for i in cc: d = tt[i+1] - tt[i] if t < tt[i]-s: s += d//2 elif t - ...
true
697ec7f61b87a490280f49cc286bdfa06ce86567
jamofer/telegram-decabot
/test/test_stores.py
UTF-8
4,846
2.765625
3
[]
no_license
import calendar import json import unittest from datetime import time, datetime from decathlon import decathlon_stores, store_decoder from decathlon.store import OpeningHour, GeoPosition from mock import patch class TestStores(unittest.TestCase): def tearDown(self) -> None: patch.stopall() def test_...
true
a5a8ece1fca774c21a47c17e32bb66c32f3c46bd
campy-db/Campy-Database
/Scripts/TripleMaker.py
UTF-8
12,126
3.328125
3
[]
no_license
""" TripleMaker """ import re import pandas as pd class TripleMaker(object): ################################################################################################ # # uri - The uri that the user has defined for their database. Must have # or / at the end. # And < > are not to be inc...
true
92f268e338e783361367a7bd58ba94fa20a3e1a4
evedal/dataing
/algoritmer_og_datastrukturer/algdat_øving5.py
UTF-8
3,310
3.53125
4
[]
no_license
import random from timeit import default_timer as timer #Creates an integer-value using ascii value of chars def ascii_value(text): total_value = 0 for char_numb in range(0,len(text)): total_value += ord(text[char_numb]) * (pow(2,char_numb)) """adds ascii value times an incrementing val...
true
d6ea96925f937877001ccfb86df59f1add9dfb8e
MiscellaneousStuff/pylol
/pylol/lib/portspicker.py
UTF-8
2,772
2.546875
3
[ "MIT" ]
permissive
# Copyright 2018 Google Inc. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
true
44da209df0ac895e1844955984c301ffafeeb64b
Nbestwl/ML_HW01
/GMM_Iris.py
UTF-8
2,909
3.359375
3
[]
no_license
# # Gaussian Mixture Models on Iris Species dataset # dataset collected from https://www.kaggle.com/uciml/datasets # # Author: Casey Sader and Lei Wang # EECS 738 Project 1, Probably Interesting Data # import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm import random as...
true
f323b2feee2c583b9148dc3e8b7cd8bcd8d9703f
zopepy/leetcode
/path_sum3.py
UTF-8
859
3
3
[]
no_license
from collections import defaultdict class Solution(object): def pathSum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: int """ def build(cur, seen): if not cur: return # print(cur.val, seen) if cur.val in seen: ...
true
2e4966568123d91b6f1a4aba6278445d3f441fd0
milena-mathew/coba-CCPO
/examples/scripts/First Script.py
UTF-8
1,465
3.328125
3
[ "BSD-3-Clause" ]
permissive
""" This is an example script that creates a Benchmark. This script requires that the matplotlib and vowpalwabbit packages be installed. """ from coba.learners import RandomLearner, EpsilonBanditLearner, VowpalLearner from coba.simulations import ValidationSimulation from coba.benchmarks import Benchmark #this line i...
true
32feb5961fe4dc1b1a67398bcf774820bd10bb8c
AaronCHH/PG_TOOL
/PYTHON/StackFiles/DEV/StackFiles_v2.py
UTF-8
349
2.578125
3
[]
no_license
import glob, sys, os # obtain files fileType = sys.argv[1] files = glob.glob(fileType) fout = open('combine.md','at',encoding='utf-8') for file in files: print(file) fin = open(file,'rt',encoding='utf-8') line = fin.readline() while line: fout.write(line) line = fin.readline() ...
true
64ac59efb0c6a1d3d4d93d2819553626bc37e63d
Abarn279/advent-of-code-2018
/src/16b.py
UTF-8
3,441
3.0625
3
[]
no_license
from file_importer import FileImporter import re from collections import defaultdict from itertools import cycle class Op: def __init__(self, op, a, b, c): self.op = op; self.a = a; self.b = b; self.c = c ##### # OPS ##### # Addition def addr(op, regs): regs[op.c] = regs[op.a] + regs[op.b]; return regs d...
true
d57fef01118e4bcb0618aff4b8b178351e95bd23
hbqdev/code
/python/advancedPyThon/checkstockprice.py
UTF-8
210
2.53125
3
[]
no_license
import yahoo_fin.stock_info as si apl = si.get_quote_table("aapl") amd = si.get_stats_valuation("amd") print("This is Apple's Stock price: " + str(apl)) print("This is AMD's analyst's info: \n") print(amd)
true
367735d2ba7e880fd1d81c4b84aec26cf66bd657
komunikator1984/Python_RTU_08_20
/Diena_1_4_thonny/hello_world.py
UTF-8
403
3.34375
3
[ "MIT" ]
permissive
for x in range(5): print("Valdis") print("alus "*5) # print("Valdis") # print("Valdis") # print("Valdis") # print("Valdis") # print("Hello World!") # print("Computer do something....") # print(2+2) # print(2*3) print(10/5) # regular division # print(10//5) # print(9//4) # dividing without reminder just the whole #...
true
87c2173769637e7b7b352a047b46e668768612e3
SpanishArmada/MMO-Pac-Man
/Player.py
UTF-8
4,309
2.953125
3
[]
no_license
from Grid import Grid class Player: #Attribute PILL = Grid.PILL CHERRY = Grid.CHERRY GHOST = 10 OTHER_PLAYER = 11 #Method def __init__(self, game_engine, id, name, x, y): self.id = id self.name = name self.x = x self.y = y self.orientation = 0 ...
true
847418457c23d38fa5540b4c67a37881c1c1c1e7
mars-project/mars
/mars/tensor/datasource/eye.py
UTF-8
4,459
2.609375
3
[ "BSD-3-Clause", "MIT", "ISC", "Apache-2.0", "CC0-1.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2021 Alibaba Group Holding Ltd. # # 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 # # http://www.apache.org/licenses/LICENSE-...
true
a54a41f4edcd5bd307e2aaa1e4c0e2de342f0aa4
wenzhifeifeidetutu/pythonWork
/pythonCrashcourseExerciseAnswer/p132.py
UTF-8
937
3.265625
3
[]
no_license
def make_sandwish( *ingredients): for ingredient in ingredients: print("add "+ ingredient) make_sandwish('asdsadas', 'seafood', 'jijiji') make_sandwish('asdas') make_sandwish() def build_profile(firstName, lastName, **user_info): """ 创建一个字典,其中包含我们知道的有关于用户的一切 """ profile = {} profile['first_name'] = firstName ...
true
f807fc77b84107b477187e0275fe5ac86ac11687
mfkiwl/Microwave-SDR
/Qt_GUI/usefulFunctions.py
UTF-8
2,126
2.65625
3
[]
no_license
import logging import socket from uuid import getnode from dataclasses import dataclass import json from json.decoder import JSONDecodeError def readable_freq(freq): """Converts frequency in Hz to human readable form""" if(freq >= 1e9): return str(freq / 1e9) + "GHz" elif (freq >= 1e6): re...
true
759a46ea56056edb5f88fa0eeb6eedd9be5d26d2
JoshuaRiddell/self-driving-model-car
/car/computer/imaging/unityController.py
UTF-8
3,797
2.8125
3
[ "Unlicense" ]
permissive
import socket import struct import numpy import time from unityCamera import UnityCamera from pathFinder import * from pathPlanner import PathPlanner, Path UNITY_IP = 'localhost' UNITY_PORT = 8005 BUFFER_SIZE = 1024 STX = "METR" ETX = "BBL" telemetryStruct = struct.Struct('<fffff') class UnityCarController(object)...
true
4be627a70381eccef2f855691febd4754964285d
SagarShirure/iris-flower-classification
/Code/iris.py
UTF-8
640
2.765625
3
[]
no_license
from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import numpy as np iris_dataset=load_iris() x_train,x_test,y_train,y_test=train_test_split(iris_dataset['data'],iris_dataset['...
true
822dfda1bb02393fd5c789cd7b7ac6fd0e8e9b9a
joanna-janos/torchfunc
/tests/performance/performance_test.py
UTF-8
2,530
2.890625
3
[ "MIT" ]
permissive
import torch import torchfunc class Model(torch.nn.Module): def __init__(self): super().__init__() self.convolution = torch.nn.Sequential( torch.nn.Conv2d(1, 32, 3), torch.nn.ReLU(inplace=True), # Inplace may harm kernel fusion torch.nn.Conv2d(32, 128, 3, grou...
true
408510b67e91d61f99090d44448844e389c050eb
KierstenPage/Intro-to-Programming-and-Problem-Solving
/Homework/hw8/Answers/kep394_hw8_q2.py
UTF-8
4,901
4.0625
4
[]
no_license
''' Kiersten Page CS 1114 kep394 The purpose of this program is to create a method to organize weather data efficiently. It also allows for temperatures and length measurements to be converted from imperial values to metric values. Another purpose of the program is to retrieve the average high and low temperatures fo...
true
c892a6b84d2bedcec65a04e03d98e7dcf454f04c
OscarMaestre/lenguajes_marcas
/ejercicios/esquemas/generador_esquemas.py
UTF-8
10,532
3.171875
3
[]
no_license
#!/usr/bin/env python3 #coding=utf-8 from random import randint def generar_rango (limite_inferior, limite_superior): """Devuelve un rango de valores al azar comprendido entre [limite_inferior y limite_superior]""" n1=randint(limite_inferior, limite_superior) n2=randint(limite_inferior, limite_...
true
77dd745d03a53928046612837e84d1cbc6105ba4
YasinEhsan/developer-drills
/slidingWindow/longestSubStrWithSameLettersAfterReplacement.py
UTF-8
2,644
2.765625
3
[ "Apache-2.0" ]
permissive
# may 31 20 def length_of_longest_substring(str, k): # init vars windowStart = 0 maxLen = 0 allowence = 0 # our char dict d = {} # window is range [windowStart, windowEnd] for windowEnd in range(len(str)): # example 'e' in the rightChar = str[windowEnd] if rightChar not in d: d[right...
true
c008e63d1d30a1a964f3d3a05bd52ce585816cfd
lienordni/ProjectEuler
/42.py
UTF-8
321
3.171875
3
[]
no_license
import math def tri(x): return (-1+math.sqrt(1+8*x))/2==int((-1+math.sqrt(1+8*x))/2) xin=open("42.txt","r") py=(xin.read()).split("\",\"") def value(string): s=0 for i in range(0,len(string)): s+=(ord(string[i])-64) return s count=0 for dk in py: if(tri(value(dk))): count+=1 print(count...
true
7774df63cdbe657bb294757b8ffe029c4d14e6bf
sb2rhan/PythonCodes
/ITStepTutorials/OffTopProjects/ParsingAndDatabase/parsedToDB.py
UTF-8
1,340
2.96875
3
[]
no_license
import mysql.connector import parserRestaurants try: db = mysql.connector.connect( host='localhost', database='test_db', user='root', password='' ) cursor = db.cursor() restaurants = parserRestaurants.get_all_restaurants() cursor.execute( ''' CREA...
true
e7a7d905083c45de50c0e760d27ba74e21560b5f
reyanvaldes/pydf1
/src/df1/replies/reply_4f.py
UTF-8
2,089
2.65625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from df1.models.base_data_frame import BaseDataFrame from df1.file_type import FileType import struct # Do the parsing of the raw data read class Reply4f(BaseDataFrame): def __init__(self, **kwargs): super(Reply4f, self).__init__(**kwargs) def init_with_params(self, dst, src, ...
true
9f5be0f51d0745f1a5620a019ed5619d72489b23
neyirerdeser/Python_Tutorials
/Concepts/Hello.py
UTF-8
733
3.796875
4
[]
no_license
import random import sys import os print("Hello") # one line comment ''' multi line comments ''' name = "Neyir" print(name) # 5 main data types # 1. numbers variable1 = 123 # 2. String # 3. lists # 4. tuples # 5. dictionaries ''' 7 operators + addition - subtraction * multiplication / division % modulo ** exponent...
true
b9ce1157c5b142fb2e719c4d2fb45808530d3329
NingyiCai/Joy_Cai_Midterm_Proejct
/Wk8 CODE.py
UTF-8
5,067
2.984375
3
[]
no_license
# import modules import time import board from analogio import AnalogIn from digitalio import DigitalInOut, Direction, Pull #import all the devices import adafruit_am2320 import busio import neopixel pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False, brightness=0.5) tem = AnalogIn(board.A1) colors = [(...
true
ebfb8e3966890b646ebe9f4c87dab5acaaf118e2
guo842917077/Exercise
/pythontest/com/crazyorange/pythonbook/unitest/__init__.py
UTF-8
453
3.21875
3
[]
no_license
""" 单元测试 1。首先导入unittest库 2.让一个类进程unittest.TestCase 3.写一个方法以test开头 4.使用assert断言方法来验证 5。使用main方法来执行,该方法会自动执行所有以test开头的方法 """ import unittest from jsontest import getUserName class UserName(unittest.TestCase): def testUserName(self): testUserName=getUserName('guo') self.assertEquals(testUserName,'guo')...
true
8aa299a0c7ae28d87fe8c3debcebc5b67cb52b5d
lucyle133c/L6-code
/Monday_FPY Calculation_V1_JZ_03222021.py
UTF-8
8,084
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 22 14:02:46 2021 @author: Jiaming.Zhou Reminder: To use this script, please read the instruction in green and follow the instruction in gray starting with 'step *'. The comments of the code are also provided. To read the data in Oracle SQL, cx_Oracle package...
true
0c4a87b99dff6b6ca3b1e854b5c0bd28eb6aea71
ccwu0918/Zerojudge-answer
/b130.py
UTF-8
115
2.71875
3
[]
no_license
n = input() a = list(map(int, input().split())) a = sorted(list(set(a))) print(len(a)) print(' '.join(map(str, a)))
true
af0374ac109274675103acad848011978b6846fa
KarelChanivecky/resound
/sound_sample.py
UTF-8
674
3.796875
4
[]
no_license
class SoundSample: """ Models a sound sample. """ def __init__(self, sample_rate, sample_duration, samples): """ Construct an instance of SoundSample :param sample_rate: the number of samples per second :param sample_duration: the duration in seconds :param sample...
true
9fae08b1c3e27521d9c97e89d4ce01e258a7a245
MarcPartensky/Python-Games
/Game Structure/geometry/version4/mydiagram.py
UTF-8
3,151
3.015625
3
[]
no_license
from myabstract import Form,Point from pygame.locals import * import mycolors import copy """ class Box(Form): def __init__(self,*args,**kwargs): Create a box object. super().__init__(self,*args,**kwargs) """ class Box(Form): def __init__(self,*args,**kwargs): super().__init__(*args,...
true
e0ac075bdfab1883f927c19ef6b8e9069925cffc
HuyaneMatsu/hata
/hata/discord/guild/guild/tests/test__put_roles_into.py
UTF-8
886
2.671875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import vampytest from ....role import Role from ..fields import put_roles_into def iter_options(): role_id = 202306100007 role_name = 'Koishi' role = Role.precreate( role_id, name = role_name, ) yield {}, True, {'roles': []} yield {role_id: role}, True, {'roles': [r...
true
7b3aaf3a7e8a95bac2c7cc52ac77a8dbf2a41f8b
Humphryshikunzi/Python_scripts
/Classes.py
UTF-8
179
3.71875
4
[]
no_license
class PartyAnimal: x = 0 def party(self): self.x = self.x+1; print('So far', self.x) an = PartyAnimal() i = 1; while i<21: an.party() i+=1; an.x
true
70c9ba8e74f5dec07084c26072088f3f3cabdbfe
Alex-GCX/multitask
/coroutine/coroutine-greenlet.py
UTF-8
527
3.390625
3
[]
no_license
import time from greenlet import greenlet def dancing(): for i in range(5): print('正在跳舞。。。。。%d' % i) sing.switch() time.sleep(0.1) def singing(): for i in range(5): print('正在唱歌。。。。。%d' % i) dance.switch() time.sleep(0.1) # 创建全局greenlet对象 dance = greenlet(dan...
true
abb19ad645b65a7c74983d4c639ef4426c9b8631
ZacDair/SER_Bi-Modal
/ensemble_emotive_classification.py
UTF-8
8,246
2.578125
3
[]
no_license
import joblib import pandas as pd from keras.utils import np_utils from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score, multilabel_confusion_matrix, classification_r...
true
41d96e4b9ae1b48e38d4fcc571a61d444182f7ec
bmsrangel/POO_Python_Udemy
/Seção 3/geradores.py
UTF-8
492
3.90625
4
[]
no_license
# def fib(max): # x, y = 1, 1 # while x < max: # yield x # x, y = y, x + y # # # gen = fib(10) # for i in gen: # print(i, end=' ') def is_prime(number): for i in range(2, number): if number % i == 0: return False return True def get_primes(number): while T...
true
644924226dbcc42375a03def7b354a1161189636
aman-raza/Friends_Hack
/Python Widgets/EMI_Calculator.py
UTF-8
2,417
3.5
4
[ "MIT" ]
permissive
''' Created EMI Calculator using Tkinter Author: @divyhshah ''' import tkinter as tk from math import ceil fields = ('Annual Interest Rate', 'Loan Tenure (in months)', 'Loan Amount', 'Monthly Payment', 'Remaining Loan') def monthly_payment(entries): # period rate: r = (float(entries['Annual Interest Rate'].g...
true
bac84011b4b818801cd98bab880ff3d8b1e6e531
leithw2/Numerical_analysis
/Newton_Raphson.py
UTF-8
1,432
2.734375
3
[]
no_license
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt import math import sympy as sym from derivate import * def main(): x = sym.Symbol('x') f_x = -x**2+ 1 print (f_x) x_k = 3 h = 1 dx_dy = d_central(f_x, x_k, h) x_k_p1 = x_k - ( f_x.subs(x,x_k) / dx_dy ) x_k = x_k...
true
1b8fc6d1148e0f51e8f83ca09d2d4020fb7d17ee
SuryodayBasak/mst-pso
/multi-data-trial-mst-pso/single_file_ga.py
UTF-8
3,447
3.046875
3
[]
no_license
import numpy as np from knn import KNNClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt from ga import GeneticAlgorithm from sklearn.datasets import load_iris, load_digits, load_wine data = np.genfromtxt('data.csv', delimiter=',')...
true
366d1dba8127fc5a5d1fcf99467b85306f4902dd
Bigless27/Python-Projects
/Roman-Numerals/Roman.py
UTF-8
3,942
3.796875
4
[ "MIT" ]
permissive
from collections import OrderedDict class Roman(object): def __init__(self, number): self.number = int(number) self.convert_table = self.make_table() while True: choice = raw_input("Type Yes or No for modern Roman Numeral Convert: ").lower() if choice == "yes": print "converted numb...
true
669a047cda0ca64a2ba865b92992b2985996dfb4
jTCode2408/Sprint-Challenge--Data-Structures-Python
/ring_buffer/ring_buffer.py
UTF-8
1,647
3.921875
4
[]
no_license
''' buffer = RingBuffer(3) buffer.get() # should return [] buffer.append('a') buffer.append('b') buffer.append('c') buffer.get() # should return ['a', 'b', 'c'] # 'd' overwrites the oldest value in the ring buffer, which is 'a' buffer.append('d') buffer.get() # should return ['d', 'b', 'c'] buffer.append('e') buf...
true
0657f9c7b71152c4907c2cf69b0faa185f50cc71
thien/iso
/code/vad_evaluator.py
UTF-8
7,150
2.5625
3
[]
no_license
class Statistics: def __init__(self, model_folder): self.model_folder = model_folder # load the csv containing the results def loadResults(model_folder, models_parent_folder="models", results_folder="results"): """ Loads csvs of all epochs from a given model_folder name. Ret...
true
33c2f60661d3116c2e3afc9b82971ea331d76709
Hrissimir/scrape_jobs
/src/scrape_jobs/cli/config_initializer.py
UTF-8
2,677
2.578125
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
import argparse import logging import sys from pathlib import Path from tempfile import gettempdir from hed_utils.support import log from hed_utils.support.file_utils import get_stamp from scrape_jobs import __version__, config _log = logging.getLogger(__name__) _log.addHandler(logging.NullHandler()) def get_log_f...
true
b7dcaa4398f256ae48a3d5438592fba2c1bc857d
viing937/codeforces
/src/519B.py
UTF-8
264
2.984375
3
[ "MIT" ]
permissive
# coding: utf-8 from collections import Counter n = input() a = Counter([i for i in input().split()]) b = Counter([i for i in input().split()]) c = Counter([i for i in input().split()]) print(''.join(list((a-b).elements()))) print(''.join(list((b-c).elements())))
true
0ff9dd11f39f022465c7fcf9bac8f14424816b85
EKrzych/codecool_projects_python
/Python/2018_02_12_Check_point/checkpoint-1-2017-3-EKrzych/main_program.py
UTF-8
3,564
3.71875
4
[]
no_license
""" The main program should use functions from music_reports and display modules """ import file_handling import display import music_reports import sys def delete_album_by_artist_and_album_name(albums, artist, album_name): """ Deletes album of given name by given artist from list and updates data file :p...
true
bad8a21c31d79ed038994acda384d858cf5d3883
OmgAlex/passenger_screening_algorithm_challenge
/common/math.py
UTF-8
177
2.8125
3
[ "MIT" ]
permissive
import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) def log_loss(x, y, eps=1e-6): x = np.clip(x, eps, 1-eps) return -(y*np.log(x) + (1-y)*np.log(1-x))
true
e3f165606138ad293d88a13e2ddc0ee7be4800bc
libinjungle/LeetCode_Python
/LearnedWhileCoding/abstract_factory.py
UTF-8
727
3.984375
4
[]
no_license
''' chess game. use abstract factory pattern to create chess roles ''' import random class Chess: def __init__(self, chess_factory = None): self.chess_factory = chess_factory def show_role(self): role = self.chess_factory.get_role() print "The role here is {}".format(role) class King: def speak(s...
true
b7af0349eae51a9f6efe309de69a99dcd2d6d28e
sai-byui/NEO2D
/environment.py
UTF-8
831
3.484375
3
[]
no_license
""" The parent class of all environments. An environment serves as a interface where agents can share objects with each other. All objects in an environment are accessible to any agent that knows about the environment """ class Environment: def __init__(self): self.objects = {} self.agents = {} ...
true
915ea4b6ea7c063aeff74ed9aca74d6598d23a8b
deub-chck/EIP
/utils/exr2png.py
UTF-8
4,879
3.296875
3
[ "MIT" ]
permissive
#!/usr/bin/python #################################################################################################### # (c) Marwan Abdellah, Blue Brain Project, Ecole Polytechnique Federal de Lausanne (EPFL) #################################################################################################### # Impo...
true
f236cb549d3a5c64b6fee67b2cd0e51325de7580
purushottam22/Author-Profiling-in-Social-Media
/Reading_file.py
UTF-8
2,967
2.96875
3
[]
no_license
#!/user/bin/env python #from __future__import unicode_literal import pandas as pd import emoji def read_file(file_name): Data_list=[] fopen = open(file_name, 'r') k=0 for line in fopen: #print(line) if k==0: k+=1 continue lines =line.split(',') #print(lines) #lines1 = lines[0].split(' ') #print(...
true
e1d792cbdfc6cef4712509fe2e114cc4f58d27c1
MeJustBear/ml-flask-test-task
/app/models/predict/model_predict.py
UTF-8
1,643
2.515625
3
[]
no_license
import itertools import requests from bs4 import BeautifulSoup from app.models.predict import modelE, tokenizer, encoder import numpy as np def predict_by_url(vgm_url, model=modelE, tokenizer=tokenizer, encoder=encoder): html_text = requests.get(vgm_url).text soup = BeautifulSoup(html_text, 'html.parser') ...
true
ede6127302b4be1bcec12d7187f165c096f7b6f2
Rockrs/Algorithm_DS
/leetcode_31.py
UTF-8
994
3
3
[]
no_license
class Solution: def nextPermutation(self, perm: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ n = len(perm) if n==1: pass else: swap_v =0 swap_i = 0 index=n-1 while(index>...
true
1e7613b3386d02235ad648e6938490389de26131
svasilev94/GraphLibrary
/graphlibrary/prim_tests.py
UTF-8
1,627
2.765625
3
[ "MIT" ]
permissive
import unittest from graphlibrary import prim from graphlibrary import digraph from graphlibrary import graph G = graph.Graph() G.vertices = {1: [2, 3, 4], 2: [7], 3: [2, 5, 6], 4: [], 5: [], 6: [], 7: [], 8: []} G.edges = {(1, 2): {'weight': 500}, (1, 3): {'weight': 100}, (1, 4):...
true
84b41ddcf3a2a1ae0d267c048f9e158f94a828f8
gmontamat/quora-question-pairs
/app/nltk_tests.py
UTF-8
1,197
3.09375
3
[]
no_license
#!/usr/bin/env python """ Test NLTK library features """ import nltk from nltk.stem.snowball import SnowballStemmer from nltk.corpus import stopwords if __name__ == '__main__': # Download necessary files to train nltk if False: nltk.download() # Load train dataset from load_data import load...
true
cdf6a764174b27f1659960efedf578d18575b644
doyleh4/LCA
/pytest_LCA.py
UTF-8
3,873
3.40625
3
[]
no_license
import unittest import LCA class TestLCA(unittest.TestCase): def test_Node(self): root = LCA.Node(1) self.assertEqual(root.data, 1) def test_insert_normal(self): root = LCA.Node(1) a = LCA.Node(2) b = LCA.Node(3) c = LCA.Node(4) root.insert(a, "left") ...
true
71565d63f9da1d03b9489d4fd1d53578a42c9c5a
AbishekMLEngineer/COVID-19-CT-CXR
/figurex/gold_standard_to_publish_json.py
UTF-8
1,765
2.90625
3
[ "LicenseRef-scancode-us-govt-public-domain" ]
permissive
""" Usage: script.py -i SOURCE -o DEST Options: -i <file> gold standard file -o <file> released file """ import json import re from pathlib import Path import docopt import pandas as pd import tqdm from PIL import Image def gold_to_publish(src, dst, drop_nature=True): ...
true
551effcc81e33a6b1c1941426f3b3521778d10ed
royrowe/python
/10/10.1.1file_reader.py
UTF-8
271
2.921875
3
[]
no_license
#!/usr/bin/env python ''' @File :10.1.1file_reader.py @Copyright :luoming @Date : @Desc : ''' file_path = '/home/luoming/python/python/10/text_files/pi_digits.txt' with open(file_path) as file_object: contents = file_object.read() print(contents)
true
e274257963004395155cad150ec1a0cd0eeb5256
sumajali/Learning-Python-
/sets.py/remove_set_items.py
UTF-8
932
4.1875
4
[]
no_license
# Removing set items # Note: remove method takes exactly only one argument. fruits = {'apple', 'orange', 'watermelon', 'guvva'} fruits.remove('orange') # remove method removes the specified value from the set print(fruits) # remove method throws an error if the specifed value doesn't exits. # Discard method won't th...
true
d1054986643ae67b271e2b37902c252091a48129
ajorve/pdxcodeguild
/warm-ups/Python.py
UTF-8
448
3.796875
4
[]
no_license
""" This is a Multiline Comment. THis is the first thing in the file. AKA 'Module' Docstring. """ #feet = input("enter the number of feet >> ") #meters = float(feet) * 0.3048 name = input("What is your name?") age = input("What is your age?") banner_ends = "*" * len(name) print(banner_ends) print(name, ...
true
3279ed7c6ef8d9de510983aaac1a25de01661145
Bolanle/G54MIP
/Repository/Data Extraction/WSJ/WSJScraper.py
UTF-8
6,968
2.75
3
[]
no_license
# Bloomberg news extractor - will read and collate bloomberg news. import calendar from collections import OrderedDict from threading import Thread import urllib.request import time from xml.etree.ElementTree import Element, SubElement, tostring from xml.etree import ElementTree from html.parser import HTMLParser from...
true
d3e8f8cbeacb27e8c2080b5e9f2e89c9ba619df0
Nock-zz/py-projects
/Turtle/main.py
UTF-8
1,075
3.34375
3
[ "MIT" ]
permissive
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. # from turtle import Screen, Turtle # # my_turtle = Turtle() # my_screen = Screen() # my_turtle.color('red', 'yellow') # #...
true
93d2d9fe0e618f13d2b559917517b7dbc4c36a30
mark-xhchen/JCBM-conc-stre-temp
/main_cnn.py
UTF-8
4,694
2.578125
3
[]
no_license
# Authors: Huaguo Chen, Xinhong Chen # Contact: xinhong.chen@cityu.edu.hk from data import Dataset, DataGenerator import keras import json import numpy as np import os from keras import backend as K from keras.optimizers import Adam from keras.callbacks import CSVLogger from sklearn.metrics import mean_squared_error, ...
true
d42e316272deb5da1b7a538cf857b61bd7b4b3e0
herzenuni/modules-packages-itertools-oop-eslutskaya
/tick-tack-toe.py
UTF-8
2,701
2.8125
3
[]
no_license
from tkinter import * import random import time move = 1 game = [] winner = 0 for i in range(3): b=[] for j in range(3): b.append(3*i+j) game.append(b) def test(game): global winner for i in range(3): if game[i][0]==game[i][1] and game[i][0]==game[i][2] and game[i...
true
7e42d421f590d94906110a8c1f1cd1c9a2ea4753
GarrettJWilliford/text_games
/hangman_file.py
UTF-8
1,723
2.765625
3
[]
no_license
import random def hangman_animation(num): one = """ 7------- | | | | | | __|__ """ two = """ 7------- | | | _n | | | __|__ """ three = """ 7------- | | | _n | 0 | | ...
true
4c831bd1e2b09b17f6be515b01636bdc9ae291ca
Sarah-Marion/News_Highlight
/tests/test_articles.py
UTF-8
1,958
3.359375
3
[ "MIT" ]
permissive
import unittest from app.models import Articles class ArticleTest(unittest.TestCase): """ Test Article class to test behaviours of the Article class Args: Unittest.TestCase: Test case class that helps create test cases """ def setUp(self): """ Set up method to run befo...
true
b9c8ce0d7db17ebdd7d5af6fca1071873b77dccd
sharingplay/Introduccion-a-la-programacion
/Python/Recursion de Pila/Listas/buscarPositivos.py
UTF-8
449
3.828125
4
[]
no_license
"""Funcion que indica si todos los elementos de una lista son positivos, Si todos los elementos son positivos debe regresar True, sino False""" def numEnteros (lista): if isinstance (lista, list): return buscarPositivos (lista) else: return "Error" def buscarPositivos (lista): if lis...
true
03c66292b9d59fb7d26b194e8a87da3a0fdd92bc
ajmunton/http_request_aggregator
/http_request_aggregator/__init__.py
UTF-8
3,962
2.640625
3
[]
no_license
import json import sys from tornado import ioloop, httpclient, escape import logging logging.basicConfig(stream=sys.stdout, level=logging.ERROR) logger = logging.getLogger(__name__) httpclient.AsyncHTTPClient.configure( None, defaults=dict( user_agent="Python-HTTP-Request-Aggregator" ) ) class Http...
true
32cc8b4844c05cc84514f99918729956344634c7
mabiesen/python_wish_list
/getcoordinates/getCoordinates.py
UTF-8
887
2.96875
3
[]
no_license
import googlemaps import time #Should be able to receive address or list of addresses; control for time allowances between calls class GetCoordinates: __myclient = "" def __init__(self, mykey): self.myclient = googlemaps.Client(key=mykey) def getCoordinatesList(self, mylist): ## exam...
true
9918a782f63ac123010002f37c0a14a399ac6104
satchitchatterji/NeuralNetworksProject
/RocketSimulation/trial.py
UTF-8
1,423
2.609375
3
[]
no_license
import numpy as np def run_single_trial(scene, rockets, controllers, cns, init, frames, continual_draw): if init is not None: scene.init_target(init) cur_frame = 0 scores = [] while(True): cur_frame+=1 if cur_frame>frames: print('Timeout!') for rocket in rockets: rocket.is_dead...
true