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
9ea9f268cc2a3537e2d2d273a6fbc40d5f56ddd3
jdkato/readability
/readability/ast.py
UTF-8
2,548
2.71875
3
[ "MIT" ]
permissive
import html.parser import re INLINE_TAGS = [ "b", "big", "i", "small", "abbr", "acronym", "cite", "dfn", "em", "kbd", "strong", "a", "br", "img", "span", "sub", "sup", "code", "tt", ] HEADING = re.compile(r"^h\d$") SKIP_TAGS = ["script", "styl...
true
b80423fc91a3584a16bfc0cc8b480113922e71c8
sleepy-crow/holberton-system_engineering-devops
/0x15-api/0-gather_data_from_an_API.py
UTF-8
1,099
3.203125
3
[]
no_license
#!/usr/bin/python3 """ script that given employee ID, returns information about his/her TODO list progress. """ if __name__ == '__main__': import json import requests import sys EMPLOYEE = "" NUMBER_TASKS = 0 TOTAL_TASKS = 0 TASK_TITLE = [] employee = requests.get('https://jsonplaceh...
true
f298f1260442e9668648b2a565873b1c81d6ec44
jaroslavvanko/python-academy
/lekce02/17_distance_2points.py
UTF-8
370
3.390625
3
[]
no_license
import math point_ax = float(input("Point A, Coordinate X:")) if point_ax < 0: print("No way broo") point_ay = float(input("Point A, Coordinate Y:")) point_bx = float(input("Point B, Coordinate X:")) point_by = float(input("Point B, Coordinate Y:")) a = abs(point_ax - point_bx) b = abs(point_ay - point_by) dist =...
true
bfc928515bc9a713a5755b6b4a8eefeebf4ad327
eraduz/game-suggestie-gen
/db.py
UTF-8
2,960
2.546875
3
[]
no_license
import sqlite3 conn = sqlite3.connect('games.db') c = conn.cursor() # c.execute("SELECT * FROM games") # print(c.fetchall()) # Create games table # c.execute(""" # CREATE TABLE IF NOT EXISTS games ( # id integer PRIMARY KEY, # naam text NOT NULL, # jaartal text, # genre text, # uitgever text, # rati...
true
0770df84bf64c2e8d61c46deca18c2985e495da5
ASHWINVT/luminarprograms
/LanguageFundamentals/reverse.py
UTF-8
91
3.59375
4
[]
no_license
num=int(input("enter no")) while(num!=0): digit=num%10 print(digit) num=num//10
true
41c4db9e7cb4b31310e216e7a090b2868c61327c
Chris-Cherry/Projects
/MadMoneyMaybes/getTickers.py
UTF-8
5,920
2.921875
3
[]
no_license
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException import csv import time import random def get_calls(): """Use html links found with get_lightning_round_htmls and find out the bull and bear calls for each together with the date.""" # Read htmls we found earlier ...
true
f6da91a5e6d114b174e0868c9e8ba6f4179b20f7
Ralfik555/Python
/UDEMY/py_adv_udemy/Section_4/5_lambda.py
UTF-8
638
3.875
4
[]
no_license
f = lambda x:x*2 f = lambda x,y:x**y print(f(5,3)) list_numbers = [1,2,3,4,11,14,15,20,21] def is_odd(x): return x%2 != 0 filtered_list = list(filter(is_odd,list_numbers)) print(filtered_list) filtered_list = list(filter(lambda x:x%2 != 0,list_numbers)) print(filtered_list) def generate_multiply_funciton(n): ...
true
09a41867547eeed9c0f361faa1599ff27889d399
danielyule/pyote
/tests/TestEngine.py
UTF-8
28,967
3.109375
3
[ "MIT" ]
permissive
import random from unittest import TestCase from pyote.engine import Engine from pyote.operations import InsertOperation, DeleteOperation from pyote.utils import TransactionSequence, State, InsertOperationNode, DeleteOperationNode def get_dummy_state(site_id): """ Get a state that we can use for testing trans...
true
187b790f14c94b89ccb634a64eea5b75b6d8c6a4
thomasabbott/code
/fft_tests.py
UTF-8
1,208
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ FFT channel position simulations, as an experiment for me Created on Fri Nov 16 08:28:17 2018 @author: tabbott """ import numpy as np from matplotlib import pyplot as plt def testtone(ch,testch=30): dt = 1 testch = 30 tmax=2**8 ftone = 1.0 * ch / tmax S = np.sin(2*np.p...
true
abd0ecc7bebf3401d2cbdf31b660af71a95f1c31
prashanthraman/Python
/Intro/Numbers&Printing.py
UTF-8
354
3.765625
4
[]
no_license
a = 1 b = 2 c = 3 sum = a + b print(sum) """follows BODMAS and evaluates from left to right if same precedence""" test = 2 + 6 * 4 / 3 - 5 print("Result is:" + str(test)) """To get integer in division, use double slash""" int_div=6//3 print(int_div) """Integer division discards the decimal part without rounding off...
true
0a8d7932e60e2d8a57225aed57e663be7829abcf
cloudtian/python-base
/base/list-if.py
UTF-8
2,083
4.5625
5
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #list和tuple #list 是一种有序的集合,可以随时添加和删除其中的元素 numberList = [1,2,3,4]; length = len(numberList); print(numberList) print(length) #获取最后一个元素 print(numberList[length-1]) print(numberList[-1]) #追加 numberList.append(5) print('追加后:' ,numberList) #把元素插入指定位置,比如索引号为1 numberList....
true
90166eb639271b74a1107e9a8ed3572e02dd1a60
gsakkis/papyros
/papyros/task.py
UTF-8
4,972
3.140625
3
[ "BSD-3-Clause" ]
permissive
'''Base L{Task} class and friends.''' __all__ = ['Task', 'UnprocessedTaskError'] import sys import traceback from papyros import log class UnprocessedTaskError(Exception): '''Attempted to get the result of a L{Task} that has not been executed yet.''' class Task(object): '''Abstract base class of a callab...
true
28d4913723967c189568e68567839e0efa709827
thiagofb84jp/python-exercises
/pythonCourseUdemu/algoritmosExercicios/estruturaSequencial/exercicio09.py
UTF-8
251
4.3125
4
[]
no_license
""" 9. Faça um Programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius. """ fahrenheit = 98 celsius = 5 * ((fahrenheit - 32) / 9) print('{}°F equivale a {:.2f}°C.'.format(fahrenheit, celsius))
true
aa4a68b4c0ea21ae88b58ae6a094523040dab597
zhang-byo/InterviewQuestion
/剑指offer/数组中出现次数超过一半的数字.py
UTF-8
782
3.40625
3
[]
no_license
# -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers): if not numbers: return 0 result = numbers[0] count = 1 for num in numbers[1:]: if count==0: result = num count = 1 elif num == resu...
true
60140e8696cf8bd0b6ea3ac0cb5707f7a534eed3
ymilkessa/ch-games
/chess/pieces.py
UTF-8
7,377
3.390625
3
[]
no_license
from piece import Piece from piece_factory import PieceFactory from constants import BLACK, WHITE from chess.moves import ChessMove class ChessPieceFactory(PieceFactory): """Generates the chess piece for a given slot when setting up the board""" def create_piece(self, board, space): x, y = space.row,...
true
000997ad98e96c743443c7561a4d238a58e67129
JakeNunemaker/marmot
/marmot/object.py
UTF-8
1,776
3.34375
3
[ "BSD-3-Clause" ]
permissive
"""Object base class for marmot process modeling.""" __author__ = "Jake Nunemaker" __copyright__ = "Copyright 2019, Jake Nunemaker" __email__ = "jake.d.nunemaker@gmail.com" __status__ = "Development" class Object: """Base object class.""" def __init__(self, name): """ Creates an instance of ...
true
b7244a3852426e070bf41148327fefdc353bbebf
mahamadousylla/GPS-via-MapQuest
/interaction_with_api.py
UTF-8
2,751
3.515625
4
[]
no_license
#Mahamadou Sylla import urllib.parse import urllib.request import json BASE_MAPQUEST_URL = 'http://open.mapquestapi.com/directions/v2/route?key=Ty4mO3IWhIGPvcp4RaALftDXorf3Kl6G&' elevation = 'http://open.mapquestapi.com/elevation/v1/profile?key=Ty4mO3IWhIGPvcp4RaALftDXorf3Kl6G&' def build_url(locations): ''' ...
true
60bd7855f48d25d4ccefd4f291dd0cd34f60cb13
pedrohfsantos/ScriptsPython
/description.py
UTF-8
1,928
2.921875
3
[]
no_license
from requests_html import HTMLSession from tqdm.auto import tqdm import re from unidecode import unidecode def AjustaDescription(file ,r): h1 = r.html.find('h1')[0].text.lower() all_paragraph = r.html.find('article p') for p in all_paragraph: i = unidecode(p.text.lower()).find(unidecode(h1)) ...
true
7ac90d8daddac77bc866c72407a6520083bacdcd
pherna06/server-consumption
/measure/log/power/plotpower.py
UTF-8
3,462
2.9375
3
[ "Apache-2.0" ]
permissive
import os import matplotlib.pyplot as plt # TODO: refactor to just handle power plot OR implement general utility 'plotdata.py' IMAGEPATH = 'img/' STYLES = { 'intproduct': 'r-', 'floatproduct': 'r:', 'inttranspose': 'b-', 'floattranspose': 'b:', 'intscalar': 'g-', 'floa...
true
14df34425cfdda45e8fd970b70af491ba3ac4821
Saurabh4626/dsa
/Classes_and_Object/error_and_exception4.py
UTF-8
446
3.9375
4
[]
no_license
##else and finally try: n = int(input("enter numerator")) d = int(input("enter denominator")) c=n/d except ZeroDivisionError: print(" denominator should be greater than 1") except ValueError: print("Enter integer value") else: ##if no exception has been raised this ## this block o...
true
516fd8753b693baed6c8d57abd3d9d8380eaa2c7
k-danna/lstm_pytorch
/main.py
UTF-8
2,578
2.703125
3
[ "MIT" ]
permissive
#! /usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt from model import Model from dataset import Dataset def main(): #currently available datasets data_files = [ 'shakespeare.txt', #1.1 mb 'grimms.txt', #541 kb 'bible.txt', #4.4 mb 'mobydi...
true
7761182313b5df6166cf077fad14c3a204f1d10e
tanzr/himlarcli
/himlarcli/printer.py
UTF-8
1,657
3.1875
3
[]
no_license
import json import operator import sys class Printer(object): VALID_OPTIONS = ['text', 'json'] INDENT = 2 def __init__(self, output_format): if output_format in self.VALID_OPTIONS: self.format = output_format else: sys.exit('Printer(): Unknown format %s' % output_f...
true
9c166cbaf03fa450b29d2e4f5890f0b8967a01a6
kanisque/Programming
/Python OOPS/testbench.py
UTF-8
379
3.328125
3
[]
no_license
import math PHI = 1.6180339 f = [ 0, 1, 1, 2, 3, 5 ] def fib ( n ): if n < 6: return f[n] t = 5 fn = 5 while t < n: fn = round(fn * PHI) t+=1 return fn testcases = int(input().strip()) while testcases: testcases-=1 n = int(input().strip()) # n = run x...
true
a0658eea04e237b01091d3e25e4d667ec14c205e
kborkowska/praktyki
/gui/Module.py
UTF-8
839
3.046875
3
[]
no_license
from numpy import array, append from weakref import ref class Module(): def __init__(self, parent, moduleName): self.moduleName = moduleName if parent is None: self.parent = None else: self.parent = ref(parent) if parent is None: self.lineage = None else: self.lineage = [parent.getLineage(), s...
true
8984c1a9fcc7937af20421b414e0e975807d4b15
DamonZCR/PythonStu
/46爬虫/selenium浏览器/xpath定位/5-索引定位.py
UTF-8
1,172
3.46875
3
[]
no_license
from selenium import webdriver import time '''同意标签下同类型标签索引操作。 1.如果一个元素它的兄弟元素跟它的标签一样,这时候无法通过层级定位到。因为都是一个父亲生的,多胞胎兄弟。 2.虽然双胞胎兄弟很难识别,但是出生是有先后的,于是可以通过它在家里的排行老几定位到。 3.如下图三胞胎兄弟输入框。 4.用xpath定位老大、老二和老三(这里索引是从1开始算起的,跟Python的索引不一样) ''' driver = webdriver.Chrome('..//chromedriver.exe') driver.get('https://www.baidu.com') # 依次点击百度...
true
7dd31edebad128cd2f0251b474a609c300e62c1c
steve75918/OOAD
/oosubway/tests/functional/test_station.py
UTF-8
932
3.171875
3
[]
no_license
import unittest from ...modules.subway import Station class test_station(unittest.TestCase): def setUp(self): self.station = Station('TestStation') pass def test_get_name(self): name = self.station.get_name() self.assertEqual(name, 'TestStation') pass def test_e...
true
f3bb964baa5fcb682a247c623edab971ff4724a5
lance-lh/Data-Structures-and-Algorithms
/DSA/string/strStr.py
UTF-8
618
3.046875
3
[ "MIT" ]
permissive
class Solution: def strStr(self, s: str, p: str) -> int: if not s or not p: return 0 m, n = len(s), len(p) lps = [0] * n self.findlps(p, lps, n) i, j = 0, 0 while i < m and j < n: if s[i] == p[j]: i, j = i + 1, j + 1 ...
true
754c45ee67d371df03716fcb00b82206bb63f8b8
FRANCIS-CASIMIR/RockPaperScissor
/Main.py
UTF-8
384
3.03125
3
[]
no_license
from Game import * if __name__ == '__main__': man = Player('Francis') machine = Machine() referee = Scorer() while True: your_choice = int(input("Enter [1] for Paper,[2] For Scissor and [3] for Rock")) man.setChoice(your_choice) machine.choose() my_choice = machine.g...
true
be6d4d275b4ef40ccd213293e3d270008fe6b226
Sainaik/Network-Embedding-and-Future-link-prediction
/Random_data.py
UTF-8
1,997
2.6875
3
[]
no_license
import networkx as nx import random from random import choice import csv import argparse import os import matplotlib.pyplot as plt # create random dataset for test (non-existing test edges) def create_random(dataset): # create individual Author-Author graphs for train and test print("Creating individual Author-Aut...
true
8663cfaa076327533637eac12ce9f0c61b10d315
Tang-08080103/Research
/Modules/replay_buffer.py
UTF-8
4,420
3.9375
4
[]
no_license
""" Data structure for implementing experience replay """ from collections import deque import random import numpy as np import pickle class ReplayBuffer(object): def __init__(self, buffer_size, random_seed=123): """ The right side of the deque contains the most recent experiences Buff...
true
55127d80e93181a5c930026b969e1436dbf02911
AdskiyDed/Python-HW-LITS
/Stroki4-dec.py
UTF-8
271
3.234375
3
[]
no_license
def dec(s): def inner(): print('\n', s(), '\n') return inner @dec def smart_input(): s = input() d = s.split(' ') max1 = 0 for i in d: i = int(i) if i > max1: max1 = i return max1 smart_input()
true
1c576f0aee3e3c0110fcfb095b50410ed76b02ea
Pravinmishra12345678/Python_Full-course
/FH5.py
UTF-8
441
3.453125
3
[]
no_license
class what: def yes(self): self.Countries = map(str, input().lower().split()) Capitals = dict() # Fill it with some values Capitals['india'] = 'delhi' Capitals['Gujrat'] = 'surat' Capitals['u.p'] = 'lucknow' sl = [] s = what() s.yes() sl.append(s.Countries) k = s.Countries for country in k: if coun...
true
dc31ec480043c397b471f2724943c61ef1760f5d
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_157/889.py
UTF-8
1,714
3.421875
3
[]
no_license
import sys inpath = sys.argv[1] outpath = sys.argv[2] multiplication = {'1': {'1': '1', 'i': 'i' , 'j': 'j' , 'k': 'k'}, 'i': {'1': 'i', 'i': '-1', 'j': 'k' , 'k': '-j'}, 'j': {'1': 'j', 'i': '-k', 'j': '-1', 'k': 'i'}, 'k': {'1': 'k', 'i': 'j' , 'j': '-i', 'k': '-1'}} def multiply(s1, s2): "...
true
2bfa75f74b073a6c8dcc7f9f9c04ac2a931b1392
DawoonC/algorithmic-problem-solving-strategies
/09-dp_techniques/packing.py
UTF-8
1,777
3.140625
3
[]
no_license
# Problem ID: PACKING # https://algospot.com/judge/problem/read/PACKING # took 1760ms # similar to Knapsack problem from collections import defaultdict def readline(): return raw_input() def get_max_score(size_limit, item, n, items, cache): if item == n: return 0 result = cache[(item, size_limi...
true
f1bd79b70f08eb488641ebb2f7f41bcfe7a552de
Saleh-Gholam-Zadeh/trajectory_simulator
/whole_trajnet/trajnetbaselines/evaluator/tools/metrics.py
UTF-8
1,729
3.03125
3
[]
no_license
from __future__ import division import numpy as np def final_l2(path1, path2): row1 = path1[-1] row2 = path2[-1] return np.linalg.norm((row2.x - row1.x, row2.y - row1.y)) def average_l2(path1, path2, n_predictions=12): assert len(path1) >= n_predictions assert len(path2) >= n_predictions pat...
true
4f532dbd212ede7c3c1ad7c87603c272cf1d9002
UToledo-DataScience/starter-pack
/data_vis.py
UTF-8
630
3.953125
4
[]
no_license
import pylab as pl # or, alternatively, import matplotlib.pyplot as plt import numpy as np # Suppose we have a series of points that we would like to plot: x, y = np.random.rand(50, 1), np.random.rand(50, 1) xy = np.concatenate([x, y], axis=-1) # concatenate the arrays on the last axis, output shape == (50, 2) print(f...
true
54e7a908f5d6f8876c252a679f1673e45783c8af
yangml6/AIOpenHack
/gear_images_pr.py
UTF-8
944
2.6875
3
[]
no_license
from PIL import Image, ImageOps import os im_pth = "/Users/Sambalaya/Desktop/gear_images" out_pth = "/Users/Sambalaya/Desktop/gear_images_a" def travel(orgpth, outpth): fs = os.listdir(orgpth) for f in fs: tmp_path = os.path.join(orgpth, f) if not os.path.isdir(tmp_path): print('do with file: ...
true
73935cc8823e1d9acbeed2dba12674252834bf1c
hooptiej/RPIbot-code
/walker.py
UTF-8
7,100
3.09375
3
[]
no_license
#!/usr/bin/python from Adafruit_PWM_Servo_Driver import PWM import time import os clear = lambda : os.system('tput reset') import pygame from pygame.locals import * clock = pygame.time.Clock() clear() # Initialise the PWM device using the default address pwm = PWM(0x40) # Note if you'd like more debug output you can i...
true
4af3cf3eab5e706a6696ca589a3055209063aeb7
sanmai/hello-ghcr
/tag-from-ref.py
UTF-8
2,004
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/python3 # MIT License # # Copyright (c) 2020 Fiona Klute # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, c...
true
954157fa93a45fbd3ce4a88a3d16ae4f4964f801
Yaoaoaoao/LeetCode
/algorithms/215_kth_largest_element_in_an_array.py
UTF-8
1,609
3.78125
4
[]
no_license
from random import randint class Solution(object): # # sort... O(nlgn) # def findKthLargest(self, nums, k): # return sorted(nums)[len(nums)-k] # randomized-select. divide-and-conquer O(n). # select the n-k+1 th element ("sorted" from smallest to biggest) def findKthLargest(self, nums, k): ...
true
3b42dccdf58111947892326e51ca0629666db951
mmheinig/Insight
/frequenttraveler_project.py
UTF-8
19,279
2.734375
3
[]
no_license
################################################################## ################################################################## # # Inputs # ################################################################## ################################################################## # input file input...
true
bdf5da7af908a3ac1314ae560af44b04b82b3950
ofriman/Computational-Geometry
/3/shortest-homotopic-paths/main/utils.py
UTF-8
3,053
3.09375
3
[]
no_license
import matplotlib.pyplot as plt import sys def _lexicographic_comp(p, q, _): return p[0] < q[0] or (p[0] == q[0] and p[1] <= q[1]) def _orientation_comp(p1, p2, p): return orientation(p, p1, p2) > 0 def lexicographic_sort(points): return merge_sort(points, _lexicographic_comp, {}) def orientation_so...
true
e2bc23d0e503b2479debc58bd8e547312e46f251
ruiwanguiuc/LeetCode
/MergeSortedArray.py
UTF-8
974
3.546875
4
[]
no_license
# https://oj.leetcode.com/problems/merge-sorted-array/ # Given two sorted integer arrays A and B, merge B into A as one sorted array. # Note: # You may assume that A has enough space (size that is greater or equal to m + n) # to hold additional elements from B. The number of elements initialized in A and # B are m and...
true
0758393312a4ac8bc0ede144a1a2f85ba1bb6808
SJamieson/bayesian-optimization-tutorial
/plotting.py
UTF-8
3,729
2.859375
3
[]
no_license
import matplotlib.pyplot as plt import scipy.stats as stats import numpy as np class FunctionPlot(): def __init__(self, ax, title, domain, range=None, resolution=None): self.locked = [] self.patches = [] self.ax: plt.Axes = ax self.ax.title.set_text(title) self.domain = dom...
true
197bd49ddd6fa7d0c99461f582ae1afc2155de92
sam-gregz/hoohacks
/sound_byte.py
UTF-8
1,019
2.71875
3
[]
no_license
#!/usr/bin/python ### ### Sample file handling ### ## Important import statements import numpy as np from scipy import signal from pydub import AudioSegment import zulko from audio_object import audio_object class sound_byte(audio_object): def __init__(self, file_path, file_type, fr=None, chnls=None, sw=None): ...
true
f7dfc8b08ab9f2c4acb6336c7e20577769054ce5
VincentVelthuizen/Week-3
/first_set/exercise_4.py
UTF-8
141
3.53125
4
[]
no_license
# a print(3 == 3) # True # b print(3 != 3) # False # c print(3 >= 4) # False # d print(3 < 4) # True print(not (3 < 4)) # False
true
0a0adcc46a68a4ef770ed5d39befc710c1232b58
IsaacDiaz09/Python-repo
/Persistencia de datos/ejercicios practica/lectura.py
UTF-8
236
3.375
3
[]
no_license
info_txt = [] with open("txt/texto_1.txt","r") as archivo: lineas = archivo.read() for linea in lineas: print(linea, end= "") info_txt.append(linea) """print(lineas)""" print("\n") print("".join(info_txt))
true
db13aceba1d1105cdabfd56ba3575786f06488db
r9y9/nlp100
/17.py
UTF-8
241
2.734375
3
[ "MIT" ]
permissive
s = {} with open("hightemp.txt") as f: lines = f.readlines() for idx, l in enumerate(lines): l = l.split("\t") s[l[0]] = idx import operator r = sorted(s.keys(), key=operator.itemgetter(1)) for l in r: print(l)
true
289a571c399caf2591d859306bfec6b44a21c3f4
somphorsngoun/graphic-1
/Homework/Import/graphic_1.py
UTF-8
664
3.5625
4
[]
no_license
import tkinter import random # 1 - Crate a window window = tkinter.Tk() # 2 - Set size window.geometry("900x500") # 3 - Create a frame frame = tkinter.Frame() # Set the tile frame.master.title("CREATE BY @SOMPHORS") # Create the cavas to draw canvas = tkinter.Canvas(frame) number = random.randran...
true
14d74b0430be111a4532329a572568a3b982888c
stellarspot/opencog-tutorial
/examples/ure/python/example_deduction.py
UTF-8
2,664
2.640625
3
[]
no_license
from opencog.type_constructors import * from opencog.atomspace import TruthValue # ============================================================================= # Crisp logic entailment (Deduction) Rule. # # A->B # B->C # |- # A->C # # See https://github.com/opencog/atomspace/tree/master/examples/rule-engine for m...
true
0b237a54a85489d1688589d2d583e05a05eb48aa
JmKanmo/PetService_Web
/rest_client/controller.py
UTF-8
4,850
2.640625
3
[ "MIT" ]
permissive
from flask import Blueprint from flask import render_template import requests from flask import request from rest_server.resource_Map import KakaoMap_Resource, Geocode_Resource from rest_client.blue_print import BluePrint from rest_server.resource_Animal import Animal_Resource, Location_Resource import random # 지도검색시...
true
37be08502cf5f74a92a25e86ba1b7bd8187afe8f
oceanobservatories/mi-instrument
/mi/dataset/driver/hyd_o/dcl/hyd_o_dcl_recovered_driver.py
UTF-8
1,583
2.703125
3
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" @package mi.dataset.driver.hyd_o.dcl @file mi-dataset/mi/dataset/driver/hyd_o/dcl/hyd_o_dcl_recovered_driver.py @author Emily Hahn @brief Recovered driver for the hydrogen series o through a dcl instrument """ from mi.dataset.dataset_driver import SimpleDatasetDriver from mi.dataset.parser.hyd_o_dcl import HydODcl...
true
fe69c0c47ba13358cdc1dff043cb8b4fe4415ed8
KowalewskiMateusz/Data-visualization-exercises
/Best articles.py
UTF-8
1,402
2.640625
3
[]
no_license
import requests from operator import itemgetter import pygal from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS url = 'https://hacker-news.firebaseio.com/v0/topstories.json' r = requests.get(url) submission_ids = r.json() submission_dicts = [] names = [] for submission_id in submission_id...
true
7e31218571a8265eb00ab0d12f2e698f464516c4
NigelKim/DataStructure
/Dijkstra.py
UTF-8
2,623
3.890625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 21 20:29:15 2019 @author: Nigel """ # Cracking the Coding Interview Chapter 4 # Python Dijkstra's Algorithm Implementation import collections class Graph: def __init__(self): self.gdict = collections.defaultdict(list) # adjacent verte...
true
3e4beace41981d59c4559d2155f317e1495cf39b
david-therincourt/microcontroleurs
/arduino-nanpy/rc_charge/charge_condensateur_3_modelisation.py
UTF-8
2,208
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- # Mesure de la tension aux bornes d'un condensateur (version simple) # R = 100 k et C = 4,7 µF from nanpy import ArduinoApi # Gestion Arduino from nanpy import SerialManager # Gestion port série from time import sleep import matplotlib.pyplot as plt # Gestion du tracé ...
true
c8e26d39bb3569d81b26b2fe2dc8f765eaff24f4
tonylibing/stockpractice
/roc/roc.py
UTF-8
3,162
2.890625
3
[]
no_license
# coding:utf-8 # 1000元实盘练习程序 # 计算ROC指标策略 import numpy as np import pandas as pd import akshare as ak import tools import run from datetime import datetime import datetime as dt import matplotlib.pyplot as plt # 研究ROC指标 @run.change_dir def roc(): codes = tools.Research(refresh = False, bSelect = False) # pri...
true
6090054b07b0349116d3f8058902c3ac68e4705d
RMPR/eopi-python
/6-7-compute-all-mnemonics-for-a-phone-number.py
UTF-8
1,172
3.90625
4
[ "Unlicense" ]
permissive
""" Write a program which takes as input a phone number, specified as a string of digits, and returns all possible character sequences that correspond to the phone number. The cell phone keypad is specified by a mapping that takes a digit and returns the corresponding set of characters. The character sequences do not h...
true
009d1816f8e4e5a0017b899cdefd89a0e2b15451
oCaraDaLoteria/CodigosBlog
/Posts/Lotofacil/L4/L4_02_Acertar_N_Fixos.py
UTF-8
1,072
2.765625
3
[]
no_license
from funcoes_e_etc import * # Crio objeto da Lotofacil loteria = Loterias('lotofacil') n_concursos = loteria.n_concursos AcertosErros = np.zeros((n_concursos+1,1)) n_fixos = 5 # Simulacao for game_id in range(1,n_concursos+1): # ---------- pego o resultado do concurso -------------------- concurso = loteria.conc...
true
20ad2c01b2fcbd6a74e5c5f5daa508fe401febe3
PAND-or/parsers
/hw02/wiki.py
UTF-8
907
3.28125
3
[]
no_license
from requests import get import re def get_link(topic): link = "https://ru.wikipedia.org/wiki/" + topic.capitalize() return link def get_topic_page(topic): link = get_link(topic) html = get(link).text return html def get_topic_text(topic): html_content = get_topic_page(topic) words = re.fi...
true
efe7e91ebb1b6374010f6ae45a2ea49f02048282
bauman/python-bson-streaming
/bsonstream/__init__.py
UTF-8
2,940
2.59375
3
[ "Apache-2.0" ]
permissive
from bson import InvalidBSON, BSON, codec_options import sys import struct class BSONInput(object): """ credit to @mpobrien (https://raw.github.com/mongodb/mongo-hadoop/master/streaming/language_support/python/pymongo_hadoop/input.py) """ """Custom file class for decoding streaming BSON, base...
true
7c7153f81e906dab4196698b527d6bc28bb94cd6
Sid1298/Randomizer
/Randomizer_15_15.py
UTF-8
1,773
4.125
4
[]
no_license
""" Problem statement : Given a number in range 0-30 (both inclusive), split the given number into 2 random parts such that no part is greater than 15. Example: split the number 26 into two random numbers (x,y) such that 0<=x<=15, 0<=y<=15 x+y = 26 Assume that the excel file for input has only one column named as ...
true
58b2b4adb2cc772cc587b3bf2aa68c2430f50c38
jiankang1991/Identify-Fraud-from-Enron-Email
/final_project/poi_id.py
UTF-8
6,090
2.515625
3
[]
no_license
#!/usr/bin/python import sys import pickle import numpy as np import pandas as pd sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit from tester import dump_classifier_and_data ### Load the dictionary containing the dataset with open("final_project_dataset.pkl", "rb") as data...
true
4af8d8c0b4f7035ce5c0be0868f6a54f54dbb9eb
wmeitzen/machine-learning
/racoons_and_foxes_raspberry_pi/cam_11.py
UTF-8
2,202
2.984375
3
[]
no_license
import cv2 import time import numpy as np from datetime import datetime from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from keras.models import load_model from PIL import Image from matplotlib import pyplot as plt # load and prepare the image def transform_frame_to_b...
true
6b2434618d46488488024886b24fc44e0102e105
FruitSamurai/captcha_detection
/extract.py
UTF-8
1,967
2.875
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2020/11/12 22:54 # @Author : AaronJny # @File : extract.py # @Desc : import os from glob import glob import cv2 import numpy as np from PIL import Image from tqdm import tqdm def extract_correct_word(): save_dir = './correct_words' if not os.path.exists(save_dir): ...
true
cd3cb09a3c57c8db90b406791e1c87a5768d3e25
SparkCat23/TrabsonSegundaPython
/trabsonLP_13_11/trabson.py
UTF-8
10,775
2.8125
3
[]
no_license
from datetime import date class Pessoa(): def __init__(self,nome,email,celular): self.nome = nome self.email = email self.celular = celular def __str__(self): return str(self.nome) def altera_celular(self,cel): if type(cel) == str: self.celular = ce...
true
d1370b41243e77b7e030b54d33e7e45c97d791b1
anna-s-dotcom/python_grundkurse_meineNotizen
/Folder/platypus.py
UTF-8
459
3.078125
3
[]
no_license
from classes.mammal import Mammal from classes.bird import Bird from classes.animal import Lebewesen class Platypus(Mammal, Bird): def __init__(self, ld3, g3, ef, schlupfz, saugzz): Mammal.__init__(self, ld3, g3, tz1 = 0, sz1 = saugzz) Bird.__init__(self, ld3, g3, ef, schlupfz) def ...
true
6931b1ce7193b7670210992c6b63a8c2b99fcaa1
developedBySk/Test-Bots
/todoApp.py
UTF-8
1,079
2.8125
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains import time class Jarvis: def __init__(self): print("Initializing Jarvis.....") self.bot = webdriver.Firefox() print("Welcome,starting my job, Mr.Tony Stark") def e...
true
ac003c5fe7cf5cf0a2beb460dc91b5990b0fbab8
rsmpark/mask-detection
/mask_dlib.py
UTF-8
4,538
2.96875
3
[]
no_license
import cv2 import dlib import numpy as np import os import imutils # Face image directories dirPath = os.path.dirname(os.path.realpath(__file__)) faceImagePath = dirPath + "\\images\\face\\" # Face predictor data path p = "data/shape_predictor_68_face_landmarks.dat" # Mask colours color_blue = (254, 207, 110) color_...
true
c03677b0da0040646c292d1bc7999043848d2280
jaiveerk/wall-street-bets
/quantfeatures.py
UTF-8
3,845
2.796875
3
[]
no_license
from logging import error import pandas as pd import numpy as np import nltk from nltk.sentiment import SentimentIntensityAnalyzer import emoji from sklearn import preprocessing # we probably just care about compound sentiment -- other options are neg, neu, pos def getCompoundSentiment(row, sia): title = row['tit...
true
39f743e9ac27cf6d3e78ecb6b8ae29c635276b90
rendelei/python_project
/day1/购物车修改版/shopping.py
UTF-8
7,193
3.515625
4
[]
no_license
''' 1、启动程序后,输入用户名密码后,如果是第一次登录,让用户输入工资,然后打印商品列表 2、允许用户根据商品编号购买商品 3、用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒 4、可随时退出,退出时,打印已购买商品和余额 5、在用户使用过程中, 关键输出,如余额,商品已加入购物车等消息,需高亮显示 6、用户下一次登录后,输入用户名密码,直接回到上次的状态,即上次消费的余额什么的还是那些,再次登录可继续购买 7、允许查询之前的消费记录 遗留问题:如何实现判断文件追加的次数,以便记录shopping的次数 ''' import os def shopping(salary): shopping_list = [...
true
6481cfda9755a881d7cd5e735f8981de142b3e4f
Garlok-Dev/Garlok-Dev.github.io
/p/download-youtube-videos/code.py
UTF-8
377
2.921875
3
[]
no_license
from pytube import YouTube #Here we ask for the URL yt = YouTube(input("Insert here the URL, plz :) = ")) #Downloading video... print("Downloading ' " + yt.title + " '...") stream = yt.streams.first() stream.download() print("\n") print("Ready now you can enjoy your video, until next time :)") #The video is download...
true
9f26d15c30d58c0b8cec1679825e277323443d3c
JanMalik/Learning-Data-Science-Master-s-Degree-2017-2019
/Big Data Tools/Beer ABV Project/Scripts/MatPlot.py
UTF-8
8,657
2.9375
3
[]
no_license
################################ ### Mallet Oscar & Malik Jan ### ### 21 November 2018 ### ################################ ################# ##### Preps ##### ################# #Libraries import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from mpl...
true
9278fb946810158b592655bfe498f19ab2bdfbea
sukant16/Leeter
/easy/minimum_time_visiting_all_points.py
UTF-8
573
3.3125
3
[]
no_license
from typing import List class Solution: def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int: time, last_point = 0, points[0] for point in points: time += max(abs(point[0]-last_point[0]), abs(point[1]-last_point[1])) last_point = point ...
true
56b4a1f5c4e593cc8920589c0fc3c506c3b4792c
elegantwist/slothtest
/slothtest/__init__.py
UTF-8
1,607
2.546875
3
[ "MIT" ]
permissive
import traceback import os import asyncio import datetime from copy import deepcopy from .sloth_log import sloth_log from .sloth_connector import SlothConnector from .sloth_config import SlothConfig from .sloth_watcher import SlothWatcher from functools import wraps # the name of the particular instance os.environ['SL...
true
246beb3d0455d49cd53bd4928884d3cd5dcb5181
JayMil/pyglet_games
/coding_train/force_mass_mover/mover.py
UTF-8
1,984
3.3125
3
[]
no_license
import random import math from pyglet.shapes import Circle import vector from vector import X, Y class Mover: ''' Circle to move randomly around screen ''' def __init__(self, x, y, window, mass=1, radius=16): self.radius = math.sqrt(mass) * 10 self.window = window self.pos = vector.cre...
true
f4595c11836b837260ad234584dca811316f5fa7
AlexDeimon/MisionTic2020
/MinTIC2022-master/Excepcion1.py
UTF-8
423
3.953125
4
[]
no_license
def division(a, b): try: coc = a/b res = a % b return (coc, res) except ZeroDivisionError: print('ERROR. DIVISION POR 0.') return '' def main(): try: num = float(input('digite el dividendo: ')) div = float(input('digite el divisor: ')) print(...
true
e99d4a653c8843ae659df33afc82cfa8aacc989e
KyleVanDenHeuvel/MineSweeper-Game
/minesweeper.py
UTF-8
2,885
3.875
4
[]
no_license
from random import randint # Size of the map (10 by default) size = 10 # Creates a matrix to store the map game_map = [] # Creates a matrix to store where mines are located game_mines = [] # Determines whether the game is over ("True" if the game is over) game_over = False #FIXME ''' Allows the user to change the siz...
true
f15da00de11a959dc9d3c4c0b9318766190614ea
demisto/content
/Packs/ApiModules/Scripts/AWSApiModule/AWSApiModule_test.py
UTF-8
10,522
2.625
3
[ "MIT" ]
permissive
from AWSApiModule import * import pytest from pytest import raises VALIDATE_CASES = \ [{ 'aws_default_region': 'test', 'aws_role_arn': 'test', 'aws_role_session_name': 'test', 'aws_access_key_id': 'test', 'aws_secret_access_key': 'test' }, { 'aws_default_region': 'region tes...
true
3d6e55bd0032c60e3d5ee0faed6bab12de428446
Long0Amateur/Self-learnPython
/Chapter 5 Miscellaneous/review/counting.py
UTF-8
305
3.890625
4
[]
no_license
# A progran gets 10 numbers from user and count how many of those numbers are # greater than 10 count = 0 # define for i in range(10): num = eval(input('Enter a number:')) if num>10: count=count+1 print('There are',count,'numbers greater than 10.')
true
f3c2967c1c1c11431ea23a4f9ed004368252e3f0
CircularWorld/AutoOffice
/OA/tools/word_tools.py
UTF-8
2,001
2.6875
3
[ "Apache-2.0" ]
permissive
import os import time from pydocx import PyDocX import time, zipfile # def get_objects_outfile(obj, infile: str): # url_list = infile.split('x-x') # # if len(url_list) == 1: # # dir, suffix = os.path.splitext(infile) # # else: # dir, suffix = os.path.splitext(url_list[0]) # outfile = '{}x...
true
340f37a4417652acd92ae73c9a044fbe6efead01
davidjohnoliver/IncomeForecast
/couple_spending_rules.py
UTF-8
7,803
3.453125
3
[ "MIT" ]
permissive
import model import spending_rules def get_luxury_over_basic(base_spending: float, luxury_compound_rate: float): """ Models expenditure as a compounding 'luxury' component added to a fixed 'basic needs' component. sp[y] = b + (1 + c)sp[y-1], where sp = spending, b = base_spending, c = luxury_compound_rat...
true
4cd07bcb9dfac97681606aca8aedee0f7e8f4554
podhmo/individual-sandbox
/daily/20170114/example_meta/01withmeta.py
UTF-8
659
3.8125
4
[]
no_license
# with meta class B: def __init__(self, x=None, y=None, z=None): self.x = x if x is not None else self.Meta.x self.y = y if y is not None else self.Meta.y self.z = z if z is not None else self.Meta.z def __repr__(self): return "{self.__class__.__name__}(x={self.x!r}, y={self.y!r...
true
a872aec58b1857465608aa4cf1adfefe71b8e193
codethat-vivek/NPTEL-Programming-Data-Structures-And-Algorithms-Using-Python-2021
/week2/Matched.py
UTF-8
584
4.40625
4
[]
no_license
# Second Problem: ''' Write a function matched(s) that takes as input a string s and checks if the brackets "(" and ")" in s are matched: that is, every "(" has a matching ")" after it and every ")" has a matching "(" before it. Your function should ignore all other symbols that appear in s. Your function should retu...
true
a661460c6d74dc7f4c0f03ca5e254a07faddba07
fmoo/Orange
/Scripts/autotile-packing-tools/src/minitile.py
UTF-8
16,765
2.6875
3
[ "MIT" ]
permissive
import os import os.path import PIL import sys from PIL import Image from argparse import ArgumentParser from typing import Any def upscale_file(input_filename, factor): p1, p2 = os.path.splitext(input_filename) output_filename = f"{p1}_{factor}x{p2}" input_image = Image.open(input_filename) imw, imh ...
true
8ae7e79e6e65c5da0e2012b89ec02428b20f2fbb
sbsreedh/Binary-Search-2
/findPeak.py
UTF-8
862
3.59375
4
[]
no_license
#Time Complexity:O(log n) #Space Complexity:O(1) #1. Calculate mid index #2. check if the mid element is greater its previous one and next one. #3. If yes, return mid index. #4. Check if right index is greater then mid index, if yes, it means the greater value might be present towards right hence shift the low pointe...
true
9b1bf2cf318b73badc2166deae6f674b966d321b
zhangxiaoyu5751/snkrs
/snkrs/send_mess_by_push_bear.py
UTF-8
1,842
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- import requests import json import config import urllib.request, urllib.parse, urllib.error def send_message(data_list): ''' data = [{ 'shoe_uniq_desc':'asd', 'shoe_name' 'shoe_intro' 'shoe_sell_time' ...
true
c6276b3df5622035891712b782013c63d8bf9726
ChillyBwoy/yadp-template
/project_name/utils/upload.py
UTF-8
645
2.734375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import datetime import hashlib import time def upload_name(file_name, keep_name=False): if keep_name: return file_name.encode('utf-8') else: fname = file_name.encode('utf-8') suffix = fname.split('.')[-1] stamp = int(time.time()) md5 = hashlib.m...
true
7fa158ff9e0b0f4ba9b3b7a624b71bd6433d3ff5
git874997967/codingbat_solutions
/rotate_left3.py
UTF-8
87
2.53125
3
[]
no_license
def rotate_left3(nums): result = nums[1:] result.append(nums[0]) return result
true
2c555020ff4c3192e4911206fcf885228d1f1073
yan25920928/python_demo
/pygame_demo/demo_unittest.py
UTF-8
192
2.828125
3
[]
no_license
import logging logging.basicConfig(level=logging.DEBUG) def foo(s): n= int(s) logging.debug("n=%d"%n) return 10/n def main(): foo('2') if __name__ == '__main__': main()
true
ba0cfc64dcd5d7b13dc81399e6138c42add2db47
VijayG95/test
/decoratorsTest.py
UTF-8
750
4.34375
4
[]
no_license
import time import math def calculate_time(func): def inner(*args,**kwargs): begin = time.time() returned_value = func(*args,**kwargs) print(returned_value) end = time.time() print("Total time taken in : ", func.__name__, end - begin) return inner @calculate_time de...
true
be2f39dad03151e24ed3f3a3c6a280d29863eb72
Aasthaengg/IBMdataset
/Python_codes/p02629/s446849878.py
UTF-8
206
3.25
3
[]
no_license
n = int(input()) ans = [] while(n > 0): x = n % 26 n = n // 26 if(x == 0): x = 26 n -= 1 ans.append(chr(x + ord('a') -1)) # print(x,n) ans.reverse() print("".join(ans))
true
a957c605023728c6ece8c3df3b490812ffbbcd33
mdfinch553/cpsc322-Final-Project
/mysklearn/myutils.py
UTF-8
11,070
3.09375
3
[]
no_license
############################################## # Programmer: Adrian Rabadam & Michael Finch # Class: CptS 322-01, Spring 2021 # Final Project # 4/21/21 # # # Description: This file defines utility # functions for assisting in classification ############################################## import numpy as np import ma...
true
96fae6d02010574e769ec851bc9742ef863aa069
jorgenringda/Slepe-Rov-RPi
/SerialWriter.py
UTF-8
973
3.34375
3
[]
no_license
import serial from threading import Thread class SerialWriter(Thread): def __init__(self, data, com_port, baud_rate): Thread.__init__(self) self.data = data self.com_port = com_port self.baud_rate = baud_rate self.serial_port = serial.serial(self.com_port, self.baud_rate, 1) ...
true
66b871d8167722a5b0950217e1332ccf0e8a673b
datautvikling/nace-predictor
/training-util/app/steps/process.py
UTF-8
1,921
2.859375
3
[]
no_license
import logging import pandas as pd from app.config import Config, ModelType from app.constants import PREPROCESSED_DATA_FILE_NAME, PROCESSED_DATA_FILE_NAME, AKTIVITET_FIELD_NAME, NACE1_FIELD_NAME def process(config: Config): """ Process the data into the desired (algorithm-specific) format. """ dat...
true
680fec26d22d67e7ad5d5780f2c283b8ce714232
nscheu/3700-Project3
/project3/project3/buffer.py
UTF-8
1,848
3.546875
4
[]
no_license
#!/usr/bin/python -u class Buffer: def __init__(self): self.size = 1 self.packets = [] def add(self, packet): self.packets.append(packet) def get_top(self): """ Gets the first packet from the buffer :return: """ if len(self.packets) > 0: ...
true
c3180458c295a3f874ed85480aa38f2e9b584d58
wnma3mz/m2m
/m2m/core.py
UTF-8
822
2.921875
3
[ "MIT" ]
permissive
# coding: utf8 import os import sys import re from bs4 import BeautifulSoup from dotenv import load_dotenv from medium_to_markdown import MediumToMarkdown from requests import get def transform_md(url): if re.match(r'^https?:/{2}\w.+$', url): m2m = MediumToMarkdown(url) m2m.transform() ret...
true
73b19fc73590bb385359c495b4b3cb69d6cc2f11
amanizardar/LibraryManagementSystem
/Library.py
UTF-8
2,523
4.125
4
[]
no_license
import pandas as pd class CentralLibrary: def __init__(self,booklist): self.books = booklist def showBookNames(self): print("****All availabe books in the Library are****: \n\n") for item in self.books: print(item) def requestBook(self,bookname): ...
true
557a0ccf46f68f4c3bbae4a1dfe965dfb101ef96
grymyk/octa
/base/matrix.py
UTF-8
885
3.15625
3
[]
no_license
def dot(u, v): return sum([coord1 * coord2 for coord1, coord2 in zip(u,v)]) def multiply_matrix_vector(matrix, vector): return tuple( dot(row, vector) for row in matrix ) def matrix_multiply(a,b): return tuple( tuple(dot(row, col) for col in zip(*b)) for row in a ) def gomoCoord(vectors): lsts = ...
true
10baab75c79e9edf1a3cb7814816c547a015e105
JuliaMuellerFr/advent_of_code
/advent_of_code_2020.py
UTF-8
13,308
3.15625
3
[]
no_license
### ADVENT OF CODE 2020 import os import re from functools import reduce import math from collections import defaultdict import copy path = "C:\\Users\Lenovo\\Documents\\GitHub\\advent_of_code" # DAY 8 print("Day 8") # part 1 # What's the accelerator value just before the loop repeats for the first time? print("p...
true
782daed626a9d42ca876b2381b5156254750ee5e
bio-ontology-research-group/pgsim
/gen_table.py
UTF-8
1,260
2.59375
3
[]
no_license
#!/usr/bin/env python import sys import os import numpy DATA_ROOT = 'data/' MEASURES = ( 'groupwise', 'pairwise', 'groupwise_sgd', 'pairwise_sgd', 'groupwise_new', 'pairwise_new',) def main(*args, **kwargs): # for measure in MEASURES: # filename = DATA_ROOT + measure + '/' + args...
true