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
cbdc16a8fbef5659ad2da4524a528244d164858f
memoia/sparkcalc
/infix.py
UTF-8
6,313
3.75
4
[]
no_license
import unittest import operator from collections import deque, namedtuple from types import IntType OperatorProperty = namedtuple('OperatorProperty', ('weight', 'method')) class BaseOperators(object): """Subclass this to add new operators""" operators = { # symbol to precendence (higher value is higher pr...
true
603a7aa667d15971ae2ef72b64ac5ba1bf6c9041
esix/competitive-programming
/acmp/page-01/0012/main.py
UTF-8
914
3.140625
3
[]
no_license
from math import * inp = open('input.txt', 'r') out = open('output.txt', 'w') n = int(inp.readline()) def sqr(x): return x * x def d2(A, B): return sqr(A[0] - B[0]) + sqr(A[1] - B[1]) def d(A, B): return sqrt(d2(A, B)) def tris_l(a, b, c): p = (a + b + c) / 2 return sqrt(p * (p-a) * (p-b) * (...
true
80cc52c00e32ff4f5400a26eeb20cd334307a2d7
hyeonsu77/Project
/Reflected_XSS_Attack.py
UTF-8
1,391
2.515625
3
[]
no_license
from time \ import sleep import requests from selenium import webdriver from bs4 import BeautifulSoup from selenium.webdriver.common.alert import Alert ## file read f = open("C:/Users/okopo/Desktop/Python_Script/XSS_Pathern.txt", 'r') # XSS Pathern lines = f.readlines() # Read XSS Pathern number = 0 # Session Start ...
true
2a05981ba989e2fcf745c1d1b6726a7d7d0ddb17
DKostyuk/introduction
/doneTask_05/Task27_insertElement.py
UTF-8
265
2.6875
3
[]
no_license
a = list(map(int, (input().split()))) b = list(map(int, (input().split()))) k = b[0] x = b[1] a.append(x) i = -1 n = -(len(a) - k) # for i in a: while i >= n: if i == n: a[i] = x else: a[i] = a[i - 1] i -= 1 print(' '.join(map(str, a)))
true
82303bfea3a663ed6af2d9458a8261751271e2c5
adilnumancelik/cmpe487-final_project
/game/server/game_controller.py
UTF-8
10,952
2.546875
3
[ "MIT" ]
permissive
import threading import pickle import json import sys import random import uuid import time sys.path.append('..') from game import Game, GameState from utils import string_to_byte, byte_to_string class GameController(): SPECIAL_KEYWORD = b"xaxaxayarmaW" MAX_RECEIVE_TIME_DIFFERENCE = 0.010 # in seconds de...
true
28a4056b2401d5106fcffce13e676fad7c29e043
nmpluta/Python
/Exam/D14.py
UTF-8
303
3.640625
4
[]
no_license
# -*- coding: utf-8 -*- # D14 stworzy słownik z liczbą pwotórzeń wszystkich liter w łańcuchu bez użycia biblioteki Count def d14(string): char_list = list(string) d = {} for char in char_list: d[char] = d.get(char, 0) + 1 return d test = "Ala ma kota" print(d14(test))
true
7ce8284f729e93463198c8af5b3d7d7a5b028a9a
razzaksr/KasthuriPython
/Python/functions/CustomOne.py
UTF-8
163
2.984375
3
[]
no_license
#defining function def kasthoori(): # function logic print('function called') kasthoori()#function call print('will make second call again') kasthoori()
true
c29a6e75d215d5c30eba1546133e1ebc93a7ced0
Emdesade/test1
/cw 6 zad 5.py
UTF-8
93
2.796875
3
[]
no_license
import numpy as np flatted_input = [3,2,1] a = np.diagflat(flatted_input) print(a)
true
a43a67dc688ac4ef71089cf9cc6bd17b9d82b6f9
rafaelperazzo/programacao-web
/moodledata/vpl_data/31/usersdata/74/10220/submittedfiles/atividade.py
UTF-8
355
3.734375
4
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division import math n = int(input('Quantidade de pontos: ')) i = 1 while n>=i: x = input('Cordenada x') y = input('Cordenada y') if (x**2+y**2)<=1 and x>=0 and y>=0: print('%d %d pertencem a figura'% (x)(y)) else: print('%d %d não perten...
true
612abbe562d07e0185fa42d2becce3a3c64ef0c3
tcltsh/leetcode
/leetcode/src/25.py
UTF-8
1,425
3.15625
3
[]
no_license
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverse(self, begin, pre, tail, k): nhead = None ntail = None if k == 2: end = begin.next end.nex...
true
60d1fa3cafd5a9ba9ef771403650d04885de58e2
Pabebezz/BarkMessage
/options.py
UTF-8
913
3.078125
3
[]
no_license
#!/usr/bin/env python # -*- coding: UTF-8 -*- '''================================================= @Author :Pabebe @Date :2020/8/28 19:59 @Description :命令行参数 ==================================================''' import argparse class OptionsParser(): def __init__(self): # 创建一个解析器,ArgumentParser 对象包含将命...
true
d566f1a4c8153ae5782d0bfd663c41ceee9dd716
qmzsky/-
/main.py
UTF-8
735
2.640625
3
[]
no_license
from xlrd import open_workbook from xlutils.copy import copy import os import re def workstatistic(sour, dest): s = [] num = 0 files= os.listdir(sour) for file in files: s += re.findall(r"\d+\.?\d*",file) s = list(map(float, s)) rexcel = open_workbook(dest) table0...
true
7a8784809ee9f643f880b40785a6929b9dbca9fd
SHRAYAS-RAGHU/Basics-of-RNN-and-LSTM
/SENTIMENT_PREDICTION_RNN/test.py
UTF-8
1,337
2.578125
3
[]
no_license
import torch.nn as nn import torch as T import numpy as np from Dataloader import DATA_LOADER d = DATA_LOADER() vocab_size = len(d.words_to_int) + 1 out_dim = 1 embedding_dim = 400 hidden_dim = 256 n_layers = 2 from LSTM_model import LSTM_SENTIMENT lstm = LSTM_SENTIMENT(vocab_size, embedding_dim, ...
true
7c236cd5f9555457f685c6665ca37f8f28faf993
Silentsoul04/my_software_study
/Algorithm/baekjoon/2675_문자열_반복.py
UTF-8
842
3.6875
4
[]
no_license
#문자열 S를 입력받은 후에, 각 문자를 R번 반복해 새 문자열 P를 만든 후 출력하는 프로그램을 작성하시오. 즉, 첫 번째 문자를 R번 반복하고 #두 번째 문자를 R번 반복하는 식으로 P를 만들면 된다. S에는 QR Code "alphanumeric" 문자만 들어있다. #QR Code "alphanumeric" 문자는 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\$%*+-./: 이다. #입력: #첫째 줄에 테스트 케이스의 개수 T(1<=T<=1000)가 주어진다. 각 테스트 케이스는 반복 횟수 R(1<=R<=8), 문자열 S가 공백으로 구분되어...
true
b4fc046aa4f7f75219168da1babfd88f3cf77904
xxcocoymlxx/Study-Notes
/CSC420/A4/q2(e)1/q2(e)1.py
UTF-8
5,957
3.09375
3
[]
no_license
import numpy as np from scipy import spatial, cluster import cv2 as cv import math import re import os from collections import Counter from matplotlib import pyplot as plot import scipy.io as spio def depth_image(disparity_image, base_width, focal_length): """ Creates a depth image using a disparity image and ...
true
7e5ae50839ac01583bbeaa4036d2ef8782dd2363
luzfcb/relator
/scripts/josh3.py
UTF-8
1,416
2.640625
3
[]
no_license
from os import path from locations.models import Location from standards.models import Standard from structures.models import Building from results import Results from quantities import year buildings = Building.objects.all() locations = Location.objects.all() standards = Standard.objects.all() periods = ((1...
true
cf15d3e5fa4b33b2547356bc0dcb4c8615d6b47d
chiblyaa/goscripts
/goscripts/obo_tools.py
UTF-8
14,647
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' @author: Pieter Moris ''' import copy import os import re class goTerm: """ GO term object. Stores the ID, name and domain of the GO term and contains dictionaries for child and parent nodes. Attributes ---------- id : str The ident...
true
a06c1bccdfa1cf532aced5336d91e59ce5789d65
ThanasisGio/PythonProjects
/interacting with databases/a.py
UTF-8
2,147
3.6875
4
[]
no_license
import psycopg2 def create_table(): #steps #1 connect to databae #2create cursor, like a pointer to connect with rows columns #3write sql query #4commit changes # connect to database file db conn=psycopg2.connect("dbname='database1' user='postgres' password='posgres1234' host='localhost' po...
true
3efe85745a480508a1c28328d0688c2a53d44ebb
XarnoldX/FlaskTutorial
/app/models.py
UTF-8
1,652
2.671875
3
[]
no_license
from app import login from werkzeug.security import generate_password_hash, check_password_hash # needed for passport hashing from datetime import datetime from app import db from flask_login import UserMixin class User(UserMixin, db.Model): # db.Model - base class for all models from Flask-SQLAlchemy, UserMixin - p...
true
7c2f98be68ba55c004e0b7b199fa4e353a91a912
SpeechieX/algorithms-and-data-structures
/algorithmic-toolbox/week3_greedy_algorithms/1_money_change/change.py
UTF-8
330
3.59375
4
[]
no_license
#python3 def get_change(m): coins = 0 while (m > 0): if m >= 10: coins+=1 m-=10 elif m >= 5: coins+=1 m-=5 elif m >=1: coins+=1 m-=1 return coins if __name__ == '__main__': m = int(input()) print(get_...
true
77f28f282db10a105baf860e77fd9e8dba29db3f
josef-pkt/joepython
/joepython/scipystats/examples/movstat.py
UTF-8
9,421
2.9375
3
[]
no_license
'''using scipy signal and numpy correlate to calculate some time series statistics see also timeseries scikits (movstat is partially inspired by it) (added 2009-08-29: timeseries moving stats are in c, autocorrelation similar to here I thought I saw moving stats somewhere in python, maybe not) TODO: mo...
true
0a8d736bd34bb736d69cef6dae1d39397ef83394
assuncaofelipe/Python-DataStructure
/q15.py
UTF-8
814
4.34375
4
[ "MIT" ]
permissive
#!python3 # -*- coding: utf-8 -*- # criar vetor de 100 posições com valores entre 10 e 50 # encontrar o maior, quantas vezes aparece e uma posição onde ele pode ser encontrado # usando função nativa from random import randint def encontrMaior(vetor, tam): maior = vetor[0] for i in range(1, tam): ...
true
38bf39be6344c113770b1807eb5f9f40484739fe
hillcjames/Picarina
/tones.py
UTF-8
6,269
3.125
3
[ "MIT" ]
permissive
''' So in real instruments, not only does each note have a different frequency, but also a slightly different distribution of overtones. From the graphs I can see, the overtones generally all fill the range from the base, to ~3000, becoming more pure as you get up. Which makes sense - an 880 A can double and triple, ...
true
10b8545e25d81593fde82eeb63ff3a8a8c0852b0
keodai/cs310-project
/setup.py
UTF-8
16,323
2.640625
3
[]
no_license
# Perform one-time setup - dataset feature extraction and machine learning model training import logging import os import shutil import subprocess from timeit import default_timer as timer import numpy as np from sklearn.metrics import homogeneity_completeness_v_measure from sklearn.svm import SVC from sklearn.neighb...
true
50690d4484392a735d9ee5328a91097c83ab28fb
david-therincourt/physique
/physique/pyboard.py
UTF-8
18,659
2.640625
3
[ "MIT" ]
permissive
# David THERINCOURT - 2020 # # This file is a modification of the original pyboard.py edit by MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2014-2019 Damien P. George # Copyright (c) 2017 Paul Sokolovsky # # Permission is hereby granted, free of charge, to any person obtainin...
true
d758a902653f7930932b38f7fd0333f7be6f8bee
zoli333/Weight-Normalization
/nn.py
UTF-8
10,069
2.5625
3
[]
no_license
import numpy as np import tensorflow as tf def int_shape(x): return list(map(int, x.get_shape())) def mean_only_batch_norm_impl(x, pop_mean, b, is_conv_out=True, deterministic=False, decay=0.9, name='meanOnlyBatchNormalization'): ''' input comes in which is t=(g*V/||V||)*x deterministic : separa...
true
1152d2be05e4c6a3f7981b00e42c240f9267d3b2
sandychn/LeetCode-Solutions
/Easy/lcci-17-10-find-majority-element-lcci.py
UTF-8
378
3.015625
3
[ "MIT" ]
permissive
class Solution: def majorityElement(self, nums: List[int]) -> int: current, cnt = None, 0 for num in nums: if current == num: cnt += 1 else: cnt -= 1 if cnt <= 0: current, cnt = num, 1 retur...
true
79b67bea2498e5df6d12c1c2a9ad6bb2f0ca106f
rmb938/pyk8s-controller
/k8scontroller/informer/processor.py
UTF-8
1,449
2.9375
3
[ "MIT" ]
permissive
import logging from queue import Empty from threading import Thread class InformerProcessQueue(Thread): def __init__(self, queue, add_funcs, update_funcs, delete_funcs): super().__init__() self.logger = logging.getLogger("%s.%s" % (self.__module__, self.__class__.__name__)) self.queue = qu...
true
f85c1897c9063ae0dd6dd0635f4ef6778a019dfd
PyBeaner/ViolentPython
/Chapter01/socket1.py
UTF-8
1,112
2.875
3
[]
no_license
import socket import sys import os def retBanner(ip, port): try: socket.setdefaulttimeout(2) s = socket.socket() s.connect((ip, port)) ans = s.recv(1024) return ans except Exception as e: print("[-] Error = ", e) def checkBanner(banner, filename): if not b...
true
30deba35ce5dbb9aa93a46ea1d3866a2fc7dbd13
Proyectos-AP/Traductores_CI3725
/Fase2/extra/parserExample.py
UTF-8
18,077
3.5625
4
[]
no_license
import sys import os from Arbol import * from Tokens import * from Lexer import * import ply.lex as lex import ply.yacc as yacc #from prueba import tokens # ----------------------------------------------------------------------------- # calc.py # # A simple calculator with variables -- all in one file. # ----------...
true
a4abfbc70558cd473b6e298d0d6412b8115ecbc7
sethest/scraping
/01/p10_urlopen.py
UTF-8
332
3.109375
3
[]
no_license
# https://docs.python.org/3/library/urllib.html from urllib.request import urlopen html = urlopen("http://pythonscraping.com/pages/page1.html") print(html.read()) # https://blog.gtwang.org/programming/python-with-context-manager-tutorial/ with urlopen("http://pythonscraping.com/pages/page1.html") as html: print(...
true
a6ebe2a4e738637cce03d10ff44d3e820ccabf69
chajk811/TIL
/알고리즘/큐연습.py
UTF-8
391
3.984375
4
[]
no_license
# 튜 동작 구현 # 세 개의 데이터 1, 2, 3을 차례로 큐에 삽입하고 # 튜에서 세개의 데이터를 차례로 꺼내서 출력한다. (ex. 1 2 3) Q = [] for i in range(1, 4): Q.append(i) for i in range(3): a = Q.pop(0) print(a, end=' ') # import queue # q=queue.Queue() # q.put('A') # q.put('B') # q.put('C') # # while not q.empty(): # print(q.get())
true
331010555614b586c96c211d29b27052a29b5ad3
boisgera/pandoc
/mkdocs/generate_types_documentation.py
UTF-8
1,788
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python import pandoc import pandoc.types from pandoc.types import * with open("api.md.template", encoding="utf-8") as file: src = file.read() doc = "" def indent(text): return "\n".join(4 * " " + line for line in text.splitlines()) def list_types(type_): _def = type_._def types_ =...
true
ce1a79acc310ddb072e09e31dc4fb01dcef98d39
markfranciose/drops_of_knowledge
/practice/algos/rect_functions/rectangle.py
UTF-8
363
4.09375
4
[ "MIT" ]
permissive
# this works, but has the argument order dependency problem class Rectangle: def __init__(self, width, height): self.height = height self.width = width def area(self): return self.height * self.width def perimeter(self): return (2 * self.height) + (2 * self.width) x = Rectangle(4, 4) print(x.wi...
true
44078c3d9d883ac2f4c31e90659951ce1fd4f4cc
eitansternlicht/grid_royale
/grid_royale/gamey/culturing.py
UTF-8
2,859
2.640625
3
[ "MIT" ]
permissive
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from typing import (Iterable, Union, Optional, Tuple, Any, Iterator, Type, Sequence, Callable, Hashable, Mapping, TypeVar) import itertools from .utils import ImmutableDict from .base import State, ...
true
420f49c45d0290529c65edd05246f6b9423d9d7e
edumeirelles/Blue_modulo1
/Aula_12/Exercicios_aula_12_ex5.py
UTF-8
1,432
3.796875
4
[]
no_license
# 5. Crie um programa que leia nome, ano de nascimento e carteira de trabalho e cadastreos (com idade) em um dicionário. Se por acaso a CTPS for diferente de 0, o dicionário # receberá também o ano de contratação e o salário. Calcule e acrescente , além da idade, com quantos anos a pessoa vai se aposentar. Considere qu...
true
93ed741d301e4dcdd89112f176109b9c9519c2e8
kentaroy47/dezero_book
/dezero.py
UTF-8
1,899
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np class Variable(): def __init__(self, x): self.data = x self.grad = None self.creator = None # for define-by-run def set_creator(self, func): self.creator = func # for auto-grad def backward(self): f = s...
true
9b4e795e162ef4b96ccf898dfb910e40ba95e2df
priyanmuthu/deep-coder
/test/test_program_generator.py
UTF-8
2,753
2.609375
3
[]
no_license
import unittest import numpy as np from src.dsl import Function, Type, Variable, Expression, Program, Signature from src.program_generator import arguments, programs, random_programs, IdGenerator, Variable, Type class Test_program_generator(unittest.TestCase): def test_arguments(self): g = IdGenerator() ...
true
d97e94e2aea2cbe10ce993de74565367bc00ad5e
olivervalmas/ECCCoursework
/Q7.py
UTF-8
142
2.78125
3
[ "MIT" ]
permissive
def repetitionDecoder(v): return [] if v.count(0) == v.count(1) else [int(v.count(0) < v.count(1))] print(repetitionDecoder([0, 1, 0]))
true
98510a6d34071395bfac74f8bc6503b0e32f4316
Palhares17/Python_Exercicios_UFV
/Lista1/ex006.py
UTF-8
113
4.0625
4
[ "MIT" ]
permissive
num = int(input('Dígite um número: ')) ant = num - 1 suc = num + 1 print(f'Antecessor: {ant}, Sucessor: {suc}')
true
ae13cf2dbfeb8ea86c57350bafe25e998d16cc49
TVSjoberg/gan-dump
/evaluation/pMSE.py
UTF-8
4,038
2.890625
3
[]
no_license
import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import PolynomialFeatures from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier from gan_thesis.evaluation.machine_learning import * from gan_thesis.data.load_data import load_data N_...
true
25efc777ecc27abeeb3122bb849e04e75ca6012d
zdyxry/LeetCode
/array/0985_sum_of_even_numbers_after_queries/0985_sum_of_even_numbers_after_queries.py
UTF-8
483
3.21875
3
[]
no_license
from typing import List class Solution: def sumEvenAfterQueries(self, A: List[int], queries: List[List[int]]) -> List[int]: S = sum(x for x in A if x % 2 == 0) ans = [] for x, k in queries: if A[k] % 2 == 0: S -= A[k] A[k] += x if A[k] % 2 == 0: S += A[...
true
a293b60e5140baf3b1a7f0d5ef281500cdf412d4
cser2016/g-sdk
/client/python/example/connect/test/cli/deviceMenu.py
UTF-8
2,497
2.78125
3
[]
no_license
import grpc import connect_pb2 from example.cli.menu import MenuItem, Menu from example.cli.input import getUserInput, UserInput, getDeviceIDs class DeviceMenu: menu = None connectSvc = None def __init__(self, connectSvc): self.connectSvc = connectSvc menuItems = [ MenuItem('1', 'Set connection...
true
f7bf94d13b6b37db7cbe6e138b8013c28f50b412
AnthonyQ98/Drive-Thru-Menu-College-Assignment
/main.py
UTF-8
2,364
4.03125
4
[]
no_license
print("1) Entree") print("2) Side Dish") print("3) Drinks") menu = input("Please select the menu you wish to go to (number):") tofu = 3.49 cajun = 4.59 buffalo = 3.99 rainbow = 2.99 riceCracker = 0.79 fries = 0.69 zucchini = 1.09 brownRice = 0.59 cafeMocha = 1.99 cafeLatte = 1.99 espresso = 2.49 oolongTea = 0.99 if m...
true
3432a7932e2a45cc6ddb4dc9e345ce4cd27ed6c2
jsparmani/8-puzzle-game-solver
/game_tree_node.py
UTF-8
2,532
3.640625
4
[]
no_license
from game_state import EightPuzzleGameState adjacent_tiles = [(1,3),(0,2,4),(1,5),(0,4,6),(1,3,5,7),(2,4,8),(3,7),(4,6,8),(5,7)] solution_state_as_array = ['1', '2', '3', '8', 'x', '4', '7', '6', '5'] class GameTreeNode(object): """A node belonging to a game tree. The node contains the current state and i...
true
8cf00c03954e7330d54f5c903feda261fbdf8e51
Traava/Aileron-Deformation
/parseNodeLoc.py
UTF-8
3,654
2.546875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as tri node = np.genfromtxt('B737.inp', delimiter = ',', skip_header = 9, skip_footer = 14594-6598) elem = np.genfromtxt('B737.inp', delimiter = ',', skip_header = 6598, skip_footer = 14594-13233) nodes = {} elems = {} elem_dict = {} elem_lst = ...
true
ff076ab9b9683a5a713a299717a6ceccdf854550
fuchsteufelswild/MiniProjects
/WebBoardGame/BoardGame/game.py
UTF-8
24,978
3.015625
3
[ "MIT" ]
permissive
import json import random import socket import concurrent import threading import time # Content for any cell # Either can be an artifact or an action class CellContent: def __init__(self): pass def execute_action(self, player): raise NotImplementedError # Empty Action/Artifact for Cell # Do...
true
a29c25038d796b07c35d1eeaceb92c8d8cdc2b54
EmilRejman/WebScraping
/app/ex2_class.py
UTF-8
7,428
3.34375
3
[]
no_license
import requests from bs4 import BeautifulSoup import ast from collections import Counter, defaultdict from geopy.distance import distance from benedict import benedict """ Posts and Users overreview (ispect the HTML): All the data we want to extract from is inside the body part of html in preformated text tag. The dat...
true
30c7c8d5f6316a755a2a06861ef3f8947c241dc3
mscroggs/Logic-Bot
/test/test_twitter.py
UTF-8
652
3.0625
3
[ "MIT" ]
permissive
from logic import FormulaFactory from time import time def test_twitter(): start = time() fac = FormulaFactory() fac.set_ascii("(a/(a>-----b))") fac.next() while not fac.formula.is_tautology(): fac.next() print(fac.formula) fac.formula.as_unicode() print("Time taken: " +...
true
780512760d1e8354dd57ed9a13ad97bdfcfb0623
Cukerman/repos
/st/main.py
UTF-8
5,886
2.953125
3
[]
no_license
from menu import Menu from simpleMenu import Simple_menu_item from menuItem import Menu_item from studentRegistry import StudentRegistry from edit import Edit from student import Student from achieverVisitor import ( LowArchieverVisitor, HightArchieverVisitor ) from printVisitor import ( BriefPrintVisit...
true
abd4e54e1ca9659e44575011fc6d1c76f1944158
pganssle/audio-feeder
/tests/test_file_probe.py
UTF-8
3,912
2.703125
3
[ "LicenseRef-scancode-warranty-disclaimer", "CC0-1.0", "Apache-2.0" ]
permissive
import datetime import logging import pathlib import typing import pytest from audio_feeder import file_probe from . import utils def test_get_multipath_chapter_info(tmp_path: pathlib.Path) -> None: expected_chapters = [ file_probe.ChapterInfo( num=0, start_time=0.0, ...
true
40828cf7ce5e2ace842986bbd34bb9d442732e9c
amalpoulose/string-operations
/19.py
UTF-8
185
2.828125
3
[]
no_license
#!/usr/bin/python2.7 def main(): s=raw_input("sting : ") l1=s.split() l1.reverse() #or l1=l1[::-1] print " ".join(l1) if __name__=="__main__": main()
true
3f3debbbcf39329c7b7ac71ac2b94286e2ab029a
NickRuiz/power-asr
/tests/test_power_align.py
UTF-8
6,201
2.515625
3
[ "MIT" ]
permissive
from power.aligner import PowerAligner from power.levenshtein import ExpandedAlignment import unittest class PowerAlign_test(unittest.TestCase): def test_fbk_u264_a(self): ref = ["So the", "other", "elephant"] hyp = """set in an""".split() align = """S S S""".s...
true
f28fede014119fc578614c8c87a3442aa9c7d054
daniloaleixo/hacker-rank
/Algorithms_track/Warmup/9.TimeConversion/time_conversion.py
UTF-8
737
4.0625
4
[]
no_license
# Given a time in -hour AM/PM format, convert it to military (-hour) time. # Note: Midnight is on a -hour clock, and on a -hour clock. Noon is on a -hour clock, and on a -hour clock. # Input Format # A single string containing a time in -hour clock format (i.e.: or ), where and . # Output Format # Convert an...
true
12ff1def4d00ae0d7661bd08e7b622b35fbaa20f
jhorneman/gameconfs
/tests/test_site/test_api/test_search_api.py
UTF-8
4,257
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- from nose.tools import * from . import APITestCase class SearchAPITestCase(APITestCase): def get_base_url(self): return super(SearchAPITestCase, self).get_base_url() + "v1/search_events" def test_post_returns_405(self): r = self.c.post(self.get_base_url() + "v1/search...
true
fa9f7bceffab4b290fd7d11f03cbdf71368ae03f
zhengruiguo/dragon
/torch/core/serialization.py
UTF-8
2,898
2.671875
3
[ "BSD-2-Clause" ]
permissive
# ------------------------------------------------------------ # Copyright (c) 2017-present, SeetaTech, Co.,Ltd. # # Licensed under the BSD 2-Clause License. # You should have received a copy of the BSD 2-Clause License # along with the software. If not, See, # # <https://opensource.org/licenses/BSD-2-Clause> # # C...
true
695be3b5c520c6457bf9da2ed82b40434fac856a
bitfede/zuora-sandbox
/python-scripts/create-account-and-subscribe.py
UTF-8
1,529
2.578125
3
[]
no_license
#!/usr/bin/env python3 import argparse import requests import json # get user-provided keyword and store it into a variable parser = argparse.ArgumentParser(description='Create a customer account and subscribe him to the selected subscription ID') parser.add_argument('-u', '--user', required=True, metavar='User', hel...
true
252b50ed8852b38303bcd9e3b349a570135e050b
nroldanf/infiniteremixer
/infiniteremixer/data/extraction/globaltempoextractor.py
UTF-8
401
2.859375
3
[ "MIT" ]
permissive
from typing import Any from infiniteremixer.utils.io import load_from_pickle class TempoExtractor: def __init__(self) -> None: pass def extract(self, path: str, song: str) -> Any: """Load the tempo extracted from the drums :return: Tempo of the song """ tempo_dict = ...
true
57a46d8b7f84a936364d7618a27479d3cd62c3a7
xiong-Fgx/Tensorflow_code
/my_code/layer_CNN.py
UTF-8
2,901
2.546875
3
[]
no_license
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data data_dir = '/home/xiong/PycharmProjects/untitled/mnist' mnist = input_data.read_data_sets(data_dir, one_hot=True) x = tf.placeholder(tf.float32, [None, 784]) y_groundtruth = tf.placeholder(tf.float32, [None, 10]) learning_rate = tf.pla...
true
7f0fdd09a4ee310a4c7777bd2fe4182eb348b44e
MDoerner/AdventOfCode2019
/AdventOfCodeIn2019InPython/AdventOfCode20191201_1.py
UTF-8
429
3.359375
3
[]
no_license
def main(): mass_list = read_input("Advent20191201_1_input.txt") fuel_list = [required_fuel(x) for x in mass_list] total_fuel = sum(fuel_list) print(total_fuel) def read_input(filename): with open(filename, "r") as file: contents = [line for line in file] return [int(x) for x i...
true
2a0a197f7e6e5f310ea3eea7921f23550442d2d0
clinthof/P2PChat
/client.py
UTF-8
4,560
2.75
3
[]
no_license
import socket as s import threading as t import tkinter as tk import datetime buf_size = 4096 HOST = 'localhost' PORT = 1024 client = s.socket(s.AF_INET, s.SOCK_STREAM) client.connect((HOST, PORT)) class OUI_GUI: def __init__(self): self.chat_window = tk.Tk() self.chat_window.withdraw() ...
true
141ce0294f629b13fb28ba118684721f622015fd
multicode/genomics
/share/FASTQFile.py
UTF-8
24,209
3.28125
3
[ "Artistic-2.0" ]
permissive
# FASTQFile.py: read and manipulate FASTQ files and data # Copyright (C) University of Manchester 2012-13 Peter Briggs # ######################################################################## # # FASTQFile.py # ######################################################################### __version__ = "0.3.0" "...
true
1955f95a47753e84a36269cf8096e53576260107
Ajay2521/Python
/ADVANCE/Functions/Built in Function/hex( ).py
UTF-8
474
4.09375
4
[]
no_license
# In this lets see about the "Built-in functions" in python. # Built-in function is defined as the functions whose functionality is pre-defined in the python compiler. # Lets see about "hex( ) bilt-in function" in python. # hex( ) - Used to generate hex value of an integer argument. # Here is the program fo...
true
c83a760cc88f19a2d9c3edf284c540a76f3b3f25
mathdoug/GridWorld
/main.py
UTF-8
1,210
3.046875
3
[]
no_license
import matplotlib matplotlib.use("TkAgg") import gym import gridworld from policyIteration import PolicyIterationAgent from randomAgent import RandomAgent from valueIteration import ValueIterationAgent if __name__ == "__main__": # Environment env = gym.make("gridworld-v0") env.setPlan("gridworldPlans/plan...
true
7616f48ee11e8470202458120b09c3175193a79f
612twilight/dl_train_form_torch_pl_demo
/preprocessing/base_class/base_processe_raw_data.py
UTF-8
4,222
2.609375
3
[]
no_license
# -*- coding:utf-8 -*- """ ------------------------------------------------- Project Name: dl_train_form File Name: base_processe_raw_data.py Author: gaoyw Create Date: 2020/12/3 ------------------------------------------------- """ import os from config.hyper import hyper from logger import log class BaseProcessing...
true
41e474ea2736cb09166a01500ea3819699dfb071
sidk-10/insights
/summary/summarize.py
UTF-8
1,848
2.84375
3
[]
no_license
import torch import json from transformers import T5Tokenizer, T5ForConditionalGeneration, T5Config model = T5ForConditionalGeneration.from_pretrained('t5-small') # model.config.max_position_embeddings = 1500 tokenizer = T5Tokenizer.from_pretrained('t5-small') device = torch.device('cpu') text =""" The US has "passe...
true
ddb30681944be29fbbb9f81eaf018f9af0599d2d
apolinario-souza/Infant_movement_assessment
/src/data/build_features.py
UTF-8
5,230
2.625
3
[]
no_license
import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import sys sys.path.insert(0,'../src/modules') import circstats as CS import scipy as sc def angle_features(df): df = df.replace([np.inf, -np.inf], np.nan) # - absolute angle a_mean = np.degrees(CS.nanmean(np.array(np.radians(...
true
52210b20eb6db71a01eec948a0f3777743437db7
NavdeepMehta/Cheenai-House-Price-Prediction
/Cheenai House Price Prediction.py
UTF-8
10,164
2.59375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score from sklearn.neural_network import MLPRegressor import time import pandas as pd import numpy as np import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inlin...
true
18aa3478ae2dd60a12c8ddbefd17a4d0c2823e6d
adityaverma121/python
/palindrome_no_chk.py
UTF-8
380
4.1875
4
[]
no_license
n = int(input("Enter a number to check palindrome : ")) number = n rev = 0 # separate unit's digit and then reverse the number while(n>0): unit_digit = n % 10 rev = rev*10 + unit_digit n = n//10 # if number is same as reverse then it is palindrome if number == rev: print(f"{number} is pali...
true
a78f2a8957d4aa108cddc13fc5eff6d9a083480b
natchi92/ARCH-COMP
/2018/AFF/hylaa-continuous/iss/ISSC01.py
UTF-8
4,598
2.828125
3
[]
no_license
''' International Space Station Example in Hylaa-Continuous ''' import numpy as np from scipy.io import loadmat from scipy.sparse import csr_matrix, csc_matrix from hylaa.hybrid_automaton import LinearHybridAutomaton, bounds_list_to_init from hylaa.engine import HylaaSettings from hylaa.engine import HylaaEngine from...
true
18a0d2fc8d09885c2bec6d72908fc9918bacb901
opsxin/tgbot-thepaper
/getupdates/main.py
UTF-8
9,338
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import os import sys import redis import logging import subprocess import telegram.ext from threading import Thread from datetime import datetime, time from configparser import ConfigParser from telegram import ParseMode from telegram.ext import Updater, CommandHandler, MessageHandler,...
true
a72b708323375e8af7ad22e485671c1896068d46
Shrikar-Kota/DSA
/Linked_List/reverse_a_linked_list.py
UTF-8
1,036
4.65625
5
[]
no_license
''' Problem statement: Reverse a linked list. ''' class Node: def __init__(self, data): self.data = data self.next = None def initialize(): head = Node(0) temp = head for i in range(1, 10): temp.next = Node(i) temp = temp.next return head #Naive method ''' Make a ne...
true
d2769d2a10982fc015caf918f1066d94f5f12c1f
cheersyouran/portfolio-manager
/task2/utils.py
UTF-8
1,030
2.671875
3
[]
no_license
import base import pandas as pd def read_records_csv(): df = base.load_records_csv() print(df['PortCode'].unique().size) # 选盈利top_n的策略 def top_nav_portcode(n): df = base.load_nav_csv() nav = df.groupby(['PortCode'])['Nav'].apply(lambda x: x.iloc[-1]).reset_index(name='Q') nav = nav.sort_values(by=...
true
06095451d0965c2b2df348a2f0b19db1e5881c98
reppy4620/glow-tts
/text_jp/tokenizer.py
UTF-8
579
3.265625
3
[ "MIT" ]
permissive
class Tokenizer: def __init__(self, dictionary_path='./filelists/word_index.txt'): self.dictionary = self.load_dictionary(dictionary_path) def __call__(self, phonemes): return [self.dictionary[s] for s in phonemes.split('-')] def load_dictionary(self, path): with open(path, 'r', en...
true
d8bdfc236e4dfa74e63c0dd217090d6e5ea41770
marquinhusgoncalves/curso-testes-pratica
/loggi/messaging/helpers/twillio.py
UTF-8
1,648
2.546875
3
[]
no_license
# coding: utf-8 RESOLVER_RATING_TO_DRIVER_CALL_CODE = 'driver_incident.driver_call_rating' RESPONSE_RATING_TO_DRIVER_CALL_GOOD = 'BOA' RESPONSE_RATING_TO_DRIVER_CALL_BAD = 'RUIM' WHATSAPP_RATINGS_REPLY_GOOD = \ 'Que bom, {first_name}. Ficamos felizes que a sua experiência tenha sido boa.\n\n' \ 'Obrigada por ...
true
fbec0c01de8972ea16635c673f7c0560aa35a870
SeptyaAndiSuryanto/deltabrowser
/accounts/forms.py
UTF-8
2,320
2.53125
3
[]
no_license
#accounts.form.py from django import forms from django.contrib.auth.forms import ReadOnlyPasswordHashField from .models import User class RegisterForm(forms.ModelForm): password1 = forms.CharField(widget=forms.PasswordInput) password2 = forms.CharField(widget=forms.PasswordInput, label='Confirm password') ...
true
697d1e35797e06a26cdcd5b44c864a05cff202ba
mahalekshmim/jenish
/jenish6.py
UTF-8
296
3.234375
3
[]
no_license
#include<stdio.h> int main() { int n; printf("enter the year : "); scanf("%d",&n); if(n%4==0) { if(n%100==0) { if(n%400==0) { printf("leap"); } else { printf("not a leap"); } } else { printf("leap"); } } else { printf("not a leap"); } return 0
true
5ce7f6a0daed11446716fb4e12873c57a9a1c560
liuhr-python/drf-homework02
/squence/views.py
UTF-8
2,642
3.109375
3
[]
no_license
from rest_framework.views import APIView from rest_framework.response import Response from squence.models import Employee from .serializers import EmployeeSerializer # 导入序列化器 from .serializers import EmployeeDeSerializer # 导入反序列化器 class EmployeeAPIView(APIView): # 查询信息 def get(self, request, *args, **kwarg...
true
f69b093f64a7c9858f5e10050edd04688153ca75
cty321/myfile
/sum.py
UTF-8
189
3.390625
3
[]
no_license
#!/bin/bash/env python def sum1(x): a = 0 for i in x: if (type(i) is int) or (type(i) is float): a += i else: continue return print(a)
true
4114182800c87e3c76d34b358edcb5811a7a6730
juliazhuzhu/MyFirstPython
/src/chapter4.py
UTF-8
1,326
4.65625
5
[]
no_license
# 这两种可变参数可以混着用 def all_the_args(*args, **kwargs): print(args) print(kwargs) # 调用可变参数函数时可以做跟上面相反的,用*展开序列,用**展开字典。 args = (1, 2, 3, 4) kwargs = {"a": 3, "b": 4} all_the_args(*args) # 相当于 foo(1, 2, 3, 4) all_the_args(**kwargs) # 相当于 foo(a=3, b=4) all_the_args(*args, **kwargs) # 相当于 foo(1, 2, 3, 4, a=3,...
true
20f8c785563053d797ff4a3e0ba76074e94368c3
dhenriquedba/code-combat
/Masmorra-Kithgard/fire-dancing.py
UTF-8
336
3.671875
4
[]
no_license
#Poupe digitação (e o seu herói) com loops! # Códigos normalmente executam na ordem em que são escritos. # Loops repetem um bloco de códigos múltiplas vezes. # Use tab ou 4 espaços para identar as linhas dentro do loop. while True: hero.moveRight() # Adicione um comando moveLeft ao loop aqui hero.moveLeft...
true
515d14e2024cb561927cd5785686fb3130dc6554
Aparna1115/Google-FooBar
/lovely_lucky_lambs/solution.py
UTF-8
1,057
3.328125
3
[]
no_license
def stingy(total_lambs): lambshenchmen = [] lambshenchmen.append(1) max = len(lambshenchmen) - 1 henchmen = 1 while(sum(lambshenchmen) <= total_lambs): if(henchmen == 1): lambshenchmen.append(1); max = len(lambshenchmen)-1 henchmen = henchmen + 1 else: lastguy = lambshenchm...
true
59c283114c5cd3f2dbb1d9db547cbda15d518148
jwrth/xDBiT_toolbox
/xdbit_funcs/calculations/clustering.py
UTF-8
934
3.046875
3
[ "MIT" ]
permissive
from sklearn.cluster import MiniBatchKMeans from sklearn.metrics import silhouette_score, silhouette_samples import pandas as pd def kmeans_clustering_2d(xy, n_clusters=2, xlabel='x', ylabel='y'): ''' Do KMeans clustering on 2D data and calculate Silhouette Score as quality metric. ''' # Initialize th...
true
37ca3f87be5f75997dc83e4b66e55eede0d4261f
Changyoon-Lee/TIL
/Algorithm/파이썬 알고리즘 문제풀이(코딩테스트 대비)/섹션 7/9. 미로의 최단거리 통로/AA.py
UTF-8
529
2.78125
3
[]
no_license
import sys sys.stdin = open('섹션 7/9. 미로의 최단거리 통로/in1.txt') Q = [] dx = [-1,0,1,0] dy = [0,1,0,-1] n = 7 a = [list(map(int, input().split())) for _ in range(7)] ch=[[0]*n for _ in range(7)] ch[0][0]=1 L=0 Q.append((0,0)) while Q: tmp=Q.pop(0) for i in range(4): x=tmp[0]+dx[i] y=tmp[1]+dy[i] ...
true
7f7540b3d36e2553d79beba13e024c39a5f2381f
yuta-ys0603/aizu_online
/chap3/sec_36.py
UTF-8
681
3.40625
3
[]
no_license
def insertionSort(A,n,g): cnt = 0 for i in range(g,n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+g] = A[j] j = j - g cnt += 1 A[j + g] = v return cnt def shellSort(A,n): total_cnt = 0 G = [1] for i in range(1,n): ...
true
ce3fefaeda2dbeccadcbe238cfa5be148fb94f2d
podhmo/individual-sandbox
/daily/20180813/example_2phasecli/02annotations.py
UTF-8
368
2.75
3
[]
no_license
import typing as t import inspect def f( x: int, y: int, *, z: int, i: t.Optional[int] = None, j: t.Optional[int] = None, ): return (x, y, z, i, j) spec = inspect.getfullargspec(f) print(spec.annotations) # {'x': <class 'int'>, 'y': <class 'int'>, 'z': <class 'int'>, 'i': typing.Union[in...
true
de92de900e212963fdb82ae4eb0a15762eb02a99
MazeFX/irdb
/irdb/app/handlers.py
UTF-8
15,191
2.6875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Handlers Collection. Module containing all the used Request Handlers for the Tornado Server. """ import json from tornado.web import RequestHandler from .schemas import ArtistSchema, SongSchema class BaseHandler(RequestHandler): async def json_response(self, data, status_code=200):...
true
f036748fbfe97d7a33d43d55b6afd2c2fb8e3cf9
YuriiKhomych/ITEA_course
/VsevolodSavchenko/2_data_types/homework.py
UTF-8
2,448
3.890625
4
[]
no_license
####################################### ##########classwork # add type Numbers_int my_num_int = 11 print(my_num_int) print(type (my_num_int)) # add type Numbers_float my_num_float = 111.1 print(my_num_float) print(type(my_num_float)) """ add type Numbers_complex my_num_complex = 111.1az print(my_num_complex) print(type...
true
245661ccce40027d6f8250b039b9d5ec21da6caa
gkqha/leetcode_python
/682.py
UTF-8
562
2.96875
3
[]
no_license
class Solution: def calPoints(self,ops): """ :type ops: List[str] :rtype: int """ stack = [] result = 0 for i in range(len(ops)): if ops[i] == "+": stack.append(stack[-1]+stack[len(stack)-2]) elif ops[i] == "D": ...
true
08e567381e84823bc01e336ff4ae44e4f4e87a95
Cassie07/version-save
/hist.py
UTF-8
1,122
3.296875
3
[]
no_license
path='rmsd.dat' # path # load data as a list count=0 dat=[] with open(path) as f: for line in f: data=line.split() dat.append(float(data[1])) #dat.append(str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])) #print(min(dat)) # min 1.2034075260162354 max3.4252567291259766 # his...
true
044fe9fcd79cf91f136e89b601abac80a001cc4d
anconaesselmann/pySearch
/src/StemmingWrapper.py
UTF-8
238
2.703125
3
[ "MIT" ]
permissive
""" @author Axel Ancona Esselmann """ from nltk.stem.lancaster import LancasterStemmer class StemmingWrapper(): def __init__(self): pass def stem(self, token): stemmer = LancasterStemmer(); return stemmer.stem(token);
true
9b5c57ff3ef8b6df555c5f9861d462e035dc0063
A5308Y/Dorfsim
/Dorfsim.py
UTF-8
870
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import pygame, random, dorflib, Panel, Input from dorflib import * from pygame.locals import * SCREEN_SIZE = (1000, 600) def run(): pygame.init() screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32) pygame.display.set_caption('Dorfsimulator') world = World(SCREEN_SIZE) panel = Panel...
true
51d6f53f49d0e638c01838c20ce02f8c77c71689
muralisc/dotfiles
/bin/make_custom_calendar.py
UTF-8
1,584
3.109375
3
[]
no_license
#!/usr/local/bin/python3 """ Helper script to create custome calendar for training session with christian(PT) python -m venv venv source venv/bin/activate pip install icalendar Use separte google calendar for easy deletions !! """ from datetime import datetime, timedelta from icalendar import Calendar, Event import ...
true
7c0080ff5df2e78da1e71efa7fd523a13fb2b6ef
uldayb/seminar2
/mybox.py
UTF-8
484
3.25
3
[]
no_license
from myboxiterator import MyBoxIterator class MyBox(): def __init__(self): self.vrbl = list() def __len__(self): return len(self.vrbl) def add(self, item): self.vrbl.append(item) def remove(self,item): assert item in self.vrbl idx = self.vrbl.index(item) ...
true
2f81dff6f94d6e07e08879c9b3bd056aee9884b9
CHI-YU-SUNG/ML
/hw2/hw1.py
UTF-8
166
3.375
3
[]
no_license
import numpy as np # 陣列元素可以使用 list 或 tuple 傳入 A = np.array([4, 5, 6]) B = np.array((1, 2, 3)) a = np.ones(5) # 印出結果 print(A) print(B)
true
d9b37be82c674c5b77c2775cc3b5a4f3aa3c39a7
ShreckYe/Huawei-Code-Craft-2019
/Preliminary/generate_makelist.py
UTF-8
828
2.84375
3
[ "Apache-2.0" ]
permissive
import os import io def add_all_files(file_list: list, root: str, relative_path: str = ""): files = os.listdir(os.path.join(root, relative_path)) for filename in files: file_relative_path = os.path.join(relative_path, filename) if os.path.isdir(os.path.join(root, file_relative_path)): ...
true
26e86aa07194a60a150f0cfcfe400eb3f577146a
stevenbrand99/holberton-system_engineering-devops
/0x15-api/0-gather_data_from_an_API.py
UTF-8
1,202
3.28125
3
[]
no_license
#!/usr/bin/python3 """module 0-gather_data_from_an_API with the function todoUserProgress""" import requests import sys def todoUserProgress(user_id: int) -> None: """show information about user TODO list progress.""" URL = "https://jsonplaceholder.typicode.com" endpoint_user = "{}/users/{}".format(UR...
true
5db608bbff589808f0f6ee860291fae5a7ca8292
vippiv/python-demo
/demo/fn-print.py
UTF-8
171
3.34375
3
[]
no_license
# print用法扩展,通过end设置连接符 print("*") print("**") print("+" * 100) print("*", end="") print("**") print("+" * 100) print("*", end="H") print("**")
true
a0455d4e908875551101bee9007ebcb81f39cfca
shaunacs/hb-practice-challenges
/advent_of_code/day2.py
UTF-8
1,536
3.4375
3
[]
no_license
passwords_file = open('passwords.txt') passwords_file = passwords_file.readlines() passwords = [] for line in passwords_file: passwords.append(line.rstrip().split(' ')) for password in passwords: password[1] = password[1].rstrip(':') for password in passwords: password[0] = password[0].split('-') def nu...
true
42a9d5d16fe624c5854c7b8d467a83ef30a98958
avirepo/SendderAssignment
/movies/helpers.py
UTF-8
2,454
3
3
[ "Unlicense" ]
permissive
import json from datetime import datetime import cachetools.func import urllib3 BASE_URL = 'https://ghibliapi.herokuapp.com/' http = urllib3.PoolManager() class People: """ Meta class for keeping records of peoples as people object need to put in set to each film should contain only single entry of ...
true