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
309cccbe2dbefde98d41f1ce885b34e1c5025503
wkiri/DEMUD
/demud/dataset/dataset_tc.py
UTF-8
5,945
2.765625
3
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
#!/usr/bin/env python # File: dataset_tc.py # Author: Kiri Wagstaff, 7/1/13 # # Readers and plotters for TextureCam (image) data sets # # Copyright 2013-2015, by the California Institute of Technology. ALL # RIGHTS RESERVED. United States Government Sponsorship # acknowledged. Any commercial use must be negotiated wit...
true
8c4f5308e94efe06fd0ab4eece6001d87caa119b
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4357/codes/1633_2918.py
UTF-8
193
3.109375
3
[]
no_license
valordoingresso=float(input("digite o valor")) qingressos=float(input("digite o numero")) precopromocional=valordoingresso-(valordoingresso*(20/100)) print(round(precopromocional*qingressos,2))
true
44a12bcb3a1bca947e3941a15be91509153315d5
MVGasior/Udemy_training
/Inne/Clock.py
UTF-8
1,541
3.453125
3
[]
no_license
import time # sprawdzenie wersji pythona import sys print(sys.version) # zamiast # print(time.clock(), time.localtime(time.clock())) # korzystaj z funkcji time.perf.counter(): print(time.perf_counter(), time.localtime(time.perf_counter())) print("Current time is... unix epoch", time.time()) print("\n")...
true
2172596930b1e07848deea5bf3c1226a1f932a4d
matthewbeckler/newlang
/advent_2017/10.py
UTF-8
1,859
3.234375
3
[]
no_license
#!/usr/bin/env python import operator test_input_size = 5 test_input_lens = [3, 4, 1, 5] real_input_size = 256 real_input_lens = [129,154,49,198,200,133,97,254,41,6,2,1,255,0,191,108] part_two_input_ascii = "129,154,49,198,200,133,97,254,41,6,2,1,255,0,191,108" def part_one(elems, lens, ix, skip_size):...
true
57b99470b5e3755e0566b05229837c60068b11be
Greesha1337/python_basic_11.05.2020
/les8_hw/task1.py
UTF-8
1,837
4.625
5
[]
no_license
# Lesson 8 HomeWork - Task 1 """ Реализовать класс «Дата», функция-конструктор которого должна принимать дату в виде строки формата «день-месяц-год». В рамках класса реализовать два метода. Первый, с декоратором @classmethod, должен извлекать число, месяц, год и преобразовывать их тип к типу «Число». Второй, с декорат...
true
903ce6f7e72f58e79d88554a4b73d8e40a821046
laits1/CodingTest
/프로그래머스/LV2/가장 큰 수.py
UTF-8
354
3.765625
4
[]
no_license
# https://programmers.co.kr/learn/courses/30/lessons/42746?language=python3 def solution(numbers): answer = '' mok = [] for i in range(len(numbers)) : if (numbers[i] / 10 < 1) : print(numbers[i]) else : print(numbers[i] / 10) return answer numbers = [3, 30, 34, ...
true
e1f9d0a963f2cd82990f6aa73a823dbde421f471
gaul/s3-tests
/s3tests/common.py
UTF-8
9,694
2.53125
3
[ "MIT" ]
permissive
import boto.s3.connection import munch import itertools import os import random import string import yaml import re from lxml import etree from doctest import Example from lxml.doctestcompare import LXMLOutputChecker s3 = munch.Munch() config = munch.Munch() prefix = '' bucket_counter = itertools.count(1) key_counte...
true
5b043f5352686c67b692ed867f581dc735fea4eb
MattBlack85/alf
/tests/test_worker.py
UTF-8
299
2.515625
3
[ "MIT" ]
permissive
import asyncio import pytest from alf.workers import Worker @pytest.fixture def queue(): return asyncio.Queue() def test_worker_initialized_as_expected(queue): worker = Worker(queue, 'http://example.com') assert worker.queue is queue assert worker.url == 'http://example.com'
true
bf6a7be5f198767c46925f3c1bb14e6b5abc7d5e
gabriellaec/desoft-analise-exercicios
/backup/user_381/ch31_2020_09_28_13_01_11_916104.py
UTF-8
234
3.078125
3
[]
no_license
def eh_primo (x): if x == 1: return False if x % 2 == 0 and x!=2: return False i=3 while i<x: if x%i==0: return False i += 2 return True print(eh_primo(7))
true
01168ef8e17792a7580996169e88affd84ecfdba
LucianoBWille/Estudos_de_Python
/Exercícios Curso em Vídeo/Exercício033.py
UTF-8
660
4.40625
4
[ "MIT" ]
permissive
# Faça um programa que leia três números e mostre qual é o maior e qual é o menor. ''' numero = int(input('Primeiro valor:\t')) menor = maior = numero numero = int(input('Segundo valor:\t')) if numero > maior: maior = numero elif numero < menor: menor = numero numero = int(input('Terceiro valor:\t')) if nu...
true
47f9534f2feb83c94722493aa1512527193dbc5e
NISHIY-EKSDEE/Archived_scenes_rendering_Blender
/range.py
UTF-8
369
3.921875
4
[]
no_license
class Range(object): def __init__(self, start, end): self.start = start self.end = end def __eq__(self, other): return self.start <= other <= self.end def __contains__(self, item): return self.__eq__(item) def __iter__(self): yield self def __str__(self): ...
true
fdf6dd007840f529d3543db248b59ed904b97edd
brianhu0716/LeetCode-Solution
/1155. Number of Dice Rolls With Target Sum.py
UTF-8
831
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon May 31 20:58:34 2021 @author: brian.hu """ class Solution: def numRollsToTarget(self, d: int, f: int, target: int) -> int: mod = 10 ** 9 + 7 def helper(n,left) : if (n,left) in self.dp : return self.dp[(n,left)] if left == 0 : # ...
true
5579ae4e2892010379605768d17d4d7bf180e4ac
BimaAdi/menu-order-recording
/app/common/response.py
UTF-8
1,704
2.6875
3
[]
no_license
from typing import Union from rest_framework.response import Response from rest_framework.status import ( HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND, HTTP_500_INTERNAL_SERVER_ERROR ) # status 200 class Success(Exception): def __init__(self,...
true
d2413ce9af24d6a8003ea54f26b48c757d813c59
bytedance/Hammer
/converters/base_converter.py
UTF-8
9,513
3.078125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# python3.7 """Contains the base class for model conversion. Basically, all converters aim at converting pre-trained models (usually officially released or trained with officially released code) to match the networks defined in `../models/`. After that, the converted weights can be easily loaded and used for other pur...
true
973e28f5a8f764780d34f35a25879205402b3195
mstepan/algorithms-py
/epi/binary_tree/binary_tree.py
UTF-8
1,122
3.9375
4
[]
no_license
from enum import Enum class BinaryTree: def __init__(self): self.root = None self.nodes = {} def add_edge(self, parent_val, child_val, direction): parent = self.__get_node(parent_val) if self.root is None: self.root = parent child = self.__get_node(child_...
true
bb1e1cab3d7ef2c271c282c25f0a6444681757ea
deepgully/codes
/leetcode/python/interleaving-string.py
UTF-8
3,643
3.796875
4
[]
no_license
""" https://oj.leetcode.com/problems/interleaving-string/ Interleaving String Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbbaccc", return false. :copyright: (c) 2014 by Gully Chen. ...
true
00cb09ea3beeb4046398b40c4ec37666e78e1c13
asunYLiu/udacity-data-science-nanodegree
/P2 - Disaster Response Pipelines/models/train_classifier.py
UTF-8
5,143
2.90625
3
[ "MIT" ]
permissive
import sys import numpy as mp import pandas as pd from sqlalchemy import create_engine import re import joblib import nltk nltk.download(['punkt', 'stopwords', 'wordnet']) from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize from nltk.stem import WordNetLemmatizer from sklearn.fea...
true
c75a744f4738a497161d553b11933ef8bff4d4af
vhsw/Advent-of-Code
/2015/Day 19/medicine_for_rudolph.py
UTF-8
3,164
3.109375
3
[]
no_license
"""Day 19: Medicine for Rudolph""" import re from collections import defaultdict with open("2015/Day 19/input.txt", encoding="utf-8") as fp: DATA = fp.read().strip() def part1(data: str): """Part 1 solution""" repls, molecule = parse(data) s = set() for idx, atom in enumerate(molecule): f...
true
c4d01a577c64feb86348962083a5c57fbb69007d
Arvind-Bhakuni/TheSparkFoundation_Internship
/task_4/terroist.py
UTF-8
12,318
2.609375
3
[]
no_license
import random import textwrap import datetime as dt import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import pandas as pd df = pd.read_csv('globalterrorismdb_0718dist.csv', low_memory=False, usecols=['iyear', 'i...
true
a11579830f291f688e70034f1d28ce5c4d34135c
obliviousmonkey1/Verlet-Integration
/Physics, Verlet Integration/Verlet_Integration.py
UTF-8
4,607
2.984375
3
[]
no_license
import math import pygame import json pygame.init() WHITE=(255,255,255) BLACK=(0,0,0) width = 1920 height = 1080 clock = pygame.time.Clock() points : int = [] sticks = [] bounce = 0.9 gravity = 0.5 friction = 0.999 model = "Model2.json" angle = 0 speed = 0.1 def distance(p0, p1): ...
true
4776945938b18f0c625d814841365796de9f9f47
Seo-GwangHyeon/Code-Test-for-Job
/studied/6th Assingment/budget.py
UTF-8
510
3.1875
3
[]
no_license
def solution(budgets, M): answer=0 budgets =sorted(budgets) L=len(budgets) if max(budgets) >= M: answer=M//L elif sum(budgets) <= M: answer = max(budgets) else: for i in range(L) : M -= budgets[i] if i < L-1 and budgets[i+1] > M // (L-i-1): ...
true
29d50fb5a8adaba477b2cccda86a8e03e77efe7e
vanpana/GP
/src/main.py
UTF-8
376
2.6875
3
[]
no_license
from src.Controller import Controller import matplotlib.pyplot as plt if __name__ == '__main__': chromosome_number = 200 gen_number = 30 ctrl = Controller(chromosome_number, gen_number, "../data/data_100.csv") ctrl.run() plt.plot(range(0, gen_number), ctrl.averages) plt.axis([0, gen_number, ...
true
925e8c13f78a3eaf77d8f4aaef6b7da8aecdd730
jzakaria/GaleShapleyPy
/utils.py
UTF-8
595
3
3
[]
no_license
import random import person.py def add_person_to_list(person, list_of_persons): person.id = len(list_of_persons.ls)+1 person.group = list_of_persons.name list_of_persons.ls.append(person) def assign_preferences(person, otherlist): rn = range(1,len(otherlist)+1) random.shuffle(rn) dt = {} for choice in rn: dt...
true
79df4fc3895f647abeff5c4781d92872859dc4fe
Oath-of-the-Peach-Garden/Guan-Yu
/programmers/week2/no1.py
UTF-8
545
3.375
3
[]
no_license
#이상한 문자 만들기 s="___try hello world strys___" list=s.split(" ") resultList=[] for word in list: idx=0 flag=1 while idx<len(word): i=ord(word[idx]) if not (i>96 and i<123) and not (i>64 and i<91): idx+=1 continue if flag%2==1 and i>96 and i<123: word=word[:idx]+word[idx].upper()+wor...
true
5c21a2bf497fc38220e320feca05b5f50a7ecf10
fszatkowski/Numerical-Methods
/2.py
UTF-8
9,589
3.09375
3
[]
no_license
import numpy as np import tqdm as tqdm from dataclasses import dataclass from typing import List, Tuple, Sequence import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm """ This script computes temperature across 2d space and time using cranck-nicholson schema we assume start values are 30 degre...
true
73b655f53e35bdb5d2e1e553d049abd65fd01791
IvoNet/StackOverflow
/src/main/python/Q14.py
UTF-8
493
3.03125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess def run_process(exe): 'Define a function for running commands and capturing stdout line by line' p = subprocess.Popen(exe.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return iter(p.stdout.readline, b'') ...
true
c0a8a749a7847426e3cdb179b972ff65460d1b8e
markosolopenko/python
/advent_of_code_2016/day_8/day8.py
UTF-8
1,088
3.140625
3
[]
no_license
import numpy as np with open('input.txt', 'r') as file: instructions = file.read().splitlines() array_np = np.zeros((6, 50)) def lights_bright(): for line in instructions: if line.startswith('rect'): pos_x, pos_y = line.split()[1].split('x') array_np[:int(pos_y), :int(pos_x)]...
true
dbab0cf0a59d4d290a4d9eec244729002c8d171e
aogdowski-pgs/py-payments-testing
/utils/reporter.py
UTF-8
1,320
2.734375
3
[ "MIT" ]
permissive
""" This module consist all methods related with reporting """ import os import time class Reporter: def __init__(self, driver__browser, config__executor): self._browser = driver__browser.get_browser() self._reports_path = config__executor.reports_path def _create_reports_dir(self): ...
true
db66daa984d47617954c7d24482102bbe5403170
farruhilhamov/python-m1
/namegenerator.py
UTF-8
1,095
3.1875
3
[]
no_license
#!/usr/bin/env/ python3 import random def main(): a = ["a","e","i","o","u","y"] b = ["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","w","x","z"] nick = '' myrange = int(input("enter lenght of your nickname: ")) r = 20 for i in range(r): c = chr(random.randra...
true
4f16753419b9a16d5cd4499f317258df8805ecab
AdamZhouSE/pythonHomework
/Code/CodeRecords/2697/60721/301417.py
UTF-8
79
2.890625
3
[]
no_license
s=input() if(s=="[5,1,4,null,null,3,6]"): print("false") else:print("true")
true
0b54b9f961913b28022fd1d6db83844e45d311a4
namphung1998/Comp123_code
/hw5/hw5Code.py
UTF-8
1,421
3.734375
4
[]
no_license
# Homework 3 # Nam Phung # COMP123 - 03 from imageTools import * from imageToolsTools import * # Question 1 def encrypt(fileName1, fileName2, cipher): """a function that takes in a text file, encrypts it using the cipher dictionary and writes the encrypted text to another file""" file1 = open(fileName...
true
15d8a3ee47d6ad46b04a79c192582d920771e5ce
yogii1981/Fullspeedpythoneducative1
/Educativeio/FULLSPEEDPYTHON/Dictionary/sizeofdictwitindic.py
UTF-8
951
4.375
4
[]
no_license
""" Determine the size of the dictionary within the dictionary To calculate the number of students in the dictionary, get the length of the total keys in the dictionary using len(student.keys()) """ def totalStudentsKey(students): return (len(students.keys())) students = { "Peter": {"age": 10, "address": "...
true
423b9d31eb2e52708f57e08c3c9377f0735ed370
DenizSka/CodingNomads
/labs/03_more_datatypes/2_lists/03_09_flatten.py
UTF-8
364
3.90625
4
[]
no_license
''' Write a script that "flattens" a list. For example: starting_list = [[1, 2, 3, 4], [5, 6], [7, 8, 9]] flattened_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] ''' # need help starting_list = [[1, 2, 3, 4], [5, 6], [7, 8, 9]] for one in starting_list: for inside in one: print(inside) # starting_list = [[[1, 2,...
true
ebd24129ad176128b50ad003f92e733b28b15f41
Daniel-ef/OIMP_seminars
/196/sem5/main.py
UTF-8
1,540
4.03125
4
[]
no_license
# tuples def foo(n): print(n) a = (1, 'str', 4.5, 'abc', foo) a[4](5) print(a[1:4:2]) a = 2 b = 1 # swap example if a > b: (b, a) = (a, b) b, a = a, b (a, b) = (a, b) if a > b else (b, a) def foo2(): return (1, 2) # range print(tuple(range(5))) print(tuple(range(1, 5))) print(tuple(range(1...
true
cc175deec70e54eaf3ca7155b9cdac70a4d0ac8c
sarahalang/dissertation-code
/custom-functions/kontroll_functionen.py
UTF-8
3,260
2.71875
3
[]
no_license
import sys import os cwd = os.getcwd() dir_for_working_code = os.path.join(cwd, 'working-code') sys.path.append(os.path.abspath(dir_for_working_code)) from ToDosLogger import * #from annotation_list_creation_utilities import getContentWordsDict, updateBagOfWordsFromString #from helper_functions import * #from cltk_ba...
true
e8d4bdc1d01a7cfc6c167f9a4c2953d37eaf7289
yanjiechg/Recommendations
/tests/data_tests.py
UTF-8
502
3.0625
3
[]
no_license
import numpy as np test_tuples = [(0,0,3), (1,1,2), (0,2,5), (3,4,1)] from src.utility import tuples_to_array def test_tuples_to_array(): target = np.matrix([[3,0,5,0,0], [0,2,0,0,0], [0,0,0,0,0], ...
true
b86392e8b582cb10155634bf7dad8ea3172e99df
ppttzhu/MATH548_Project1
/testing.py
UTF-8
15,578
2.734375
3
[]
no_license
#!/usr/bin/env python3 # encoding: utf-8 """ @Project: MATH548_Project1 @FileName: testing.py @Author: Kim Ki Hyeon, Lu Weikun, Peng Yixin, Zhou Nan @Date: 2018/10/25 @Description: @File URL: https://github.com/ppttzhu/MATH548_Project1 """ from pricingengine import * from pandas_datareader import data from pinance im...
true
6021b172ffa7138a879bb6e8b5ce18cd286977cf
plawanrath/Leetcode_Python
/FindKClosestElements.py
UTF-8
1,462
4.46875
4
[]
no_license
""" Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order. An integer a is closer to x than an integer b if: |a - x| < |b - x|, or |a - x| == |b - x| and a < b Input: arr = [1,2,3,4,5], k = 4, x = 3 Output: [1,2,3...
true
0fa06c2fa6f9be76a5514373d04a480f0996b18d
Raseckuat/LearningPython
/Numero_de_1_o_2_digitos.py
UTF-8
283
3.796875
4
[]
no_license
numero=int(input("Ingresa un numero entre 1 y 99:")) if numero >0 and numero <25: if numero < 9: print(f"El numero= {numero}, tiene 1 digito") else: print(f"El numero= {numero}, tiene 2 digito") else: print(f"el numero= {numero}, esta fuera de rango.")
true
5a954cc5e65e5e2688c4dcf49caf288483ee134e
pat92fr/Carre92-2020
/60 - Simulator/lidar_client_telemetry.py
UTF-8
2,456
2.546875
3
[]
no_license
#-*- coding: utf-8 -*- ######################## # pip install numpy # pip install matplotlib ######################## # Import ######## import sys import os import time import socket import datetime import math import numpy as np import matplotlib.pyplot as plt from argparse import ArgumentParser from matplotlib.widg...
true
e188f27a73ed83226b729cec1dd2bd9a14bb47bb
gschen/where2go-python-test
/1806101007侯帅/20191215/2.py
UTF-8
377
3.3125
3
[]
no_license
from typing import List class Solution: def sequentialDigits(self, low: int, high: int) -> List[int]: S=[] for i in range(low,high): for j in range(0,len(str(i))-1): if int(str(i)[j])==int(str(i)[j+1])-1: S.append(i) return S so=S...
true
329e93225687ee329af3a552093e1b6d4b262736
nmdanny/university-api
/backend/app/app/schemas/track.py
UTF-8
767
2.71875
3
[]
no_license
from .common import ExtraData, Translations, ExtraDataField, TranslationsField from pydantic import BaseModel, Field from app.db.base import DegreeType class Track(BaseModel): """ A track within a university is usually a path to getting a degree Most tracks belong to a particular department & faculty, ...
true
81bec3fa0a9c6c262475d7dff166d19665b0a589
JingkaiTang/github-play
/life_or_hand/use_own_way_over_year.py
UTF-8
249
3.15625
3
[]
no_license
#! /usr/bin/env python def next_woman(str_arg): find_child_with_other_hand(str_arg) print('think_own_week_into_way') def find_child_with_other_hand(str_arg): print(str_arg) if __name__ == '__main__': next_woman('point_and_life')
true
2f7e60961fafef163e690bbc0b34e69dd478cfa8
enriquenc/DCCD
/cli/user_cli.py
UTF-8
2,134
2.53125
3
[]
no_license
import sys sys.path.append("../DCCD/") from crypto.private_key_generator import KeyGenerator from crypto.wif import * from objects.transaction import Transaction import cmd, sys from validators import tx_validator from objects.serializer import Deserializer, Serializer import requests import json import time from objec...
true
15e855f8d0128ee180ddfaf99221341d40209800
PacktPublishing/Advanced-Web-Scraping-with-Python
/chapter2/code/requests/requests_post.py
UTF-8
273
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests data_dictionary = {'name': 'username','password': '123456','email': 'user@domain.com'} response = requests.post("http://httpbin.org/post",data=data_dictionary) if response.status_code == 200: print(response.text)
true
92a0ab1a3ebeee0155372e263caa185aee67d2aa
yczhangsjtu/Python-RA2
/shp/shpplayer.py
UTF-8
1,131
2.671875
3
[]
no_license
import shp import pygame import os data = shp.load("Refactor/render_layer/img/shp/small/engineer.shp", "Refactor/render_layer/img/pal/red.pal") w, h = data[0].w, data[0].h n = len(data) print("%d, %dx%d" % (n, w, h)) pygame.init() font = pygame.font.Font(None, 24) screen = pygame.display.set_mode((...
true
8f2a82a94a8d68c3fe452edbbcde4445169536d2
troyzhao/parse-crash-log
/Find Block Symbol.py
UTF-8
5,311
2.546875
3
[]
no_license
import os import json finalSymbols = [] fpath = Document.askFile( "Select path to save json file", "block_sym.json", 'save' ) print "select f path ", fpath doc = Document.getCurrentDocument() IS32BIT = not doc.is64Bits() def searchBlockReference(segment, baseAddr, callfuncName = "NoFunc"): print "base addr 0x%x"...
true
9b486d10903c4c84fbbbc41ef57487ceb05a76b8
v-nys/python-controlegroep
/python-geneste-for.py
UTF-8
84
3.6875
4
[]
no_license
for digit in "123": print(digit) for letter in "abc": print(letter)
true
64a1520a12c41c9500a0203bb566d2ed9130c93c
Deana444/FITS_Analysis
/Ft1_Hourglass_ROI.py
UTF-8
3,252
3.40625
3
[]
no_license
# Example program to analysis LAT data from a FITS file, using Python and Matplotlib # Compares HDU information against Weniger paper from math import pi as PI from astropy.io import fits import numpy from pylab import * import glob import scipy.stats r=20 # From Weniger paper phi=60 # From Weniger paper ...
true
df4758a1dce2243664d5f268610ae1f350227e17
hithxh/CS190B-Web-and-Text-Mining
/Lab2/1.frequency.py
UTF-8
830
3.421875
3
[]
no_license
import nltk from nltk import FreqDist #read file from local f = open('input.txt','rU') raw = f.read() raw = raw.replace('\n',' ') raw = raw.decode('utf8') #decode raw text by utf-8 tokens = nltk.word_tokenize(raw) #change all tokens into lower case words1 = [w.lower() for w in tokens] #list comprehension #only...
true
e649a50f785cf7eb5aa824531f2744d3529f013b
asokolsky/RESTing-with-Flask
/04.couchdb/farm/app/test_farm_schema.py
UTF-8
1,857
2.734375
3
[ "MIT" ]
permissive
# # Testing Farm schema # # Launch it by issuing: # python3 -m unittest test_farm_schema -v # import unittest from schema import SchemaError from .farm_schema import AnimalSchema class TestFarmSchema(unittest.TestCase): def setUp(self): ''' Executed prior to each test. ''' retu...
true
f7776bbccd0f6a3fec43a86dcf8f44e6a07018a8
SR2k/leetcode
/first-round/1518.换酒问题.py
UTF-8
1,556
3.484375
3
[]
no_license
# # @lc app=leetcode.cn id=1518 lang=python3 # # [1518] 换酒问题 # # https://leetcode-cn.com/problems/water-bottles/description/ # # algorithms # Easy (67.52%) # Likes: 49 # Dislikes: 0 # Total Accepted: 23.1K # Total Submissions: 34.2K # Testcase Example: '9\n3' # # 小区便利店正在促销,用 numExchange 个空酒瓶可以兑换一瓶新酒。你购入了 numBott...
true
64b7240996b5e293ceb1097f02c03bea7417b021
JuhaszIstvan/StochasticVol
/thesis.py
UTF-8
2,808
2.671875
3
[]
no_license
#https://pythonforfinance.net/2016/11/28/monte-carlo-simulation-in-python/ if __name__ == '__main__': import sys from scipy.stats import norm from scipy.stats import lognorm import os, os.path import matplotlib.pyplot as plt import matplotlib.mlab as mlab import numpy as np import pand...
true
f109fe9e71cfdd1fa4a0d90fe8b70878c6b3fe88
FedeMiya/CursoPython
/Ej8Modulo2.py
UTF-8
316
4.375
4
[]
no_license
#8. Leer un número y calcular la suma de los números naturales hasta ese número. #Modificar el algoritmo para que se pueda procesar muchos números. Dar por terminada la #entrada cuando el número sea 0. n = int(input('Ingrese un número: ')) nSum = 0 while n != 0: nSum += n n += -1 print (nSum)
true
49f3ff4976692c0b93c412a6bde7c07421d9b72c
CalmSlug/100d-auction
/auction.py
UTF-8
1,687
4.25
4
[]
no_license
# Importing operating system logic and art assets: import os import auction_art # Creating variables: # 1. A dictionary to store bids # 2. Variables to store winner's name and bid auction = {} winner_name = "" winner_bid = 0 # Bidding function that will gather user bids into the dictionary; # Uses recursi...
true
3e9ee77acccce6c7d4c60e764bda01885d1d93f1
Gexeg/lessons
/Base algorithms/Stack.py
UTF-8
1,172
3.65625
4
[]
no_license
import unittest class Stack: def __init__(self): self.stack = [] def size(self): return len(self.stack) def pop(self): if len(self.stack) == 0: return None return self.stack.pop(0) def push(self, value): return self.stack.insert(0, value) def ...
true
10bca63d5441f16fa4613b69452fefac11868065
DT-In/addressparser1
/src/core/general/helperlib.py
UTF-8
11,391
3.34375
3
[ "MIT" ]
permissive
""" Author: Create date: Description: helper library Version Date Description(of Changes) 1.0 Created """ import sys import re from datetime import datetime from dateutil import tz import jellyfish as jf from django.contrib.humanize.templatetags.humanize i...
true
180e5663ba8754b3bd7e20a4c9c7b783e1ed41f8
rheehot/Algorithm_problem
/leetcode_letter-combinations-of-a-phone-number.py
UTF-8
817
3.234375
3
[]
no_license
class Solution: def letterCombinations(self, digits: str) -> List[str]: #중첩함수 def dfs(index, path): #재귀 종료 조건 -> 끝까지 탐색하면 백트래킹 if len(path) == len(digits): answer.append(path) return for char in num_dic[digits[index]]: ...
true
3b06ba2ce38da285ff25741ad605ce9d27e87b76
m-hawke/codeeval
/easy/40_self_describing_numbers.py
UTF-8
519
2.765625
3
[]
no_license
import sys #for line in (l.strip() for l in open(sys.argv[1])): # print(int(all(line.count(str(i)) == int(c) for i, c in enumerate(line)))) for line in (l.strip() for l in open(sys.argv[1])): for i, c in enumerate(line): if line.count(str(i)) != int(c): print(0) break else:...
true
e6e7ae853aac4dfafb3635b0ee0cdbb8daf42b26
moisesmagno/aulas
/python/curso-video/testes/ex_aula07.py
UTF-8
251
3.9375
4
[]
no_license
nome = input('Qual é seu nome? ') # print('Seu nome é {:20}'.format(nome)) # print('Seu nome é {:>20}'.format(nome)) # print('Seu nome é {:<20}!'.format(nome)) # print('Seu nome é {:^20}!'.format(nome)) print('Seu nome é {:=^20}!'.format(nome))
true
1c0ab253cb10f54d77bb48b03ea785ed89529ab1
shaunwbell/FOCI_Analysis
/temp/epickey2json.py
UTF-8
503
2.53125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Fri Jan 29 09:57:50 2016 @author: bell """ import datetime import json import csv from natsort import natsorted infile = '/Users/bell/Downloads/epickey.csv' epic_file = csv.DictReader(open(infile,'rU')) epic_keys = {} for row in epic_file: epic_keys[row['KEY']] = row prin...
true
5f8fbf570c8c0540c45ae773f872725aeaa5d97c
mr-nishanth/100-days-python-code
/excersise/prime.py
UTF-8
232
3.9375
4
[]
no_license
x=int(input("Enter any number = ")) pos=0 for i in range(2,x): if x%i==0: pos=1 break if pos==0: print(x," is prime") else: print(x," is not prime") # output: # Enter any number = 13 # 13 is prime
true
f1bae549285c6e848d8fb7316d9a9fef63cbd693
kojandy/AVM
/avm.py
UTF-8
7,336
2.59375
3
[]
no_license
#!/bin/env python import ast import copy import random import string import unittest from typing import Dict, List import astor import calcfitness import minLength branch_lineno = [0] def b_dist(pred: ast.Compare) -> float: left = pred.left right = pred.comparators[0] assert (type(left) == ast.Str) ...
true
d2be79fcc7bfba304c913abc8cf15c999508f6cc
anagainaru/MPI_Lectures
/basic_examples/4_send_np_array.py
UTF-8
360
2.796875
3
[]
no_license
#!/usr/bin/env python from mpi4py import MPI import numpy as np # Example for sending a numpy array comm = MPI.COMM_WORLD rank = comm.Get_rank() if rank == 0: sdata = np.array([i for i in range(5)]) comm.Send(sdata, dest=1, tag=11) elif rank == 1: rdata = np.array([0 for i in range(5)]) comm.Recv(rd...
true
ff6282d85433d35dde80ed34c4c9a2a68df9dd65
hualongdeng/hualongdeng-COMP90051-Statistical-Machine-Learning
/TwoStageTrAdaBoostR2.py
UTF-8
16,350
2.984375
3
[ "MIT" ]
permissive
""" TwoStageTrAdaBoostR2 algorithm based on algorithm 3 in paper "Boosting for Regression Transfer". """ import numpy as np import copy from sklearn.tree import DecisionTreeRegressor from sklearn.metrics import mean_squared_error from sklearn.model_selection import KFold ############################################...
true
1c5db7069a1882897e4ee9a7b19cb2abb9ccea08
tsukit2/eds-project-euler-solutions
/python/problem4.py
UTF-8
679
4.21875
4
[]
no_license
# A palindromic number reads the same both ways. The largest palindrome made from # the product of two 2-digit numbers is 9009 = 91 x 99. # # Find the largest palindrome made from the product of two 3-digit numbers. #def is_palindromic(num): # num_str = str(num) # i, j = 0, len(num_str) - 1 # while i <= j: # ...
true
af870aea0067b277e0c31edcc7d5c808d6eba9d2
Manjutadi/rev-of-digits-using-lists.py
/rev of digits using lists.py
UTF-8
315
3.15625
3
[]
no_license
def rev(n,data): def digits(i): d=0 while i: r=i%10 i=i//10 d=d*10+r return d c=[] for i in data: c.append(digits(i)) return c n=int(input()) data=list(map(int,input().split())) r=rev(n,data) print(*r)
true
bcfc43d7f87e790e8b1a7100351114189fa6bf96
kylechenoO/812pytest
/pynative/q11.py
UTF-8
275
3.515625
4
[]
no_license
#!/opt/anaconda/bin/python ## Question 11: Write a code to extract each digit from an integer, in the reverse order ## import build-in pkgs import re def getReverse(inputVal): return(re.sub(r'^ | $', '', re.sub('', ' ', str(inputVal)[::-1]))) print(getReverse(19378))
true
def6b474c787c303eea91929295b24b8879a9684
Aasthaengg/IBMdataset
/Python_codes/p03220/s510240816.py
UTF-8
554
3.25
3
[]
no_license
from typing import List def answer(n: int, t: int, a: int, hs: List[int]) -> int: import sys result = 0 temperature_difference = sys.maxsize for i, h in enumerate(hs, start=1): temp = abs(a - (t - h * 0.006)) if temp < temperature_difference: temperature_differenc...
true
654252caf751b7ef9565c930b4279f9601997898
Tomasz-Kluczkowski/Coding_exercises
/Find-Nth_Smallest_Element/tests/test_nth_smallest.py
UTF-8
541
3.25
3
[ "MIT" ]
permissive
import pytest from nth_smallest_element import nth_smallest, nth_smallest_order_n test_data = [([14, 12, 46, 34, 334], 3, 34), ([45, -10, 4, 5, 4], 4, 45), ([1, 3, 4, 5], 7, None), ([4, 3, 4, 5], 4, None)] @pytest.mark.parametrize('arr, n, expected', test_data) def test_nth_sm...
true
57f130fc80e3cfdc7da568d0572dbad0cf9f39a1
mukundacharya/Steam-Bot-using-BeautifulSoup-and-Python
/scrp.py
UTF-8
2,590
2.53125
3
[]
no_license
import requests from bs4 import BeautifulSoup import smtplib URL='https://store.steampowered.com/specials#tab=TopSellers' header ={"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'} page=requests.get(URL,headers=header) so...
true
445df177192655f98f660cdf55dfc9870cd31775
hongliang5623/vanyar
/leetcode/object_learn.py
UTF-8
414
3.171875
3
[]
no_license
# coding: utf-8 class Student(object): def __init__(self, name): self.name = name def age(self): return 20 def home(self): return Student.get_user_home('beijing') @classmethod def get_user_home(cls, local): if local: return local ...
true
59044a095315936af46d8cecdca9987981679919
balamurugan1999v/DataStructure
/list1.py
UTF-8
2,086
3.859375
4
[]
no_license
def insertbeg(llist,val): llist.insert(0,val) def insert_pos(llist,val,pos): llist.insert(pos-1,val) def insert_end(llist,val): llist.append(val) def delete_beg(llist): del llist[0] def delete_pos(llist,pos): del llist[pos-1] def display(llist): for i in range(len(llist)-1): print(llist[...
true
cbee6313e65b6ed169425a9eda69c0a5a8bbf764
dhyuan/video_flow
/gpu_test/src/testOneQuery.py
UTF-8
8,103
2.578125
3
[]
no_license
import time from datetime import datetime import sys from numba import cuda, jit import numpy as np import math import os def compare(test_file, sources_dir, top_numb): start_time = datetime.now() d_sources_features_on_gpu = load_features_to_gpu(sources_dir) test_features = read_test_features_from_file(...
true
bb843635d4150ee7bf43fa3b47fe30583d121935
marcelocra/ita-mips-simulator
/src/loader.py
UTF-8
940
3.15625
3
[]
no_license
# coding: utf-8 class Loader(object): def __init__(self, src_file='instructions.txt'): self.pc = [] self.mem_x = [] self.mem_y = [] self.instruction_lines = [] self.src_file = src_file def read_instructions(self): f = open(self.src_file, 'r') for line i...
true
53da75e63f1f6f544de1ef0139d5a4b1487df1ed
ecslee/photocode
/pset1/a1Requirements.py
UTF-8
3,061
2.671875
3
[]
no_license
import a1 import imageIO import numpy import random import unittest import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.im = imageIO.imread() def test_0_imageLoad(self): self.assertEqual(self.im.s...
true
7ce11e6f71aa13f7e62fabd23a4374bb4786cedb
markblandford/PythonDemos
/EssentialPythonDemos-June27_2014/01_Intro_to_python/colls.py
UTF-8
599
3.625
4
[]
no_license
lst = [1, 1, 2, 3, 5, 8, 13] st = {1, 1, 2, 3, 5, 8, 13} d = { "name": "Michael", "age": 41 } d = dict(name="Michael", age=41) print(d, type(d)) print(lst) print(st) print(lst[2]) print(lst[-1]) print(lst[len(lst) - 1]) # bad!! # slice a list... print(lst[:3]) print(lst[-3:]) print(lst[2:5]) lst.append(2...
true
294e065c455c87506bc42384c7b95f5c55df9dc6
petr-tik/lpthw
/ex40.py
UTF-8
766
3.953125
4
[]
no_license
""" classes in python: class name_of_class(object): def __init__(self): self.tangerine = "And now a thousand years between" def apple(self): print "I am classy APPLES!" by instantiating you create objects from classes and you create a mini module, which you can assign to a variable, so you can work with i...
true
061c8081fdf6714a671c2eb6c27fe59d5e8943ed
coderliuhao/DataScienceBeginner
/python_advanced/some_builtin_module/re_module.py
UTF-8
6,489
3.65625
4
[]
no_license
import re # re.match(pattern,string,flags=0) #pattern为正则表达式 #string为要匹配的字符串 #flag 为标志位,控制正则表达式匹配方式,如是否区分大小写,多行匹配等等 print(re.match("www","www.nowcoder.com").span())#起始位置匹配 print(re.match("com","www.nowcoder.com"))#不在起始位置匹配 #example line="Cats are smarter than dogs" match_obj=re.match(r"(.*) are (.*?) .*",line,re.M|re...
true
1842409d0c104765336f48a6666aef10898ed5ac
dengxiongbing/workspace
/PythonTrain/src/basic/Syntax_Function.py
UTF-8
2,265
3.390625
3
[]
no_license
#!/usr/bin/env python #coding:UTF-8 #================================================================= # @ Author : xiaodeng, Tencent ISD # @ Desc : update source code # @ FileName : Syntax_Function.py # @ Date : 2011-11-19 # @ ModifyHistory : # @ Remark : #=====================================================...
true
955c1584fbf7be37d6cbcde199345299584c3ee2
xkumiyu/case-style-changer
/tests/test_case_changer.py
UTF-8
1,093
2.71875
3
[ "MIT" ]
permissive
import pytest from case_style_changer.case_changer import CaseChanger from case_style_changer.case_style import CamelCase from case_style_changer.case_style import CapitalCase from case_style_changer.case_style import ConstantCase from case_style_changer.case_style import KebabCase from case_style_changer.case_style i...
true
65b4840413f6682489854fdda61c3223b3a899e8
sameersaini/hackerank
/Implementation/BeetweenSets.py
UTF-8
811
3.234375
3
[]
no_license
#!/bin/python3 import os import sys from math import gcd def checkFactor(number, arr): for x in arr: if x % number != 0: return False return True def checkMultiple(number, arr): for x in arr: if number % x != 0: return False return True def getTotalX(a, b): ...
true
96ebced450cdf5af346f751a36becd5640d0def0
Xiuying/illumitag
/illumitag/helper/barcodes.py
UTF-8
5,502
2.578125
3
[ "MIT" ]
permissive
# Built-in modules # from collections import Counter, OrderedDict # Internal modules # from illumitag.helper.primers import ReadWithPrimers, ReadWithPrimersMissmatch from fasta import FASTA, FASTQ, PairedFASTQ from plumbing.common import GenWithLength from plumbing.cache import property_cached # Third party modules #...
true
cbdcd6bb9326283c52d6bdd50514388d0c57d9f0
ysei/dirlistings-client
/dirlistings_client/__main__.py
UTF-8
1,487
2.59375
3
[]
no_license
import os import sys from datetime import datetime from tempfile import mkdtemp from urllib.request import urlopen from .parser import parse epoch = datetime(1970, 1, 1) def parse_listing(url, cache=None, last_modified=None, recursive=True): # prepare attrs cache = cache and os.path.abspath(cache) or mkdtem...
true
99a4fad929a8457a3110402672e71383a4d84204
turkeydonkey/nzmath3
/nzmath/cubic_root.py
UTF-8
5,188
3.015625
3
[]
no_license
import random import nzmath.arith1 as arith1 import nzmath.arygcd as arygcd def c_root_p(a, p): """ Return the cubic root modulo p. (i.e. a^3 = x (mod p)) """ if (a % p) == 0: return [0] if p == 2 or p == 3 : return [a % p] if (p % 3) == 2: return [pow(a, (((2 * p) -...
true
217db569dc6e56eea3abca5fce93a07fbbc94b36
kawmaiparis/Comsci_AS
/Dot.py
UTF-8
1,000
2.703125
3
[]
no_license
import pygame, sys import pygame.locals as GAME_GLOBALS import pygame.event as GAME_EVENTS pygame.init() window = pygame.display.set_mode((500, 500)) x, y, move_x, move_y = 0, 0, 0, 0 width, height = 40,40 while True: window.fill((0,0,0)) for event in pygame.event.get(): if event.type == GAME_GLOBALS...
true
d304e67dbc4f0eb0de5b806e8989f09603964389
sarthak-chakraborty/CausIL
/LIB/python/structure_learning/constraint_based/.ipynb_checkpoints/pc-checkpoint.py
UTF-8
1,484
2.515625
3
[ "MIT" ]
permissive
import sys # sys.path.append('../python/') from python.ci_tests import fast_conditional_ind_test # sys.path.append('../libraries/') from libraries.pclib import estimate_skeleton, estimate_cpdag from python.bnutils import one_hot_encoder from sklearn.preprocessing import KBinsDiscretizer import pandas as pd def pcalg(...
true
833c96b737238d612bb07bfcd78b370ab3195a15
yprodev/python_ads
/set_map/linearset.py
UTF-8
1,576
3.921875
4
[]
no_license
# Implementation of the Set ADT container using a Python list. class Set: # Create an empty set instance def __init__(self): self._theElements = list() # Return the number of items in the set def __len__(self): return len(self.__theElements) # Determines if an element is in the set def __contains__(self, el...
true
7b31260c8a2a579ce3ac14960529c5860bf65434
junbeomLim/Algorithm
/BOJ/backjoon 1700.py
UTF-8
790
3.0625
3
[]
no_license
N, K = map(int, input().split()) name = [0 for _ in range(K)] name = list(map(int, input().split())) concent = [0 for i in range(N)] i,j = 0,0 count = 0 for j in range(K): if concent.count(name[j]) > 0: continue elif concent[-1] == 0: concent[i] = name[j] i += 1 else: count ...
true
1b372234b6029d26206119a8ffe9cbec2cc1e44e
kpolnitz/sweeger
/scraper/dzoneScraper.py
UTF-8
2,347
2.84375
3
[ "MIT" ]
permissive
from common import Article import requests from bs4 import BeautifulSoup from selenium import webdriver import time import os def getDzoneURL(topic, pageNumber): assert type(pageNumber) == int and pageNumber >= 1 # f-string formatting will only work on Python 3.6+ return f'https://dzone.com/{topic}/list?...
true
cfcf05a852c6b1228a93619a421be08c9499bb74
carnationcrab/Fundamentals-of-Python-H1
/htt2_8.py
UTF-8
639
4.1875
4
[]
no_license
# SAM MARTORANA # ################################ [H1_4] ################################# # # Do HTT2 ("How to Think..." Chapter 2) Exercise 8. Your code should prompt # the user to: # (a) enter the float radius of a circle; # (b) read the entered value as a string (str); # (c) convert it to a float, then # (d) use ...
true
1f8519b999bec825c11e9886d8526e06ac1a651c
theluc-2111/letheluc-fundamental-c4e32
/Session 1/homework/hw_circle.py
UTF-8
110
3.046875
3
[]
no_license
from turtle import * speed (-1) shape('turtle') for v in range(120): forward(3) left(3) mainloop()
true
ab776bd8ced99ec6dc2c4d19370b832d24a42fd1
kikugawa-shoma/Atcoder
/Educational DP Contest/bitDP.py
UTF-8
326
2.765625
3
[]
no_license
#桁DP 最単純ver N以下の整数の個数 N = inout() L = len(N) dp = [[0]*2 for i in range(L+1)] dp[0][0] = 0 dp[0][1] = 1 for keta in range(0, L): dp[keta+1][0] = dp[keta][0]*10 + dp[keta][1]*(int(N[keta])) dp[keta+1][1] = dp[keta][1] print(dp[-1][0]+dp[-1][1]) #0も含むので(N+1)を出力で正解 a = 0
true
d08e3bcba3f29d290b334dce58a71f68980fe930
kiwi-33/Programming_1_practicals
/p18-19/p19p3.py
UTF-8
1,496
3.859375
4
[]
no_license
'''define the function import os check if file exists, if so open it. initialise counts to 0 for line in file: for character in line: if character = one of the bracket symbols: incriment count **do this for all 8** print all 8 totals. if sum (evenc...
true
4958ad60fa26ef7fe8f4427bd927df98eef16492
mdrachuk/serious
/tests/test_json_api.py
UTF-8
5,983
2.734375
3
[ "MIT" ]
permissive
from dataclasses import dataclass from typing import Optional from uuid import UUID import pytest from serious import JsonModel, LoadError from serious.descriptors import TypeDescriptor from serious.serialization import Loading, Dumping, FieldSerializer, field_serializers from tests.entities import DataclassWithDatac...
true
abc78ddd8f280a9f1d0f77f713a3dc9875b92592
LinZLin/Selenium_Data_Frame
/public/pages/base/base_page.py
UTF-8
8,116
2.859375
3
[]
no_license
""" __author__ = 'LZL' # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┃ ┗━━━┓ ...
true
fc5769b9e6d48585b0324359f938bfc3e6fc06ff
MrGi89/movieAPI
/api/views.py
UTF-8
3,482
2.828125
3
[]
no_license
from django.db import connection from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView from api.models import Comment, Movie from api.serializers import CommentSerializer, MovieSerializer, TopSerializer class ListMovies(APIView): def get(self, req...
true
02578daa6308a50dcf9c9363dc9e9acb3fbb832f
SangYoonLee1231/BaekJoon-Code
/Python/Bronze/No 10187.py
UTF-8
156
2.765625
3
[]
no_license
# https://www.acmicpc.net/problem/10817 # 세 수 (구현) / 브론즈3 A = list(map(int, input().split())) A.sort() #sorted_list = sorted(A) print(A[1])
true
9e796f5a67c4956abb674b4e3531e3674623ae82
dongyu-zhao/Ling131_final
/classification.py
UTF-8
2,612
2.859375
3
[]
no_license
import nltk import pickle import random import os from nltk.corpus import movie_reviews from sklearn.svm import LinearSVC from review_sentiment import ReviewSentiment def train(rs): print() print('Naive Bayes') nb_classifiers = [rs.train_classifier(nltk.NaiveBayesClassifier, i, 3) for i in range(6)] p...
true
42d5f2a43221faab79a99f1c6ff099cf8de1409f
federicociner/cs7641-A3
/src/clustering.py
UTF-8
13,164
2.609375
3
[]
no_license
import pandas as pd import numpy as np import timeit from helpers import cluster_acc, get_abspath, save_dataset, save_array from sklearn.metrics import silhouette_score from sklearn.manifold import TSNE from sklearn.cluster import KMeans from sklearn.mixture import GaussianMixture as GMM from collections import default...
true