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
436da6adbbede83367c180c134534b1831e80c03
1368129224/NeteaseCloudMusicSpider
/Spiders/spider.py
UTF-8
7,474
2.515625
3
[]
no_license
import requests import pymysql from concurrent.futures import ThreadPoolExecutor from Helper.SqlHelper import getMySqlTx def get_artist_id(name, api): ''' 搜索歌手 :param name: 歌手名 :param api: api :return: 元组:(歌手ID,歌手名) ''' url_search_artist = 'http://localhost:3000/search?type=100&keywords={}...
true
b76dfd87da579f5ea0a2e88630b27f93cd3fb2ea
jedzej/tietopythontraining-basic
/students/adam_wulw/lesson_01_python_basics/car_route.py
UTF-8
236
3.515625
4
[]
no_license
km_p_day = int(input('How meny km per day?\n')) route = int(input('How far you are going?\n')) extra_dey = 0; if (route % km_p_day > 0): extra_dey = 1 print('You need at least ' + str((route // km_p_day ) + extra_dey) + ' days')
true
41d2c3db26f2f42845df02130c68956b7fb742a9
Pato91/msft
/leet/oneaway.py
UTF-8
783
3.21875
3
[]
no_license
def oneaway(first, second): if not isinstance(first, str) or not isinstance(second, str): raise Exception('Invalid Input') elif first == second: return True n = len(first) m = len(second) if abs(n - m) > 1: return False if m == n: diff = 0 for i, c in enumerate(first): if second[i] != c: diff...
true
bf3f8fc4ea7e724331e20aab1fe0002748a6a2ee
atuanpham/wacv-journal-version
/src/utils/misc.py
UTF-8
200
2.640625
3
[ "MIT" ]
permissive
import os def transform_raw_data(data): return data.reshape(data.shape[0], *data.shape[1:], 1) def get_direct_directories(path): dir_walker = os.walk(path) return next(dir_walker)[1]
true
3128f9e66bac1325e65bb3990940c3317d399616
ShreyasVora/FPL_App
/FPL_past.py
UTF-8
15,809
3.4375
3
[]
no_license
import numpy from tabulate import tabulate from CSV_reader import CSV_reader import csv from colorama import init, Fore init(autoreset=True) class Implementation: """ A class that represents an implementation of the Elo Rating System """ def __init__(self, base_rating=1000): "...
true
1377ba51cd0b1b9cd32c3ac9a9efae36fd04380a
kalyanchirla/Modified-rsa-cryptosystem
/main.py
UTF-8
6,394
3.640625
4
[]
no_license
import pandas as pd import sys import random def power(a,b,m): """ Calculate 'a' power 'b' modulo 'm' using binary exponentiation """ a = a%m res = 1 while b>0: if b&1: res = res * a % m a = a * a%m b = b>>1 return res def isprime(n): """ Check i...
true
a7b10a20c1ec529255aa795611ddc243731fc8e3
Elasticnoise/my-own-way-to-Python
/lesson_003/01_days_in_month.py
UTF-8
1,189
4.125
4
[]
no_license
# -*- coding: utf-8 -*- # (if/elif/else) # По номеру месяца вывести кол-во дней в нем (без указания названия месяца, в феврале 28 дней) # Результат проверки вывести на консоль # Если номер месяца некорректен - сообщить об этом # Номер месяца получать от пользователя следующим образом # user_input = input("Введите, п...
true
c1762947f492ff88245a4644ca696e0d841f7bf9
123jrf/AEGIS
/DataTool/web-gen-tool.py
UTF-8
9,332
2.671875
3
[]
no_license
# (c) 2020 Jesse Forgione import bs4, glob, json, os, time SEASON_TEMPLATE = """<!DOCTYPE html> <html> <head><title>AEGIS League - {$EventName$}</title> <meta charset="utf-8" /> <link rel="stylesheet" href="/AEGIS/styles.css?version=2" /></head> <body><h1>AEGIS League {$EventName$} {$HeaderText$}</h1> <p>{$BodyText...
true
d6757c295a854cbb96827879c68f034ccd542ef5
kush-x7/Python-2021-notes
/programs/bmi_calculator.py
UTF-8
460
4.25
4
[]
no_license
#1. Create a greeting for your program. print("Welcome to the BMI calculator") #2. Ask user to input his/her height height = input("enter your height in m: ") weight = input ("enter your weight in kg: ") #3. Convert the input string into integer / float weight_int =int(weight) height_float = float(height) #4. Calcu...
true
70f91b294cd0e68dade75e805d0d2159508cdfd6
Hugo-Oh/study_DataStructure
/인프런/섹션 2/3. k번째 큰 수/AA.py
UTF-8
356
2.703125
3
[]
no_license
import sys sys.stdin = open("in1.txt", 'rt') n, k = map(int, input().split()) arr1 = list(map(int, input().split())) arr2 = [] for i in range(0, len(arr1) - 2): for j in range(i + 1, len(arr1) - 1): for q in range(j + 1, len(arr1) - 0): arr2.append(arr1[i] + arr1[j] + arr1[q]) print(list(set...
true
97154595aafd0c0d0550599b3fe61d94e399deeb
Rakeshgsekhar/code_practice_c_plus_plus
/codes/py/maxnumberofCoins.py
UTF-8
722
3.140625
3
[]
no_license
class Solution: def maxCoins(self, piles): temp = piles temp = sorted(temp) count = 0 idx = len(temp) if len(temp) == 3: print(temp[1]) return temp[1] else: n = len(temp)//3 k = 0 while k < n: ...
true
b51f8da1ad5c12dda3b036a75c2a6a48569ea9cd
drufat/spexy
/spexy/integrate/symbolic.py
UTF-8
4,899
3.203125
3
[]
no_license
# Copyright (C) 2010-2016 Dzhelil S. Rufat. All Rights Reserved. ########################## # Symbolic Integration ########################## import sympy as sy from spexy.data import memoize x, y, x0, y0, x1, y1, x2, y2 = sy.symbols('x, y, x0, y0, x1, y1, x2, y2') @memoize('memoize/sympy.json', lambda expr: repr(e...
true
8a6ddece9a2d0962c096be76d672afd572a6de55
tyler-le/Lane-Detection
/LaneDetection.py
UTF-8
5,021
3.0625
3
[]
no_license
import numpy as np import cv2 import matplotlib.pyplot as plt # TODO: Implement program to detect curved lanes # Function to stack videos for cleaner display output. def stackVideos(scale, imgArray): rows = len(imgArray) cols = len(imgArray[0]) rowsAvailable = isinstance(imgArray[0], list) width = im...
true
4998fb04dd6d3aaa89dc88f1a944631ee0179aeb
hsharrison/test-repo
/src/packagename/module.py
UTF-8
86
2.703125
3
[ "MIT" ]
permissive
"""Module.""" def add(x: float, y: float) -> float: """Add.""" return x + y
true
676794c39854b46ea69415049d607df3fbad26a7
rurrui/testgit
/map&rreduce.py
UTF-8
681
3.28125
3
[]
no_license
#map def f(x): return x*x L=list(map(f,[1,2,3,4,5,6,7,8,9])) L #Not map M=[] for n in [1,2,3,4,5,6,7,8,9]: M.append(f(n)) print(M) #reduce strToint from functools import reduce DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} def strToint(s): def fn(x,y): ret...
true
8b09addfa371d0a2f0bb31c38498f1b6f27e0763
george-sarji/YL1-201718
/Agario/Ball.py
UTF-8
930
3.515625
4
[]
no_license
from turtle import * class Ball(Turtle): def __init__(self, x, y, dx, dy, r, color): Turtle.__init__(self) self.pu() self.goto(x, y) self.dx = dx self.dy=dy self.r=r self.shape("circle") self.shapesize(r/10) self.color(color) def move(self...
true
48eff67dd5333dcdc8132891226a93d3c84f883e
meetashok/projecteuler
/30-40/problem-36.py
UTF-8
809
3.859375
4
[]
no_license
## Problem 36 ## Double Base Palindromes import utils def binary(n): condition = True binary_digits = [] i = 1 while condition: if n == 0: binary_digits.insert(0, 0) condition = False elif n == 1: binary_digits.insert(0, 1) condition...
true
c59da681c5a7e1fef0313d517813fbae41332641
Aasthaengg/IBMdataset
/Python_codes/p03080/s967079553.py
UTF-8
149
3.15625
3
[]
no_license
#!/usr/bin/python3 n = int(input()) s = input() cr = sum([int(c == 'R') for c in s]) cb = n - cr if cr > cb: print("Yes") else: print("No")
true
52495ac083d0389b5bfb5314cc465e57cb41589a
arto-pihlaja/py-problems
/test_pb1.py
UTF-8
400
2.953125
3
[]
no_license
import unittest import pb1 class TestFirstProb(unittest.TestCase): def test_simple(self): tstArr = [-1, -1, 0, 1, 2] self.assertEqual(pb1.calculateRatios(tstArr), [0.4, 0.4, 0.2]) def test_rounding(self): tstArr = [-1, 5, -1, 0, 1, 2] self.assertEqual(pb1.calculateRatios(tstArr)...
true
1f6b08a4afdad804610008904efa7c08f273df87
DagF/tdt4120_algdat_h15
/assignments/assignment_7/merge.py
UTF-8
1,225
3.28125
3
[]
no_license
from sys import stdin from itertools import repeat def merge_l(lef, rig): l_h = lef r_h = rig d_l = len(r_h) + len(l_h) list = [None] * d_l i,j,k = 0,0,0 left_length = len(l_h) right_length = len(r_h) while i < left_length and j < right_length: if l_h[i] < r_h[j]: ...
true
c62b4383cea8aa49a8ab32a5197aab67086b94e1
DrOncogene/zuri-django-blog-prod
/blogapp/tests/test_models.py
UTF-8
2,056
2.515625
3
[]
no_license
from django.test import TestCase from ..models import Author, Post, Comment # Create your tests here. class TestModelsClass(TestCase): @classmethod def setUpTestData(cls): cls.author = Author.objects.create( username='kayode', password='testpassword', first_name='Rasheed', last_na...
true
39ac1f616fec9d96d5b7a12087ce859ce1510a85
failureperson/python
/python_crash_course.py
UTF-8
568
2.53125
3
[]
no_license
for i in [1,2]: print(i) for j in [1,2]: print(j) print(i+j) print(i) print("done looping") ''' with open('s.txt', "w+") as x: x.writelines(" th data is hidden data , data is data") count =0 with open('s.txt', "r+") as x: s =x.read().split() for i in s: if i == "data":...
true
b3f791f66a7a1cb34c1072b7a1feef9682f032b6
luiz-csilva/exercicios-python
/pares_impares.py
UTF-8
529
3.046875
3
[]
no_license
import random numeros_aleatorios = [random.randint(1,100),random.randint(1,100),random.randint(1,100),random.randint(1,100),random.randint(1,100), random.randint(1,100),random.randint(1,100),random.randint(1,100),random.randint(1,100),random.randint(1,100)] i = 0 pares = [] impares = [] while i...
true
fc5364cf113fe6227d4ccc9ef7f271827b75d104
BreadYang/DQN
/deeprl_hw2/preprocessors.py
UTF-8
5,610
3.15625
3
[]
no_license
"""Suggested Preprocessors.""" import numpy as np from PIL import Image from deeprl_hw2 import utils from deeprl_hw2.core import Preprocessor, Sample class HistoryPreprocessor(Preprocessor): """Keeps the last k states. Useful for domains where you need velocities, but the state contains only positions. ...
true
bdc103917bde7e175f3589fcc5d0da00f2a450ff
mttymtt/DrawBot-Sketchbook
/Classes/Andy-Clymer/2019-07-30/03_animation.py
UTF-8
529
3.28125
3
[ "MIT" ]
permissive
import math total_frames = 40 speed = 1/15 # represented as a fraction of a second newPage("A5") for frame in range(total_frames): percent = frame / (total_frames - 1) print(percent) frameDuration(speed) # represented as a fraction of a second # fill(1) # rect(0, 0, width(), height()) fil...
true
ba23a55c5ba54d235c06426953c5d2e73942e63a
aradai/python_practice
/python_mega_course/beyond_the_basics/merge.py
UTF-8
672
3.265625
3
[]
no_license
#!/usr/bin/env python3 from datetime import datetime def reader(path): with open(path, "r") as myf: temp = myf.read() return temp def writer(cont1, cont2, cont3): now = datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f") with open("{0}.txt".format(now), "w") as mf: #for i, j, k in zip...
true
b1839e498887b48a9564760d1fe9b6e6df424f48
microsoft/pgtoolsservice
/tests/pgsmo_tests/test_utils_urn.py
UTF-8
1,909
2.953125
3
[ "MIT" ]
permissive
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
true
59f45dcfbad1dcfa5d2fe52f92f855be5f5a0c10
nuprl/retic_performance
/benchmarks/sample_fsm/Test_Population.py
UTF-8
997
2.6875
3
[ "MIT" ]
permissive
from Test_Automata import defects, cooperates, tit_for_tat, grim_trigger from Untyped.Population import Population a1 = [defects(0), cooperates(0)] p1 = Population(a1) e1 = [defects(40), cooperates(0)] p1_expected = Population(e1 + a1) a2 = [defects(0), tit_for_tat(0)] p2 = Population(a2 + a2) e2 = [defects(13), tit_...
true
bfd3c4ef2efbb14fea94b6d5f21db01dd79f3a5c
RedGry/ITMO
/Theory of probability/PRAC_5/main.py
UTF-8
6,821
3.03125
3
[]
no_license
import math from tabulate import tabulate import matplotlib.pyplot as plt import numpy as np def read_file_data(): while True: path = input("Введите путь к файлу: ").strip() try: with open(path) as f: data = [list(map(float, row.split())) for row in f.readlines()] ...
true
56608912cd60c57395e6e14bf00bf9d1e51c7b80
jedthompson99/hacker_rank
/basic data types/runner_up.py/runner_up_hacker.py
UTF-8
237
3.140625
3
[]
no_license
n = int(input()) a = map(int, input().split(" ")) a = list(a) mx1 = a[0] mn = a[0] for i in a: if(i > mx1): mx1 = i if(i < mn): mn = i mx2 = mn for i in a: if(i > mx2 and i < mx1): mx2 = i print(mx2)
true
ce40835f3ee57b58ca0083cb6103a7a394705718
AakashNaik/Machine_Learning
/Linear Regression/learning_rate.py
UTF-8
6,521
2.90625
3
[]
no_license
import random import math import numpy as np import matplotlib.pyplot as plt def x_generate(points): x=[] x=np.random.uniform(0.0,1.0,points) return x ################################ def y_generate(x): p=math.pi*2 y=[] for n in range(len(x)): y.append(math.sin(p*x[n])) # prin...
true
ea9aa8622de60bf3a9c04e6b6c2f420cd16efa06
puruckertom/esa_python
/script_keys/exer02_strings_key.py
UTF-8
2,821
3.515625
4
[]
no_license
import unittest class TestStrings(unittest.TestCase): def test_strings(self): """ A basic introduction to strings """ str_dir = ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__'...
true
991d1c00bab6c784994018a7745af73b5bc588cc
ThrallOtaku/python3Test
/base/day10/迭代器与生成器/5生成器循环.py
UTF-8
80
2.6875
3
[]
no_license
mylist=(x for x in range(100000000)) for it in mylist:#循环 print(it)
true
57e49bd487cdfb9944a140f63334a98df360039c
nakalyangoaisha/My_bootcamp_project
/tests/test_room_class.py
UTF-8
330
2.796875
3
[]
no_license
import unittest from app.room import Room class Test_class_Room(unittest.TestCase): def test_if_room_isinstance_of_class_Room(self): room = Room('room_name', 'capacity') self.assertTrue(isinstance(room, Room), msg='room is not an instance of the Room class') if __name__ == '__main__': unitte...
true
dc4b1e4c5c41c445986f6301c549bb274f8da50c
SauryStand/sentiment_detection
/preprocess/torch/jwp_train_bce.py
UTF-8
3,807
2.59375
3
[ "Apache-2.0" ]
permissive
# -*- coding:utf-8 -*- import torch import torch.nn as nn import torch.optim as optim import numpy as np import pickle from utils.config import Config from JWP import JWP import torch import torch.nn as nn import torch.nn.functional as F config = Config() with open(config.waimai_cn_pkl_path, 'rb') a...
true
7ea03e035b3074131361d1f62ab6deaff9d50d64
eerimoq/monolinux-example-project
/3pp/linux/tools/testing/selftests/tc-testing/tdc_helper.py
UTF-8
1,977
3.21875
3
[ "MIT", "Linux-syscall-note", "GPL-2.0-only" ]
permissive
""" # SPDX-License-Identifier: GPL-2.0 tdc_helper.py - tdc helper functions Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com> """ def get_categorized_testlist(alltests, ucat): """ Sort the master test list into categories. """ testcases = dict() for category in ucat: testcases[category] = list...
true
c2a00e0bfb16b0047de38f20d2efff5c5b6bdbca
dennis-park-TRI/kinetics-downloader
/lib/metadata.py
UTF-8
3,155
3.046875
3
[ "MIT" ]
permissive
import os def get_valid_videos(videos, root, class_dirs=True): """ Go through a list of videos and find all downloaded videos. :param videos: The list of video metadata. :param root: Videos root. :param class_dirs: Expect videos to be located in folders named after their classes (e.g. jog...
true
99441cd206c80748f2413b6aee570ffd356a479c
davidlibland/scratch-python
/clustering/clustering_metric_evals/evaluate_metrics.py
UTF-8
4,001
2.671875
3
[]
no_license
from collections import Counter from itertools import combinations from sklearn import metrics import pandas as pd from scipy import stats from clusterings.get_rankings_packet import get_clustering_lists, ClusterType def to_binary(clustering_list): return [x == y for x, y in combinations(clustering_list, 2)] ...
true
d7891e370b71e1f403a153a114b51b3dd763a526
kostenickj/de_id
/readTest.py
UTF-8
262
2.578125
3
[]
no_license
import sys, csv if __name__ == '__main__': fname = sys.argv[1] mode = sys.argv[2] fin = open(fname, 'rU') if mode == 'd': cin = csv.DictReader(fin) else: cin = csv.reader(fin) for l in cin: pass fin.close()
true
965496366acea07accc1c50ec1faa8cb0b7b17a6
suchismitarout/pythonpractice
/possible_triplet_of_sum.py
UTF-8
422
3.390625
3
[]
no_license
def possible_triplet_of_sum(num_list, k): for i in range(len(num_list) - 1): s = set() diff = k - num_list[i] for j in range(i + 1, len(num_list)): if diff - num_list[j] in s: print((num_list[i], num_list[j], diff - num_list[j])) return True ...
true
40713a01c5a76d271e0aaea9f75015b172518641
taofesco/BoVF-with-SVM-Classifier
/save_figures.py
UTF-8
2,293
2.96875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # coding: utf-8 # Imports # get_ipython().run_line_magic('matplotlib', 'inline') # Import matplotlib import matplotlib # Force matplotlib to not use any Xwindows backend matplotlib.use('Agg') from matplotlib import pyplot as plt from sklearn.metrics import confusion_matrix import globals impor...
true
73e895505aa1271d331ae9cc9f4fa9696ad93ad6
Axelrod-Python/Axelrod
/axelrod/tests/strategies/test_gradualkiller.py
UTF-8
2,712
2.5625
3
[ "MIT" ]
permissive
"""Tests for the Gradual Killer strategy.""" import axelrod as axl from .test_player import TestPlayer C, D = axl.Action.C, axl.Action.D class TestGradualKiller(TestPlayer): name = "Gradual Killer: (D, D, D, D, D, C, C)" player = axl.GradualKiller expected_classifier = { "memory_depth": float(...
true
e03129ee54b9fa5c59d32ab7972d82fcefd6420d
nickdurbin/sprint-algos
/recursive_count_th/count_th.py
UTF-8
1,730
4.5625
5
[]
no_license
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): # We need to create a variable that stores the ...
true
6b625025aa643bfb04047f35a8066968be31a562
Tailszefox/scrabblesolve
/binaire.py
UTF-8
6,312
3.484375
3
[ "CC0-1.0" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- import os.path import sys # Nœud de l'arbre contenant une lettre class Noeud(object): """ Constructeur lettre : lettre stockée dans le nœud mot : True si le chemin représente un mot du dictionnaire, False sinon fd : lettre située au même niveau et après dans l'ordre ...
true
0d657f59fe09652fbed75aa5926a84efef81803a
bedlansonny/24-Game
/24GameSolver.py
UTF-8
1,062
3.125
3
[]
no_license
##solver for 24 Game import itertools opers = ['+','-','/','*'] oc = [p for p in itertools.product(opers, repeat=3)] paraStrs = [' ',' ( ) ',' ( ) ',' ( ) ',' ( )( ) ','( ) ',' ( )','(( ) ) ','( ( )) ',' (( ) )',' ( ( ))'] pc = [[c.strip() for c in s] for s in paraStr...
true
ba952dcb7e87a368e0848e9d6e754c7321a449b9
IFF-0303/pymethods
/pymethods/math/rigid_transform.py
UTF-8
733
3.140625
3
[]
no_license
from ..math import least_squares_fitting_of_two_point_sets import numpy as np def rigid_transform( vector_a: np.array, vector_b: np.array) -> np.array: """rigid_transform rigidly transform vector_a onto vector_b Args: vector_a (np.ndarray): staring location of N dimensions x M...
true
2517e7aeb157e4dfb0139150f6fab1ecda5e0127
dkalisch/SocialMediaHarvester
/SocialMediaHarvester/SocialMediaHarvester/static/Harvesters/TwitterHarvester/twitterHarvester.py
UTF-8
221
2.828125
3
[]
no_license
''' Created on 21.11.2013 @author: hauck ''' import sys def startHarvest(keyword, date): print "I am going to harvest for the keyword: "+keyword+", and the date: "+date+"." startHarvest(sys.argv[1], sys.argv[2])
true
db9609953afe17b0b9d1cd2bc5469c46c77e2235
jcohen66/Python-Network-Apps
/basics/collections/dictionaries.py
UTF-8
608
3.484375
3
[]
no_license
# dicts are unordered # keys must be immutable # keys must be same type # values can be immutable or mutable dict1 = {} dict1 = {"Vendor": "Cisco", "Model": "2600", "IOS": "12.4", "Ports": "4"} s = dict1['IOS'] s = dict1['Vendor'] dict1["RAM"] = "128" dict1["IOS"] = "12.3" del dict1["Ports"] n = len(dict1) b = "IOS...
true
be8d0faad8aae9b18ad2cc51e2a7bd1f342dfd98
jon--lee/arxiver
/arxiver/parsers/new_publ.py
UTF-8
2,678
2.984375
3
[]
no_license
# # @author jonathan_lee@berkeley.edu (Jonathan N Lee) # # NewPubl implements parser class which is designed to handling # parsing of new publications on arxiv given a specific topic # new publications papge is only html (no xml api) # # system libraries import urllib2 # internal libraries from arxiver.papers import ...
true
14586ffd43aa83ace46d3fc476f56a2078b8f9c9
benrgreene/TwoDimHash
/TDHash.py
UTF-8
1,678
3.375
3
[]
no_license
#!/usr/bin/env python # Author: Ben Greene # Copyright October 2015 # Object: A two dimensional hash table import random, os.path import types import math import os import sys class TDHash: def __init__(self, filename, size = None): if size is None: size = 499 self.hash_map = [[[] for x in range(size)] for...
true
90c15eae2bcafbd22b3e903d87e29c741823e61e
K-Imtiaz/Python_Projects
/String and String manipulation.py
UTF-8
286
3.671875
4
[]
no_license
print("Hello Imtiaz\nHow are you\nHow's day 1 going\nIs python really easy as they say?\nDay 1 - Python Print Function\nThe function is declared like this\nprint('What to print')") print("Hello"+"Imtiaz") print("Hello"+" "+"Imtiaz") print("Hello"+" Imtiaz") print("Hello "+"Imtiaz")
true
cf92369a13484f24fb9f04017f99c2d885b4c88b
goodsosbva/BOJ_Graph
/2667.py
UTF-8
1,324
3.28125
3
[]
no_license
from collections import Counter from functools import reduce from collections import deque n = int(input()) # 지도 입력 squre = [list(map(int, list(input()))) for _ in range(n)] visited = [[0] * n for _ in range(n)] # 오, 왼, 아래, 위 dx = [1, -1, 0, 0] dy = [0, 0, -1, 1] #print(squre) def BFS(x, y, cnt):...
true
1fd1f0633bf7a7f1698f634b69d8da807827fab7
stephenmylabathula/SkyeRobot
/RobotCortex/SkyeCortex/Components/Throttle.py
UTF-8
1,276
3.328125
3
[]
no_license
import tkinter as tk class Throttle(tk.Canvas): def __init__(self, master = None, maxVal = 255, width = 100, height = 200): tk.Canvas.__init__(self, master, width=width, height=height, borderwidth=5, background='white', relief='sunken') self.width = width self.height = height self.m...
true
b40c01fa21beff42ea94dc1166e2247926f3adf9
intelligenceunion/iu_demo
/cl/backend/api.py
UTF-8
1,402
2.625
3
[]
no_license
import falcon from functools import wraps def get_all_apis(a): res = [] for member in a.__dict__.values(): if not hasattr(member, '__bases__'): continue if BaseApiResource in member.__bases__: res.append(member) return res def convert_custom_verb_pattern(uri_pattern...
true
7cfa9d9e61961a18755a0310b65f332ad8fba1d1
Domino2357/daily-coding-problem
/#13.py
UTF-8
1,297
4.125
4
[ "MIT" ]
permissive
""" This problem was asked by Amazon. Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. For example, given s = "abcba" and k = 2, the longest substring with k distinct characters is "bcb". """ def longest_substring(max_distinct_char, input_strin...
true
c4d4e4e261b4269fa78c1ccda6781a929cd9e255
omad/dea-vectoriser
/tests/test_utils.py
UTF-8
3,362
2.734375
3
[]
no_license
import boto3 import json import pytest from pathlib import PurePosixPath from dea_vectoriser.utils import upload_directory, receive_messages, output_name_from_url, geotiff_url_from_stac, \ publish_sns_message def test_s3_directory_upload(s3, tmp_path): # Create a small directory structure with 2 empty files ...
true
fe0142d34c50e0b30aa80117827b4a96d14ba1bc
zengxiao1028/mobiledepression
/data_prepare/prepare_data.py
UTF-8
7,260
2.515625
3
[]
no_license
import os import pickle def prepare_data(subjects,data_dir ): import pandas as pd import numpy as np from scipy import stats import os deltat = 1800 win = 24 * 3600 x = np.array([]) y = np.array([]) print('total subjects:', len(subjects)) for (s, subject) in enumerate(subject...
true
19376a2c50e0ab73ec668e434aa7f5804a3a7668
CFCC/python-projects
/camper-project-minecraft-animals/sample/creeper.py
UTF-8
1,535
3.796875
4
[]
no_license
#!/usr/bin/env python3 # Load the required modules and functions from turtle import * from random import choice # Draw a box on screen with a given color def drawbox(i_color): pencolor(i_color) fillcolor(i_color) begin_fill() for i in range(4): forward(boxlength) left(90) end_fill() # Return to the starting...
true
e2530a18f0d252be7ed7871764cb7462a40c2b67
datta07/chat-apis
/test.py
UTF-8
3,076
3.109375
3
[]
no_license
''' - User should either login or register to use - chat can be seen by anyone but message can be sent by only users who have joined group - join the group before to send message ''' import requests user=None def login(): global user print(("-"*30)+"\n"+"Login:- "+"\n"+("-"*30)) username=input("Enter ...
true
8675914277fe18deef16baad43f4148c58cd59dd
icentasy/algorithm
/CodingInterviews/python/print_list_from_tail_to_head.py
UTF-8
690
3.828125
4
[]
no_license
# -*- coding:utf-8 -*- class ListNode: def __init__(self, x): self.val = x self.next = None ''' 递归法 ''' class Solution: # 返回从尾部到头部的列表值序列,例如[1,2,3] def printListFromTailToHead(self, listNode): if listNode is None: return [] res = self.printListFromTailToHead(listN...
true
ee150d5790711b08443095bf4a46105c830f3bb7
PARKJUHONG123/turbo-doodle
/BOJ/combine_array.py
UTF-8
185
2.921875
3
[]
no_license
import sys N, M = map(int, sys.stdin.readline().split()) A = list(map(int, sys.stdin.readline().split())) B = list(map(int, sys.stdin.readline().split())) C = A + B C.sort() print(*C)
true
a4999196da80e2ee5ff017b3d4762466dff68ef7
readelev/cj-2016
/week-03/wh-briefings-word-scrape.py
UTF-8
524
2.59375
3
[]
no_license
import requests from os import makedirs from os.path import join THE_URL = 'https://www.whitehouse.gov/briefing-room/press-briefings?page=' MAX_PAGE_NUM = 162 INDEX_PAGES_DIR = 'index-pages' makedirs(INDEX_PAGES_DIR, exist_ok=True) for page in range(0, MAX_PAGE_NUM): url = THE_URL.format(page) resp = requests.get(TH...
true
86e90f9063cd48c345959ec3d42aae4a583c572c
dreadster3/CipherAI
/CipherAI/GeneticAlgorithm.py
UTF-8
9,871
3.421875
3
[]
no_license
import random import copy import numpy as np from CipherAI.Encoder import Encoder from CipherAI.FileParser import FileParser import time # Auxiliary method to swap 2 letters in an alphabet_map # @param map_alphabet that needs to be altered # @param i index of element 1 # @param j index of element 2 # return alphabet...
true
3471e53f96acab0f99b82f63144a2ce935e85795
forecasttrading/test
/Algo_SVM.py
UTF-8
450
3.546875
4
[]
no_license
# Import Library from sklearn import svm # Assumed you have, X (predictor) and Y (target) for training data set and x_test(predictor) of test_dataset X = [[0, 0], [2, 2]] y = [0.5, 2.5] # Create SVM(Support Vector Machine) classification object model = svm.svc(gamma='scale') # Train the model using...
true
582f8bdf02b584abb0e5b2f91b08f860e54655e3
mbartcus/TwoModeCoclustering
/SubDataSet.py
UTF-8
3,321
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 7 10:35:40 2018 @author: HZTT9795 """ import KHCUtils as khc import constants as const import utils as utl import os class SubDataSet(): """ class SubDataSet aim: geather information for sub-dataset attributes: indexVariable1 - in...
true
c434b98caed8cbd08336e0ee9ad9036e5a00c74e
tiagokepe/duckdb
/tools/pythonpkg/tests/fast/types/test_timestamp_tz.py
UTF-8
660
2.546875
3
[ "MIT" ]
permissive
import pandas as pd import numpy as np import datetime import duckdb class TestPandasTimestampTz(object): def test_timestamp_tz(self, duckdb_cursor): df_in = pd.DataFrame({ 'datetime': [pd.Timestamp('20180310T11:17:54Z')], 'string': ['foo']} ) df_expected_res...
true
a81f47c64c1558d04d75335f24c3cbb3a32ecaf8
nick-martin-24/madness
/src/utils.py
UTF-8
1,116
2.65625
3
[]
no_license
import os import ftputils import pandas as pd from datetime import datetime as dt from scrapeutils.ncaa import utils as nsu output_directory = '{}/data/madness/{}/'.format(os.environ['HOME'], dt.now().year) round_values = {'First Four&#174;': 0, 'First Round': 1, 'Second Round': 2, ...
true
bfd410053987e01c20c0b60053e63b22ddf7a596
Matias-Gutierrez/practica-con-python
/1°Semestre/Laboratorio/entrevista.py
UTF-8
220
3.84375
4
[]
no_license
nombre = input("Escriba su primer nombre "); apellido = input("Escriba su apellido "); edad = input("Ingrese su edad "); altura = input("Ingrese su altura "); print("Su nombre es ", nombre, " y tiene " , edad, "años ");
true
0801ecfcac93287ac9c215d1099fd35888ec95fc
rajasaur/dev-weather-api
/weather_api.py
UTF-8
509
3.25
3
[]
no_license
import requests API_KEY = '7336babd2ce61f8563de4fb7f514319f' city_name = input('Enter a City Name: ') API_URL = f'http://api.openweathermap.org/data/2.5/weather?q={city_name}&appid={API_KEY}' try: response = requests.get(API_URL).json() todays_weather = response['weather'][0]['description'] print(f"Tod...
true
3af11da9d22c5b0482cd3c3285617df6e7634cd9
buxuele/algo_snippet
/没意思/1252.py
UTF-8
1,104
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- # author: fanchuang # DateTime:2021/2/19 0019 16:18 # contact: fanchuangwater@gmail.com # about: # 1. 如何对一个列表整体赋值呢 # r = [1 ,2, 3] # s = [x+1 for x in r] # print(s) # 2. 如何取到矩阵的某一列。 def solution(): # n = 2 # m = 2 # # indices = [[0, 1], [1, 1]] # indices = [[1, 1], [0, ...
true
a67c6588913c5528ca196a77eb63ebebfb0a04fb
Bulgakoff/hws_PyQt
/lesson_3/codes_3/storage.py
UTF-8
593
2.609375
3
[]
no_license
import sqlite3 import time from dataclasses import dataclass @dataclass class ClientInfo: login: str password: str class ClientStorage: def __init__(self, conn) -> None: self._conn = conn def add(self, login, info): pass def find(self, client_id): pass def get(self...
true
8aa728420302a672c25962d0a815e65abe3e1b00
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4470/codes/1756_674.py
UTF-8
486
3.640625
4
[]
no_license
# Não se esqueça de incluir o módulo numpy # Use o navegador Chrome, para copiar/colar a entrada de exemplo from numpy import* v=array(eval(input("Digite o numero: "))) print(size(v)) #1 quantidade de elemento do vetor print(v[0]) #2 primeiro elemento do vetor print(v[4]) #3 ultimo elemento do vetor print(max(v)) #4 M...
true
ad1aaceb929254bf088e384a4f40c858d12a5d13
lahsivjar/cricket-case-study
/classificationTree.py
UTF-8
966
2.796875
3
[]
no_license
from os.path import join import Orange import utilities as util def main(): data_path = join(util.module_path(), "..\\tabFile\newData2"); data = Orange.data.Table(data_path) print "Learning please be patient ..." classification_tree = Orange.classification.tree.TreeLearner(data) print "Saving tr...
true
475771f60866a78217f48a1fa739afcbd75a5ff1
cloud2010/dl-models
/tf-test/tensorflow-learning.py
UTF-8
1,758
3.5625
4
[]
no_license
""" TensorFlow basic operation learning """ import tensorflow as tf # 避免输出TensorFlow未编译CPU指令集信息 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 常量 node1 = tf.constant(3.0, dtype=tf.float32) node2 = tf.constant(4.0, dtype=tf.float32) # 打印节点 print(node1, node2) # 创建会话sess正式运行,输出节点信息 sess = tf.Session() print(ses...
true
97b37b5fad42aa317c50c28958b21e3d11bcb85f
aspspspsp/codeproblems_python
/Medium/62_UniquePaths.py
UTF-8
681
2.921875
3
[]
no_license
class Solution(object): def uniquePaths(self, m, n): """ :type m: int :type n: int :rtype: int """ martix = [[None] * m] * n for i in range(0, n): for j in range(0, m): # 原點 if i == 0 and j == 0: ...
true
45cd21c2ef3d171316c067723ef6a411c9f64924
pranavraj101/python-
/vowels.py
UTF-8
314
4.125
4
[]
no_license
# Program to illustrate a loop with condition in the middle #Take input from the user untill a vowels is entered while True: print("enter a vowel number") v=input() if v == 'a'and v=='e' and v=='i'and v=='o' and v=='u': break print('That is not a vowels, Try again!') print('thank you!')
true
0e4799c9aec3c6518a3c191cc3cc242d031c7c30
Tyler-Yates/pattern-web
/application/data/document_dao.py
UTF-8
1,801
2.703125
3
[ "MIT" ]
permissive
import datetime import os from bson import ObjectId from pymongo import MongoClient from pymongo.collection import Collection from pymongo.database import Database from pymongo.results import InsertOneResult # Set the documents to expire after a set amount of time TTL_SECONDS = 6 * 60 * 60 # expire after 6 hours # ...
true
531f2fd2f64cc733c23af724f466a77c0cfdf88e
le0liu/JableTVDownload
/encode.py
UTF-8
526
2.859375
3
[ "Apache-2.0" ]
permissive
import os import time def encodeMp4(folderPath): #開始時間 start_time = time.time() print('開始合成影片..') number = folderPath.split('/')[-1] before = number + '/o' + number + '.mp4' after = number + '/' + number + '.mp4' command = 'ffmpeg -i ' + before + ' -c:v libx264 -b:v 2M -threads 5 ...
true
33009894c925739a729a1de6a512faf10206e2f8
GabrieleMazzola/crowd_computing_group10
/explanation/satisfaction/satisfaction.py
UTF-8
217
2.96875
3
[]
no_license
from enum import IntEnum class Satisfaction(IntEnum): VERY_WEAK = 1, WEAK = 2, INDIFFERENT = 3, MEDIUM = 4, STRONG = 5, VERY_STRONG = 6 def __str__(self): return str(self.value)
true
ee3e247025546c6521a56bd722ccd7041d59b39b
felipessalvatore/CLCD
/clcd/rnn_train/util.py
UTF-8
10,916
2.59375
3
[ "MIT" ]
permissive
import matplotlib matplotlib.use('Agg') import torch # noqa import torch.nn as nn # noqa import torch.optim as optim # noqa import numpy as np # noqa import matplotlib.pyplot as plt # noqa import pandas as pd # noqa from torchtext import data # noqa import os # noqa import inspect # noqa import sys # noqa imp...
true
5857d0c711616007212ee61469ed8de083d76d97
nguyenducle90/final_gold
/demo.py
UTF-8
675
2.734375
3
[]
no_license
import os import pickle import sklearn import streamlit as st Filepath = os.path.join(os.getcwd(),'gold.model.pkl') def forecast(spx:float, uso: float, slv:float, eur_usd: float)->float: model = pickle.load(open(Filepath, 'rb')) results = model.predict([[spx, uso, slv, eur_usd]]) return results[0]...
true
871feabe2edf643da1c3ab0c6e971c5f7d4fa0e4
SimoneMons/phtree_analisiLogica
/ALPredicatoNominale.py
UTF-8
289
2.65625
3
[]
no_license
def find_predicato_nominale(doc): for token in doc: if token.pos_ == 'ADJ' and doc[(token.i-1)].lemma_ == 'essere': token._.predicato_nominale = doc[(token.i - 1)].text + ' ' + token.text else: token._.predicato_nominale = '' return doc
true
488576529b225fea3abc0fb380d14dff1fa80fd5
papasmf1/python2
/demo.py
UTF-8
66
2.71875
3
[]
no_license
result = 3 + 5 print(result) print("hello world") print("two 222")
true
64fb272015e34f44de71a9c639ab25a23ec5aa55
sametyonturk/YMGKProject
/YMGK_Verianalizi.py
UTF-8
9,616
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 1 21:52:26 2020 @author: RamazanSamet """ import pandas as pd import datetime import numpy as np import joblib import math import csv import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression f...
true
a0ca1c6d270e040294171fcd3885677b96825673
guofei9987/leetcode_python
/solved/[492][Construct the Rectangle][Easy].py
UTF-8
360
3.21875
3
[]
no_license
# https://leetcode.com/problems/construct-the-rectangle import numpy as np import math class Solution: def constructRectangle(self, area): """ :type area: int :rtype: List[int] """ L_start=math.ceil(area**0.5) for i in range(L_start,area+1): if area%i==0: ...
true
b7d5d4e94dad544cdad70ae537f257413df31606
robertorivera16/BigDataProject3
/task.py
UTF-8
3,783
2.53125
3
[]
no_license
import csv import json import re import string import tensorflow as tf from tensorflow import keras import numpy as np imdb = keras.datasets.imdb wIndex = imdb.get_word_index() wIndex = {k:(v+3) for k,v in wIndex.items()} wIndex["<PAD>"] = 0 wIndex["<START>"] = 1 wIndex["<UNK>"] = 2 wIndex["<UNUSED>"...
true
50525dc6f612a08a54cd323f76d7008e270a2b66
q15y5Blue/myblog
/blog/craw/test/trans_t.py
UTF-8
1,757
2.71875
3
[]
no_license
# encoding:utf8 import re file = open('xt.txt', 'r', encoding='utf-8') fil_source = open('123.sql', 'r', encoding='utf-8') file_list = [] for line in file.readlines(): file_list.append(line) # print(file_list) file.close() table_list = [] index_list = [] for file_index in range(0, len(file_list)-1): if fil...
true
797fef415706053ba4ee981af6e41f9137abf8ae
kachim30/lesson
/praktika/lesson93.py
UTF-8
1,500
3.71875
4
[]
no_license
class User(): """ Создания личных дел User """ def __init__(self, first_name, last_name, age): """Создания основныее отрибуты User вод (имени, фомилии, возраст)""" self.first_name = first_name self.last_name =last_name self.age = age self.login_attempts = 0 def de...
true
2ec805cc57766118f096ba2b767a8896339adf77
mou7/mix-multi
/utils.py
UTF-8
494
3.3125
3
[]
no_license
import numpy as np def normalize_mat(M): """ This function normalizes the matrix M so the sum of its elements along each row is 1 Arguments: - `M`: numpy array """ if len(M.shape) ==2: M = 1.0*np.array(M) s = np.sum(M,axis=1) index = np.nonzero(s)[0] s = s[index] ...
true
9e24f7f81d92bbe829c92c0076aa5242576ec578
KristiaanSondaar/Programming2
/Opdrachten/1. Formatting.py
UTF-8
186
3.828125
4
[]
no_license
def convert(celsius): return celsius * 1.8 + 32 celsius = 25 print(convert(celsius)) print(' F C') for i in range(-30,50,10): print('{:5}{:5}'.format(convert(i),i))
true
f5e8fea890008686b62b3c8f024ec83c8f78bddc
vtharini/python2
/print_every_third.py
UTF-8
98
2.953125
3
[]
no_license
st=input() l=list(st) st1='' for i in range(len(l)): if(i%3==0): st1+=l[i] print(st1)
true
79872077bb4536a9f8e71355ad4706e48f93c820
C00reNUT/vqgan-clip-generator
/examples/video.py
UTF-8
2,051
2.65625
3
[ "MIT" ]
permissive
# Generate a vide based on a text prompt. Note that the image will stabilize after a hundred or so iteration with the same prompt, # so this is most useful if you are changing prompts over time. In the exmaple below the prompt cycles between two every 300 iterations. from vqgan_clip import generate, video_tools, esrgan...
true
520295b8f7da448872a94ece0b29f77a04c513f6
mqinbin/python_leetcode
/441.排列硬币.py
UTF-8
268
2.5625
3
[]
no_license
# # @lc app=leetcode.cn id=441 lang=python3 # # [441] 排列硬币 # # @lc code=start class Solution: def arrangeCoins(self, n: int) -> int: for k in range(1,2**32): if n < k * (k + 1) // 2: return k-1 # @lc code=end
true
f6117aef79636d06005d9174b8f66eb211c9b052
zcallanan/python-learning-projects
/tic tac toe/Select A Square.py
UTF-8
3,982
4.09375
4
[]
no_license
'''When a player (say player 1, who is X) wants to place an X on the screen, they can’t just click on a terminal. So we are going to approximate this clicking simply by asking the user for a coordinate of where they want to place their piece.''' if __name__ == '__main__': def validate(player_input, array, all_inpu...
true
b6de3aa3c29d74566f26d8d20fdb47f4cbd63bc0
weixing0909/Deep-Learning-Examples
/a20_dataset/voc/voc_.py
UTF-8
7,136
2.625
3
[]
no_license
import os import cv2 import random import numpy as np import keras from keras.models import Sequential from keras.utils.data_utils import Sequence from keras.utils.data_utils import GeneratorEnqueuer from keras.utils.data_utils import OrderedEnqueuer from keras.engine.training_utils import iter_sequence_infi...
true
b23f8acf9323987b1b8cf11d02dd33bf8c19445d
Madhav2108/Python-
/basic/display1.py
UTF-8
129
3.78125
4
[]
no_license
name="Phthon" age=17 print(name,age) print(name,",",age) print("Your name is ",name," and is ",age) #print(name,", ",age)
true
7f9841a2ae85a745183966152f2ec36db9498f83
wfg2af/cs3240-labdemo
/MessagePassing.py
UTF-8
2,813
3.078125
3
[ "MIT" ]
permissive
__author__ = 'wfg2af' from Crypto.PublicKey import RSA from Crypto.Hash import SHA256 from Crypto import Random class userMessages: #Each user will have the public key of any other user. UserMap = {} UserName = "" def __init__(self, UserName = "", UserMap = {}, key = None): self.UserMap = UserM...
true
f48bc47caaa0e0139533c3cb590aea5cce039ccc
tkongy/semantic-segementation
/train_multi.py
UTF-8
1,789
2.578125
3
[]
no_license
from dataloader import image_segmentation_generator from MultiRes_Unet import * from keras import optimizers from keras.callbacks import ModelCheckpoint from keras.metrics import categorical_crossentropy # 使用CPU #import os #os.environ['CUDA_VISIBLE_DEVICES'] = '-1' def train(model, image_folder, label_fol...
true
9c5fd84d1919d21cdfc8614ee50333c99396a4bf
deepthivenkat/leetcode-solutions
/wordBreak.py
UTF-8
389
3.015625
3
[]
no_license
class Solution(object): def wordBreak(self, s, wordDict): len_s = len(s) arr = [False for i in range(len_s+1)] arr[0]=True i=0 while i<=len_s: j=0 while j<i: if arr[j] and s[j:i] in wordDict: arr[i] = True ...
true
4fe612946eb8d12af8726df5b5937d55a71ffb07
rpakdel/scikit-geologic-classification
/prepareData.py
UTF-8
855
3.25
3
[]
no_license
from sklearn import preprocessing #%% [markdown] # Scikit includes a [preprocessing](http://scikit-learn.org/stable/modules/preprocessing.html) module that can # 'standardize' the data (giving each variable zero mean and unit variance, also called *whitening*). # Many machine learning algorithms assume features wil...
true