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
8ad8bba8a16cf567208b64bd27c1f693cf578910
yumerov/codewars
/done/kyu-7/progressive-spiral-number-position.py
UTF-8
371
3.671875
4
[]
no_license
# hhttps://www.codewars.com/kata/progressive-spiral-number-position/train/python from unittest import TestCase from math import ceil, floor def layers(n): return floor(ceil(n ** 0.5) / 2) + 1 test = TestCase() test.assertEqual(layers(1),1) test.assertEqual(layers(5),2) test.assertEqual(layers(25),3) test.asser...
true
134255f1ecf7ffbc5709c69421c674955931e5c9
PhoduCoder/PythonPractice
/Maximum-Minimum.py
UTF-8
421
4.40625
4
[]
no_license
#print("Enter the number of elements in the list") #num_of_elements = input('Enter the number of elemnts you would like in the list') given_list = [2,3,4,54,32,1,4,5] min=given_list[0] max=given_list[0] for i in range(len(given_list)): if (given_list[i]<min): min = given_list[i] if (given_list[i]>max): max=gi...
true
26249b37ef5b34eeed57dfa0aa37268f9c0c7487
Zeus-HackOlympus/Ganitansh-GUI
/game/PygameExamples/Simple Ball.py
UTF-8
1,199
2.984375
3
[]
no_license
import random import pygame from pygame.locals import * pygame.init() BLACK = (0, 0, 0) GRAY = (127, 127, 127) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) CYAN = (0, 255, 255) MAGENTA = (255, 0, 255) colors = [ BLACK, GRAY, WHITE, RED, ...
true
798401b9a82e77f4ff73dd957cc1ac1853fd2372
allenxzy/Data-and-Structures-and-Alogrithms
/python_data/Chapter 12/R/R-12.14.py
UTF-8
226
2.671875
3
[]
no_license
#-*-coding: utf-8 -*- """ Following our analysis of randomized quick-sort in Section 12.3.1, show that the probability that a given input element x belongs to more than 2logn subproblems in size group i is at most 1/n**2. """
true
cb5ac3d169a7c07509d56697f1adeaf85dccfc19
sixuerain/CrawlMan
/dashiye/main.py
UTF-8
1,266
2.546875
3
[]
no_license
# -*-coding=utf-8-*- # @Time : 2020/4/26 20:20 # @File : main.py import requests import numpy as np code = input('请输入股票代码:') cookies = { 'PHPSESSID': 'jqb0q4h60h4bmtj5bkd9bjuv00', 'Hm_lvt_210e7fd46c913658d1ca5581797c34e3': '1587903421', 'Hm_lpvt_210e7fd46c913658d1ca5581797c34e3': '1587903461', } heade...
true
3753687285be8550597db67ccc8e5812e3a74b65
artizanatweb/iot_station
/Relay.py
UTF-8
3,235
2.796875
3
[]
no_license
import sys import machine import time from SettingsSingleton import SettingsSingleton from Button import Button from Led import Led class Relay: """Relay object""" def __init__(self, name): self.name = name self.settings = None self.rSettings = None self.button = None ...
true
f851a4cd1daf4589480c47f852e03d43648ba093
hboonewilson/IntroCS
/DAs/WilsonHenryDA1.py
UTF-8
1,101
4.1875
4
[]
no_license
#Henry Wilson #Discussion Assignment 1 #Section 0A04 # Aug/29/19 #return ['hawkid'] def getHawkID(): return ['hbwilson'] #add two arguments into the function and return the #first value minus the second value def subtractThem(a,b): return a-b #add the three arguments and return the sum def addEm(a, b, c): ...
true
524a16bb2370e13ea31725a97166c58a3f0752ce
wogus3602/study
/윤석주/day11/콘테스트.py
UTF-8
264
3.3125
3
[]
no_license
wUniv = [] kUniv = [] #입력받기 for i in range(10): wUniv.append(int(input())) for i in range(10): kUniv.append(int(input())) #내림차순 정렬 wUniv.sort(reverse=True) kUniv.sort(reverse=True) #top3점수 합 print(sum(wUniv[:3]),sum(kUniv[:3]))
true
35359c2497a975ee3ac78056d2aa04cbb47f2fdc
DaHuO/Supergraph
/codes/CodeJamCrawler/16_1_1_neat/16_1_1_easyrider_run.py
UTF-8
485
3.734375
4
[]
no_license
#!/usr/bin/python3 nr_of_tasks = int(input()) for i in range(1,nr_of_tasks+1): last_char = "" first_char = "" result = [] row = input() for character in row: if character >= first_char: result.insert(0, character) first_char = character else: re...
true
1b09829f7dba8e464179bc5d795ddc97a529e48b
Reatris/DeepLearing_Origin
/DeepLearning7/Convolution.py
UTF-8
1,352
2.6875
3
[ "MIT" ]
permissive
import im2col as Im2col import col2im as Col2im import numpy as np class Convolution: def __init__(self,w,b,stride=1,pad=0): self.w=w self.b=b self.stride=stride self.pad=pad def forward(self,x): FN,C,FH,FW=self.w.shape N,C,H,W=x.shape out_h=int(1+(H+...
true
6204e483b24e647eeb0b3f6386b62caea6d48981
jlyu/chain-leetcode
/expired/list/83. Remove Duplicates from Sorted List.py
UTF-8
2,878
3.703125
4
[]
no_license
# -*- coding: utf-8 -*- """ https://leetcode.com/problems/remove-duplicates-from-sorted-list/ Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. """ # Definition for singly-linked list. c...
true
e62cf332c3f051bb4cb0baf5f2d5b7288efe61a4
offbynull/offbynull.github.io
/docs/data/learn/Bioinformatics/input/ch8_code/src/ch7_copy/phylogeny/AdditivePhylogeny_Verbose.py
UTF-8
4,326
2.796875
3
[]
no_license
from __future__ import annotations from sys import stdin from typing import Callable, TypeVar from ch7_copy.distance_matrix.DistanceMatrix import DistanceMatrix from graph.UndirectedGraph import Graph from helpers.InputUtils import str_to_list from ch7_copy.phylogeny.FourPointCondition import is_additive from ch7_cop...
true
48db8d1e9fdb76d7c30da4f2a6b43401a72cb323
prohan05/Data-Structures-and-Algorithms
/DSA/Stack/stack_symbols.py
UTF-8
834
3.734375
4
[]
no_license
class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def check(self): for i in range(0, len(self.items)): for n in range(0, len(self.items)): while i < n: if self.items[i] == "(" or self.items...
true
77d76c980686f36f50d3202911c601020f57daae
Warptenhazz/mscThesis
/Grupal.py
UTF-8
4,508
3.078125
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain", "Unlicense" ]
permissive
import sys reload(sys) sys.setdefaultencoding('utf-8') import random import operator import matplotlib.pylab as plt overallfitnessGrupal = {} #this procedure generate a dict with 40 items def generateRules(): rules = {} #all rules of an single agent for i in range(40): #create 40 rules per agent a = ...
true
3b7a27621ebcc18d13aad8eb6f47761f88cc934a
Praveencode-kumar/Pythonlearning
/chapter-5/5.6.py
UTF-8
658
4.09375
4
[]
no_license
#Exercise 5.6. #The Koch curve is a fractal that looks something like Figure 5.2. To draw a Koch #curve with length x, all you have to do is import turtle bob = turtle.Turtle() def koch(turtle, length): if length < 3: turtle.fd(length) return koch(turtle, length/3) turtle.l...
true
b62eeda43bbb9ffb2f862a9cf19ea767c36d038a
themohitkhare/Scorpion
/NewsEvaluation.py
UTF-8
652
3.515625
4
[]
no_license
""" Simple module to parse the given article for relevant english words and removing any other garbage strings. """ import nltk from nltk import word_tokenize from SentimentAlgo import Evaluation def Dictionary(news): """ Method tokenise the article and compares each word with present english dictionary. ...
true
e28c967a35bc416ba22b63462107c01bc7839e64
Jasonmes/Flask-model
/demo6_errorhander.py
UTF-8
438
2.9375
3
[]
no_license
from flask import Flask, abort, redirect app = Flask(__name__) @app.route('/') def hello_world(): # 主动产生一个404的错误 # 参数1:必须是http的错误状态码 abort(404) return "Hello World!" @app.errorhandler(404) def error1(error): print(error) # 捕获404异常,然后重定向到百度官网 return redirect("https://www.baidu.com") if _...
true
acdb12b7df32f534deb750c3e839fe67cd4ad4f0
GeekEast/95888-Data-Focused-Python
/Homework/1/test.py
UTF-8
65
3.15625
3
[]
no_license
def f(x,y,z): return (x+y)/z a=5 b=6 c=7.5 result = f(a,b,c)
true
f7856c0ccd78e08b377356b363c45bffe2e14c78
gungoren/ml_lecture_notes
/sec1_preprocessing/_5_concat_frames.py
UTF-8
1,032
3.3125
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.impute import SimpleImputer from sklearn.preprocessing import LabelEncoder, OneHotEncoder df = pd.read_csv("../data/bilkav/sec1_preprocessing/eksikveriler.csv") print(df) """ imputer = SimpleImputer(missing_values='NaN', strategy='m...
true
4a03e46c263a459ec62674f7d3a3ef0cd276f432
6desislava6/Hack-Bulgaria
/Hack-third-week/Monday/BankAccount.py
UTF-8
2,280
3.890625
4
[]
no_license
class BankAccount: def __init__(self, name, amount, currency): self.amount = amount self.name = name self.currency = currency self.account_history = ['Account was created'] def history(self): return self.account_history def balance(self): current_history = ...
true
a6c2ee1a29d62e5c517ca1e8d24d792ab4a2320b
grey-kimtaeyoung/mapatofu
/function.py
UTF-8
1,048
4.40625
4
[]
no_license
## 함수 기본 문법 # def function_name(parameter): # # logic # print(parameter) # function_name(10) ### 함수를 사용했을때와 사용하지 않았을때의 차이 ## 사용하지 않았을때 # r_name = "김태영" # n_name = "다니엘" # print("진짜 이름은 " + r_name + " 입니다.") # print("가짜 이름은 " + n_name + " 입니다.") # r_name = "귀도반로섬" # n_name = "독재자" # print("진짜 이름은 " + r_name ...
true
9f14a9fee760b8ca5ed4e47cb42df82d5d2d2147
fredsonchaves07/ruifma
/app/controllers/admin/file.py
UTF-8
908
2.5625
3
[ "MIT" ]
permissive
import os from flask import current_app from werkzeug.utils import secure_filename from datetime import datetime from app.dao import file as file_dao def create_file(file): now = datetime.utcnow() filename = secure_filename(os.path.join(str(now), file.filename)) path = os.path.join(current_app.config['UPLO...
true
356b544d78e8e5c7b3f3c2375c2e1540a7c658c9
VCMason/PyGenToolbox
/src/pygentoolbox/ConvertBedToRangeCoordinatesOneFilePerLine.py
UTF-8
1,458
2.796875
3
[ "MIT" ]
permissive
def main(bedfile): import os outfilenames = [] with open(bedfile, 'r') as FILE: output = [] for line in FILE: onelineout = [] scaffold = line.strip().split('\t')[0] start = int(line.strip().split('\t')[1]) end = int(line.strip().spli...
true
b62a33080238fe793bf17f7712513dbadf88c5e5
lpython2006e/student-practices
/14_Tran_An_Thien/Bai_1.6.py
UTF-8
827
3.671875
4
[ "MIT" ]
permissive
# Write a guessing game where the user has to guess a secret number. # After every guess the program tells the user whether their number was too large or too small. # At the end the number of tries needed should be printed. # It counts only as one try if they input the same number multiple times consecutively. sobimat ...
true
8d89f4fdc0bef825d64ffd929d256f4c9a26630a
aditi148/Code-Practice
/DFS.py
UTF-8
775
3.25
3
[]
no_license
def init(self): self.graph = {'A' : set(['B', 'C']), 'B': set(['A', 'D', 'E']),'C':set(['A', 'F']),'D':set(['B']), 'E': (['B', 'F']), 'F': (['C', 'E'])} def addEdge (self, u, v): self.graph[u].append(v) def DFSUtil(self, v, visited): visited[v] = True print(v) for i in self.gr...
true
83a2c6c1b0a210de5d3c8c838b7b99127d2ff2e9
nischalshrestha/automatic_wat_discovery
/Notebooks/py/jwlin17/first-attempt-at-titanic-notebook/first-attempt-at-titanic-notebook.py
UTF-8
6,644
3.546875
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[ ]: import pandas as pd import numpy as np # In[ ]: train = pd.read_csv('../input/train.csv') test = pd.read_csv('../input/test.csv') # In[ ]: train = train.append(test, sort=False) # In[ ]: train.info() # **TODO LIST** # # **1. None values in age ** # # **2...
true
ee15cce3f03190bfa3da30273e3e318b4bcbf149
dennis2030/leetcodeStudyGroup
/223-rectangle-area/sony/Rectangle Area.py
UTF-8
1,242
3.171875
3
[]
no_license
class Solution(object): def computeArea(self, L1, D1, R1, U1, L2, D2, R2, U2): """ :type A: int :type B: int :type C: int :type D: int :type E: int :type F: int :type G: int :type H: int :rtype: int """ area = (R1 - L1) ...
true
a4fd3772004b1044ff4dad6632995101b7e1d089
gbondos/Election-Analysis
/PyPoll.py
UTF-8
1,811
3.90625
4
[]
no_license
# Open the data # Total number of votes cast # A complete list of candidates who received votes # Total number of votes each candidate received # Percentage of votes each candidate won # The winner of the election based on popular vote import datetime now = datetime.datetime.now() print(f"The time right now is {now} o...
true
52b29ce1812da00c65a745979a333a79afe9fa69
robgon-art/music-generator
/program/predict.py
UTF-8
8,872
2.890625
3
[ "MIT" ]
permissive
import os import argparse import pickle import numpy from music21 import instrument, note, stream, chord, duration from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import LSTM from keras.layers import Activation from keras.layers import Bidirectional ...
true
518dc4ea45029e83bcced1a09e3456402f0ec625
tijus/machine-learning-projects
/Linear Regression/Synthetic/extraction.py
UTF-8
2,412
3.25
3
[]
no_license
import numpy as np import os class extraction(): ''' Name: extraction type: class objective: to instantiate the object enabling extraction of Synthetic dataset ''' def __init__(self): ''' Constructor used for enabling extraction class instantiation ''' ...
true
7a5f619293f453673cb957e4bd2ff51870b61907
arironman/MSU-Python
/ex-8/20.py
UTF-8
91
3.890625
4
[]
no_license
n = int(input("Enter a Number: ")) sum=0 for x in range(1,n+1): sum+=x print(sum)
true
46068bba5fafe234018bcbe04be0c7297cbdb15d
BedirT/Algorithms_and_DS
/Problems/LeetCode/015_3Sum.py
UTF-8
831
3.046875
3
[]
no_license
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: nums = sorted(nums) res = [] for i in range(len(nums)): if i > 0 and nums[i] == nums[i - 1]: continue target = -nums[i] # two pointer - r / l r = len(nums)...
true
4227d1454ebebc0dc774c5b1b8767b3f26777d53
Yuanpengli/jd_competition
/array_tfrecord.py
UTF-8
9,096
2.921875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # encoding: utf-8 # Created Time: import os import numpy as np import tensorflow as tf def convert_string_to_dtype_np(s): if s in ['uint8']: return np.uint8 elif s in ['int32', 'np.int32']: return np.int32 elif s in ['int64', 'np.int64']: return np.int64 ...
true
68e0483e4993138fc93d4b9114ef0e98f3452dfe
Agnimandur/USACO
/USACO Training/Barn Repair/barn1.py
UTF-8
1,376
3.4375
3
[]
no_license
""" ID: shivara2 LANG: PYTHON3 TASK: barn1 """ def readInput(): fin = open('barn1.in','r') data = fin.readlines() boardNumber = int(data[0].split()[0]) cowStalls = [] for i in range(1,len(data)): cowStalls.append(int(data[i])) cowStalls = sorted(cowStalls) fin.close() return boa...
true
e3db77439043cb2fc5c7f5d866febcb67d57857b
NeginAshouri/Reddit-Popularity-Predictor
/src/data/make_dataset.py
UTF-8
6,021
3.03125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import logging import json from pathlib import Path from collections import Counter from nltk.stem import PorterStemmer ps = PorterStemmer() project_dir = Path(__file__).resolve().parents[2] def main(): """ Runs data processing scripts to turn raw data from (../raw) into cleaned da...
true
2b9c6843610a3dcd197bc13f9e22257161f91dc1
nikrasiya/Hashing-2
/560_sub_array_sum_equals_k.py
UTF-8
1,953
3.765625
4
[]
no_license
class Solution: def subarraySum(self, nums: [int], target: int) -> int: # BRUTE FORCE O(n^2) # count = 0 # for i in range(len(nums)): # sum = 0 # for j in range(i + 1, len(nums)): # sum += nums[j] # if sum == k: # co...
true
8095443d7b1a67e8c1abae16363a30f6d9e66531
parambole/LeetCode
/DP/min-path-sum.py
UTF-8
1,454
2.96875
3
[]
no_license
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: n = len(grid) m = len(grid[0]) dp = [ [0]*m for i in range(n)] dp[0][0] = grid[0][0] for i in range(1, n): dp[i][0] = dp[i-1][0] + grid[i][0]...
true
0e9fca1a3dc9719266c007b17614d5fb87e32f0d
Re50N4NC3/Copy-modifier
/main.py
UTF-8
3,775
2.828125
3
[]
no_license
from pynput.keyboard import Key, KeyCode, Listener import pyautogui as pgui import pyperclip from tkinter import Tk, Label, Button, messagebox, Text, END # from PyQt5.QtWidgets import QApplication, QLabel # /////////// functions # clean up the keys and move changed string to the clipboard def clean(txt): # clear ...
true
29a1b53ea33273dc4fbc8910a356a8de9993082f
manikos/EDX
/6.00x Files/W6_L10_P3_prime_number_exception.py
UTF-8
534
3.65625
4
[]
no_license
def isPrime(n): '''returns True if the positive integer n is a prime number and False otherwise. The function raises a TypeError if n isn't an integer and a ValueError if n is an integer less than or equal to zero''' if type(n)!=int: raise TypeError if n<=0: raise ValueError checkList...
true
4c88b6a56b2de71f3e3554c7600b3f53a9182d15
gbraad/python-word-chain
/wordchain-nltk-networkx.py
UTF-8
1,223
3.078125
3
[]
no_license
#!/bin/env python3 from requests import get import re from nltk.metrics import * import networkx import itertools import sys import argparse # load file def load_words_file(url): filecontent = get(url).text return re.findall(r'<pre>(.*?)</pre>', filecontent, re.S)[0].replace('\n', ' ').strip().split(' ') def...
true
52561f9bfe27bdc06289a223937fa4477c53aa28
Akasan/OverloadManager
/OverloadManager/OverloadManager.py
UTF-8
2,638
3.53125
4
[ "MIT" ]
permissive
from typing import Dict, Any class InvalidArgumentsError(Exception): """ This raise when called execute with invalid arguments""" def __init__(self, mes): super(InvalidArgumentsError, self).__init__(mes) class ArgumentOverwriteError(Exception): """ This raise when arguments already registered ar...
true
fa36f2baa3059b2e3baff26e6d30308de15aea0c
njoubert/spooky
/src/groundstation/module_test.py
UTF-8
825
2.625
3
[ "BSD-3-Clause" ]
permissive
# Copyright (C) 2015 Stanford University # Contact: Niels Joubert <niels@cs.stanford.edu> # # General import sys, os, time import traceback # Spooky-related import spooky, spooky.modules class TestModule(spooky.modules.SpookyModule): ''' This is a dumb test module ''' def __init__(self, main, instance_name=...
true
c60f0bcccc74badb394337c181cb3749876b2f90
janaleible/hotpotQA-ir-task
/retrieval/neural/modules/rankers.py
UTF-8
1,418
2.515625
3
[]
no_license
from retrieval.neural.modules.encoders import Encoder from retrieval.neural.modules.scorers import Scorer import main_constants as const from abc import abstractmethod from torch import nn import torch class Ranker(nn.Module): epochs_trained: int weight: float def __init__(self, query_encoder: Encoder, d...
true
9dee4fa62198b7e43c001ce01f53be3e2d9a46a0
abecus/DS-and-Algorithms
/problems/leetcode/longestStringChain1048.py
UTF-8
1,835
3.703125
4
[]
no_license
""" _________________________1048. Longest String Chain_________________________ Difficulty: Medium Likes: 228 Dislikes: 15 Solution: None Total Accepted: 15.5K Total Submission: 30.6K Acceptance Rate: 50.8% Tags: Hash Table, Dynamic Programming Given a list of words, each word consists of English lowercase let...
true
56613784c62b3d925e359c6cef619ae883fc2597
monkrobot/test_project
/Tasks_from_acm.timus.ru/01HelloWorld.py
UTF-8
534
3.5
4
[]
no_license
import math import matplotlib.pyplot as plt x = [] y = [] def func123(yo, xo, x1): x0 = 0 y0 = 0 error = 0 deltax = abs(x1 - x0) deltay = abs(x1 * math.tan(yo/xo) - y0) deltaerr = deltay ys = y0 for x_point in range(x0, x1): x.append(x_point) print('ys', x_point, ys) ...
true
aa18f94c6e4849966bbecc6ad55211071d5896d2
andy-maier/ownmoviedb
/ownmoviedb_check.py
UTF-8
39,442
2.578125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # coding: utf-8 # ----------------------------------------------------------------------------- # Copyright 2012-2017 Andreas Maier. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wit...
true
6ac829cbce1772c9d05fb5cb06d2389a123ac092
ausaki/data_structures_and_algorithms
/leetcode/number-of-matching-subsequences/411858309.py
UTF-8
541
2.734375
3
[]
no_license
# title: number-of-matching-subsequences # detail: https://leetcode.com/submissions/detail/411858309/ # datetime: Thu Oct 22 20:20:44 2020 # runtime: 284 ms # memory: 15.4 MB class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: result = 0 for w in words: i = 0 ...
true
b1192bf70d748dd4813a351f9a78cedcab422a3b
lblazok/Lugeon_Test
/lu_calc.py
UTF-8
1,297
3.625
4
[]
no_license
import matplotlib import matplotlib.pyplot as plt matplotlib.use('TkAgg') def Lu_calc(pressure, flow_meter, interval_length): ''' Calculate lugeon value Params: pressure: number array, Pressure value for each pressure step flow_meter: number array, Flow meter reading for each pressure step inte...
true
0ab5020cbf290d348fdf076e2d60c2e06b2d4c9d
onixultras13/myIsdreposiroty
/password program.py
UTF-8
247
3.359375
3
[]
no_license
var2="changeme" x=0 while x<=4: var1=input("enter password") if var1==var2: print("correct") break elif var1!=var2: print("try again") x=x+1 if x==5: print("Access Denied") break
true
58309a4709551118134f90d8c1e0d5a4ca58956f
universe3306/WebStudio2019
/3_flask_2/practice/JihyunLee/api.py
UTF-8
3,267
2.75
3
[ "MIT" ]
permissive
from flask import Flask, request from flask_restful import Api, Resource import json import os app = Flask(__name__) api = Api(app) class UserList(Resource): def get(self): # 리소스를 클라이언트한테 가져다 주는 GET 메소드 if not os.path.exists('users.json'): return 'users.json is not exists' wit...
true
c667581a8459522cfd42028ab657ead23ff310bd
ujalapraveen/Dictionary
/w3resource21.py
UTF-8
346
3.203125
3
[]
no_license
# d= {'1':['a','b'], '2':['c','d']} # list1=d.get("1") # list2=d.get("2") # for i in range(2): # for j in range(2): # print(list1[i]+list2[j]) d={'1':['a','b'],'2':['c','d']} i=0 list1=d.get('1') list2=d.get('2') while i <len(d): j=0 while j<len(d): new=(list1[i]+list2[j]) print(n...
true
2d291be7449e65a66cb8f9a2f7fc9877ad7aa91c
Illykai/tensorflow-tutorials
/tutorials/scratchpad.py
UTF-8
1,207
3.484375
3
[]
no_license
import math initial = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] sorted = [] count = len(initial) + 1 rows = 4 columns = int(math.ceil(count / rows)) full_columns = count % columns if not count % columns == 0 else columns partial_columns = columns - full_columns # Row 1 index = rows - 1 column = 1 w...
true
800092b88c875fc919a175c707a112000aa5a7b1
DishaVaidh/Trivago-Web-Scraping-and-Analysis-with-gui
/Trivago scrap and analysis/data_analysis_gui.py
UTF-8
2,920
2.921875
3
[]
no_license
import tkinter as tk from tkinter import ttk import pandas as pd import numpy as np import plotly.express as px df=pd.read_csv("tourist places.csv") df=df.sort_values(by="Title") import Graph_code as gc import time from tkinter import * import trivago_tk def triv2(): # Creating tkinter window ...
true
a9b562f7b7f459fbf1b43eb7526f22e61ee6072d
gengchao0812/HogwartsSDET144
/testing/conftest.py
UTF-8
296
2.59375
3
[]
no_license
import pytest #conftest固定名,并且被测包要有__init__.py文件 #session跨模块执行一次 module为模块级别,每个模块执行一次 @pytest.fixture(scope="session") def open(): print("跨模块只执行一次") yield print("恭喜,到这里就都执行完了")
true
19bb86c33ac70dfe655fa8e80392e90ef1884449
cn5036518/xq_py
/python16/day1-21/day014 内置函数02/pdf要点总结/06 二分法查找.py
UTF-8
2,977
4.25
4
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- #@time: 2019/11/6 7:15 #@author:wangtongpei '''''' ''' 二分法 1、核心思想 掐头去尾取中间(中位数) 2、前置条件 已经完成了排序(升序或者降序) 二分法查找: 方法1:循环+左右边界位置变动(两者之差减半) --可以知道目标数在列表中的位置 方法2:递归+新产生列表(新列表长度减半) --无法知道目标数在列表中的位置 方法3:递归+左右边界位置变动(两者之差减半) ''' # 方法1:循环 + 左右边界位置变动(两者之差减半) # -...
true
8230513ff352eb9246827474f26d0dac2d4d5197
pratishthaverma22/30-Day-LeetCoding-Challenge
/Week 3/FindAllAnagramsInString.py
UTF-8
1,101
3.40625
3
[]
no_license
/* Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100. The order of output does not matter. Example 1: Input: s: "cbaebabacd" p: "abc" Output: [0, 6] Ex...
true
455988eb0cb994634a2949e37d25c18f7ccd5c95
Shiru99/Learning-Python
/1.05.py
UTF-8
2,718
4.15625
4
[]
no_license
########################################################################################################## # ### Functions ### # def addition(alpha,beta): # gamma = alpha + beta # print(gamma) # print(addition(11,33)) # ### return is compulsary so...
true
be75ff4d5311cb878cef5f34399c1f6fcda86c8d
Alexpll/homework_check
/DZ/DZ4/6.py
UTF-8
399
3.328125
3
[]
no_license
def cached(func): cache = {} def decorate(*args): if args in cache: return cache[args] else: cache[args] = func(*args) return cache[args] return decorate @cached def fib(n): if n == 1 or n == 2: return 1 else: return fib(n - 1) +...
true
cfdf718f73524561c516d0c6cc5a737df2ab5b11
ath32/ASCs
/0_Python_scripts/2.1_Simple_null_sims.py
UTF-8
7,778
2.65625
3
[]
no_license
### IMPORTS ### import os import numpy as np import csv import time import scipy.stats as st ### CHOOSE SOURCE FOLDER (EMBL) ### source = '1_FASTA_Eubacteria_cds_TT11' ### FUNCTIONS ### def folder_parse(source): csv_total = [] for root, dirs, filenames in os.walk(source): for f in filenames: ...
true
42451d0598592feb54ab4e9e7bc6a80d7361af04
davidiwu/tf2.0
/data-pipeline/tensor_permutation.py
UTF-8
2,707
3.109375
3
[]
no_license
import numpy as np import tensorflow as tf ''' tensor permutation functions: tf.stack(inputs, axis=-1) tf.reshape(x, (batch_size, -1, d_model)) tf.transpose(x, perm=[0, 2, 1, 3]) tf.squeeze(expand, axis=1) tf.split(ones, axis= -1, num_or_size_splits= 2) tf.unstack(ones, axis= -1) broadc...
true
d5bdff69452bee5f9ede9256538a3e3f604cfd6a
meqili/Deep-3D-CNNs-for-MRI-Classification-with-Alzheimer-s-Disease-And-Grad-CAM-Visualization
/scripts/utils.py
UTF-8
2,607
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/python3.5 import numpy as np import sys def iterate_minibatches_train(inputs, targets, batchsize, shuffle=False): """Iterate minibatches on train subset. Parameters ---------- inputs : numpy.ndarray Numpy array of input images. targets : numpy.ndarray Numpy array of bina...
true
9beacff6adbc013796cf34dd2aa5b31a3c89655f
lehuutrung1412/CS112.L21.KHTN
/Practice/Codeforces/977_A_Wrong_Subtraction.py
UTF-8
279
2.859375
3
[]
no_license
n, k = map(int, input().split()) while (k != 0): mod = n % 10 if mod == 0: n = n // 10 k -= 1 else: remain = k - mod if remain <= 0: n -= k k -= k else: n -= mod k -= mod print(n)
true
12177598da62a3db32835de2d2dc051c6b240128
cb285/serialTerminal
/serialTerminal.py
UTF-8
2,785
2.78125
3
[]
no_license
#!/usr/bin/env python3 import serial import time import sys import readline import glob import threading import os ENDL = "\r" ENCODING = "ascii" HIST_FILENAME = "serial_history" def attemptSerConn(port, baudrate): if (len(glob.glob(port)) == 0): print("port not available. check connection.") ...
true
46ed57ec28b995576bd54184fef3de42803472de
jbm1991/Exercism
/python/armstrong-numbers/armstrong_numbers.py
UTF-8
299
3.359375
3
[]
no_license
from functools import reduce def is_armstrong_number(number): raised = digits_raised_to_power(number) total = reduce(lambda a, b: a + b, raised) return number == total def digits_raised_to_power(number): power = len(str(number)) return [int(i) ** power for i in str(number)]
true
9d31cb59d0bc9f847a777a2055d1652b396bc29a
subratcall/problem-solving-nov
/problems/65-AverageOfLevelsInBinaryTree/solution.py
UTF-8
598
3.5625
4
[]
no_license
# class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right def averageOfLevels(root): queue = deque([root]) res = [] while(queue): same_level_values = [] for i in range(len(queue)): o...
true
64da175baaf7c226ce4d1980e4ef39fd9ba89c32
alexn11/inscriptiones-app
/webapp/model/simple_tokenizer.py
UTF-8
2,102
3.453125
3
[ "MIT" ]
permissive
""" This version works only for documents with only alphabetical charaacters and spaces (no points etc) 0 = OOV also: make sure there is consistence wrt b-string vs normal string """ def load_from_file(file_path): word_list_file = open(file_path, 'rb') word_list = [] for line in word_list_file: word = line...
true
b57d90fff13c437f4a14142cae0d3aa5b372eafb
sc0tt/phenny
/modules/antijoke.py
UTF-8
1,592
2.765625
3
[]
no_license
import feedparser import re from random import randint, choice import html.parser punCount = 0 exp = re.compile('<p>(.*?)<\/p>') hrefExp = re.compile('<a href="(.*?)">[link]') htmlParser = html.parser.HTMLParser() def antijoke(phenny, input): feed = feedparser.parse('http://www.reddit.com/r/antijokes/.rss?limit=5...
true
62191ef8501b8f66e4f6e9e596c8ab61111764ab
dbunker/SABR
/test/Hard/Pack/Z-Puzzle/gen-pack.py
UTF-8
2,512
2.828125
3
[ "MIT" ]
permissive
# this will write out the the TBL of the z bin packing problem # which is to fit long-z shaped pieces into a 5x5x5 cube # shape # O O # O O O # 25 peices out = '\nSym { 0 1 }\n\n' out += 'Board{\n' for z in range(0,5): for y in range(0,5): out += '\t' for x in range(0,5): out += str(z) + str(y) + str(x) +...
true
a12379d41d43eba5e1cebbae5538168bbf3fcaf6
yinhsunhuang/TIMIT_training
/Layer.py
UTF-8
1,448
2.734375
3
[]
no_license
import torch import torch.nn.functional as F from torch.autograd import Variable class Layer(): def __init__(self): self.parameter = [] def out(self): pass class FCLayer(Layer): def __init__(self, W, b, act_fnc=F.sigmoid): self.W = W self.b = b self.act_fnc = act_fn...
true
8be329ca1a14b2d70dabf5f5e1d6d44030034a38
drlongle/leetcode
/algorithms/problem_1642/leetcode3.py
UTF-8
1,691
3.8125
4
[]
no_license
class Solution: def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: # Helper function to check whether or not the specified building is reachable # from the first building with the bricks and ladders we have. def is_reachable(building_index): ...
true
364899863cdd41b2f5183e51808b8ae0d99223a0
gvannest/n_puzzle_42
/test_npuzzle.py
UTF-8
618
3.40625
3
[]
no_license
import pytest import random from algo_class import Algo from node_class import Node """Tests du calcul heuristique manhattan distance et linear conflict""" @pytest.fixture def node_generator(): """Creates nodes for testing functions""" Node.h_method = 'manhattan' Node.final_grid = [1,2,3,8,0,4,7,6,5] ...
true
33d89fa3d6c0a75c0d8f14b11adbb036f80a2f19
Rushi21-kesh/30DayOfPython
/Day-9/Day_9_Janvhi.py
UTF-8
148
3.75
4
[]
no_license
number = int(input("Please Enter any Number: ")) last_digit = number % 10 print("The Last Digit in a Given Number %d = %d" %(number, last_digit))
true
fa561ac96c7645933af1eaed678d3ae379135655
Dev2050/Python
/data_analysis_re_urlilib.py
UTF-8
1,514
2.890625
3
[]
no_license
Python 3.7.0a1 (v3.7.0a1:8f51bb4, Sep 19 2017, 18:50:29) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import re >>> import urllib.request >>> def getStock(): url="https://finance.google.com/finance?q=" stock=input("Please enter the stock market name? ...
true
f778ad3a7ba0c145187d1cecb0cbaab6c38d66f5
FrancoCabezasPoblete/Peasy
/Backend/csv/Benchmarks/LimpiadorCSV.py
UTF-8
843
3.171875
3
[]
no_license
fileCSV = input("Ingrese el archivo CSV a limpiar de repetidos: ") with open(fileCSV+".csv", "r") as f_in: unicos = list(f_in.readlines()) for i in unicos : cont = 0 comaicont = 0 for icoma in range(len(i)): if(i[icoma] == ','): comaicont += 1 if(comaicont == 2): coma...
true
dc563a5bbdfc1b6e8a3eb0cbb016b92e3afc8530
dislocated-averstra/baseRepo
/Python/Mazes/GameObject/MazeAlgorithm.py
UTF-8
3,631
3.484375
3
[]
no_license
import random from Python.Mazes.Utilities.Stack import Stack class GenerateMaze: """ constructor for maze """ def __init__(self, maze_containers): self.container = maze_containers self.stack = Stack() self.visited = [] self.largestStack = 0 self.largestStackLocation =...
true
20cf9be75256794fa4feaa7ca203caac49dfeb8a
sawyermade/advanced-python
/as2/inventory.py
UTF-8
537
3.625
4
[]
no_license
''' Daniel Sawyer Assignment 2 inventory Fall 2017 ''' def displayInventory(inventory): print('Inventory:') sum = 0 for i, j in inventory.items(): print(j, i) sum += j print('Total number of items: ' + str(sum)) def addToInventory(inventory, addedItems): for i in addedItems: if i not in inventory: invent...
true
ad9584020f9c5e54ccfd55c3022d0d40e743483b
Peachmann/python-assignments
/assign1/crypto.py
UTF-8
5,918
3.953125
4
[ "BSD-2-Clause-Views" ]
permissive
"""Assignment 1: Cryptography for CS41 Winter 2020. Name: <YOUR NAME> SUNet: <SUNet ID> Replace this placeholder text with a description of this module. """ import utils ################# # CAESAR CIPHER # ################# def encrypt_caesar(plaintext): """Encrypt a plaintext using a Caesar cipher. Add m...
true
ecde4a7b9e4d375aedd1018210b13bd9f64c7e15
Legoota/PythonAlgorithmTraining
/Sorts/bubblesort.py
UTF-8
357
3.703125
4
[]
no_license
def bubblesort(array): for i in range(len(array),0,-1): sorted = True # Optimization in case the input array is already sorted => O(n)=1 for j in range(i-1): if(array[j+1] < array[j]): array[j+1], array[j] = array[j], array[j+1] sorted = False if(s...
true
183c0c57b0340d0d6cd724fdf73538322fc5af29
AimAndIgnite/face-recognition
/Main.py
UTF-8
7,649
2.953125
3
[ "MIT" ]
permissive
import cv2 import numpy as np from matplotlib import pyplot as plt import os def get_path_list(root_path): # Obtains list of path directories from root path # Returns: list(s) containing the names of the sub-directories in the root directory train_root_path_content = [] for i in os.listdir(root_path...
true
c7b4e56bd925e1f0a6e193de2bacde85f7807f18
arodgers11/Coursera_Capstone
/Personal/census.py
UTF-8
1,918
2.75
3
[]
no_license
import requests import folium import pandas as pd import matplotlib.pyplot as plt from math import sin,cos,sqrt from geopy.geocoders import Nominatim url='https://api.census.gov/data/2017/acs/acs5/subject' key='7bad81938d25611bd2d0362e77c32f0594ea0243' zips='44301,44302,44303,44304,44305,44306,44307,44308,4431...
true
a7d4254077f16558b20bf99a75ae543cae12238d
redpoint13/ProgrammingFoundations
/break_time.py
UTF-8
207
2.890625
3
[]
no_license
import time import webbrowser breaks = 3 break_count = 0 while break_count < breaks: time.sleep(10) webbrowser.open("https://www.youtube.com/watch?v=3GwjfUFyY6M") break_count = break_count + 1
true
d3b3d4e310f966463f944761e165626677feadbf
cwaage/checks
/computeAve/check50/__init__.py
UTF-8
1,594
3.265625
3
[]
no_license
from check50 import * class Computer_Average(Checks): @check() def exists(self): """computeAve.c exists""" self.require("computeAve.c") @check("exists") def compiles(self): """computeAve.c compiles""" self.spawn("clang -std=c11 -o computeAve computeAve.c -lcs50 -lm")....
true
a44e288201cae7ac3dd72d082bb6df979ecf2ef5
heyMP/spacy-course
/exercises/es/test_01_12_03.py
UTF-8
1,433
3.8125
4
[ "CC-BY-NC-4.0", "MIT" ]
permissive
def test(): assert ( len(pattern) == 3 ), "El patrón debería describir tres tokens (tres diccionarios)." assert ( isinstance(pattern[0], dict) and isinstance(pattern[1], dict) and isinstance(pattern[2], dict) ), "Cada entrada en el patrón debería ser un diccionario." ...
true
3274a0bb57858cec54f4c6c08e393155893197c9
Jellluuuz/ProjectEuler
/PEprob164.py
UTF-8
384
3.28125
3
[]
no_license
import time count = 0 def create_number(strng, n, som): if len(strng) == n: global count count += 1 return else: for j in range(10-som): temp2 = int(strng[-1]) create_number(strng + str(j), n, temp2 + int(j)) t = time.time() for i in range(1, 10): ...
true
99f6d9c54cbeb079c27097c29a5fba9dfdf68b27
emilbakke/da-newsroom
/build/util.py
UTF-8
5,643
2.828125
3
[]
no_license
from argparse import Namespace from os.path import exists from urllib.parse import urlparse import regex as re # stdlib module doesn't support \p{L} from tqdm import tqdm from newsroom import jsonl ############# # Constants # ############# ASSET_FILES = set(["css", "js", "png", "eot", "tff", "woff", "svg", "jpg", ...
true
a8d05aa84351b7d7be713d733366b569aa789273
Oussama3030/DATA-Py
/DATA-V inleveropgave week 7.py
UTF-8
1,351
2.8125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import scipy.odr as odr t = np.array([0.25,0.75,1.25,2.5,3.0,3.75,4.5,5.5,7.0,8.5]) d = np.array([1.43,2.06,2.09,2.66,3.31,3.52,3.79,4.12,4.35,4.95]) sig_d = np.array([0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.20]) #plt.figure() #plt.plot(t,d, label='.') #plt.e...
true
2d1d6f0e28ff5f5e5e2c6af6f777b428d1114a91
vitordsbatista/Evolgen-Framework
/create_pop.py
UTF-8
1,488
3.359375
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- #===================================# # File name: # # Author: Vitor dos Santos Batista # # Date created: # # Date last modified: # # Python Version: 2.7 # #===================================# import numpy as np import random as rd def pop_int(ind_num, ind_...
true
d8d82dfaa19d8c3a609edfba42d9b6e8279a077c
cristina2450-cmis/cristina2450-cmis-cs2
/cs2_quiz2.py
UTF-8
1,647
4.8125
5
[]
no_license
#PART 1: Terminology #1) Give 3 examples of boolean expressions. #a) 1 < 2 #b) 10 == 10 #c) 3 >= 2 # #2) What does 'return' do? # Return prints out the final value after a function has worked. # # # #3) What are 2 ways indentation is important in python code? #a) It shows when a function is finished. #b) It shows # # ...
true
6afdd40101a6d637babca9f46a55066bdbd63bce
LukeNFox/SVM_LR_performance_analysis
/svm_linear_regression.py
UTF-8
3,149
2.859375
3
[]
no_license
import sklearn from sklearn import linear_model, preprocessing from sklearn.svm import SVR from sklearn.metrics import max_error,mean_squared_error, mean_absolute_error, r2_score import matplotlib.pyplot as plt from math import sqrt from statistics import mean from sklearn.model_selection import cross_val_score fro...
true
70a4f39d53b582e80296bce3b546b32ad40b7113
stewartmiles/falken
/service/data_store/assignment_monitor.py
UTF-8
17,261
2.578125
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
true
35ee7b3df76afd65b08039328795c10389cfee76
ryoibaraki/bee_ant_resnet
/resnet.py
UTF-8
3,703
2.53125
3
[]
no_license
import torch import torch.nn as nn class block(nn.Module): def __init__(self, in_channels, out_channels, identity_downsample=None, stride=1): super(block, self).__init__() self.expansion = 4 self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1,padding=0) ...
true
f16d3f4c1e41b99d8fffceea88d4823668da432d
m0zjo-code/meteordoctor
/wav_client.py
UTF-8
2,094
2.703125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy.signal import stft import meteordoctorlib as mdl ## Settings plot_spec = False ## Some constants target_buffer_len = 8000 NOVERLAP = 0.8 spec_xy = 256 norm_aspect = 1.5 MINF = 500 MAXF = 1500 ## Filename fn = "sample_meteor_data_v4.wav" ### Load main fi...
true
a86400f063d15ceb46e29c91889b9c2747e55df6
julioaamaral/ml
/aux_files/t2.py
UTF-8
122
2.734375
3
[]
no_license
... #this part create a simple math expression #using the scalar-variables (tensors) a and b, defined earlier. c = a + b
true
f797b077545a4b9e4a959f6caed05275554db740
Vinicoreia/AlgoRythm
/python/EPI/wellFormedString.py
UTF-8
387
3.59375
4
[]
no_license
def wellFormedString(s): stack = [] d = { '(': ')', '[': ']', '{': '}', } for letter in s: if(letter in d): stack.append(letter) elif not stack or letter != d[stack.pop()]: return False return not stack print(wellFormedString('(())'...
true
0c2fd5d3549152d917452d872e9bb8ff12af2573
AlexvO09/pyjuggling
/juggling/simulator/__init__.py
UTF-8
902
3.25
3
[ "BSD-3-Clause" ]
permissive
import cv2 import math class Simulator: def __init__(self, circles, trajectory, initial_angle, appearance_step=1): self.__circles = circles self.__trajectory = trajectory self.__appearance_step = appearance_step self.__step = 0 self.__radians = initial_angle ...
true
2e559cf035f57b7fed380200a14d591575db848a
jmcarp/neurotrends
/neurotrends/pattern/lang/matlab_utils.py
UTF-8
2,999
2.875
3
[]
no_license
# -*- coding: utf-8 -*- import json import requests from bs4 import BeautifulSoup from neurotrends.config import re, cache_collection from neurotrends.pattern.misc import delimiter version_subs = [ # Handle whitespace ( r'\s+', delimiter, ), # Make initial "r" (e.g. "r2011") optiona...
true
cc7ada2f4d49e31bb477c8cf1c0eded873cd7e7a
AgnesaS/DataMiningProject
/GuiApp.py/app.py
UTF-8
4,686
2.78125
3
[]
no_license
import tkinter as tk from tkinter import * import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from IPython.core.display import HTML from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.tree import DecisionTreeClassifier root = tk.Tk() ...
true
644080773f997104a5538d010c2376c28ce02ea6
dtdu1985/Twitter-Bots-Social-Impact
/twitterbot_retweet.py
UTF-8
1,548
3.265625
3
[ "MIT" ]
permissive
#Notes #import twitter API wrapper, API credentials from separate file #auth_handler authentication handler to be used #runs Tweet actions for hashtag word in local language top items #api.search q the search query string #lang Restricts tweets to the given language #rppnumber of tweets to return per pg max 100 imp...
true
9651b91eea6ebcc9daea674879afe78fc5ae56bd
jamesmilliman/project_euler
/euler/p5.py
UTF-8
275
3.375
3
[]
no_license
def p5(n = 20): x = n found = False while True: found = True for i in range(1, n): if x % i != 0: found = False break if found: return x else: x += n print(p5())
true
4503145e72f036e5d29e495729f0f82c63c55e80
hvaandres/Video_Project
/main.py
UTF-8
1,011
2.953125
3
[]
no_license
import csv from selenium.webdriver.chrome.options import Options from selenium import webdriver import time def url_links(url_obj): reader = csv.DictReader(url_obj,delimiter = ',') try: chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argumen...
true