blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
f57f2441f24f7db7e5c9a9d3613376ab06d44cf8
Python
wonyeonglee/studyCT
/Greedy/greedyQuiz7.py
UTF-8
278
3.671875
4
[]
no_license
#설탕 배달 (백준 문제) n = int(input()) sum=0 original_n = n #먼저 5킬로 먼저 담는다. sum+= n//5 n = n%5 #그 다음 3킬로 담는다 sum+= n//3 n = n%3 if(n!=0): n= original_n sum = n // 3 n = n%3 if(n!=0): sum = -1 print(sum)
true
64f847f9400c047977543ab95ccb1e5762468512
Python
ParkJeongseop/Algorithm
/Python/11399.py
UTF-8
158
2.890625
3
[]
no_license
n = int(input()) p = sorted(map(int, input().split())) answer = 0 for i in range(len(p)): for j in range(i+1): answer += p[j] print(str(answer))
true
3c95d0a3127670efc01bd4272d04d64c17f9635e
Python
daobilige-su/guts
/GPy-0.4.6/GPy/examples/regression.py
UTF-8
11,878
2.9375
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2012, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) """ Gaussian Processes regression examples """ import pylab as pb import numpy as np import GPy def toy_rbf_1d(optimizer='tnc', max_nb_eval_optim=100): """Run a simple demonstration of a standard Gau...
true
2fa07fcbe8a7255a871ef21574bd0f0900d996d5
Python
Energy-Queensland/nem-reader
/print_examples.py
UTF-8
2,380
2.5625
3
[ "MIT" ]
permissive
import nemreader as nr def output_file(): from nemreader import output_as_csv file_name = "examples/unzipped/Example_NEM12_multiple_meters.csv" output_file = output_as_csv(file_name) def pandas_df(): from nemreader import output_data_frames file_name = "examples/unzipped/Example_NEM12_multip...
true
3d6bffb4164c62aba2ec9f9b76f20998ce25b75c
Python
chippolot/advent-of-code
/2020/07/7_1.py
UTF-8
759
3.34375
3
[]
no_license
map = {} seen = set() def traversecontainers(color): print(color) if color in seen: return seen.add(color) if color in map: for c in map[color]: traversecontainers(c) lines = open('input.txt', 'r').read().splitlines() counting_color = 'shiny gold' for line in lines: ...
true
d09b22bb1f78b0d1ab38f96a7aba7979df8bd4bf
Python
chuck1l/market_intelligence
/src/fea_ing_description.py
UTF-8
1,738
3.03125
3
[]
no_license
import pandas as pd import numpy as np from datetime import date import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error #plt.style.use('ggplot') plt.rcParams.update({'font.size': 16}) from pandas_datareader import data as pdr import yfinance as yf # Create the date range for data start_date =...
true
acf006fc9917762d255994f2373a2223d47d46e9
Python
youthgovernsl/THE-IDLE-PythonCrashCourse-2021
/Week-6/6.1_Basic image transforms.py
UTF-8
853
3.296875
3
[]
no_license
import cv2 img = cv2.imread('Samples/RGB.png') # loads an image (formats including jpg and png are supported) # relative or absolute file path could be provided print(img.shape) # dimensions of image img1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # conversion from BGR to RGB colour schemes # Syntax: cv2.rectangle(ima...
true
0242e02c423cec90266b8905063f8ffcaca76f6c
Python
paulmcheng/Machine-Learning-For-Trading
/05-Statistical-analysis/simple_moving_average.py
UTF-8
1,447
3.171875
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import sys from pathlib import Path as pa sys.path.insert(0, str(pa(__file__).resolve().parent.parent)) from common import stockdata as sd def get_rolling_mean(df, window): return df.rolling(window=window, center=False).mean() def get_rolling_std(df, window): ...
true
2650d907feaecccdee8684d3f49d32ea1150af55
Python
mh105/somata
/somata/basic_models/arn.py
UTF-8
18,488
2.8125
3
[ "BSD-3-Clause-Clear", "BSD-3-Clause", "BSD-2-Clause" ]
permissive
""" Author: Mingjian He <mh105@mit.edu> arn module contains autoregressive model of order n methods used in SOMATA """ from somata.basic_models import StateSpaceModel as Ssm from somata.exact_inference import inverse import numpy as np import numbers from scipy.linalg import block_diag class AutoRegModel(Ssm): ...
true
88939c71ff6e2dc0b984abc9ab9f70a788419c6a
Python
rahulrkroy/coding
/pythonbasics/generator.py
UTF-8
122
3.421875
3
[]
no_license
def topten(): n=1 while(n<=10): yield(n*n) n+=1 values=topten() for i in values: print(i)
true
661837cd7886c47de2847f854b1a86cd6ab8dadb
Python
Techwrekfix/Starting-out-with-python
/chapter-3/5. Mass_and_weight.py
UTF-8
447
4.59375
5
[]
no_license
#This program measure the weight of objects #Getting the mass of an object from user mass_of_object = float(input("Enter the mass of the" \ " mass of the object: ")) #Calculating the weight: weight = mass_of_object * 9.8 print("\nThe weight of the object is N", format(weight,'.2f'),sep='')...
true
7c7feadbdf5f5c7da78e35fa299223d84e8e64fb
Python
sischei/global_solution_yale19
/Lecture_5/code/scikit_multi-d.py
UTF-8
2,123
3.234375
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt import cPickle as pickle from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C np.random.seed(1) # Test function def f(x): """The 2d function to predict.""" return np.sin(x[0...
true
3291b2caffcee42cabb42f2402fe14eff0606db5
Python
sand9888/DAT210x-python
/lab7/cross_validation.py
UTF-8
779
2.90625
3
[]
no_license
from sklearn.cross_validation import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0) # Test how well your model can recall its training data: model.fit(X_train, y_train).score(X_train, y_train) #0.943262278808 # Test how well your model can predict unseen data...
true
65957b16bd11b573a7ae2e8ede5c5fe181ce8051
Python
YatinGupta777/Python-Programs
/Gfg/Subarray of size k with given sum.py
UTF-8
780
4.0625
4
[]
no_license
# Python program to check if any Subarray of size # K has a given Sum # Function to check if any Subarray of size K # has a given Sum def checkSubarraySum(arr, n, k, sumV): # Check for first window curr_sum = 0 for i in range(0,k): curr_sum += arr[i] if (curr...
true
485b382de50f8b0afba1f8ef14751b06f8a8178f
Python
gjanesch/Darebee-Scraper
/darebee_scraping_functions.py
UTF-8
5,442
2.75
3
[]
no_license
import re import os from bs4 import BeautifulSoup import pandas as pd import requests import darebee_scraper_constants as consts # Shorthand for grabbing a web page def get_page_html(url): return BeautifulSoup(requests.get(url).text, "lxml") # Checks the main page and grabs all of the workout URLs def get_dare...
true
6e2888f477443ad040000c6598d7e21b30497103
Python
sanfendu/TCM_word2vec
/train_model.py
UTF-8
2,282
2.53125
3
[]
no_license
import GlobalParament import utils from gensim.models import word2vec #训练模型word2vec def train(sentences, model_save_path): print("开始训练") model=word2vec.Word2Vec(sentences=sentences,size=GlobalParament.train_size,window=GlobalParament.train_window) model.save(model_save_path) print("保存模型结束") ...
true
b92dcd150c250c8eb62f373c50d40e5a8e8b4182
Python
Seralpa/AdventOfCode2018
/day3/p1.py
UTF-8
791
3.34375
3
[ "MIT" ]
permissive
class Rectangle: def __init__(self, offset, size, id): self.offset = (int(offset[0]), int(offset[1])) self.size = (int(size[0]), int(size[1])) self.id = id def fillRect(self, matrix): for i in range(self.offset[0], self.offset[0] + self.size[0]): for j in range(self.offset[1], self.offset[1] + self.size[1...
true
05ad53adc73ed59e04c7a46ba4b25af21c5440c6
Python
ZainebPenwala/Python-practice-problems
/longest word.py
UTF-8
541
3.9375
4
[]
no_license
# find_longest_word that takes a list of words and returns the length of the longest one. li=['hi','hello','wonderful'] longest=li[0] for elem in li[1:]: if len(elem)>len(longest): longest=elem print(longest,len(longest)) # filter_long_words that takes a list of words and an integer n and retur...
true
5f45178558e81970290c61add495858fc41f56c4
Python
jaceycarter/datavisualizationhw02
/piechart.py
UTF-8
1,404
3.3125
3
[]
no_license
#importing stuff import json import pprint import matplotlib.pyplot as plt import numpy as np #with open('us_senators.json', 'r', encoding = 'ASCII') as f: #sen = f.read() #us_senators = json.loads(sen) #with open('us_governors.json', 'r', encoding = 'ASCII') as f: #gov = f.read() #us_...
true
cb72a6d2c4bc8befa159b048c8781bc084fa5205
Python
vitormrts/python-exercises
/Desafios/des090b.py
UTF-8
409
3.9375
4
[ "MIT" ]
permissive
num = list() par = list() impar = list() while True: num.append(int(input('Digite um valor: '))) resp = str(input('Quer continuar? [S/N] ')).upper().strip()[0] if resp == 'N': break for i, v in enumerate(num): if v % 2 == 0: par.append(v) else: impar.append(v) print(f'\nLista...
true
b308224630d899293555011972e395b22599b004
Python
Cactiw/UText_bot
/libs/locations/castle.py
UTF-8
686
2.84375
3
[]
no_license
from libs.locations.location import * class Castle(Location): def __init__(self, id, name, fraction): super(Castle, self).__init__(id, name) self.fraction = fraction #фракция, которая контроллирует точку def change_fraction(self, new_fraction): self.fraction = new_fraction feds_ca...
true
3e210d1f0d86f844afe91c1086af322e3b95d984
Python
ModellingWebLab/cellmlmanip
/cellmlmanip/rdf.py
UTF-8
1,102
3.390625
3
[ "BSD-3-Clause" ]
permissive
"""Module for working with RDF data.""" import rdflib def create_rdf_node(node_content): """Creates and returns an RDF node. :param node_content: the content for the node. The ``node_content``, if given, must either be a :class:`rdflib.term.Node` instance, a tuple ``(namespace_uri, local_name)``, or...
true
2b9ee5725f8e0dc09c783a34c1318d467c2bba23
Python
evgeniysgs3/YouSecReport
/miscellaneous/tools/Nmap/ReadConfig.py
UTF-8
645
2.65625
3
[]
no_license
import configparser class Config: def __init__(self, file_config): self.f_config = file_config def read_config(self): """Read configuration file""" config = configparser.ConfigParser() config.read(self.f_config) return config def get_auth_for_send_email(self): ...
true
9f37c7e64b57313d282053d751c05d09a218d68d
Python
hunzo/book-devops
/chapter16/otp_dock/python/tests/unit_tests/otp_test.py
UTF-8
872
2.671875
3
[]
no_license
import pytest from src import otp def test_generate_otp_return_str_type(): res = otp.generate_otp() assert type(res) is str def test_generate_otp_return_length(): res = otp.generate_otp() assert len(res) == 6 def test_generate_otp_return_str_numeric(): res = otp.generate_otp() assert res.isnu...
true
712c71297af0e02f159f9fa837a19cb1d6380384
Python
jeffreylozano1376/Basics_Python
/exercises/4 - dictionary_exercise.py
UTF-8
2,311
3.890625
4
[]
no_license
# Person person_info = {"first_name": "Jeffrey", "last_name": "Lozano", "age": 29, "city": "Mandaluyong City"} print(person_info) # Favorite Numbers friends = { 'jastin': '6', 'gabriel': '1', 'julius': '5', 'shem': '9' } for name, number in friends.items(): print(f"{name.title()}'s f...
true
e504c623fc132d34d87c2bd1c2f14e59a2f86381
Python
xiaohuanlin/Algorithms
/Leetcode/1557. Minimum Number of Vertices to Reach All Nodes.py
UTF-8
1,864
4.03125
4
[]
no_license
''' Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed edge from node fromi to node toi. Find the smallest set of vertices from which all nodes in the graph are reachable. It's guaranteed that a unique solution exists. Notice ...
true
05008032fdb3c51d01923b78ce822c452a250a01
Python
YuriiKhomych/ITEA-BC
/Vlad_Hytun/4_iterations-Hytun_Vlad/hw/HW_41_iterations-Hytun_Vlad.py
UTF-8
478
4.46875
4
[]
no_license
# 1. Write a Python program that accepts a string # and calculate the number of digits and letters. # isdigit() # isalpha() # "a".isdigit() - проверка на стринг или же дигитал digit = 0 letter = 0 my_string = input("Enter please your string: ") for symbol in my_string: if symbol.isdigit(): digit += 1 e...
true
5dd9475718203d40903134af0ee33277f00c4935
Python
elenatheresa/CSCI-160
/elenaCorpus_CSCI160_tuesday_parta-2.py
UTF-8
701
4.0625
4
[]
no_license
''' Elena Corpus CSCI 160 Tuesday 5-7 pm asking the user what kind of shape they wish to draw, either rectangle or triangle ''' shape = input("Choose between rectangle or triangle: ") rectangle = 'rectangle' triangle = 'triangle' if shape == rectangle: print("Enter width: ") width = int(input()) print("...
true
59d10ed580ce5d5e0b9b721f5741a40eb354bc89
Python
Stanleyli1984/myscratch
/lc/prob_72.py
UTF-8
1,027
3.28125
3
[]
no_license
class Solution: # @param {string} word1 # @param {string} word2 # @return {integer} def minDistance(self, word1, word2): dp_array = [float('-inf')] + [float('inf')] * (len(word2)) # At least how many chars are needed to generate inx number of matches # Find the maximal number of matches ...
true
4c2e422fbb0b877e8b7a9e0dd09a6d1df10ed86d
Python
shigeokitamura/atcoder
/abc126/c.py
UTF-8
224
2.875
3
[]
no_license
# https://atcoder.jp/contests/abc126/tasks/abc126_c import math N, K = map(int, input().split()) a = 0 for i in range(1, N+1): x = 0 while(i * pow(2, x) < K): x += 1 a += 1/N * pow(1/2, x) print(a)
true
ea12deb107b764393df6d6a9903c9c199a15f137
Python
alekhka/virtual-assistant-avika
/sewrite.py
UTF-8
664
2.859375
3
[]
no_license
#!/usr/bin/env python import time import serial import sys ser = serial.Serial( port='/dev/ttyS0', baudrate = 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, t...
true
e0e09895ea0d19dca122fed10be1075cb7510712
Python
2legit/python-anandology
/modules/7.py
UTF-8
583
4.03125
4
[]
no_license
""" Write a function make_slug that takes a name converts it into a slug. A slug is a string where spaces and special characters are replaced by a hyphen, typically used to create blog post URL from post title. It should also make sure there are no more than one hyphen in any place and there are no hyphens at the b...
true
b481e1e823f74b036746a446a224c139a8c07dff
Python
kaylezy/Batch-Three
/Ikorodu Center I/Python/Adedejiproject.py
UTF-8
2,499
3.9375
4
[]
no_license
#Get user operational input print("welcome to our improved calculator") print("For multiplication input'*',For addition input'+',For division input'/',For Subtraction input'-',") print("========================================================================================") user_input= input("what mathematical op...
true
121b78373fd3a4b7d9a4a20dbff9f0e7746350ec
Python
jleng7987/Algorithm-sorting
/面试真题整理/完美世界/盒子套.py
UTF-8
560
2.984375
3
[]
no_license
import math n=int(input()) ls = [] lsd = [] for i in range(0,n): c, k = map(int, input().split()) d = (math.pow(c, 2) + math.pow(k, 2)) ** 0.5 ls.append([c,k]) # ls1 = set(ls) # ls1.sort(reverse=True) print(ls) def minl (i, min, count=0): if i == n: return count if ls[i][0] > min[0] & ls[i]...
true
12d6053cb183e29dcdaa96ee7de1d4ee90afbb99
Python
Etherealskye/Mango
/MangoMain.py
UTF-8
17,563
2.921875
3
[]
no_license
import os import discord import sys import pandas as pd import youtube_api.youtube_api_utils from youtube_api import YouTubeDataAPI from dotenv import load_dotenv from discord.ext.commands import Bot from discord.ext import commands from HololiveStreamer import hololiveStreamer from HololiveStream import HololiveStream...
true
be5cf3d11d65ea23b23970d73e245e5d9b305398
Python
EstradaAlex20/Computer-Graphics-1-Project
/Texture.py
UTF-8
4,225
2.65625
3
[]
no_license
from Program import * import io import png import zipfile import os.path class Texture: def __init__(self, typ): self.type = typ self.tex = None def bind(self,unit): glActiveTexture(GL_TEXTURE0 + unit) glBindTexture(self.type,self.tex) def unbind(self,unit): ...
true
6ef68666458f6802f71e6e46ee1e82b967015c32
Python
LuterGS/AI2020_H2
/LuterGS/Preprocess.py
UTF-8
7,007
2.984375
3
[]
no_license
from tqdm import tqdm import numpy as np import os from konlpy.tag import Okt # 파일 INIT PATH = os.path.dirname(os.path.abspath(__file__)) TAG = Okt() TAG_NAME = [ "Noun", "Verb", "Adjective", "Determiner", "Adverb", "Conjunction", "Exclamation", "Josa", "PreEomi", "Eomi", "S...
true
a79a05b827aa945dddb12253b57a77e31a779d1e
Python
xxz/test-av2
/snippet/dynamic_calls.py
UTF-8
1,909
2.828125
3
[]
no_license
class vm: def power_on(self): return "vm is powered on" def exec_cmd(self, cmd): return "%s executed on vm" % cmd def revert_snapshot(self, name): return "reverting to snapshot %s" % name def task(self, *args): return "something goes wrong" def thre...
true
bcadf44db8076d68b7ecf81f09694e90d36de68d
Python
16kozlowskim/Software-Engineering
/scraper/news.py
UTF-8
1,092
3
3
[]
no_license
import feedparser, csv, sys from pyteaser import SummarizeUrl def get_rss(search): url = 'https://news.google.com/news/rss/search/section/q/'+search+'/'+search+'?hl=en&gl=GB&ned=us' d = feedparser.parse(url) return d def get_data(rss, num): pathToCSV = '../fileStore/file.csv' data= [] with op...
true
1953080c273eef8f3ad7753d52e31d6b5632bce8
Python
nadav366/intro2cs-ex2
/quadratic_equation.py
UTF-8
1,431
4.46875
4
[]
no_license
def quadratic_equation(a, b, c): """ This function accepts factors of a second-order equation and returns the solutions :param a: Numeric value, factor of x^2, Suppose he did not 0 :param b: Numeric value, factor of x :param c: Numeric value, free factor :return: Numeric value, Equation...
true
936ac996ada27dc7cce81fe832a3c0f8d06acd75
Python
adamsjoe/keelePython
/Week 3/11_4.py
UTF-8
1,393
4.46875
4
[]
no_license
# Dictionaries in Python are Mutable. Dictionaries are passed to functions by reference. # A dictionary dict is declared as: # dict={'Andrew':5, 'Brian':3, 'Clive':2, 'David':4} # it contains the names of volunteers and the number of times that they have volunteered for a particular duty. The dictionary is regularly ...
true
b77d1824eddaab7e4998c374ff761bac65a6f586
Python
muggin/string-kernels
/src/ngk_kernel.py
UTF-8
529
3.546875
4
[]
no_license
def create_ngrams(text, n): """Create a set of ngrams of length n""" return set(text[i:i+n] for i in range(len(text)-n+1)) def ngk(doc1, doc2, n): sd1 = create_ngrams(doc1, n) sd2 = create_ngrams(doc2, n) if len(sd1 | sd2) == 0: return 1.0 return len(sd1 & sd2) * 1.0 / len(sd1 | sd2)...
true
cd3ba5abdd2e221f464815bbc9bd5d0f7ea3582f
Python
henrymendez/garage
/openai/venv/lib/python3.10/site-packages/langchain/document_loaders/sitemap.py
UTF-8
2,392
3.078125
3
[]
no_license
"""Loader that fetches a sitemap and loads those URLs.""" import re from typing import Any, Callable, List, Optional from langchain.document_loaders.web_base import WebBaseLoader from langchain.schema import Document def _default_parsing_function(content: Any) -> str: return str(content.get_text()) class Sitem...
true
39377dc4982404044b77233e7108a91a7948f765
Python
varuneranki/CKANCrawler
/ckancrawler/main.py
UTF-8
2,444
2.859375
3
[]
no_license
#!/usr/bin/env python #python Epydoc docstring for a function http://epydoc.sourceforge.net/manual-epytext.html __version__ = '$0.1$'.split()[1] __author__ = 'Varun Maitreya Eranki' __doc__=''' @author: U{'''+__author__+'''<http://www.github.com/varunmaitreya>} @version: ''' + __version__ +''' @copyright: 2018 @licen...
true
0d4fe47435395b42e0825e0ea88e956f3a797e3c
Python
rafaelburgueno/Bitbugsg5
/proyectofarmacia/core/views.py
UTF-8
1,881
2.640625
3
[]
no_license
from django.shortcuts import render # importamos el TemplateView para implementar las vistas basadas en clases from django.views.generic.base import TemplateView class HomePageView(TemplateView): template_name = 'core/home.html' # metodo para insertar el diccionario de contexto(datos de la base de ...
true
2b61799afa6edd44fe232dd1066765ef6a2c937b
Python
lawy623/Algorithm_Interview_Prep
/Algo/Leetcode/074SearchA2DMatrix.py
UTF-8
609
3.3125
3
[]
no_license
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ n = len(matrix) m = len(matrix[0]) i = 0 j = n * m - 1 while i <= j: mid = (i + j) / 2 ...
true
7531fd17c7fc73bd178e2dd3ac89702fc83099a1
Python
PSFREITASUEA/walkcycle-mario
/Player.py
UTF-8
4,898
3.015625
3
[]
no_license
import pygame.image from SpriteLoader import * from utils import * class Player: def __init__(self, pos_x, pos_y): self.sprites_walk_right = load_sprites_walk_right() self.sprites_run_right = load_sprites_run_right() self.sprites_walk_left = load_sprites_walk_left() self.sprites_r...
true
dab916828f7c3612739071338775a224af82bb2f
Python
gerardburgues/LinearRegression
/LinearRegression/main.py
UTF-8
4,105
3.265625
3
[]
no_license
""" La nostra base de dades tracta sobre el rendiment d’alumnes de secundària en dos escoles portugueses. Els atributs inclueixen dades sobre les seves calificacions, característiques demogràfiques, socials i característiques relacionades amb l’escola. Totes aquestes dades han sigut obtingudes de informes escolars ...
true
9e3a2e41cfcd1309d98f50447ff41be17f0b7796
Python
blorente/beyond-the-loop
/scripts/post-formatter.py
UTF-8
3,565
2.671875
3
[ "MIT" ]
permissive
#/usr/bin/python3 import argparse import re import sys from pathlib import Path def printerr(*args): print(*args, file=sys.stderr) def parse_args(): parser = argparse.ArgumentParser(description='Process blogs') subparsers = parser.add_subparsers(dest="subcommand_name") devto_subcommand = subparsers.a...
true
b2878b7c19ba36aa3d20026f61cc7ba1f4f3e40d
Python
Eric-Canas/BetArbitrageAnalysis
/Scrapers/MainScraper.py
UTF-8
2,776
3.140625
3
[ "MIT" ]
permissive
from requests import get from requests.status_codes import codes from lxml import html from Scrapers.commons import * from time import sleep from random import uniform, shuffle from Constants import * class BetScraper(): """ Class that extract all the information of oddschecker.com/es/ """ ...
true
7e58c6e7b1f295595ad812bfcde2dc6cd195136d
Python
veetarag/Data-Structures-and-Algorithms-in-Python
/DataStructure/linkedList.py
UTF-8
2,116
3.75
4
[]
no_license
class Node(): def __init__(self, val): self.val = val self.next = None def traverse(self): node = self while node!=None: print(node.val) node = node.next def printnext(self): print(self.next) def removeKfromList(self, head, key): ...
true
867b7b849da612b5d3bf12c55fb7fd1b21083b18
Python
deref007/learn_python_web
/learn_web/app_resp2.py
UTF-8
923
2.609375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask import Flask, jsonify from werkzeug.wrappers import Response from config import setting app = Flask(__name__, static_folder='/web_ui') app.config.from_object(setting) """ 另一种响应的方法 使用werkzeug内置的Response进行返回,使用jsonify进行json的格式化返回 """ class JSONResponse(Response...
true
7c6e97355fa776c0a8723a6001682e88b177b405
Python
samjabrahams/taqtoe
/taqtoe/player/human.py
UTF-8
2,370
4.03125
4
[]
no_license
import taqtoe.utils as utils from taqtoe.exceptions import BadMoveException from taqtoe.player.player import Player class HumanPlayer(Player): """ Class for a human tic-tac-toe player. """ def move(self, game): """ Asks for user input from the console to make a move. Will loop until ...
true
f202201e9b465352629aac62062b5af680671604
Python
yuquan1006/Python_Spaces
/library/p_requests/unit_test.py
UTF-8
905
3.953125
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # Version : py2 import unittest # 对abs()函数单元测试 # 设计测试用例 # 输入正数,比如1、1.2、0.99,期待返回值与输入相同; # 熟入负数,比如-1、-1.2、-0.99,期待返回值与输入相反; # 输入0,期待返回0; # 输入非数值类型,比如None、[]、{},期待抛出TypeError。 # add('1','1') class test(unittest.TestCase): def test01(self): self.assertEqual(1,abs(1...
true
c2855dad2fe5db401fb5426737ce141ca8804085
Python
Stoggles/AdventofCode
/2015/day02.py
UTF-8
685
3.15625
3
[]
no_license
test1 = [['2x3x4'], 58, 34] test2 = [['1x1x10'], 43, 14] def calc(list): areas = [] lengths = [] for present in list: dimensions = sorted(int(length) for length in present.split('x')) areas.append(dimensions[0] * dimensions[1] * 3 + dimensions[0] * dimensions[2] * 2 + dimensions[1] * dimensions[2] * 2) # area ...
true
aa6d85eced6f14aa242fdac20cf2b8e3cdf5b321
Python
hiroshi-maybe/deep-learning-from-scratch
/feed-forward-neural-network/neuralnet_mnist.py
UTF-8
1,037
2.6875
3
[]
no_license
import sys, os sys.path.append(os.pardir) import numpy as np import pickle from dataset.mnist import load_mnist from PIL import Image # pip install Pillow from common.functions import sigmoid, softmax def get_data(): (x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, flatten=True, one_hot_label=False)...
true
3b9ae4cbfb5117d150422541e8283b72c5336586
Python
tjytlxwxhyzqfw/online-judge
/codeforces/375/2/A.py
UTF-8
181
2.96875
3
[]
no_license
def read(t=None): string = raw_input() return string if t is None else [t(x) for x in string.split()] if __name__ == "__main__": a = read(int) a = sorted(a) print a[2] - a[0]
true
abfae196f120d72a83a6180263f713091218bdf1
Python
xatshepsut/GraphingApp
/graph_generator/graph_generator.py
UTF-8
1,863
3.328125
3
[]
no_license
# https://networkx.github.io/documentation/latest/reference/generators.html import click import networkx as nx from enum import Enum class GraphType(Enum): Path = 'path' Cycle = 'cycle' Star = 'star' Complete = 'complete' Hypercube = 'hypercube' Wheel = 'wheel' Random = 'random' @classmethod def fromstrin...
true
c6828960992bc69106079a696d9dae097af8b9a2
Python
autosub-team/VHDL_Tasks
/gates/scripts/LogicFormulaCreator.py
UTF-8
3,316
2.671875
3
[]
no_license
#!/usr/bin/env python3 ######################################################################## # LogicFormulaCreator.py # Generates a logic formula for given TaskParameters # # Copyright (C) 2015 Martin Mosbeck <martin.mosbeck@gmx.at> # License GPL V2 or later (see http://www.gnu.org/licenses/gpl2.txt) ##########...
true
8c7f708c13e140998d7c23e3f016f842f41f1d9d
Python
mnihatyavas/Python-uygulamalar
/Bernd Klein (520) ile Python/p_31704.py
ISO-8859-9
976
3.140625
3
[]
no_license
# coding:iso-8859-9 Trke # p_31704.py: Sevgi sembol kalbin topografik grafii rnei. import numpy as np import matplotlib.pyplot as mp from p_315 import Renk x, y = np.ogrid [-1:1:100j, -1:1.56:100j] mp.style.use ("dark_background") mp.contour ( x.ravel(), y.ravel(), x**2 + (y - ((x**2)**(1.0 / ...
true
144ac04d2da7bbd63aa97a60c1194f40d2a7ef25
Python
dongtianqi1125/Miki
/system/data/basicSchedule.py
UTF-8
2,566
2.875
3
[ "MIT" ]
permissive
from datetime import datetime import time from query import Query class BasicSchedule(object): # 时间调度模块 def __init__(self): self.query = Query() self.all_trade_days = None self.system_run_before_trading_start = False self.system_run_after_trading_end = False def run_before_trading_start(self): # 盘前运行 ...
true
eecd71ac67e7a36834e1c5f07009b144e300ef8e
Python
dabuu/test_pycharm
/overcome_python/chapter5 regex/test_regex.py
UTF-8
1,471
3.515625
4
[]
no_license
# -*- encoding:utf-8 -*- __author__ = 'dabuwang' import re; sss = "Life can be good"; print "====================== 1. 匹配&搜索: re.search 从整个string中查询,re.match 从 第一个字母开始查询================"; print re.search("can", sss); # matchobject print re.search("can", sss).group(); #can print re.match("can", sss); # None print ...
true
cf6ef3d6beec70327342ea0171b64154ddf7572f
Python
jefesaurus/hexapod-engine
/old-versions/staging/parts_library/leg_library.py
UTF-8
479
2.515625
3
[]
no_license
__author__ = 'glalonde' import xml.etree.ElementTree as ET import copy from staging.leg import Leg def parse_legs(): tree = ET.parse(parts_path + '/legs.xml') root = tree.getroot() for child in root: new_leg = Leg.from_xml_node(child) legs[new_leg.type] = new_leg def get_leg(name): i...
true
ddfd01cd8f1c4a04fac86eeaccbdb25d8a1275f5
Python
rafaelpascoalrodrigues/snakeAI
/ai_random_play.py
UTF-8
170
2.875
3
[]
no_license
import random # Random engine prng = random.Random() def play(): return prng.randint(0, 3) def main(): print(play()) if __name__ == '__main__': main()
true
f356e2be88e82cc2fdae41079222b9b924cd42b0
Python
ToeKnee/chat-demo
/server/chat/users/email.py
UTF-8
692
2.65625
3
[]
no_license
from django.core.mail import send_mail def send_welcome_email(user): """ Send a welcome email to the specified user """ # Usually I would use something like Foundation Emails and send # HTML + plain text emails. But for simplicity, plain text emails # will do. # http://foundation.zurb.com/ if...
true
69604aa6fc8f38b643aa32cd9123f232483f9ba4
Python
ruxtain/matrix
/matrix/amazon/proxy_pool/__init__.py
UTF-8
1,897
2.609375
3
[ "MIT" ]
permissive
# 放置 proxy_pool 下共用的部分 # 对外交流的脚本 ''' 未来可能购买代理的商家: 阿布 https://www.abuyun.com/pricing.html 西刺 http://www.xicidaili.com/wn/ ''' from matrix.models import * import multiprocessing import time import json import random import requests import os def get_proxy_country(url): ''' url 需要去掉端口部分 根据 url 读取其所属的国别,读取失败...
true
94fe85b2407bc3b19bf212fb8d818cfaf3fa1645
Python
jdanray/leetcode
/subdomainVisits.py
UTF-8
441
3.046875
3
[]
no_license
# https://leetcode.com/problems/subdomain-visit-count/ class Solution: def subdomainVisits(self, cpdomains): count = {} for cp in cpdomains: n, dom = cp.split() n = int(n) dom = dom.split(".") sub = "" for d in dom[::-1]: if sub: sub = d + "." + sub else: sub = d + sub if s...
true
6d3596b5a7994e7660eccf5acc649f3f24f2d810
Python
xc145214/python-learn
/exs/ex12.py
UTF-8
147
3.078125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # 构造 1-100 的奇数列表 L = [] n = 1 while n < 100: L.append(n) n = n + 2 print L
true
127a07e792fa0a15157043e0d03531bbe6c1fea9
Python
weruuu/Program
/Python/link_test.py
UTF-8
556
3
3
[]
no_license
import pymysql # 连接数据库 connect = pymysql.Connect( host='localhost', port=3306, user='Eviless', passwd='', db='mysql', charset='utf8' ) # 获取游标 cursor = connect.cursor() # 查询数据 sql = "SELECT * FROM testtb " cursor.execute(sql) for row in cursor.fetchall(): print(row) print('共查找出', curso...
true
3b0220e68a951cf25df924007d283f8aa6383e7c
Python
lsst-sitcom/spot_motion_monitor
/spot_motion_monitor/controller/plot_ccd_controller.py
UTF-8
1,456
2.515625
3
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
# This file is part of spot_motion_monitor. # # Developed for LSST System Integration, Test and Commissioning. # # See the LICENSE file at the top-level directory of this distribution # for details of code ownership. # # Use of this source code is governed by a 3-clause BSD-style # license that can be found in the LICE...
true
8e1733bf25585703533d5fb6226d5b7cb8a346c1
Python
jasonbaker/agentm
/agentm.py
UTF-8
3,372
2.6875
3
[]
no_license
from pymongo.son_manipulator import SONManipulator __version__ = '0.1.0' class ValidationFailedError(Exception): pass def WritableValue(name, validator=None): """ A value in the dictionary that has been exposed as both readable and writable. :param name: The key of the dictionary to be exposed. ...
true
24fbeabbe57b118a9256170483cae411604e0350
Python
EricWebsmith/ml_framework_poc
/py/job_executor.py
UTF-8
667
2.609375
3
[]
no_license
import json import sys def my_import(name): components = name.split('.') mod = __import__(components[0]) for comp in components[1:]: mod = getattr(mod, comp) return mod def execute(config_file): config={} with open(config_file) as f: config=json.load(f) f.close() in...
true
6a49078ce095279c67650c98249a3732889d189b
Python
rpryzant/code-doodles
/interview_problems/2018/PRAMP/two_sum/twosum.py
UTF-8
1,047
3.1875
3
[]
no_license
""" classic case of pairs [package1 package2 .. package n] weight limit need to select 2 packages whose sum == limit only 1 pair [3 1] [1 3] 1) bf for package, check all others, if sum == limit, return that pair O N^2 2) 21 [4, 6, 10, 15, 16] ^ if we find a 21-6=15 later on, we're done { ne...
true
ceec6e5a52c2f8d8c002db5f8292a70a9a8dbb73
Python
Janoda/ayudantia-IIC1103
/crea_contrataciones.py
UTF-8
639
3.0625
3
[]
no_license
import random f = open("contrataciones.txt", "w") equipos = ["Univ Católica", "U. La Calera", "Unión Española ", "Curicó Unido", "Antofagasta", "U. de Chile", "Huachipato", "U. Concepción", "Audax", "Everton", "Wanderers", "Cobresal", "Iquique", "Palestino", "Coquimbo", "O'Higgins", "La Serena", "Colo Colo" ] newline =...
true
0651f6dbdc463606a0339f7c61ea82aae6aa5aa3
Python
Manuel-MA/webApp
/src/index.py
UTF-8
5,778
2.5625
3
[]
no_license
from flask import Flask, url_for, render_template, request app=Flask(__name__) @app.template_global(name='zip') def _zip(*args, **kwargs): return __builtins__.zip(*args, **kwargs) @app.route("/") def cover(): return render_template('cover.html'), 200 @app.route("/City") def city(): topic='City' pictures=['ar...
true
30a510e4155044572dfed321542d08c8c1afddeb
Python
dschaffner/SSX_python
/PE_SC/constructPatternCount.py
UTF-8
945
3.25
3
[]
no_license
import numpy as np from collections import Counter def constructPatternCount(data,n=5,delay=1): ''' Parameters ---------- data : 1-D array time-series data. n : integer,optional embedding dimension. The default is 5. delay : integer, optional embedday delay. The de...
true
c786c02d94074638caeb83eb265d94b6b0a54687
Python
BhoomikaMS/PIP-1BM17CS047
/divisors.py
UTF-8
117
3.46875
3
[]
no_license
n=int(input("Enter a number: ")) li=[] for i in range(1,(n//2)+1): if n%i==0: li.append(i) li.append(n) print(li)
true
db9de781f8aab920f7d764cbf62e202304a33f8c
Python
paul-yamaguchi/2021_forStudy
/05_01バブルソート.py
UTF-8
254
3.4375
3
[]
no_license
def sort(A): for i in range(0, len(A) - 1): modify_order(A, i) print(A);print() def modify_order(A, i): for j in range(len(A) - 1, i, -1): if A[j - 1] >A[j]: A[j - 1], A[j] = A[j], A[j - 1] sort([9,2,7,4,5])
true
87d873e4c8c46b5aa2ced21af067aab9bf6416b7
Python
tomisilander/bn
/bn/infer/jtr.py
UTF-8
1,061
2.84375
3
[]
no_license
#!/usr/bin/env python import heapq import udg, elo """ Builds a tree of clique(indice)s """ def jtr(clqs, valcs): # sort sepsets (cliquepairs) largest first (smallest weight) w = [elo.weight(clq, valcs) for clq in clqs] clqpairs = [((-len(clq1&clq2), w[i]+w[j]), (i, j)) for (i,clq1) in en...
true
662864a5b8b96d1d3bf6e2ad8d991002c61f3695
Python
chrisk60331/multiprocess-ftp
/test/queue_test.py
UTF-8
1,735
2.6875
3
[]
no_license
"""Test suite for queue classes.""" from unittest.mock import Mock import pytest from multiprocess_ftp.better_queue import BetterQueue def test_better_queue(): better_queue = BetterQueue() expected_object, expected_count = ["foo"], 1 better_queue.put(expected_object) actual_count = better_queue.qsi...
true
de502c74433892da7bcaed427fe5fd46ccc01a87
Python
smspillaz/graph-paths
/increasing.py
UTF-8
108
3.3125
3
[]
no_license
complexity = 20 for i in range(0, complexity): for j in range(0, i): print(i) print(j)
true
c4818505cfcf1c61c62ecf66f41883d492222013
Python
AndrewYoung97/baseline_bigcn
/tools/earlystopping2class.py
UTF-8
2,599
2.859375
3
[]
no_license
import numpy as np import torch class EarlyStopping: """Early stops the training if validation loss doesn't improve after a given patience.""" def __init__(self, patience=7, verbose=False): """ Args: patience (int): How long to wait after last time validation loss improved. ...
true
dda2d3780b425758311b613fc680d8f8b8c987c9
Python
BEmran/sim-to-real
/extra/simple_dynamic.py
UTF-8
3,001
2.921875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 28 11:29:10 2018 @author: emran """ import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint class Dynamic: def __init__(self, s0, dsdt, dt = 0.01, int_type = "rk4"): ns = len(s0) self.dt = dt ...
true
0c107cf6558f60f5e34b11cde5985b2683833f0b
Python
mjj29/deckchecks
/top_tables.py
UTF-8
3,542
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import csv, sys, cgitb, os, cgi from deck_mysql import DeckDB from printers import TextOutput, HTMLOutput from login import check_login from swisscalc import calculateTop8Threshold output = None def top_tables(tournament, form): try: with DeckDB() as db: id = db.getEventId(tournament) ...
true
2b34b3dae39f5b2d2c7e2301f5f5432f827187fe
Python
spacetx/starfish
/starfish/core/experiment/builder/test/test_inplace.py
UTF-8
5,571
2.53125
3
[ "MIT" ]
permissive
import hashlib import os from pathlib import Path from typing import Mapping, Union import numpy as np from skimage.io import imsave from slicedimage import ImageFormat from starfish.core.types import Axes, Coordinates, CoordinateValue from ..builder import write_experiment_json from ..inplace import ( InplaceFet...
true
774d961b22dbec8fce3155c3d8f421a2b96bd20a
Python
pankajsherchan/MachineLearning
/Regression/Linear Regression/SimpleLinearRegression/simplelinearRegression.py
UTF-8
1,891
3.28125
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt def trainData(X, Y, theta, learning_rate, iterations): costs = [] for i in range(iterations): Ytheta = X.dot(theta) cost = Ytheta - Y theta = theta - learning_rate * X.T.dot(cost) mse = cost.dot(cost) / len...
true
de034679596037950018f0b827a868770bf412ea
Python
mlell/tapas
/scripts/src/geom_induce.py
UTF-8
3,143
3.671875
4
[ "MIT" ]
permissive
#!/usr/bin/env python from argparse import ArgumentParser import sys from random import random def main(): parser= ArgumentParser(description=""" Change one base into another with a probability geometrically dependent on proximity to string beginning or end. The function used to calculate the base ex...
true
f362d06212e5c21eec34b245e4a58b02d8ebc44c
Python
jaydoe723/MachineLearning
/Pseudomonas Aeruginosa Files/load_dataset.py
UTF-8
2,434
2.734375
3
[]
no_license
from random import shuffle import glob import sys import re from PIL import Image import tensorflow as tf import pandas as pd TARGET_FEATURE = 'carb.auc.delta' target_df = pd.read_csv("target_labels.csv") # Convert to form the tf will understand def _int64_feature(value): return tf.train.Feature(in...
true
2c9dc19871bbd323ff39b396ca8b92305da78c77
Python
315181690/THC
/Python/HackerRank/Sum_Basic_Looping.py
UTF-8
235
3.46875
3
[]
no_license
#!/usr/bin/python3.7 # #David Alonso Garduño Granados #Python(3.7.4) #01/12/19 #01/12/19 #Se realiza la suma de n terminos de manera recursiva def Sloop(x): if x==1: return(1) else: return(x+Sloop(x-1)) n=int(input()) print(Sloop(n))
true
5df1f4cfd6a8d9c9344d4069d4d27d1f2168ff43
Python
sixspeedchips/neural-net-impl
/src/rework/Functions.py
UTF-8
320
2.78125
3
[]
no_license
import numpy as np class Tanh: @staticmethod def f(x): return np.tanh(x) @staticmethod def prime(x): return (1 + Tanh.f(x)) * (1 - Tanh.f(x)) class Relu: @staticmethod def f(x): return np.maximum(0, x) @staticmethod def prime(x): return (x > 0)*1.0
true
adea984579d1bab82c10734729fe5c98da3cedea
Python
teamopensource/jmeter-test-plans
/php/conversion/k-to-csv-all.py
UTF-8
2,030
2.5625
3
[]
no_license
import sys import glob import argparse import re import os parser = argparse.ArgumentParser(description='Convert cachegrind to csv') parser.add_argument('--cap', default="0", type=int, help="exclude function calls below this threshold (microseconds)") parser.add_argument("--i", default=".", help="directory containing...
true
ff00b75a991236222af676acfb28e8d0addae676
Python
riteshtawde/AI
/WumpusWorld_MDP/wumpus_mdp.py
UTF-8
4,292
3.09375
3
[]
no_license
''' @author: ritesh(rtawde@iu.edu) ''' import solver import time class WumpusMDP: # wall_locations is a list of (x,y) pairs # pit_locations is a list of (x,y) pairs # wumnpus_location is an (x,y) pair # gold_location is an (x,y) pair # start_location is an (x,y) pair representing the start location ...
true
8b1d25ae477860ce2b9d77530cadb250504b135c
Python
the-alexmeza/kiteai
/make_dict.py
UTF-8
1,220
2.671875
3
[ "Apache-2.0" ]
permissive
import csv import nltk import numpy as np import pickle as pkl from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from preprocess import preprocess_for_dict vocab_size = 7000 stop_words = set(stopwords.words('english')) # Format of list: # [((ID, Text), [toxic, severe_toxic, obscene, threat, i...
true
4044b8a758d6455f4992d3724c40a6a0335ac816
Python
yukihiko-shinoda/asynccpu
/tests/testlibraries/cpu_bound.py
UTF-8
2,192
2.8125
3
[ "MIT" ]
permissive
""" Cpu bound. see: https://docs.python.org/3/library/asyncio-eventloop.html#executing-code-in-thread-or-process-pools """ import os import time from datetime import datetime from logging import getLogger from multiprocessing.connection import Connection from signal import SIGTERM, signal from typing import Any, NoRet...
true
a50da690bc756c77349387249ac866a7aa31c06c
Python
perlfu/timelapse-ae
/render-frames.py
UTF-8
2,563
2.609375
3
[]
no_license
#!/usr/bin/env python import math import pickle import os import re import sys from cmd_queue import CommandQueue cmd_queue = CommandQueue() def render_frame(src_path, dst_path, day, srcs, n, gn, img_type='hdn'): # pick mode if len(srcs) <= 5: weighting = True mode = '-m' else: we...
true
2bb4d69012b8c629193e8fa46f76c65da68514ca
Python
tonycolucci/AVC_Project
/src_test/train_model.py
UTF-8
2,856
2.921875
3
[]
no_license
# Imports import logging import yaml import pickle import pandas as pd import numpy as np import sklearn from sklearn.linear_model import LogisticRegressionCV logging.basicConfig(level=logging.INFO, format="%(name)-12s %(levelname)-8s %(message)s") logger = logging.getLogger() def split_response(data, response_col, ...
true
646af16bb1ced4ac570774856328432fd8379787
Python
dheeraj-326/fetch_coding
/src/utilities/emails.py
UTF-8
1,119
2.96875
3
[]
no_license
''' Created on Oct 13, 2020 @author: dheer ''' from src.data.constants import Constants class Emails(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' def count_unique_emails(self, emails): return len(self.__cleanup_email...
true
b4fe7e4e9a2df97b1017274301b17032f3c104d7
Python
dlrocker/pikamon-py
/pikamon/spawner/spawner.py
UTF-8
1,873
3
3
[ "MIT" ]
permissive
import random import logging from discord import Embed from pikamon.constants import Pokemon, DiscordMessage logger = logging.getLogger(__name__) async def spawn(message, cache): """Spawns a pokemon based on probability if a pokemon has not already been spawned for the channel with the current message bein...
true
688b67c0cd4a92246c797e4d1a572a9bfea560b9
Python
yinzuopu/api_test
/db2.py
UTF-8
1,063
2.859375
3
[]
no_license
#另一种封装方法 #导入pymysql库 import pymysql class DB: def __init__(self): self.conn =pymysql.connect(host="127.0.0.1", port=3306, user="root", passwd="123456",#注意是passwd不是password ...
true
8507ab96b74cbd8971c5b9bce206777649094ca3
Python
Aurigae-a/tape_bouncing
/obstacle.py
UTF-8
2,232
3.359375
3
[]
no_license
class Obstacle: """ 这个类实现障碍物 """ def __init__(self, init_number, init_x, init_y, init_radius): """ 构造函数 """ # 编号 self.number = init_number # 生命值 self.lifeTime = 3 # 障碍物中心坐标位置 self.pos = [] self.pos.append(init_x) sel...
true