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
606241c82ff4eaf98eb2e7da37c8b8baae145ebf
made-ml-in-prod-2021/kadetfrolov
/airflow_ml_dags/images/build_features/main.py
UTF-8
1,864
2.8125
3
[]
no_license
import numpy as np import click import re import os import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.impute import SimpleImputer from sklearn.pipeline import Pipeline import pickle def numerical_pipeline(df: pd.DataFrame) -> Pipeline: pipe = Pipeline([('imputer', SimpleImputer(mis...
true
a33bc6fe0532212c03401e0b16fe168a656e28a2
Md-Monirul-Islam/Python-code
/Advance-python/What is File and File Handling in Python.py
UTF-8
155
2.5625
3
[]
no_license
f = open("file.txt",mode="w") f.write("My name's MD. Monirul islam Munna.\nI am a student of Jessore Univerdity of Science & Technology.\nDepartment of CSE.") f.close()
true
55be22f25bb6a6115c8cb69dd8aa65456af8dda7
jpschultz/pygs
/pygs/pygs_tools.py
UTF-8
4,090
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import string #py3 compatible try: import initialize_service as init_service except ImportError: from . import initialize_service as init_service import pandas as pd from numpy import nan import math def get_all_sheet_names(spreadsheetId): all_sheets = [] service = init_service.g...
true
a6345589b4fff6dde257d496d2a20b9134a23063
jkadlec/hn-who-is-hiring-challenge
/challenge.py
UTF-8
1,157
2.78125
3
[]
no_license
import requests from collections import deque def _get_session(): req = requests.get('http://challenge.shopcurbside.com/get-session') return req.text def _dfs(seed_next, session): next_links = deque(seed_next) secret = '' while any(next_links): curr = next_links.pop() req = reque...
true
f17e43c8b8993222e718dfb2e965140d43f09229
giswqs/Python-books
/Geoprocessing with Python/Chapter13/listing13_13.py
UTF-8
734
2.6875
3
[]
no_license
# Script to draw a topo map with mapnik. import mapnik srs = '+proj=utm +zone=10 +ellps=GRS80 +datum=NAD83 +units=m +no_defs' m = mapnik.Map(1200, 1200, srs) m.zoom_to_box(mapnik.Box2d(558800, 5112200, 566600, 5120500)) # Add a GDAL datasource. topo_lyr = mapnik.Layer('Topo', srs) topo_raster = mapnik.Gdal( file=...
true
699ae37903a7a785ad22006adfe293dc456b0e6b
BergC/leetcodepython
/20_valid_parentheses/solution.py
UTF-8
597
3.03125
3
[]
no_license
import timeit test_code = ''' class Solution: def isValid(self, s: str): open = tuple('({[') close = tuple(')}]') legend = dict(zip(open, close)) queue = [] for bracket in s: if bracket in open: queue.append(legend[bracket]) elif bra...
true
178a4cfea25a9de574c2198be471ea32c08bdf3e
souzalaercio2004/CodigosPython
/advinhacao.py
UTF-8
2,073
4
4
[]
no_license
import random def start_advinhacao(): print('********************************') print('Bem vindo ao jogo de adivinhação') print('********************************') print('\n') def get_Numero(): return(random.randrange(1,101)) def nivel_Difuculdade(): valor=0 while (valor<= 0 or valor >=3)...
true
b77429e6a80e2148d6255beca543ccb99de63255
Gwinew/To-Lern-Python-Beginner
/Pluralsight/Intermediate/Unit_Testing_with_Python/3_Unit_testing_with_pytest/5_Organizing_Test_Code_for_large_project/phonebook_pytest2/src/phonebook/phonenumbers.py
UTF-8
983
3.453125
3
[]
no_license
"""Given a list of names and phone numbers. Make a Phonebook Determine if it is consistent: - no number is a prefix of another - e.g. Bob 91125426, Anna 97625992 - Emergency 911 - Bob and Emergency are inconsistent """ import os from phonebook.data_processing import clean_phonen...
true
5a068c7b52ce928366d0d800f347e6e70d9f080b
TheNerdJedi/pythonstuff
/ex11a.py
UTF-8
378
4.125
4
[]
no_license
print '\nWhat\'s your name ?', name = raw_input('-->') print '\nHow old are you, %s' % name, age = int(raw_input('-->')) print '\nHow tall are you (in cm), %s' % name height = int(raw_input('-->')) print '\nHow much do you weight (in kg), %s' %name weight = int(raw_input('-->')) print '\nSo, %s is %d years old, %d cm ...
true
554273663c91897e57161d5f5f99250cb50a0e55
taigaoma1997/ML_MM_Benchmark
/models/Transformer/utils/helper_functions.py
UTF-8
7,968
2.578125
3
[ "MIT" ]
permissive
""" This is the helper functions for various functions 1-4: retrieving the prediction or truth files in data/ 5: Put flags.obj and parameters.txt into the folder 6-8: Functions handling flags 14: Normalize at eval mode (get back the original range) """ import os import shutil from copy import deepcopy import ...
true
32b08179711831c8aa14b9c558c008d11774812a
mei28/Machine_teaching
/src/make_2DGaussian.py
UTF-8
8,076
2.828125
3
[]
no_license
# %% from PIL import Image, ImageDraw, ImageFont import numpy as np from matplotlib import pyplot as plt import seaborn as sns import pandas as pd import random sns.set() np.random.seed(28) random.seed(28) # %% ves_mu = np.array([0.10, 0.13]) ves_sigma = np.array([[0.12, 0], [0, 0.12]]) val_ves = np.random.multivariat...
true
4229bae6671ff9e60b342591a753e9c7c5f5fcd7
frodre/pyLIM
/calib_test_scripts/misc_utils.py
UTF-8
6,651
2.71875
3
[ "MIT" ]
permissive
import os import numpy as np import pandas as pd def build_ncf_fpaths(parent_dir, exp_names, exp_folders, exp_files, var_names): var_mapping = {'tas': 'atmos', 'tos': 'ocean', 'zos': 'ocean'} var_long_post = {'atmos': '_sfc_Amon', ...
true
95ff8b05293c95392acc043fd6f5930d32f3e8f6
torjussa/playground
/pythontest.py
UTF-8
117
3.21875
3
[]
no_license
import time print ("HelloWorld") for x in range (0,3): print "Seconds until start: " , x time.sleep(1) print"go"
true
d74ea24606129d214d905a5ac7686828a6326254
billyio/atcoder
/ABC151-200/ABC178/abc178_c.py
UTF-8
78
3.0625
3
[ "MIT" ]
permissive
N = int(input()) ans = 10 ** N - 9 ** N * 2 + 8 ** N print(ans % (10**9 + 7))
true
cdb972ffafcea23346ceeb8f6c2fd6813309e020
Androm517/Pong
/source/gui.py
UTF-8
2,884
3.5
4
[]
no_license
import tkinter as tk class PongLogicGui: """ Den här klassen skickar information mellan de olika widgetarna. Den innehåller också gameLoop som styr rörelser i PongArea. Den här klassen hämtar information från en widget genom att definiera en funktion som tilldelas widgeten och den skickar information ...
true
db47ab1873ddfdad713c544c8ea18ffadd408371
Lunreth/pyleecan
/pyleecan/Functions/FEMM/create_FEMM_boundary_conditions.py
UTF-8
1,192
2.625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- def create_FEMM_boundary_conditions(femm, sym, is_antiper): """Create the boundary conditions in FEMM Parameters ---------- femm : FEMMHandler client to send command to a FEMM instance sym : int Symmetry factor of the machine is_antiper : bool T...
true
c84d34636569a78d2b511e1ec838e123982ae794
yfeng2018/IntroPython2016a
/students/Boundb3/Session05/Map_lambda_play.py
UTF-8
119
3.296875
3
[]
no_license
z= 3 f = lambda x, y : (x+y)*z print(f(2,3)) fl = [lambda x,y: x*y, lambda x,y: x-y] res = fl[1](4,5) print(res)
true
8e77756131f9f142d87b0b53621c5706372eec38
ronmin/CHEME_5500_WC_4
/Fibonacci_seq.py
UTF-8
930
4.4375
4
[]
no_license
#! python3 # Fibonacci_seq.py - Enter a number and have the program generate the Fibonacci sequence to that number # or to the Nth number. import time def Fibonacci_seq_Nth(n): seq = [1, 1] for N in range(1, n + 1, 1): seq.append(seq[-1] + seq[-2]) return seq[:-3] def Fibonac...
true
5e0796a7133987e1ac287eab47857de8d777118f
I318928/Python-Homework
/课后作业/第三天作业/guoqijun/Chapter 5/Q4.py
UTF-8
199
2.640625
3
[]
no_license
performances = {'Ventriloquism':'9:00am','Snake Charmer':'12:00pm','Amazing Acrobatics':'2:00pm','Enchanted Elephants':'5:00pm'} performances['Enchanted Elephants'] = '6:00pm' print(performances)
true
8305a183af260730902823dc0970b93184416bcd
mines-nancy-tcss5ac-2018/td1-geiser1u
/TD 1 - Problème 16.py
UTF-8
412
3.5625
4
[]
no_license
def max_puissance_10(N): # Renvoie l'ordre de grandeur de N mp10 = 0 p10 = 0 while int(N/10**p10) > 0: mp10 = p10 p10 += 1 return mp10 def solve(n): somme = 0 N = 2**n for i in range(max_puissance_10(N),-1,-1): digit = int(N/10**i) somme += digit...
true
f66e5cf79599f8affe68f7ceec9c762ad41cc86f
AndreeaNenciuCrasi/Programming-Basics-Exercises
/First SI week/Sorting problem.py
UTF-8
390
3.46875
3
[]
no_license
import sys print('Number of arguments: {}'.format(len(sys.argv))) print('Argument(s) passed: {}'.format(str(sys.argv))) list = sys.argv[1:] n = len(list) print(n) k = 1 while k < n: j = 0 while j <= n-2: if int(list[j]) > int(list[j+1]): temp = list[j+1] list[j+1] = list[j] ...
true
f0d36aeda6f3ace08a7aea7599b877653b31d67f
bppwd2020-Curtis/NeuralNetwork
/visualization.py
UTF-8
2,885
2.90625
3
[]
no_license
import os,sys os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" import pygame import numpy as np from Neuron import * from NeuralNetMath import * from NeuralNetLayer import * from NeuralNetwork import * #Neural Net Part n1 = Neuron("Red") n2 = Neuron("Green") n3 = Neuron("Blue") neurons = [n1,n2,n3] inputLayer = Neu...
true
a827a80f73835290a03c516f88596b24a6579456
theresaming/vending-machine-oneweek
/scripts/vending/vendingmachine.py
UTF-8
995
3.28125
3
[]
no_license
import serial, time from threading import Thread class VendingMachine: running = None ready = None arduino = None def read(self): while self.running: recv_data = self.arduino.readline() if recv_data.strip() == 'ready': self.ready = True ...
true
df8842b5a29009a233ecd313ff769c6ced5bcf4c
kazuyachue/Artificial_Intelligence
/Fall Semester/Beginning Exercises/p11a.py
UTF-8
228
3.328125
3
[]
no_license
try: f = open("p11a.txt", 'r') s = input("What is your name? ") f.seek(0) print("Last person's name: " + f.read()) finally: f.close() try: f = open("p11a.txt", 'w') f.write(s) finally: f.close()
true
c380cb95a6b8b16561241952180119a15be7512e
Zmegolaz/adventofcode2020
/day5/part1.py
UTF-8
216
3.03125
3
[]
no_license
highest_seat = 0 with open('input') as f: for line in f: highest_seat = max(highest_seat, int(line.strip().replace('F', '0').replace('B', '1').replace('L', '0').replace('R', '1'), 2)) print(highest_seat)
true
9c3e4fccdf1e797946edaa9134e1cb0e72d691d5
Zhouzp2115/DP-GAN
/cifar-10/train.py
UTF-8
4,595
2.515625
3
[]
no_license
# coding:utf-8 import torch import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F import torchvision.utils as vutils import matplotlib.pyplot as plt import numpy as np from torch import optim from fkimgloader import FakeDataLoader from dataloader import CIFARDataLoader cl...
true
8b52874a0cd6cc36fd6e49a8e14ebb6f0dcf1cf3
cshintov/hackerrank
/oldh/manasa_n_stones.py
UTF-8
1,017
3.484375
3
[]
no_license
""" solving manas and stones problem """ def read_strings(num): """ read lines of input """ for _ in range(num): yield raw_input() def read_nums(num): """ read single numbers from each line """ for num in read_strings(num): yield int(num) def frequencies(num): """ generate the f...
true
2d492c59f9fde76836f0e2b4a1112ef1e10241d1
xinghun61/infra
/appengine/monorail/tools/ml/trainer2/train_ml_helpers.py
UTF-8
4,830
2.578125
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Or at https://developers.google.com/open-source/licenses/bsd """ Helper functions for spam and component classification. These are mostly for feature extra...
true
737db3f7304d0ce144fb369b116ce2b26ed7ce98
jhabarsingh/DOCMED
/machine_learning_models/chest_xray_classifier/script.py
UTF-8
3,053
2.796875
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import seaborn as sns import keras from keras.models import Sequential from keras.layers import Dense, Conv2D , MaxPool2D , Flatten , Dropout from keras.preprocessing.image import ImageDataGenerator from keras.optimizers import Adam from sklearn.metrics import classification_report,conf...
true
c10be19179a68433ba14df014f4f1b75c62d0f48
loctrin/amazon-timestream-telegraf-and-grafana-demo
/lambdas/ts_detect_anomaly/timestreamquery.py
UTF-8
7,326
2.6875
3
[ "MIT-0" ]
permissive
import boto3 import json from botocore.config import Config import time import random import sys, traceback from timeit import default_timer as timer import datetime import os from collections import defaultdict, namedtuple import argparse ''' ## Create a timestream query client. ''' def createQueryClient(region, prof...
true
be0a74c6d281f6402543afa9ee7fa4eac1f49d84
ZYL-IRENE/RCAnalysis
/RCdetection/test.py
UTF-8
2,862
2.65625
3
[]
no_license
import csv import copy import numpy as np import json import mymds import lof import feature_explore import category_analysis as ca # open data file data = [] isFirstLine = 1 with open('./static/shuttle20.csv', newline='') as readfile: reader = csv.reader(readfile) for row in reader: ...
true
603c7f124ccf5e56e097ee661e440402d0284526
crazynoodle/static_html
/webframe/app.py
UTF-8
14,423
2.5625
3
[]
no_license
import os import re import cgi import json import threading import logging from urllib.parse import parse_qs from wsgiref.headers import Headers from jinja2 import Environment, FileSystemLoader #define a global object to store request and response ctx = threading.local() _RESPONSE_STATUSES = { # Informational ...
true
61bff88ba6f0ee5fd3e4433e3f562921a48f528a
chyu/Python-practice
/listPython.py
UTF-8
1,540
3.40625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 17 21:37:42 2018 @author: chakyu """ #---- Start program ---- import os import re #-------------------------------------------------------------- def countComments(filename): fileHandle = open(filename, 'r') #line = fileHandle.readl...
true
23c2633c2fad8f2c7ea983a7523604fda92da105
cbhramar/python-ramp-up
/sort.py
UTF-8
903
3.5
4
[ "MIT" ]
permissive
import random def msort(x): if len(x) < 2: return x result = [] mid = len(x)//2 y = msort(x[:mid]) z = msort(x[mid:]) i,j = merge(y,z,result) result += y[i:] result += z[j:] return result def qsort(x): if len(x) < 2: return x result = [] mid...
true
fa302c58c39c1f246f44f2c1cb1c39780ff97d6e
DReichard/ImageClassifier
/prepare_dataset.py
UTF-8
2,221
2.65625
3
[]
no_license
import os import image_parsing import numpy as np from keras.utils import to_categorical from sklearn.model_selection import train_test_split random_seed = 42 def randomize(dataset, labels): permutation = np.random.permutation(dataset.shape[0]) shuffled_dataset = dataset[permutation] shuffled_labels = l...
true
495efc728758ee0a5d5eed56db30e8fa85a92d89
PetraVidnerova/euler
/48.py
UTF-8
75
3.609375
4
[]
no_license
sum = 0 for x in range(1,1001): sum += pow(x,x) print(str(sum)[-10:])
true
d565638f4fcdd31042919c750cae9513d15bb872
gios91/max-ingress-parser
/app.py
UTF-8
1,420
2.6875
3
[ "Apache-2.0" ]
permissive
import sys import json import csv INGRESS_URL = "https://intel.ingress.com/intel?ll={}&z=17&pll={}" def main(input_file_path,output_file_path): L_out = [] L_out.append("{};{};{};{}".format('portal','url','priority','category')) f = open(input_file_path, 'r') json_data = json.load(f) for portals_id...
true
adfd9ec18019556edb2e8c13cffa341819ea608d
dpieski/uspto-opendata-python
/uspto/util/command.py
UTF-8
10,019
2.578125
3
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
# -*- coding: utf-8 -*- # (c) 2017 Andreas Motl <andreas@ip-tools.org> import os import sys import json import logging from uspto.util.common import get_document_path, read_list, normalize_options, read_numbersfile, get_archive_path from uspto.util.numbers import guess_type_from_number, format_number_for_source logger...
true
19c4f865ec243264c41bd7f02e5a07019d28014d
kr-ann/search_engine
/mw_client_with_threading.py
UTF-8
1,965
2.9375
3
[]
no_license
import mwclient as mw import threading import time import codecs class MyThread(threading.Thread): def __init__(self, site, subcategory_name): self.site = site self.subcategory_name = subcategory_name def run(self): print(threading.currentThread().getName() + '\n') ...
true
2661dad62215022603b64a6d341598f5246b16e3
mauricio-mautec/MercadoPy
/api/pedido/PedidoDTO.py
UTF-8
18,314
2.734375
3
[]
no_license
from datetime import date, datetime import importlib from utility import konstantes database_DB = konstantes('DATABASE','database_DB') banco = importlib.import_module (database_DB) # TRABALHA OS ITENS QUE COMPOEM UM PEDIDO DE VENDA from api.pedido.ItemDTO import ItemDTO from api.pedido.Item_EstoqueDTO ...
true
d157b62d4c63528235491d1de6752de13488ca0d
chansol2/soldOut
/main/back/flask/app/models/cate_info.py
UTF-8
521
2.5625
3
[]
no_license
from app import db class CategoryModel(db.Model): __tablename__ = "cate_info" cate_id = db.Column(db.BigInteger, primary_key=True) cate_nm = db.Column(db.String(150)) parent_id = db.Column(db.Integer) sub_parent_id = db.Column(db.Integer) products = db.relationship("ProductsModel") def...
true
fabb0fc82650b5f37cee48241f39202fa6955282
bradynichols/untitled_space_game
/sprites.py
UTF-8
2,863
3.09375
3
[]
no_license
# Sprite classes for platform game import pygame as pg import pygame.gfxdraw from settings import * vec = pg.math.Vector2 class Player(pg.sprite.Sprite): def __init__(self, game): pg.sprite.Sprite.__init__(self) self.game = game self.image = pygame.image.load("./img/astronaut_stand.png") ...
true
1aadf66c25618f311ef230a6eb351f18e528666f
powdahound/reflex
/clients/python/reflex.py
UTF-8
724
2.9375
3
[]
no_license
import socket # Stat types TYPE_SUM = 1 TYPE_AVERAGE = 2 class ReflexClient: def __init__(self, host, port=7828): self.host = host self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) def send(self, type, key, value): msg = "%d %s %d" % (type, key, v...
true
34fc7061552e453a97b905013503f4ba49396cdd
chinacharlie/demo
/test_mock.py
UTF-8
1,120
3.234375
3
[]
no_license
import requests import unittest from unittest import mock #自定义异常 class myException(Exception): pass #判断python.org是否是python网站,用到来requests.get def is_python_site(): try: r = requests.get('http://python.org') except IOError: pass else: if r.status_code == 200: return ...
true
882e29e15261b1328eb14ec3de7b874f8610f87c
poojasingh1995/list
/python/function/sum_and_avg.py
UTF-8
556
3.640625
4
[]
no_license
# def sum_and_avg(k): # a=int(input("enter the num")) # b=int(input("enter the num")) # c=int(input("enter the num")) # i=0 # sum=0 # while i<k: # sum=sum+a+b+c # a=a+1 # print(sum) # i=i+1 # sum_and_avg(10) # def add_numbers(number_x,number_y): # number_sum=number_x...
true
232ad4ee2e0c85a8edfb802999f43c4a36866a37
wyz2368/open_spiel
/open_spiel/python/algorithms/psro_v2/plot_curves/pie.py
UTF-8
927
2.984375
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(figsize=(6, 3), subplot_kw=dict(aspect="equal")) recipe = ["0.364 two devs", "0.636 one dev", ] # data = [float(x.split()[0]) for x in recipe] # ingredients = [x.split()[-1] for x...
true
0b0d95cfd4ae2048a6ec651234b445c341f88222
naeimbah/Cardiac_classification
/github_class/src/process_hdf5.py
UTF-8
5,301
2.6875
3
[]
no_license
#!/usr/bin/env python # load libraries import os import re import h5py import dicom import numpy as np from functools import partial from multiprocessing import Pool from skimage.transform import resize from src.interpolate import linear_interpolate # script level variables DICOM_PATTERN = re.compile(".dcm$") STUD...
true
fcdf719c84ddf8879ba59d2d2fee4adcb1705ad8
jordano1/python
/python_education/generator/simple_generator.py
UTF-8
93
3.46875
3
[]
no_license
def gen(num): for i in range(num): yield i for item in gen(100): print(item)
true
f6f745b08e14bb8d912565e1efecf3bbf9a437a1
mnk343/Automate-the-Boring-Stuff-with-Python
/partI/ch3/collatz.py
UTF-8
321
3.59375
4
[]
no_license
import sys def collatz(number): if number%2 : print(3*number+1) return 3*number+1 else: print(number//2) return number//2 number = input() try : number = int(number) except ValueError: print("Please enter integer numbers!!") sys.exit() while True: number = collatz(number) if number == 1: break ...
true
79067607d56552bd0d784088edc5d881dc0b094f
brentd-smith/pipelinesite
/books/tests.py
UTF-8
1,356
2.921875
3
[]
no_license
from django.test import TestCase from django.http import HttpResponse import os from .views import hello from django.test import Client # Create your tests here. class InitialBooksTests(TestCase): """ NOTE: this demonstrates using the django.test.Client object to simulate actual GET or POST requests to t...
true
c6fe4f948c26d2ed4d37b17bef5ad9d7b816b983
sillyfish/learn-python
/python_crash_course/ch08/cities.py
UTF-8
454
2.578125
3
[]
no_license
""" Title: Date: 2023-04-24 11:42:44 LastEditTime: 2023-04-24 11:44:24 Category: Tags: Slug: Authors: 惊人不易 Summary: """ """ Title: Date: 2023-04-24 11:42:44 LastEditTime: 2023-04-24 11:42:47 Category: Tags: Slug: Authors: 惊人不易 Summary: """ def describe_city(city, country="China"): print(f"{city.title()}...
true
e3478d966c0f783af0b2999ddee30af97cde4890
SpooderManEXE/Hacktoberfest2020-Expert
/Python Programs/DiceRoller.py
UTF-8
315
3.734375
4
[ "MIT" ]
permissive
import random min = 1 max = 6 roll_again = "yes, I would like to Roll Again!" while roll_again == "yes" or roll_again == "y": print "Rolling the dices..." print "The values are...." print random.randint(min, max) print random.randint(min, max) roll_again = raw_input("Roll the dices again?")
true
b979052b7a0543cdbf8720a6007cfa2a81878df8
tenggeli/Euler
/python/zhizhu/urldown2.py
UTF-8
353
2.828125
3
[]
no_license
# coding:utf-8 import urllib2 from bs4 import BeautifulSoup url = "http://www.lvluole.name/?p=314" respon = urllib2.urlopen(url) conn = respon.read() souce = BeautifulSoup(conn,'html.parser',from_encoding="utf-8") print "获取所有链接" links = souce.find_all('a') print links for link in links: print link.name,link.get_tex...
true
0e84fc017f643ab1edc39d6136da71cf4b3f5465
jingfei510/PythonProjects
/类的英雄无敌/play.py
UTF-8
236
2.796875
3
[]
no_license
from heroes import * msg = '欢迎来到王者峡谷' if __name__=="__main__": print(msg) milo=Hero('milo') boss=Element('boss') print(boss.hp) milo.hit(boss) print(boss.hp) boss.hit(milo) print(milo.hp)
true
a3ee3a2b2ae74d1dee99b96f409157844c01f1e2
hcotterill2402/isc-work
/python/while.py
UTF-8
193
3.640625
4
[]
no_license
#While loops in Python #Control Flow, excercise 1 #1 #never ending while loop! #x=5 #while x>0: # print x # x+=1 #While loop that never gets called x=5 while x<0: print x x+=1
true
4d70437c771218c3c678950511898e90e5a39f75
Marqueeze/COURSES_lab_1-2-3
/main.py
UTF-8
331
2.890625
3
[]
no_license
import sys from logic import tokenize, digits_indicies, foreign_indicies if __name__ == '__main__': if len(sys.argv) != 2: print("Expected 1 argument which is directory path") else: path = sys.argv[1] print(tokenize(path)) print(digits_indicies(path)) print(foreign_indic...
true
dab6106c66b8b4afdb1312138f28f176ce011004
matthewR1993/qscheme
/core/state_configurations.py
UTF-8
3,674
3.0625
3
[]
no_license
# This submodule consist of functions for different state configurations. # All state configurations are normalised and with not applied operators!!! import numpy as np from math import factorial, exp, sqrt import cmath as cm import numpy.polynomial.hermite as herm DEF_SERIES_LEN = 100 def single_photon(series_leng...
true
682049995ab145f33456dbf1511061bac3d0bdac
JuanIsernGhosn/pedestrian-detection-with-descriptors
/src/LBPDescriptor.py
UTF-8
436
2.609375
3
[]
no_license
import cv2 as cv2 import _functions class LBPDescriptor: #Local Binary Pattern descriptor object class def compute(self, img): """ Compute descriptor. Args: img (int[][][]): An RGB image. Returns: float[]: Local Binary Pattern descriptor. """ ...
true
efcf08fff85c88c427fead28272ce44e666a9611
charleseagle/Machine-Learning-Coursera-Python
/Week9/VisualizeFit.py
UTF-8
627
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Oct 23 12:47:25 2015 @author: Charleseagle """ from __future__ import division import numpy as np import matplotlib.pyplot as plt import MultivariateGaussian def VisualizeFit(X, mu, sigma2): X1, X2 = np.meshgrid(np.arange(0,35.5,0.5),np.arange(0,35.5,0.5)) m, n = np....
true
149270e26d968d37e0c15525f2c268c7e194faca
jelly/raingraph
/raingraph.py
UTF-8
1,947
2.875
3
[]
no_license
#!/usr/bin/python import argparse import os from datetime import datetime, timedelta import requests import pygal from jinja2 import Environment, FileSystemLoader URL = 'http://projects.knmi.nl/klimatologie/daggegevens/getdata_dag.cgi'; VARS = 'RH' DATE_FORMAT = '%Y%m%d' # Old data https://projects.knmi.nl/klimat...
true
1367dc8eba2c45e64e9a25f5d279b6829a18198e
mksachs/glow_ml
/model_tests.py
UTF-8
9,512
2.828125
3
[]
no_license
from argparse import ArgumentParser import os.path import warnings import requests import pandas as pd from sklearn.metrics import ( accuracy_score, f1_score, precision_score, recall_score, confusion_matrix, roc_auc_score, precision_recall_curve, roc_curve ) import matplotlib; matplotlib.use('AGG') import seab...
true
c56df247dd908cdb8377154090e20f173d3f280c
Nuolong/bobbit
/src/bobbit/modules/expand.py
UTF-8
498
2.953125
3
[ "MIT" ]
permissive
# expand.py # Metadata NAME = 'expand' ENABLE = True PATTERN = r'^!expand (?P<phrase>.*)' USAGE = '''Usage: !expand <phrase> Given a phrase, this inserts a space between each letter. Example: > !expand social distancing s o c i a l d i s t a n c i n g ''' # Command async def expand(bot, message, phr...
true
7b95e1e2a24ed9d74d7fadc49d1ee09386d5c460
hartzcc/hacker_rank
/swap.py
UTF-8
180
3.375
3
[]
no_license
string = 'ABCDCDC' sub_string = 'CDC' ctr = 0 end = len(sub_string) for i, _ in enumerate(string): if string.find(sub_string, i, i + end) != -1: ctr += 1 print(ctr)
true
bd3f4f009490ff86bdd3450c6a52af4cad48c088
AlisonQuinter17/holbertonschool-higher_level_programming
/0x0A-python-inheritance/3-is_kind_of_class.py
UTF-8
209
3.28125
3
[]
no_license
#!/usr/bin/python3 """Module for is_kind_of_class method.""" def is_kind_of_class(obj, a_class): """This method determine if object is an instance or a subclass.""" return (isinstance(obj, a_class))
true
70a3540826c95be3079ba1c722427ae7c72c1278
heyshb/Competitive-Programming
/CodeChef/17/JULY17/NITIKA.py
UTF-8
295
3.390625
3
[]
no_license
def modify(str): return str.capitalize() def modify2(str): return str.upper()[0]+". " T = int(input()); for i in range(0,T): s = input() words = s.split(' '); for j in range(0,len(words)-1): if (words[j] != ""): print(modify2(words[j]),end = '') print(modify(words[len(words)-1]))
true
1f54bb719e4d233100c55cebf20bea02d640d089
so-coolboy/mouse-track
/过拟合/overfit3.py
UTF-8
1,611
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Oct 19 09:20:10 2017 @author: Yang """ ''' 判断所需特征的个数 特征的数量与模型误差关系 大概50个左右的特征 特征的随机选取造成误差波动很大 ''' import pandas as pd import numpy as np import random import xgboost import matplotlib.pylab as plt train = pd.read_csv(r"G:\比赛分享\data\alltrain.csv") test= pd.read_csv(r"G:\比赛...
true
0e7c7dfe0e898a19fc6cd7e6b983b1cb4593a927
galmasi/keylime
/keylime/mba/mba.py
UTF-8
4,724
2.515625
3
[ "Apache-2.0" ]
permissive
import json from typing import Dict, List, Mapping, Optional, Set, Tuple from keylime import config from keylime.common import algorithms from keylime.failure import Failure from keylime.mba.elchecking import mbpolicy, policies from keylime.mba.elparsing import tpm2_tools_elparser # ########## # type definition for a...
true
f0d1d31547eb2672f21c9106b3f2922f5192e359
Tiendinh2000/dinhquangtienSS1
/Include/Pile_per_Gallon.py
UTF-8
124
3.234375
3
[]
no_license
m = int(input("enter numer of mile:")) g = int(input("enter numer of gallon:")) def cal(a,b): print("MPG:",a/b) cal(m,g)
true
9136a49f8fca4338799b3e2c05e88287aba5538e
Central-Hackathon/unBlockFood
/Project/Main.py
UTF-8
3,723
2.53125
3
[]
no_license
from bigchaindb_driver import BigchainDB from bigchaindb_driver.crypto import generate_keypair import time from pprint import pprint bdb_root_url='http://localhost:59984' bdb = BigchainDB(bdb_root_url) # define asset oliveoil={'data':{'ml':{'origin':'lamia','quality':'A'},},} # create keys pr = generate_...
true
2ac0233609b705913dc2784ffd98554b6ec98a9f
MarioIshac/FeatureSelector
/selector.py
UTF-8
12,344
3.0625
3
[]
no_license
import math import numpy as np from random import sample class FeatureSelector(): def __init__(self, observed_data_frame, output_column_name, cutoff=None): """ :param observed_data_frame: A pandas DataFrame with input columns to consider and output column. :param output_column_name: Name ...
true
e15608239f61ed687d11717581ce830f050aec35
lykius/raspberry
/raspberry-fly/filters/moving_average_filter.py
UTF-8
929
3
3
[]
no_license
""" filters/moving_average_filter.py Process that filters input data using moving average. """ from collections import deque from pubsub.message import Message from utility.exceptions import * from utility.logger import Logger def moving_average_filter(in_q, out_q, out_topic): logger = Logger(out_q) try: ...
true
0f107ce05992a11f4e1467c403f3960b8be9d035
lewisamarshall/euler
/030/030.py
UTF-8
165
3.046875
3
[]
no_license
min=32 max=5000000 total=0 for i in range(min, max): dig_sum=0 for ch in str(i): dig_sum+=int(ch)**5 if i==dig_sum: print i total+=i print total
true
d14d0500350016d93955e63dd5ee7cc9a5fa8b8f
aleksey-ushakov/GeekBrains-HW
/Python Algorythm 1/HW02/HW02 Ushakov.py
UTF-8
7,544
4.25
4
[]
no_license
import random #1. Написать программу, которая будет складывать, вычитать, умножать или делить два числа. Числа и знак операции вводятся пользователем. # После выполнения вычисления программа не должна завершаться, а должна запрашивать новые данные для вычислений. # Завершение программы должно выполняться при вводе сим...
true
e25ed6459741aa82bf7170db060e2981d812ff28
chuhongwei/vedioCompress
/TestDemo/VideoCodec/getResidual.py
UTF-8
991
2.890625
3
[]
no_license
from PIL import Image from numpy import average, dot, linalg import cv2 def diatance_ratio(v1,v2): distance=0 avg=0 for i in range(0,3): avg+=(0+v1[i]+v2[i])/2 distance+=abs(0+v1[i]-v2[i]) return distance/(avg+1) def cal_distance(im1,im2): distance=0 M,N,K=im1.shape ...
true
6861ac7837505d80b845dc6433a14c38fa7085fd
cloew/DevLog
/devlog/config/config.py
UTF-8
1,486
2.65625
3
[ "MIT" ]
permissive
from kao_config import GlobalConfigFile from kao_decorators import lazy_property import os import toml EDITOR_KEY = 'editor' LOG_DIR_KEY = 'log_dir' class Config: """ Represents the DevLog Configuration """ CONFIG_FILENAME = ".devlog" @lazy_property def config(self): """ R...
true
6431f68390b9a989ec21998e6160f545032e1155
MBras/AOC2020
/23/part2.py
UTF-8
4,464
3.796875
4
[]
no_license
import time data = list("389125467") data = list("158937462") data = [int(i) for i in data] # convert to a list of numbers #Represents the node of list. class Cup: def __init__(self,data): self.data = data; self.next = None; class CupCircle: #Declaring head and t...
true
08dcd9e186c2bd10eba9a0ed940d9cc19ebba933
madschade/neo4j
/graphsimplification.py
UTF-8
4,633
2.640625
3
[]
no_license
""" Create simplified second graph """ from neo4j.v1 import GraphDatabase, basic_auth URI = "bolt://localhost:7687" USERNAME = "neo4j" PASSWORD = "neo4j1" INPUTGRAPH = "load.cy" class GraphSimpification(object): def __init__(self, uri, user, password): self._driver = GraphDatabase.driver(uri...
true
80ce1ec5d54226514d8c5ac7e0407ec09b395fb1
matin-ufl/har_shape_features
/demo_supervised_learning_draft_dictionary.py
UTF-8
14,229
2.84375
3
[]
no_license
from dictionary_learning.supervised_learner import SupervisedLearner from dictionary_learning.utils import Utils import os import pandas as pd import time def learnDictionaryDraft(): tic = time.time() # Instantiating supervised learner class. sl = SupervisedLearner() # List of activities in csv file...
true
8c8bfc2630642693dea446337158a019712d8fff
JoseFernandoInsper/ProjetoFinalCloud
/tesks.py
UTF-8
877
2.921875
3
[]
no_license
from sys import argv from datetime import datetime import requests import json with open("dns.txt", "r") as file: text = file.readlines() url = "http://" + text[0] + "/tasks/" COMMANDS = ["get", "add", "delete"] if __name__ == "__main__": if argv[1] == COMMANDS[0]: response = requests.get(url + "get/") ...
true
91e82e28437787e561e4ab9a98f160c8d1791aef
laucia/germanizator
/germanizator/germanification.py
UTF-8
1,650
3.046875
3
[ "MIT" ]
permissive
import re germanifications = [ ( "accents", re.compile(r'[ˈˌ]'), r'' ), ( "initial eszett", re.compile(r'\bß'), r's' ), ( "eszett before consonant", re.compile(r'([^aeiouäöü])ß'), r'\1s' ), ( "eszett before vowe...
true
a132c1c1563067980b2631508d6d63b95251023d
yuniaohappy/LearningPython
/Python带我起飞/9-11.py
UTF-8
624
3.78125
4
[]
no_license
#Python中元类的实现原理 # def fun(self): # print('元类中的函数!!!') # # # cls = type('MyClass',(object,),dict(myfun=fun)) # cls = type('MyClass',(object,),{'myfun':fun}) # obj = cls() # obj.myfun() # print(cls.__name__) # print(cls.__bases__) # print(cls.__dict__) class MyClassMetaClass(type): def __new__(cls, name, bases,a...
true
b528de2317dff453e8a31dce297374f5269cd034
Druciaki/Energy
/readtsv.py
UTF-8
2,322
3.25
3
[ "BSD-3-Clause" ]
permissive
# # @author: Thiago Druciaki Casagrande # # Read TSV input file and serves data as np arrays # import os, sys import numpy as np import pdb; class energy_file: efile = None def __init__(self, name=''): self.efile = open(name) self.data_indexes = [] self.date_column_index = 0 # Always...
true
4f720a5a3977e623e94629c9ea3f516fc348541c
JoseIbanez/rp-shot
/social-media/mastodon_upload.py
UTF-8
1,080
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import argparse from os.path import expanduser import json from mastodon import Mastodon import logging logger = logging.getLogger(__name__) def upload(filename,message): try: with open(expanduser('~/.secrets/mastodon.json')) as f: auth_data = json.load(f) ...
true
41454f9be600331d062028ab553c116badd8c684
Cimetiere/Twitch_project
/app.py
UTF-8
22,235
2.703125
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import plotly.express as px import plotly.graph_objects as go import bar_chart_race as bcr from functools import reduce import cv2 from wordcloud import WordCloud from PIL import Image, ImageDraw, ImageFont from sklearn import preprocessing import s...
true
c78af89964e0d91539d0e7c07bffa8f26e814298
banana6742/machinelearning
/5p_html.py
UTF-8
2,961
3.34375
3
[]
no_license
from bs4 import BeautifulSoup as Bs school=""" <address> <head> <title>This is spice up academy</title> </head> <body> <schools> <p class="title"> <b>This is located in the heart of Bangalore city koramangala</b> </p> <classrooms> <classroom id="555F"> <teacher>Lohit...
true
0650c5e69d287059296d467d03214b61b5a9c466
wgoakley/typed_python
/nativepython/tests/alternative_compilation_test.py
UTF-8
4,622
2.78125
3
[ "Apache-2.0" ]
permissive
# Coyright 2017-2019 Nativepython Authors # # 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 ...
true
bbcc13043a052bb63625482d7837d999e854b099
artemshekh/abiboka
/structure/particle.py
UTF-8
1,012
3.03125
3
[]
no_license
from utils.constants import ELECTRON_MASS, PROTON_MASS, NEUTRON_MASS, ELECTRON_CHARGE class Particle(object): def __init__(self): """ TODO: common properties of particles :return: """ raise NotImplementedError() def __eq__(self, other): return isinstance(self, o...
true
a2e3b0c795807b3f542c2e0a3759b5b75d2bfea9
webtechanoj/compoundInterest_python
/compoundInterest.py
UTF-8
534
3.59375
4
[]
no_license
# V 1.1 Calculate the compound interest Test commit def compound_interest(principle, rate, time, frequency): result = principle * (pow((1 + rate), 24*time)) return result p = float(input("Enter the principal amount: ")) r = float(input("Enter the interest rate: "))/100 t = float(input("Enter the days: ")...
true
de4ec7fa8671d809174d4d5f8a40de43ed947dae
Ita-Moz/Thong-Ke-May-Tinh
/PhanPhoiNhiThuc.py
UTF-8
2,042
3.171875
3
[]
no_license
from matplotlib.pyplot import xlabel, ylabel import scipy import seaborn as sns import numpy as np from scipy import stats import matplotlib.pyplot as plt from scipy.stats import norm # Bai1: Tính phân phối nhị thức x = stats.binom(120, 0.25) # xác định số câu trên 65 prA = 1-x.cdf(65) ky_vong = x.mean() do_lech = x....
true
55d43e872c216e85b5c157109cb325b6b1eb13c2
gwencatliu/numbertheory
/pptriplespractice.py
UTF-8
281
4.0625
4
[]
no_license
def primtriples(x, v): a = x**2 - v**2 b = 2 * x * v c = x**2 + v**2 print(a , b , c, "\n") value = int(input("Give a range: ")) for i in range(1, value, 1): v = i for j in range(i+1, value, 1): u = j print(u,v) primtriples(u,v)
true
b0838174cfb2c6ed410c9bce8a8bed0166ec2dfa
dkogan/python_extensions_without_setuptools
/project/pymodule.py
UTF-8
242
2.609375
3
[]
no_license
#!/usr/bin/python2 r'''A module written in python''' from __future__ import print_function from . import c_library def g(): r'''some function''' print("in my written-in-python module g(). Calling c_library.f()") c_library.f()
true
a06568e1ee2dbab35b51180f2cc16455d1b2ab3d
mohmansour/movies-list
/media.py
UTF-8
676
3.28125
3
[]
no_license
# import the modules you need to complete the project-webbrowser give us the ability to access online URLs import webbrowser # define a new Class (Movie) to represent the initial form of movies class Movie(): # here is the documentation of class """this is the initial class for movies before definition for ea...
true
cb05fb5473eef818d5d1006afc755e0f42784a92
buyaoliandemogutou/interfaceTest
/common/readExcel.py
UTF-8
3,270
2.84375
3
[]
no_license
import os import unittest from common.configHttp import RunMain from ddt import ddt,data import xlwt as xlwt #调用读Excel的第三方库xlrd from xlrd import open_workbook import getpathInfo # 拿到该项目所在的绝对路径 path = getpathInfo.MakePath().get_Path() # path=os.path.dirname("usercase.xlsx") class readExcel(): def excel_data_list(sel...
true
683341f9f27a0f76828286fc8b124912f1b7e386
StoyankaNikiforova/Snake-Python-Game
/class_food.py
UTF-8
168
2.609375
3
[]
no_license
from class_world_object import WorldObject class Food(WorldObject): def __init__(self, name, energy): self.energy = energy super().__init__(name)
true
97002b83483c1be4ecb75b45c9d830547306bb2d
DumbMachine/POC
/src/image/color_based_segmentation.py
UTF-8
2,317
2.625
3
[]
no_license
import os import colorsys import cv2, numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans # image_path = "../../test/proposal_cce_pepper_small.png" image_path = "../../test/nemo0_crop.jpg" image_path = "../../test/yeezes_single_crop.jpeg" image = cv2.imread(image_path) image = cv2.cvtColo...
true
5dc0fc661d828edd512d72217468962dc3cb507a
caoyu11337/computational_linguistics
/RNN_Poetry_Generate/rnn_models.py
UTF-8
6,339
2.609375
3
[ "Apache-2.0" ]
permissive
import tensorflow as tf import functools import setting import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' HIDDEN_SIZE = 128 # LSTM隐藏节点个数 NUM_LAYERS = 2 # RNN深度 def doublewrap(function): @functools.wraps(function) def decorator(*args, **kwargs): if len(args) == 1 and len(kwargs) == 0 and callable(...
true
39eeacb644339f1f2d2fced843368d500c7def80
saintjeremy/PyBasics
/samples/dict.py
UTF-8
733
4.03125
4
[]
no_license
#!/usr/bin/python3 # Dictionaries map keys to values. dieter = { 'mike': 456, 'bill': 399, 'sarah': 521 } # Subscripts. try: print(dieter) print(dieter['bill']) print(dieter['nora']) print("Won't see this!") except KeyError as rest: print("Lookup failed:", rest) print() # Entries can be added, u...
true
ddae46c0baa73fd6d9b36632bd319a1f78a50f7d
davidmatthews1uvm/2020-ALIFE
/paretoFront/axis.py
UTF-8
2,305
3.09375
3
[]
no_license
import localConstants as lc import math, pygame import numpy as np from abc import ABC, abstractmethod class AXIS(ABC): def __init__(self,screen,myfont): super().__init__() self.screen = screen self.myfont = myfont self.Set_Label() self.textrect = self.text.get_rect...
true
796e11a2215ba9d1e83fe29333f9c2b57d6ce04e
pearpai/TensorFlow-action
/deep_learning_with_tensorFlow/Chapter05/p11201.py
UTF-8
517
3.03125
3
[ "Apache-2.0" ]
permissive
import tensorflow as tf # 使用和保存模型代码中一样的方式来声明变量 v1 = tf.Variable(tf.constant(1.0, shape=[1]), name='v1') v2 = tf.Variable(tf.constant(2.0, shape=[1]), name='v2') result = v1 + v2 # 声明tf.train.Saver类用于保存模型 saver = tf.train.Saver() ''' 参数 初始化 ''' with tf.Session() as sess: # 加载已经保存的模型,并通过已经保存的模型中变量的值来计算加法 saver...
true
2eaeba2d811f8fa42a9cdbc53662c1b2c594aa9d
alexandraback/datacollection
/solutions_6377668744314880_0/Python/Lau/C.py
UTF-8
534
2.9375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- def solve(N,M): cuts = [] for X0,Y0 in M: mincut = N-1 for Xi,Yi in M: if (Xi,Yi) == (X0,Y0): continue cut = 0 for x,y in M: if (x-X0)*(Yi-Y0)<(y-Y0)*(Xi-X0): cut += 1 mincut = min(cut, mincut) cuts.append(mincut) return "\n".join(str(i) ...
true