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
38273c11c261133302926651ba7bf72e70f269ca
Python
imgagandeep/searching-sorting-algorithms
/007-insertion-sort.py
UTF-8
392
4.1875
4
[]
no_license
# Insertion Sort Algorithm def insertionsort(list): for index in range(0, len(list)): current_element = list[index] pos = index while current_element < list[pos - 1] and pos > 0: list[pos] = list[pos - 1] pos -= 1 list[pos] = current_element list ...
true
e9400d4d80eb3f26806e4e2c0bf756189d6df8f7
Python
jvhti/trabalhoPE
/analise/gerarGraficoMovieCount.py
UTF-8
523
3.234375
3
[]
no_license
import matplotlib.pyplot as plt import json with open('data/moviesCount.json', 'r') as file: moviesCount = json.load(file) plt.plot(range(len(moviesCount)), moviesCount.values(), linestyle='--', marker='o') plt.title("Quantidade de Vídeos por App") plt.savefig('imagens/VídeosPorApp.png', bbox_inches='tight') sum = ...
true
73f259dd6f8b1a4de80c38f4adb79a44ef7acc1e
Python
hyungsuklim/DeepLearning
/Project/actor_network.py
UTF-8
6,496
2.625
3
[]
no_license
# coding: utf-8 import tensorflow as tf from tensorflow.contrib.layers.python.layers import batch_norm as batch_norm import numpy as np import math # Hyper Parameters LAYER1_SIZE = 300 LAYER2_SIZE = 400 LEARNING_RATE = 1e-4 TAU = 0.001 BATCH_SIZE = 32 class ActorNetwork: """docstring for ActorNetwork""" ...
true
473425f53b5b1845130d27bf150d34400c3145d1
Python
qmnguyenw/python_py4e
/geeksforgeeks/python/easy/27_20.py
UTF-8
3,113
3.609375
4
[]
no_license
numpy.reshape() in Python The **numpy.reshape()** function shapes an array without changing data of array. **Syntax:** numpy.reshape(array, shape, order = 'C') **Parameters :** **array :** [array_like]Input array **shape :** [int or tuples of int] e.g. if we are...
true
f48fe7542eca26cb98c87ee4879cf0e32986a495
Python
kobe1916/python-code
/爬虫/requests/requests小技巧.py
UTF-8
3,332
2.625
3
[]
no_license
In [1]: import requests In [2]: response = requests.get("http://www.baidu.com") In [3]: response.cookies Out[3]: <RequestsCookieJar[Cookie(version=0, name='BDORZ', value='27315', port=None, port_specified=False, domain='.baidu.com', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure...
true
33795691786e732f9956a2638dd2f46d591a317e
Python
codeprogredire/Python_Coding
/83.py
UTF-8
844
3.34375
3
[]
no_license
''' Link: https://leetcode.com/problems/cheapest-flights-within-k-stops/ ''' import heapq def findCheapestPrice(n,flights,src,dst,K): adj={u:[] for u in range(n)} for f in flights: adj[f[0]].append((f[1],f[2])) for u,v in adj.items(): print('{} :'.format(u),end=' ') for i i...
true
ef644234f5a68cd24b2d85f3759adb9f41a07fd1
Python
FlogFr/UnAvis
/unavis/models/common.py
UTF-8
2,419
2.515625
3
[]
no_license
from django.db import models from django.conf import settings class InvincibleModel(models.Model): """ ```InvincibleModel``` enables the model to never be deleted from the DB by a .delete() """ is_active = models.BooleanField('Is the object active', null=False, ...
true
824bbbb4d0792c54f1e3df19e28fc872e03ebfd9
Python
jangnh/post
/social_publish_tool/social/poster.py
UTF-8
799
2.578125
3
[]
no_license
from .base import BasePoster class Poster(): def __init__(self, strategy: BasePoster): self._strategy = strategy @property def strategy(self) -> BasePoster: return self._strategy @strategy.setter def strategy(self, strategy: BasePoster) -> None: self._strategy = strategy ...
true
666dde563ef85f0256612a42d1eedb1b148a8313
Python
kpot/kerl
/kerl/common/history.py
UTF-8
6,732
2.921875
3
[ "MIT" ]
permissive
import datetime import os.path from typing import NamedTuple, List, Optional import numpy as np class HistoryRecord(NamedTuple): # Exact date and time of the record date_time: datetime.datetime # Exact total reward received during the simulation exact_reward: float # Moving average of the rewards...
true
57efb3dea66693f2c523df30da84ada72aaf8617
Python
kmill/notes
/model.py
UTF-8
14,279
2.5625
3
[]
no_license
import os.path import time import sqlite3 import json import datetime DB = None def db_connect(dbfile) : """Connects to the db. Sets the global DB variable because there should be only one connection to the db at a time anyway.""" global DB if not os.path.isfile(dbfile) : raise TypeError("The...
true
0835b8a36172decbf38ae4dd9caac19efe343a5f
Python
itaycsguy/ChordsLearner
/Source Code/Progress.pyw
UTF-8
909
2.71875
3
[]
no_license
import logging from tkinter import ttk from tkinter import * from threading import Thread """ Main pupose: initialize each base parameter to classification operation usage """ class Progress(): """ Main pupose: start processing bar view @param self this object """ def start_progress(self): self.progress_bar.st...
true
7bf6af803ecb9a4473357e496421b785b925322e
Python
rafarafarafarafael/py_objs
/polymorphism.py
UTF-8
443
3.890625
4
[]
no_license
from Person import Person class Person2(Person): def greet(self, name=""): if name == "": print("Hello, " + self._first_name + "!") else: print("Hello, " + name + "!") if __name__ == '__main__': my_artist = Person2('Rafael', 'Santos', 1976, 3, 23) print('my artist ...
true
10217da9c20adcc23bee63c189c010baeae7d929
Python
meghoshpritam/univ-sem2
/cg/shapes/trapezium.py
UTF-8
810
3.390625
3
[]
no_license
# docs: https://tkdocs.com/tutorial/canvas.html from tkinter import Tk, Canvas def draw_trapezium(canvas_width=500, canvas_height=500, canvas_bg="#ffffff", fill="#ffffff", outline="#E93B81", square_width=5): root = Tk() root.title('Trapezium') small_side = canvas_height if canvas_height ...
true
dc4cea7aa2c1fcbb012a721e3c1ae228b254559b
Python
georgeclm/python
/number.py
UTF-8
405
3.875
4
[]
no_license
from math import * myNum = -50 print(-54.56) print(myNum) print(str(myNum) + " So now i can print number inside of my string ") print(abs(myNum)) print(pow(3,10)) print(max(55,65)) # max for maximum number print(round(5.6)) # round the number print(floor(3.8)) # floor to round down the number print(ceil(3....
true
e164f0c2ce108977611abd76259b58e93ce97aa6
Python
bfichera/shgpy
/tests/test_merge_containers.py
UTF-8
1,774
2.59375
3
[ "MIT" ]
permissive
import unittest import shgpy import numpy as np class TestMergeContainers(unittest.TestCase): data_filenames_dict = { 'PP':'tests/Data/dataPP.csv', 'PS':'tests/Data/dataPS.csv', 'SP':'tests/Data/dataSP.csv', 'SS':'tests/Data/dataSS.csv', } fform_filename = 'tests/fform/T_...
true
0d3b5235dbe76c4b62f77c19df9d25c4cd248edb
Python
RuYunW/LCProject
/magic/multi_method_classify.py
UTF-8
919
3.171875
3
[]
no_license
import os # 读文件 filename = 'train_magic_method_class.txt' with open(filename, 'rb') as f: content = f.read().decode('utf-8') content = content.split("\n") flag = [] for i in content: if "class" in i: flag.append(1) else: flag.append(0) temp = [] class_name = "" for i in range(len(flag))...
true
10d81903a20bcb3db4ad0087d3677368b6ff9e3d
Python
Wjonke/Algorithms
/stock_prices/stock_prices.py
UTF-8
3,367
3.734375
4
[]
no_license
#!/usr/bin/python import argparse #first pass solution # def find_max_profit(prices): # def merge(a, b): # x = y = 0 # result = [] # while x < len(a) and y < len(b): # if a[x] < b[y]: # result.append(a[x]) # x += 1 # else: # ...
true
621ed23a0a5b70b48eec4c0649d8bb413bcc9102
Python
pranjalsk/easy-shopping-semantic-web-app
/Data_Hunting/Dataset_Safeway_alcohol.py
UTF-8
7,618
2.578125
3
[]
no_license
# This code extracts all the Bakery products data from Safeway.com # and makes csv file of the same from selenium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver...
true
ba8af99d2c25641501a0a7cd2a9c9bc8319c4803
Python
mistert14/mistert-skulpt
/skulpt/python/blackjack.py
UTF-8
6,067
3.03125
3
[]
no_license
import simplegui import random CARD_SIZE = (73, 98) CARD_CENTER = (36.5, 49) CARD_BACK_SIZE = (71, 96) CARD_BACK_CENTER = (35.5, 48) CANVAS_W = 800 CANVAS_H = 600 COLORS = ('trefle','pique','coeur','carreau') RANKS = ('A','2','3','4','5','6','7','8','9','T', 'J','Q','K') POINTS = {'A':1, '2':2, '3':3, '4':4, '5':5...
true
20c5693a52820f4f963be14853693d7c6affcc11
Python
NREL/sup3r
/sup3r/utilities/utilities.py
UTF-8
46,084
2.8125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """Utilities module for preparing training data @author: bbenton """ import glob import logging import os import re from fnmatch import fnmatch from warnings import warn import numpy as np import pandas as pd import psutil import xarray as xr from packaging import version from scipy import nd...
true
85447f94cc66b278a7d6e3b51c22e66faf711a03
Python
Maillol/test
/hotels/console.py
UTF-8
8,666
3.125
3
[]
no_license
import argparse from cmd import Cmd import datetime import pathlib import pickle from typing import Optional from .model import Hotel, NoFreeRoom class HotelCmd(Cmd): path_to_file: Optional[pathlib.Path] hotel: Hotel def __init__(self, completekey='tab', stdin=None, stdout=None): super().__init...
true
443deae2f2cb568f6132983471f7dc84e6c320ad
Python
Labannya969/Hackerrank-practice
/python/08. Regex and Parsing/001. Validating phone numbers.py
UTF-8
247
3.328125
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT import re n = int(input()) pattern = re.compile(r'^[7-9]\d{9}$') for i in range(n): k=input() if pattern.match(k): print('YES') else: print('NO')
true
b27b0b83e4be6e15bf06345f0a417d1ea12286bb
Python
PoroTomato99/Python_Crash_Course
/word_cloud.py
UTF-8
8,153
3.15625
3
[]
no_license
#!/usr/bin/env python file_contents = """This title is the first of its kind and will help you to secure all aspects of your Amazon Web Services (AWS) infrastructure by means of penetration testing. It walks through the processes of setting up test environments within AWS, performing reconnaissance to identify vulnerab...
true
7bbaba5d607b3a72cc0eac002cedfec3e17df435
Python
sawyermade/computerVisionGrad
/as1/smcImgCpu.py
UTF-8
2,313
2.59375
3
[]
no_license
import numpy as np import imageio, os, math, sys from tqdm import tqdm from color_conversion import * def meanshift_gs(img_og, steps, hr, hs, M, sdr, sds): img_in = np.copy(img_og) img_out = np.copy(img_og) for step in tqdm(range(steps)): for i in range(img_in.shape[0]): for j in range(img_in.shape[1]): X...
true
fca163fe038cd6494b6c866524d8935dc9c44a13
Python
silphire/training-with-books
/math-and-algorithm/023.py
UTF-8
201
2.625
3
[ "MIT" ]
permissive
# https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_w n = int(input()) bb = list(map(int, input().split())) rr = list(map(int, input().split())) print(sum(bb) / n + sum(rr) / n)
true
a68248b900492835983f1b1743dac2c9906df345
Python
timof1308/CsvToJson
/CsvFile.py
UTF-8
1,123
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/python # Author= Timo Fischer import sys from File import File from JsonFile import JsonFile class CsvFile(File): """ CSV File Class """ def __init__(self, file): """ CsvFile class constructor :param file: """ super().__init__(file) # check ...
true
1e9e2698976e43438863ca7d6ed82661955fec05
Python
adeshaies/Bank.py
/Bank.py
UTF-8
611
3.125
3
[]
no_license
class user: accounts = 0 @classmethod def __init__(self, username, password): self.username = username self.password = password user.accounts += 1 def encrypt(self): privatekey = 7411 letters = "abcdefghijklmnopqrstuvwxyz" encrypted = "" for letter in self.username: if letter in...
true
defc0dec1060f64350e38ddccdbc92926b532a01
Python
friendshuhr/pythonStuff
/Python Demos/guessingGame.py
UTF-8
258
3.796875
4
[]
no_license
#make a guessing game that prompts the user to enter a number. #tell them it's wrong until they get it right. #you can pick the number num = input("Enter a number") while num != 2: print ("no no silly") num = input("try again") print ("Yaay!")
true
9f4155d7637f59a43acc162c0ec18f73cc37ce5d
Python
MovIe-Tech/movie-recommender
/web/app.py
UTF-8
418
2.609375
3
[]
no_license
from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/search', methods=['POST']) def search(): return render_template('search.html', movies=find(request.form['statement'])) def find(statement): return ['映...
true
032c3742eb9a53a6831c8763784e79a88a6ab861
Python
vvindovv/likelion-homework
/blog/models.py
UTF-8
824
2.703125
3
[]
no_license
from django.db import models from django.contrib.auth.models import User # Create your models here. class Blog(models.Model): # pk title = models.CharField(max_length = 200) #짧은글(title) pub_date = models.DateTimeField('date published') #날짜와 시간의 변수 body = models.TextField() #긴글형식 def __str__(self):...
true
7aefa7bbdda982fed1d2b15c1998b13e6760de55
Python
msc-acse/acse-9-independent-research-project-LCS18
/cctv-ml-workflow/ml.py
UTF-8
3,794
2.671875
3
[ "MIT" ]
permissive
"""Laura Su (GitHub: LCS18)""" import numpy as np import random import utils import torch from torch.utils.data import TensorDataset from custom_dataset import CustomImageTensorDataset from data_augmentation import get_transform def set_seed(seed): """ Use this to set ALL the random seeds to a fixed value ...
true
685bdecd8e029b131145675a3b0238c77eba91e3
Python
yeasellllllllll/bioinfo-lecture-2021-07
/src/190page.py
UTF-8
232
2.875
3
[]
no_license
f = "data.txt" d = {} with open(f, "r") as fr: for line in fr: l = line.strip().split(" ") gene, val = l[0], l[1] d[gene] = val print(d.items()) print(sorted(d.items(), key=lambda x: x[1], reverse=True))
true
b164f6b0bc6082d512b710c0ee471de923d17964
Python
sam78640/internet-crawler
/database_exporter.py
UTF-8
566
2.921875
3
[]
no_license
import sqlite3 def create_table(): conn = sqlite3.connect('websites.db') c = conn.cursor() c.execute('''CREATE TABLE websites (id integer primary key autoincrement, websites TEXT)''') conn.commit() conn.close() def insert_data(): conn = sqlite3.connect('websites.db') c = conn....
true
9f91eddf0a7422accc599684c06c1c4f7e305791
Python
JudsonMurray/MovieDB
/CL/src/MovieList.py
UTF-8
19,460
3.828125
4
[]
no_license
# Claire Leblanc # Movie List # Program Description - User is able to add in the list, remove from the list, view the list, have a summary of the list # - User is now able to access Shortest to Longest, Longest to Shortest, A - Z, Z - A # - User is not able to add actors and ...
true
4d24afca9d1aacc9e12dfe57177cad17062d96fc
Python
fengzhongzhu1621/xTool
/tests/utils/test_timezone.py
UTF-8
1,710
2.65625
3
[ "MIT", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause", "Python-2.0" ]
permissive
# coding: utf-8 import datetime as dt import pytest from xTool.utils.timezone import * def test_is_localized(): now = utcnow() assert is_localized(now) def test_utc_epoch(): d = utc_epoch() assert d.year == 1970 assert d.month == 1 assert d.day == 1 def test_is_naive(): now = dt.dat...
true
ce99d57f3dadf4f54fc654d9a731a57bb656c59a
Python
DaiJitao/algorithm
/leetcode_china/demo2_2.py
UTF-8
1,364
3.5625
4
[]
no_license
class ListNode: def __init__(self, val, next): self.val = val self.next = next def demo(): """ 第一种方法是直接相加,但是无法应对超大链表; :return: """ pass def add_arr(arr1, arr2, add_bit): pass def demo2(l1: ListNode, l2: ListNode): h1 = l1 h2 = l2 n1, n2 = 0, 0 arr1 = [] ...
true
b87ad993aee98f64fcfe22efe4331b8599755eee
Python
hewaele/leetcode
/携程笔试/q2.py
UTF-8
1,243
2.828125
3
[]
no_license
from sklearn.metrics import roc_auc_score """ 10 1 0.90 0 0.70 1 0.60 1 0.55 0 0.52 1 0.40 0 0.38 0 0.35 1 0.31 0 0.10 0.68 """ n = int(input()) result = [] for i in range(n): r, p = map(float, input().strip(' ').split(' ')) result.append([r, p]) result.sort(key=lambda s: s[1]) #计算TPR #循环判断截断误差 roc = [] f...
true
9c9c6c06da22e55f370752fa93916c438fc99446
Python
jeffcall-ch/dividends
/SP500_div_yield_crawler.py
UTF-8
1,506
3.046875
3
[]
no_license
from bs4 import BeautifulSoup import requests import re class SP500(object): def __init__(self): pass def find_number_percent(self, input_text): words = input_text.split(" ") found_percentages = [] for word in words: if word.find("%") != -1: # append...
true
f05f4c79a52f614390dc7164df5b573d6c6f9fd9
Python
ryandasher/pythonthehardway
/ex5.py
UTF-8
539
3.671875
4
[]
no_license
name = 'Ryan D. Asher' age = 28 # not a lie height = 68 # inches weight = 145 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' print "Let's talk about %r." % name print "He's %r inches tall." % height print "He's %r pounds heavy." % weight print "Actually that's not too heavy." print "He's got %r eyes and %r hair." ...
true
32cfb38fbf60bfc77b6ff4f6cc32d3fc86cdf093
Python
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/leap/ca5b6d6ed1bf4c52973a8d8e8f5e868c.py
UTF-8
281
3.65625
4
[]
no_license
# # Returns true if year is leapyear # Conditions: # Year is divisible by 4 # Year is not divisible by 100 unless also divisible by 400 def is_leap_year(year): if not (year % 4 == 0): return False elif (year % 100 == 0) and not (year % 400 == 0): return False return True
true
999f32199e351006e599f999b5c9418bc6b2b3f2
Python
sharonsabu/pythondjango2021
/LanguageFundamentals/age.py
UTF-8
140
3.359375
3
[]
no_license
yob=int(input("enter the year of birth = ")) cy=int(input("enter the current year = ")) age=cy-yob print("age =",age) ly=100-age print(ly)
true
f2363b9836c6784ba570e40b92ec89528e0302ad
Python
jvaneg/ryuRestDBA
/backend/dbaAlgorithms.py
UTF-8
9,733
3.015625
3
[]
no_license
from copy import copy # allocated excess bandwidth evenly but not higher than what the flow is demanding def allocate_egalitarian(flow_list, excess_bandwidth): active_flows = [] # determine active flows (flows using bandwidth) for _flow_id, flow in flow_list.items(): if(flow.get_demand_bw() > 0): ...
true
bfe5ccfc44dbd385c45f9f9b2c733cb7598cf77f
Python
luoqiaoen/Python-ML-Workspace
/deep_learning_1/sklearn_ann.py
UTF-8
602
2.859375
3
[]
no_license
#Simple sklearn example from process import get_data from sklearn.neural_network import MLPClassifier from sklearn.utils import shuffle X, Y = get_data() X, Y = shuffle(X, Y) Ntrain = int(0.7*len(X)) Xtrain, Ytrain = X[:Ntrain], Y[:Ntrain] Xtest, Ytest = X[Ntrain:], Y[Ntrain:] #set model parameters, see MLPClassifie...
true
6a4b2312b181e2efb68c74251edcae240b5ab423
Python
zhangler1/leetcodepractice
/链表/148.排序链表.py
UTF-8
1,456
3.109375
3
[]
no_license
from 链表.链表序列化与打印 import ListNode,LinkList class Solution: def sortList(self, head: ListNode) -> ListNode: def merge(l1:ListNode,l2:ListNode): p=ListNode() head=p while(l1 and l2): if l1.val>l2.val: p.next=l2 p=p.next...
true
f4687ba4c75c16978ad81dca4c55ce81b6e38777
Python
roikvlad/Programming
/Курсовая/Python/ball.py
UTF-8
1,033
2.6875
3
[]
no_license
import pygame from game_object import GameObject from PIL import ImageFont # new import config as c # print(Q) # Q = [ # [ # ['Как называется ближайшая к Солнцу планета?','orange'], # ['Венера','red'], # ['Марс','deeppink'], # ['Меркурий','tomato'], # ['Земля','cyan'] # ], # ...
true
c9e1af7437068009d2875d65b0583f0b36215946
Python
KseniiaPrytkova/iban-validator
/get-iban-countries.py
UTF-8
630
2.921875
3
[]
no_license
import requests from bs4 import BeautifulSoup f = open('iban-data.txt', 'w') URL = "https://www.iban.com/structure" r = requests.get(URL) soup = BeautifulSoup(r.content, 'html5lib') data = [] table = soup.find('table', attrs={'class':'table'}) table_body = table.find('tbody') rows = table_body.find_all('tr') for ro...
true
743d6bfef6eed8a714baaa7ec4c8921df9e9439c
Python
FIRESTROM/Leetcode
/Python/375__Guess_Number_Higher_or_Lower_II.py
UTF-8
579
2.875
3
[]
no_license
class Solution(object): def getMoneyAmount(self, n): """ :type n: int :rtype: int """ dp = [[0] * (n + 1) for _ in range(n + 1)] for length in range(2, n + 1): for start in range(1, n - length + 2): end = start + length - 1 ...
true
50598ed826bd8198aac6edd64ce36270344bd835
Python
openelections/openelections-data-ia
/openelexdata/us/ia/util.py
UTF-8
3,828
3.40625
3
[]
no_license
import re import struct NUMBER_WORDS = { 'zero': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9, 'ten': 10, 'eleven': 11, 'twelve': 12, 'thirteen': 13, 'fourteen': 14, 'fifteen': 15, 'sixteen': 16,...
true
1c3840e6b0dd02fe2aab59ea5ec472a2497171d2
Python
Obukhova2001/practicum_1
/task20.py
UTF-8
1,173
3.40625
3
[]
no_license
""" Имя проекта: Boring-numpy Номер версии: 1.0 Имя файла: practicum-1(1-101).py Автор: 2019 © Д.А.Обухова, Челябинск Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru) Дата создания: 11/11/2020 Дата последней модификации: 11/11/2020 Связанные файлы/пакеты: numpy, ran...
true
3efee2c3d697868c3784b3ad7c15c2822820516e
Python
dzervas/boredom
/snake/snake.py
UTF-8
3,876
2.90625
3
[ "Beerware" ]
permissive
from curtsies import input from curtsies.window import FullscreenWindow from curtsies.formatstringarray import FSArray from curtsies.formatstring import fmtstr from random import randrange from time import time import sys # Body and head ascii form of the snake and apple. # head, body, apple, space theme = [ u" ", fm...
true
74626605a416a8a9f485f7a8822f4aa35e22e592
Python
TurtleHermitVT/Slippi_Live_Replay_Parser
/replay_parser.py
UTF-8
1,821
2.703125
3
[ "MIT" ]
permissive
#Experimental Live Slippi Replay Parser #Parses the data during live gameplay #Updates are inconsistently timed as data becomes available, #This means that the parser won't be on the exact same frame as the live game #but every single frame will be read. import time import translator from structures import * from gen...
true
576ceb94187260ca2767db47c680d727499c8bdb
Python
ErfanEbFiN2/coronavirus
/coronavirus.py
UTF-8
690
2.96875
3
[]
no_license
import requests from bs4 import BeautifulSoup import re my_list1 = [] my_list2 = [] l = 0 city = input('Enter a city to see a information : ') Get = requests.get('https://www.worldometers.info/coronavirus/country/' + city + "/") one = BeautifulSoup(Get.text, 'html.parser') information1 = one.find_all('h1') information...
true
94a3b68232ea7fe13d4014f0525dac843e0f39d9
Python
zanderdk/P7
/scripts/node2vec-parameter-optimization/get_nodes_test.py
UTF-8
577
2.796875
3
[]
no_license
from node2vec import getAllNodes import time import pickle start = time.time() nodes = getAllNodes() end = time.time() print("getAllNodes time:") print(end - start) print("nodes length before pickle: %d" % len(nodes)) start = time.time() with open('all_nodes.pickle', 'w') as f: pickle.dump(nodes, f) end = time.t...
true
83a51e49bfd543effcd2a0a19c5bdef998c73ef3
Python
EnderCaster/MyGitExperimentSpace
/linux_path/linux_monitor/network_monitor.py
UTF-8
800
2.875
3
[]
no_license
#!/usr/bin/env python # -*- utf-8 -*- import time import sys if len(sys.argv) > 1: INTERFACE = sys.argv[1] else: INTERFACE = 'eth0' STATS =[] print 'Interface : ',INTERFACE def rx(): ifstat=open('/proc/net/dev').readlines() for interface in ifstat: if INTERFACE in interface: stat = float(interface.split()[1]...
true
6a88c7a122a555d22a3db53f9a6decd274f8e1ca
Python
Minsc016/ggstudy
/py/第四章:迭代器与生成器/4_10_序列上索引值迭代.py
UTF-8
2,570
4.0625
4
[]
no_license
######################################################################### # File Name: 4_10_序列上索引值迭代.py # Author: Crow # mail:qnglsk@163.com # Created Time: Thu Dec 26 14:51:16 2019 ######################################################################### #!/usr/bin/env python3 # 在迭代一个序列的同时 跟踪正在被处理 的 元素索引。 # 解决方案,内置的 ...
true
eaad742da33074803601bd7bd01641009dc51f7a
Python
pushkarlaulkar/competitiveprogramming
/printlistwithspaces.py
UTF-8
50
2.890625
3
[]
no_license
a = [1, 2, 3]; print " ".join(str(x) for x in a);
true
1b9ff1db85135fa322d4280b9be7e7ce09b7c478
Python
malikalbeik/Buyit
/helpers.py
UTF-8
756
3
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" This helper file contains functions that we will use for security purposes. """ from functools import wraps from flask import redirect, session ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg']) def login_required(arg): """ Decorate routes to require login. http://flask.pocoo.org/docs/0.12/patterns/vie...
true
7174bbfa760d9683d5e85624639b6889dac38a76
Python
zclongpop123/sag_utils
/sag_fileTools.py
UTF-8
825
2.515625
3
[]
no_license
#======================================== # author: changlong.zang # mail: zclongpop@163.com # date: Mon, 29 Jun 2015 11:24:46 #======================================== import os, os.path, cPickle #--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-...
true
90e01d449f5befd9479dcf2c22c9cbe6bd70665d
Python
Aasthaengg/IBMdataset
/Python_codes/p03039/s003961310.py
UTF-8
1,389
3.4375
3
[]
no_license
# N, M から相異なる二点を取った時のマンハッタン距離の、二点の取り方についての総和を、 # _{N + M - 2} C _{K - 2} 倍したものが答え。 N, M, K = map(int, input().split()) # コンビネーション前計算。 MOD = 10 ** 9 + 7 table_len = 2 * 10 ** 5 + 10 fac = [1, 1] for i in range(2, table_len): fac.append(fac[-1] * i % MOD) finv = [0] * table_len finv[-1] = pow(fac[-1], MOD - 2, M...
true
89faa05b4fa46f25a6778fcace883df78dd39ffa
Python
renero/trader
/src/utils/plot_utils.py
UTF-8
6,447
2.796875
3
[]
no_license
import matplotlib.dates as mdates import numpy as np import pandas as pd from matplotlib import pyplot as plt from pandas import Series def trend_lines(ax1, trend, **kwargs): # plot lines where trend changes for x in trend.index[trend.green == 1].values: ax1.axvline(x, color='green', linestyle='--', a...
true
17f60d82e4909f81f29738232737fa56021ab33a
Python
blacknaml/Learning-New-Thing
/python-fundamental/input-float.py
UTF-8
429
3.71875
4
[ "MIT" ]
permissive
#!/usr/bin/python from __future__ import print_function def main(): # membuat prompt untuk tipe data float bilriil = float(raw_input("Masukan bilangan riil: ")) # menggunakan variabel untuk melakukan perhitungan hasil = bilriil * 2 # menampilkan nilai variabel print("Bilangan yang dimasukan ...
true
86b8f56533197963f6e18467d5a3062dc0dc9985
Python
Punttikarhu/Hy-Data-analysis-2019
/file_count.py
UTF-8
543
3.390625
3
[]
no_license
#!/usr/bin/env python3 import sys def file_count(filename): with open(filename) as f: data = f.read() numberOfLines = len(data.strip().split('\n')) numberOfWords = len(data.split()) numberOfChars = len(data) return numberOfLines, numberOfWords, numberOfChars def main(): f...
true
9325cda2d66c8d0b5fe07940c1b4b03d928ef5fa
Python
Lewkow/cosmic_twins
/game_object.py
UTF-8
1,058
3.453125
3
[]
no_license
import math from physics import Vector2d from helpers import draw_centered class GameObject(object): """All game objects have a position and an image""" def __init__(self, position, image, speed=0): self.object_time = 0 self.c = 5 self.image = image self.position = Vector2d(posi...
true
ed664480aa4372df36d7c2bd9ee3460b2b162130
Python
s62195541/250201048
/lab10/example2.py
UTF-8
188
3.234375
3
[]
no_license
def hailstone(n): s = str(n) if n==1: return s else: if n%2==0: return s+','+ hailstone(n//2) else: return s+',' + hailstone((3*n)+1) print(hailstone(5))
true
4786af0b5377c8fe50573f8a9921d8e095f83762
Python
cyber1998/netflix-titles-2019
/app/models.py
UTF-8
1,942
2.90625
3
[]
no_license
from django.db import models class Country(models.Model): """ The name of the country where the title was released """ name = models.CharField(max_length=128, help_text='Name of the country') def __str__(self): return self.name class Category(models.Model): """ The category in w...
true
8d4dec68d4c57705ed92ba6fa3e332182e65c7cb
Python
julianbrouwer/programmeren
/les 9/pe9_2.py
UTF-8
660
2.9375
3
[]
no_license
import datetime import csv bestand = 'inloggers.csv' vandaag = datetime.datetime.today() s = vandaag.strftime("%a %d %b %Y, at %X") with open('bestand', 'a', newline='') as myCSVFile: writer = csv.writer(myCSVFile, delimiter=';') writer.writerow(('datum','naam', 'voorletters', 'geboortedatum', 'email')) w...
true
b09d9f11ab2f70101fccfdb6e2ced80bdcca28b2
Python
shashank793/Python-3-BootCamp-Solution
/function assignment/check_panagram.py
UTF-8
264
3.5
4
[]
no_license
import string def ispangram(str1, alphabet=string.ascii_lowercase): x = set(alphabet)-set(str1.lower().replace(" ","")) if len(x) == 0: print(True) else: print("Not a Panagram") ispangram("The quick brown fox jumps over the lazy dog")
true
9936cdc726b9d1e998a35e21c48161d812ab5b69
Python
CosterBellido/Python-principiantes
/Convertidor de fahrenheit a celsius.py
UTF-8
123
3.640625
4
[ "Apache-2.0" ]
permissive
# Convierte de Fahrenheit a Celsius def convert(s): f = float(s) c = (f - 32) * 5/9 return c print(convert(78))
true
9da4d447dc6aa54e618d5b11415d00f7d44c09b7
Python
vpc20/binary-trees
/SearchInABinarySearchTree.py
UTF-8
1,043
4.6875
5
[]
no_license
# Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's # value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should # return NULL. # # For example, # # Given the tree: # 4 # / \ # 2 ...
true
03d84152731eb9cb04de4006175ad407425f1405
Python
mini338/mpf
/mpf/system/events.py
UTF-8
28,981
3
3
[ "MIT" ]
permissive
"""Contains the base classes for the EventManager and QueuedEvents""" # events.py # Mission Pinball Framework # Written by Brian Madden & Gabe Knuth # Released under the MIT License. (See license info at the end of this file.) # Documentation and more info at http://missionpinball.com/mpf import logging from collecti...
true
9df93958eb2e02b3460a7c8c941c84764d470919
Python
mohmah9/cs224n-2021-project
/src/Pre_processing.py
UTF-8
6,576
2.6875
3
[]
no_license
import json import csv import time import pandas as pd from hazm import * print("Pre Processing ...") start = time.time() with open('keyfari.json') as f: data_k = json.load(f) with open('hoghoghi.json') as f: data_h = json.load(f) r_k=[] for i in data_k: if len(i['raay']) < 150 and len(i['raay2']) < 150: ...
true
72f034083b20f268b57fef2f557151a48766641f
Python
shilpavijay/Pandas-and-Data-Analytics
/MultipleDataFrames.py
UTF-8
1,074
3.046875
3
[]
no_license
import pandas as pd df1 = pd.DataFrame({'HPI':[80,85,88,85], 'Int_rate':[2, 3, 2, 2], 'US_GDP_Thousands':[50, 55, 65, 55]}, index = [2001, 2002, 2003, 2004]) df2 = pd.DataFrame({'HPI':[80,85,88,85], 'Int_rate':[2, 3, 2, 2], ...
true
2fe511682925f68ba80213b5fee0730915c27d48
Python
AdamBhavnani/PythonProjects
/RandomMapGenerator/RandomMapv2.py
UTF-8
4,744
3.234375
3
[]
no_license
#import libraries/modules import RMv2_Func as RMv2 #PILlow library (python image library) for creating & loading images import PIL from PIL import Image #colour picker for image colours import tkinter as tk import tkinter.ttk as ttk from tkcolorpicker import askcolor #get input for Random Walk algorithm parameters map...
true
6ccada61d512fc685759eac10f92c6d2d92cdb47
Python
mit-quest/dendritic-spines
/train/data/mask-generation-scripts/alt-mask-gen.py
UTF-8
8,742
2.859375
3
[]
no_license
import os import numpy as np from skimage import io from scipy.io import loadmat from PIL import Image def getData(source = "./ann_files"): images = dict() for r, d, f in os.walk(source): for file in f: if '.ann' in file and '.ann' == file[-4:]: fileContents = loadma...
true
ba60ec4cba5e87ac69f97a88b0eddfd19904e24a
Python
byeongal/KMUCP
/week04/code01.py
UTF-8
76
2.78125
3
[ "MIT" ]
permissive
true_value = True false_value = False print(true_value) print(false_value)
true
58179356dc15fdaff727d3f50a3e7436ea7f1f51
Python
sunwenquan/scrapy-teaching
/glance.py
UTF-8
1,185
2.78125
3
[ "Apache-2.0" ]
permissive
import warnings import scrapy from scrapy.http.request import Request from scrapy.utils.deprecate import method_is_overridden class QuotesSpider(scrapy.Spider): name = 'quotes' start_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def start_requests(self): requests = [] f...
true
23b6f3001024f6e8a6dfdac6bca136e1c47e9300
Python
CDaudish/TDD
/check_pwd.py
UTF-8
113
2.765625
3
[]
no_license
def check_pwd(password): if len(password) >= 8 and len(password) <= 20: return True return False
true
71b3023c2574ab3f02db7f9530475eaec8b43b39
Python
tchapeaux/advent2019
/12_b.py
UTF-8
4,273
3.5625
4
[]
no_license
from copy import deepcopy from itertools import combinations import math import re from _lib import getLinesForDay rawInput = getLinesForDay(12) # Each planet is a list with 6 elements: # x, y, z, vx, vy, vz planets = [[] for l in rawInput] for idx, line in enumerate(rawInput): coords = re.match(r"<x=(.*), y=(....
true
824a2a1e98a50621abebb1e79d086b99c4abbb0e
Python
woopy098/SocialMediaCrawler
/socialMediaObjectCreator.py
UTF-8
6,117
3.6875
4
[]
no_license
from nltk.sentiment.vader import SentimentIntensityAnalyzer class socialMedia: """ A class to represent social media ... Attributes ---------- socialMedia : Object Create object for different social media. Object has database type, sentiment score and crime score Methods ...
true
aac70de6fb283f9f70ac961e23f4f06ed0a7a9e8
Python
weiyudang/leetcode
/offer/8.py
UTF-8
663
3.78125
4
[]
no_license
#coding:utf-8 ''' 输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。 n=2 10->1 n=3 11->2 n=9 1001->2 思路1:移位 >> 依次与&0x1直至数据为0 思路: n&(n-1) 每个数字n 与n-1 进行与运算可以消除最后一个1 1001—1000 0111 ''' class Solution: def NumberOf1(self,n): count=0 if n<0: n = n & 0xffffffff while n: n=n&(n-1) ...
true
24a618fe5580982ed9c7515775bc07c8f92a30bd
Python
nishant27kaushik/Covid-19_Cases
/Covid Stats/mycode.py
UTF-8
1,153
3.5
4
[]
no_license
#Plotting Covid-19 Cases & Deaths using the Covid Lib #Author Nishant Kaushik #Date: 2020-07-15 from covid import Covid from matplotlib import pyplot as plt covid = Covid() active_cases = covid.get_total_active_cases() total_deaths = covid.get_total_deaths() confirmed_cases = covid.get_total_confirmed_cases() mort...
true
1a12abdf6a7e029bce5c21689f9607c65a0b2496
Python
ChanJeunlam/gfdlvitals
/gfdlvitals/averagers/land_lm4.py
UTF-8
4,772
2.59375
3
[]
no_license
"""Land LM4.1 Averaging Routines""" import xarray as xr import gfdlvitals.util.gmeantools as gmeantools import gfdlvitals.util.xrtools as xrtools import gfdlvitals.util.netcdf as netcdf __all__ = ["xr_average"] def xr_average(fyear, tar, modules): """xarray-based processing routines for cubed sphere LM4 land ...
true
ce80a362c378e4f5a5f685e64db6386f7fbe768a
Python
bksahu/dsa
/dsa/patterns/two_pointers/squaring_a_sorted_array.py
UTF-8
879
3.984375
4
[ "MIT" ]
permissive
""" Given a sorted array, create a new array containing squares of all the number of the input array in the sorted order. Example 1: Input: [-2, -1, 0, 2, 3] Output: [0, 1, 4, 4, 9] Example 2: Input: [-3, -1, 0, 1, 2] Output: [0, 1, 1, 4, 9] """ # def solution(arr): # return sorted([x*x for x in arr]) # Idea is...
true
b2c3a90407aa451f0fa630a4f2b7ca4a8f4c5361
Python
lbarberiscanoni/gt4teams_analysis
/survey/merge.py
UTF-8
792
2.5625
3
[]
no_license
import csv from pprint import pprint survey_data = {} i = 0 keys = [] with open('survey_structured.csv', 'r') as infile: survey = csv.reader(infile) for row in survey: ob = {} if i < 1: keys = row else: for x in range(len(keys)): ob[str(keys[x])] = row[x] survey_data[ob["code"]] = ob i += 1 h...
true
f6411e96de1e30fa82fc6644464eb9712b5bc052
Python
yayankov/Python-Coursera
/Python Data Structure/tuples.py
UTF-8
766
3.421875
3
[]
no_license
#Write a program to read through the mbox-short.txt #and figure out the distribution by hour of the day #for each of the messages. You can pull the hour out #from the 'From ' line by finding the time and then #splitting the string a second time using a colon. #From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 #O...
true
0cd9929ef333bde005ad610422d9e5e88f0fd6b0
Python
bala4rtraining/python_programming
/python-programming-workshop/pythondatastructures/built_in_functions/filter/filter_one.py
UTF-8
151
3.484375
3
[]
no_license
numbers = [10, 20, 0, 0, 30, 40, -10] # Filter out numbers equal to or less than zero. result = list(filter(lambda n: n > 0, numbers)) print(result)
true
f99a1fd233250345004bd1b30955cf0183af2010
Python
hlibco/raspberrypi
/rgb_fade.py
UTF-8
2,232
3.421875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Turns ON and OFF a single RGB LED with many colors and interval of 1.5 seconds. ''' import RPi.GPIO as GPIO import time import math print GPIO.VERSION # RGB CONFIG - Set GPIO Ports RGB_RED = 11 RGB_BLUE = 15 RGB_GREEN = 13 RGB_CYAN = [RGB_GREEN, RGB_BLUE] RGB_WHITE = [RGB...
true
814ce12e75fbc7021ba08b8de5df638c24ef2486
Python
jiang718/MusicTheory
/tuning.py
UTF-8
981
3.546875
4
[]
no_license
# 12 tones # C3 -- E5 [0..28] # A script for generating different music tunings import math def printData(a, n, s): print(s+':') for i in range(0,n): print(name[i % 12]+str(i / 12 + 3)+' : '+str(a[i])) n = 29 y = pow(2, 1.0/12) a = [0 for i in range(0, n)] a[0] = 132.0 name = ['C', 'C#', 'D', 'D#', '...
true
53deadd71560adce250d56aee7542695eb27c182
Python
sandeepkumar8713/pythonapps
/10_dynamic_programming/31_minimum_paper_cut_square.py
UTF-8
1,982
4.125
4
[]
no_license
# https://www.geeksforgeeks.org/paper-cut-minimum-number-squares-set-2/ # Question : Given a paper of size A x B. Task is to cut the paper into squares of any size. Find the minimum # number of squares that can be cut from the paper. # # Examples: # Input : 36 x 30 # Output : 5 # Explanation : 3 (squares of size 12x12...
true
4ba3978593aad6c7e68dd266fe64f0a4c49cce02
Python
kictstudent/NLP
/NLTK.py
UTF-8
2,175
4.03125
4
[]
no_license
# -*- coding: utf-8 -*- import nltk import gzip from nltk.book import * #Create a function percent(word, text) that calculates how often a given word occurs in a text. def percent(word,text): w = text.count(word) t = len(text) return 100 * w / t def words_lt_or_eq_five(text): r...
true
69b312170f6ffe3c9a34f676d950b7db2a009a7c
Python
cpekyaman/HackerRank
/PythonChallenge/src/easy/challenge.py
UTF-8
1,408
3.734375
4
[]
no_license
from fractions import Fraction from functools import reduce def is_weird(): num = int(input()) if num % 2 != 0: print("Weird") elif num >= 2 and num <= 5: print("Not Weird") elif num >= 6 and num <= 20: print("Weird") else: print("weird") def arithmeti...
true
102bcfe147c2776525314f9715ac0e1b732d4d30
Python
kepich/Catapult
/Ellipse.py
UTF-8
533
2.859375
3
[]
no_license
from abc import ABC from pygame import draw from Entity import Entity class Ellipse(Entity): def __init__(self, x, y, width, height, color, isGhost=True): super().__init__() self.x = x self.y = y self.isGhost = isGhost self.color = color self.width = width ...
true
0b8c3ec5e7111630f76ecd2024e5a9c17731081e
Python
blumoestit/100DaysPython
/Day4/random_choice_from_a_list.py
UTF-8
341
4.40625
4
[]
no_license
#### LISTS #### import random names_str = "Dor, Rem, Mif, Fas, Sol, Laa, Sid" names = names_str.split(", ") # Chose a person from a list randomly (1) random_name = random.randint(0, len(names) - 1) person = names[random_name] print("Who will pay today: ", person) # Chose a person from a list randomly (2) print("Who ...
true
d3aebde275cade7cd2655ceea895d6727074b5ed
Python
SDomarecki/WSEOptimizer
/app/database_scripts/database_preprocessor.py
UTF-8
4,396
2.609375
3
[ "MIT" ]
permissive
import io import json import os import shutil from app.config import Config from app.database_scripts.basic_info.br_basic_info_scraper import BRBasicInfoScraper from app.database_scripts.company_details import CompanyDetails from app.database_scripts.fundamentals.biznes_radar.br_scraper import BRScraper from app.datab...
true
bbdfa2dfa83621fa25f19bf65c8dc534b0c8911b
Python
push44/earthquake-damage-prediction
/src/predict.py
UTF-8
4,401
2.578125
3
[]
no_license
import pandas as pd import model_dispatcher import pickle from scipy import sparse import numpy as np pd.options.mode.chained_assignment = None def train(X_num, X_bin, y): # Train model clf1 = model_dispatcher.models["decision_tree_clf"] clf1.fit(X_num, y) X_comb = sparse.csr_matrix(np.hstack((X_bin...
true
6279d09da537cdc9e0e113264f7663439de1f570
Python
beatabb/My_University
/Semester_5/SW_SmartVents/client.py
UTF-8
853
2.953125
3
[ "MIT" ]
permissive
import socket import select import sys import time # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 10000) print('connecting to', server_address[0], 'port', server_address[1], file=sys.stderr...
true
d749d9858147f0a7f45b3f46dfc4e579c00011f0
Python
rlronan/ADV_ECG
/utils/create_data.py
UTF-8
3,385
2.890625
3
[ "MIT" ]
permissive
import numpy as np import torch def create_data(raw_data = None, raw_labels = None, permutation = None, ratio = None, preprocess = None, max_length = None , augmented = None, padding = 'two'): ## Input: # raw_data: waveform data np.ndarray # raw_labels: label data np.ndarray # permutaion: fixed permutat...
true
50d982326404fb4d263282a57f78c1d715eaf196
Python
garfieldnate/vi_experiments
/web_corpus/wiki_keywords/gen_queries.py
UTF-8
1,658
3.40625
3
[ "Apache-2.0" ]
permissive
# Generate random tuples (web queries) from a word list # Apparently the same method for generating web queries as is used in BootCat import argparse import sys import random def get_random_tuple(seeds, order=3): picked = set() seed = random.choice(seeds) for _ in range(order): while len(picked) <...
true
ad7b9bdf5232525bf3a24c7d7dee4ca4b063e3a8
Python
parzuko/adventOfCode2020
/day5/binary_boarding.py
UTF-8
1,744
3.53125
4
[]
no_license
def find_row(boarding_id): low = 0 high = 127 index = 0 for move in boarding_id: if move == "F": high = find_mid(low, high) if move == "B": low = find_mid(low, high) + 1 if index == 6: return min (low, high) index += 1 def find...
true
263a88941f7e4136f68393635b3080679af3b2b5
Python
lwei140108/prcatice_django
/supermarket/simple/models.py
UTF-8
4,848
2.640625
3
[]
no_license
from django.db import models from django.contrib.auth.models import AbstractUser # 数据库模型 每一个类代表一张数据表 变量代表表中的字段名 class User(AbstractUser): class Meta: verbose_name = '用户信息' verbose_name_plural = verbose_name nickname = models.CharField('昵称', max_length=20, null=True) avatar = models.ImageF...
true