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 |
|---|---|---|---|---|---|---|---|---|---|---|
fce29a52a4806a4dbdeb3e1e5dfd9a221475195c | Therealchainman/LeetCode | /problems/minimum_cost_to_connect_two_groups_of_points/solution.py | UTF-8 | 866 | 2.75 | 3 | [] | no_license | class Solution:
def connectTwoGroups(self, cost):
# kmn graph, so m and n nodes. Each edge will have a weight or cost and the edges connect from m to n node.
# It is a bipartite graph. I don't know if I am the best at identifying those issues.
M,N=len(cost),len(cost[0])
mincols=[mi... | true |
fe447591714b6a1ff158c2db5f547fcb2d7eb8c1 | SciLifeLab/scilifelab | /scilifelab/experiment/project.py | UTF-8 | 2,017 | 2.921875 | 3 | [
"MIT"
] | permissive | """scilifelab.experiment.project module"""
import os
import re
from scilifelab.utils.misc import filtered_walk
# By default samples are named P###.*
re_sample = "^(P[0-9]{3,})"
def validate_sample_directories(plist, pdir):
"""Validate that paths in plist are indeed in subdirectories of pdir.
:param plist: lis... | true |
1f79e2bfd864c5544461a7e721b94aa42a1bbf01 | A01377744/Mision-10 | /Mision_10.py | UTF-8 | 1,809 | 3.453125 | 3 | [] | no_license | # Autor: Alejandro Torices Oliva
# Es un
import matplotlib.pyplot as plot
def sumaPuntos(nombre):
entrada = open(nombre, 'r')
entrada.readline()
entrada.readline()
puntosXequipo = {}
for linea in entrada:
datos = linea.split('&')
equipo = datos[0]
puntos = int(datos[8])
... | true |
81a502a375d87988d782114454c260315795b1a6 | Zarand3r/ligo-pendulum | /controller/noise.py | UTF-8 | 1,720 | 2.9375 | 3 | [] | no_license | # filter some data using SOS so as to preserve the dynamic range
import numpy as np
import scipy.signal as sig
def generate_noise(fs=1024, f1=15, f2=100, amplify=1):
bg_raw = np.random.randn(1000)
# f1 and f2 is a bandpass
sosBP1 = sig.butter(8, [f1/(fs/2), f2/(fs/2)], btype='bandpass', output='sos')
... | true |
9fb59acd14ed73b99690fa8464c0994a71c60e65 | paulinho-16/MIEIC-FPRO | /REs/RE06/ContadorPalavras/count.py | UTF-8 | 214 | 3.46875 | 3 | [] | no_license | def count(word,phrase):
word=word.lower()
phrase=phrase.lower()
palavras=phrase.split()
contador=0
for i in palavras:
if (i==word):
contador+=1
return(contador) | true |
11e63194f33f9138aa339787c6124bf6c3e9403e | ddelporte/efk | /app-log-plain/main.py | UTF-8 | 390 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
import logging
import time
logger_simple = logging.getLogger()
while True:
logger_simple.info("info level - simple message to display")
logger_simple.warning("warning level - simple message to display")
logger_simple.error("error level - simple message to display")
logger_simpl... | true |
9606ccf2a3019bb35566310116586a3dea9169b7 | JollenWang/study | /python/python_prj/dir.py | UTF-8 | 84 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# usage of dir()
print(dir())
import sys
print(dir(sys)) | true |
de4968faa3b56ceb3f5a3f39071d5014e7d1747e | PaulohFerreira/Game-Experiments | /Generic Survivor/characters.py | UTF-8 | 17,320 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Módulo Characters - 22/01/2015
# Módulo que contém as classes para dos objetos personagens
import pygame as pg, sys
from pygame.locals import *
from world import Tree, Stone
from equipments import *
from constructions import *
from recipes import *
# Classe Persona - Personagem ... | true |
2cb575894be1a9062e9a54a80fb190b4388c507a | alborzgh/bbp | /bbp/comps/metadata.py | UTF-8 | 1,803 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
This program defines a metadata class for managing metadata
files used in workflows. This class will be used by workflow
components.
$Id: metadata.py 1699 2016-07-25 22:37:48Z fsilva $
"""
from __future__ import division, print_function
class Metadata(object):
def __init__(self, base_pro... | true |
a90d4b9ebe1a456ec64b0c073defece5b5cf2505 | skolaric/dbl-smartcity | /data-processing/data/Atlanta/scripts/00b-generate-3D-tiles.py | UTF-8 | 4,924 | 2.84375 | 3 | [
"MIT"
] | permissive |
import sys
import os
import math
print()
print("========================================================================================")
print("This is a script that generates 3D tiles from OSM.OBJ data.")
print("Author: Sinisa Kolaric")
# for lon0 in range(-180, 180, 1): # degrees
# for lat0 in range(-90, 90,... | true |
6121e678610aeeaf9db2b388fbbcca905b8f30e9 | noahedelson/beavOnline | /src/effect.py | UTF-8 | 790 | 2.53125 | 3 | [] | no_license | from WorldObject import WorldObject
from Factory import Factory
from Position import *
from time import time
from random import random as rand
class effect(WorldObject):
def __init__(self, sublocale, effectType, duration):
WorldObject.__init__(self, sublocale, effectType)
self.duration = duration
def idl... | true |
5c67b93e86fda28c91802bc34c239f60e8b12cae | xdurch0/bird_detection2.0 | /make_tfrecords.py | UTF-8 | 6,461 | 2.609375 | 3 | [] | no_license | import argparse
import os
import sys
import librosa
import numpy as np
import tensorflow as tf
from data_utils import make_dev_inds, make_labeled_data_list, \
prepare_transform, read_data_config, random_pad
def fulfill_config(config_path):
"""Checks whether the data for a requested config exists and creates... | true |
1a4c010e8406d697f71e85a8ca4cfc795a42a90f | ChrisKCarr/DataBase_Skeleton | /DataBase_Outline.py | UTF-8 | 10,555 | 2.5625 | 3 | [] | no_license | from tkinter import Tk, StringVar, ttk, messagebox
from tkinter import *
import time
import datetime
#-----------------------------Frames-----------------------------------
root = Tk()
root.title("Efficency Tracker")
root.geometry('1350x650+0+0')
root.configure(background='black')
LeftFrame = Frame(root, wid... | true |
47fc1ad7523037d386cfd27fb7a993de1270687c | transparent-framework/optimize-ride-sharing-earnings | /baselines/networks/cdqn.py | UTF-8 | 582 | 2.84375 | 3 | [] | no_license | import torch.nn as nn
class DQN(nn.Module):
"""
Deep Q-Network
"""
def __init__(self, input_dim, output_dim):
super(DQN, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.fc = nn.Sequential(
nn.Linear(self.input_dim, 128),
... | true |
7d7d603225e4c7021d597fca8002608969ec699d | YangLiyli131/Leetcode2020 | /in_Python/1594 Maximum Non Negative Product in a Matrix.py | UTF-8 | 1,044 | 2.59375 | 3 | [] | no_license | class Solution(object):
def maxProductPath(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
row = len(grid)
col = len(grid[0])
grid[0][0] = [grid[0][0],grid[0][0]]
for i in range(1,row):
cur = grid[i][0]
p... | true |
6c365dee7d454cf7fc7139337b78105743d387fc | phamour/tf2-resnet-cifar10-horovod | /dataset.py | UTF-8 | 3,950 | 3.0625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os
TRAIN_FILES = ('data_batch_1.bin',
'data_batch_2.bin',
'data_batch_3.bin',
'data_batch_4.bin',
'data_batch_5.bin')
TEST_FILES = 'test_batch.bin'
class Cifar10DatasetBuilder(object):
"""Builds a tf.data.... | true |
04c41c84c80fc887bfcb1124d7c2332fef31da62 | Nora-Wang/Leetcode_python3 | /Greedy/055. Jump Game.py | UTF-8 | 2,470 | 3.90625 | 4 | [] | no_license | Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
Example 1:
Input: [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 t... | true |
1cea3b4355c3e58be57eb20119bae7e1d9b5d4b3 | piyushkashyap07/recursion | /stringstointerger.py | UTF-8 | 749 | 3.984375 | 4 | [] | no_license | # String to Integer
# Send Feedback
# Write a recursive function to convert a given string into the number it represents. That is input will be a numeric string that contains only numbers, you need to convert the string into corresponding integer and return the answer.
# Input format :
# Numeric string S (string, E... | true |
b2529a4d8f4c2daf423e5eef2834b77285df573c | aliyahyaaamir/practice | /edit_distance.py | UTF-8 | 2,418 | 4.34375 | 4 | [] | no_license | """
We have 3 operations that we can perform
We want to find the minimum number of operations to convert word1 to word2
So the minimum number of operations eh
We have two ptrs i, j
comparing
word1[0] to word2[0] -> we see that to convert word1[0] to word2[0] we need to remove the letter and add r
So 2 operations, or... | true |
9be5e5fb699b5e95a7843604aa017cca6b6c86df | kourav1991/pythonProg | /StringToDict.py | UTF-8 | 181 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 29 12:34:04 2019
@author: SKourav
"""
string = input("Enter string : ");
dict1 = {}
dict1.keys["a"]
dict1.values[1]
print (dict1) | true |
c6dc52aab2295d38ae11c860988f7167733cdda0 | rsaravia/PythonBairesDevBootcamp | /Level2/ejercicio4.py | UTF-8 | 339 | 4.28125 | 4 | [] | no_license | #4. Create a Python function that accepts any number of numbers as positional
# arguments and prints the sum of those numbers.
def sum_var(**variable):
out = 0
for key,value in variable.items():
#print(key,value)
out += value
return out
print(sum_var(a=1, b=2, c=3))
print(sum_var(a=1,b=2,... | true |
a58b5060e5c5d4fdf3f8d70f376adb74d80c25fa | jiwootv/jiwootv_home_cumputer | /또 과제.py | UTF-8 | 285 | 3.046875 | 3 | [] | no_license | count = 0
while count < 5:
print(count)
count += 1
print('')
count = 0
while count < 5:
print(count)
count = count + 1
else:
print(count)
count = 0
print('')
while count < 5:
print(count)
count += 1
if count == 3:
break
count = 0
while count < 5 | true |
ecb23975576b51e029ee72d74d0ea8bf0419efd0 | ml-lab/SentimentAnalysis | /load_data.py | UTF-8 | 1,499 | 3.25 | 3 | [] | no_license | import json
from datetime import datetime
import re
from nltk.corpus import stopwords
import pickle
def read_data(file_name=''):
data = []
print('Reading data start', datetime.now())
# file_name = 'Electronics_5.json' # 13 secs loading time
# file_name = 'Digital_Music_5.json' # 1 sec loading time
... | true |
f007e191d1609665b3aa34ae0b907b9a41d2e304 | SHPsStudents/C | /SakilUploads/Python/assignment 9.4 coursera.py | UTF-8 | 456 | 3.28125 | 3 | [] | no_license | fname = input('Enter file name: ')
try : file = open(fname)
except : print('Enter file name properly')
counts = dict()
for line in file:
if line.startswith('From '):
words = line.split()
mail = words[1]
counts[mail] = counts.get(mail, 0) + 1
bigcount = None
bigmail = None
for mail,count in... | true |
980f2a0b47ce2f53840114f37c60d327446a522a | Albli001348/Chance2Climb | /tweeter.py | UTF-8 | 230 | 2.515625 | 3 | [] | no_license | import tweepy
consumer_key =
consumer_secret =
access_token =
access_token_secret =
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
| true |
753f1a965b609b9a1c7713ff83cd9304a654b1d2 | Dpugh09/CS10403 | /Average.py | UTF-8 | 363 | 3.84375 | 4 | [] | no_license | average = 0
total = 0
howManyEntered = 0
howMany = int(input('How many test scores would you like to average: '))
while howManyEntered < howMany:
testScore = int(input('Enter test score: '))
total = total + testScore
howManyEntered = howManyEntered + 1
average = total / howMany
print('The average f... | true |
8c271c99f7f7fce5d2a88195c6fab23f5f694df1 | tahayasindemir/Rule_Based_Classification | /Rule_Based_Classification.py | UTF-8 | 2,426 | 3.046875 | 3 | [] | no_license | import pandas as pd
# add the absolute path here
df = pd.read_csv("...\persona.csv")
def check_df(dataframe, head=5):
print("##################### Info #####################")
print(dataframe.info())
print("##################### Shape #####################")
print(dataframe.shape)
print("########... | true |
36655bfb9c27f9230612bbbce72683a1b64ed8d9 | PlattsSEC/SECret-Santa- | /santasend.py | UTF-8 | 2,379 | 2.65625 | 3 | [] | no_license | import base64
import httplib2
from email.mime.text import MIMEText
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
# Path to the client_secret.json file downloaded from the Developer Console
... | true |
4eebdd19a82c351143130fefe07c7650b23ef216 | thienhuynhit/RaspberryPi-IOT | /01gpio/03digital_in/digital_input_wpi.py | UTF-8 | 139 | 2.71875 | 3 | [] | no_license | import wiringpi as wpi
PIN_SW = 18
wpi.wiringPiSetupGpio()
wpi.pinMode(PIN_SW, wpi.INPUT)
while True:
print(wpi.digitalRead(PIN_SW)) | true |
d62fca5fa91b8fed6b7bb26fc75ea4377fe5d461 | Kristjaan/Python_practice | /unitConvert.py | UTF-8 | 975 | 4.34375 | 4 | [] | no_license | #!/usr/bin/env python3
# Exercise 9.1: Unit converter
def is_number(num):
try:
float(num)
return True
except ValueError:
return False
def calc_km_miles(km):
miles = float(km.replace(",", ".")) * 0.62137
return miles
print("Hello! I'm a unit converter. I convert kilometers ... | true |
ac9331ee2d38b49e72fd63c37c82054365d2b294 | jravesloot/sift_app | /sift/concerts/management/commands/add_artists.py | UTF-8 | 2,123 | 2.875 | 3 | [
"MIT"
] | permissive | """
management/commands/add_artists.py
Add artist(s) to database.
"""
from datetime import datetime
import os, sys
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from concerts.models import Artist
from concerts.utils import FIXTURE_DIRS
class Comman... | true |
6cc90ded26d758e06f8daaaded3f28001b27c380 | hyarcticfox/Seeker | /seeker1.py | UTF-8 | 2,733 | 2.890625 | 3 | [] | no_license | #技术路线 requests-bs4-re
import requests
import bs4
import re
import traceback #用来跟踪异常返回信息
def getHTML(url, code = "utf-8"):
try:
#kv = {'wd':'111'} # param参数,html中以?wd=111形式加在url后面
r = requests.get(url, timeout = 30)
# r = requests.get(url, timeout=30, headers={'cookie': coo})
... | true |
a29a6ab7fb3ea33f7d732ce4d49c5b9dd12f08e2 | rxue07/TestPython | /test/seven.py | UTF-8 | 1,938 | 4.46875 | 4 | [] | no_license | '''
一: 已知:元组 a = (1,2,3) 利用list方法,输出下面的结果:
(1,2,4)
'''
print('第一题:')
a = (1, 2, 3)
b = list(a)
b[-1] = 4
a = tuple(b)
print(a)
'''
二: 利用列表推导完成下面习题:
1 输出结果:[1 love python,2 love python,3 love python,.... 10 love python]
2 输出结果:[(0,0),(0,2),(2,0),(2,2)
'''
print('第二题:')
print(['%s love python' % s for s in range(1, 11... | true |
3c57685db8184a4247ffbda294dc16d248b701c9 | ActiveScrub/lpthw | /ex1.py | UTF-8 | 278 | 3.65625 | 4 | [] | no_license | #print("Hello World!")
#print("Hello Again")
#print("I like typing this.")
#print("This is fun.")
#print('Yay! Printing.')
#print("I'd much rather you 'not'.")
#print('I "said" do not touch this.')
print("'whatever' 'you' 'do' 'don't' 'Fuck' 'with' 'your' 'code' 'like' 'this'") | true |
cff544d78112fe8b56a03748e87cb0b23536782a | yuzhenbo/leetcode | /leetcode/self/118_Pascal'sTriangle.py | UTF-8 | 578 | 3.1875 | 3 | [] | no_license | class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
nums = []
for index in range(numRows):
length = index + 1
subnum = []
for i in range(length):
if i == 0 or i == length-1... | true |
137160569a0fea09c978361b6790f615eb69b6fa | ucczs/AoC_2020 | /23_Python/23_01/23_01.py | UTF-8 | 1,457 | 3.140625 | 3 | [] | no_license | import copy
def findSubstractor(numbers, currentIdx, currentNumber):
subtractor = 1
pickupIdx = 1
while(pickupIdx < 4):
substraction = currentNumber - subtractor
if substraction <= 0:
substraction = max(numbers) + substraction
if numbers[(currentIdx + pickupIdx)%len(num... | true |
84fdff1aa074b1bc18c4d0e34cb20790392dfb12 | rtao258/HawkPi | /tests/test_amc.py | UTF-8 | 289 | 2.578125 | 3 | [
"MIT"
] | permissive | import pytest
from cogs.amc import score
def test_wrong_number_of_problems():
with pytest.raises(ValueError):
score(0, 0, 0)
def test_all_correct():
assert score(25, 0, 0, 15) == (150, 15, 300)
def test_all_skipped():
assert score(0, 0, 25, 0) == (37.5, 0, 37.5)
| true |
ab4d646d1b2e6629a3d46743e305bc0c50cb4ac3 | Hennessy-zhao/PyQt5-point | /27-QAbstractSlider-功能作用+信号.py | UTF-8 | 1,661 | 2.90625 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class Demo(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("QAbstractSlider")
self.resize(500,500)
self.setup_ui()
def setup_ui(self):
... | true |
8c211e8e7256f0185cea10cd178d92a95959d835 | hacmao/Cryptopal | /set4/challenge_27.py | UTF-8 | 1,182 | 3.578125 | 4 | [] | no_license | '''Recover the key from CBC with IV=Key'''
from Crypto.Cipher import AES
from Crypto.Random import urandom
key = urandom(16)
iv = key
def xor(a,b):
return bytes([a0^b0 for a0,b0 in zip(a,b)])
class CBC_mode :
def encrypt(self,string):
cipher = AES.new(key,AES.MODE_CBC,iv)
ret... | true |
55b1e41029754ba9f8baa72940e435fb9cc3fcf8 | FangyangJz/Black_Horse_Python_Code | /第二章 python核心/HX02_linux系统编程/02线程/xc13_异步1.py | UTF-8 | 860 | 3.171875 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# author: Fangyang time:2018/4/3
from multiprocessing import Pool
import time
import os
def test():
print('---进程池中的进程---pid=%d, ppid=%d---'%(os.getpid(), os.getppid()))
for i in range(3):
print('---%d---'%i)
time.sleep(1)
return 'haha'
def t... | true |
3f2db7116450b09190e4b1da247fc84b64fa9458 | astrocronopio/CodigoTesisIB | /TesisMaestriaDocs_v2/Presentacion/heat_map.py | UTF-8 | 1,610 | 3.09375 | 3 | [] | no_license | import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
def cart2sph(x, y, z):
dxy = np.sqrt(x**2 + y**2)
r = np.sqrt(dxy**2 + z**2)
theta = np.arctan2(y, x)
phi = np.arctan2(z, dxy)
theta, phi = np.rad2deg([theta, phi])
return theta % 360, phi, r
def sph2ca... | true |
2a901b04e979592ec7fd6af32d733b20a4decf8d | aidenbenner/competitive-programming | /problems/dmoj/uncategorized/nim.py | UTF-8 | 1,076 | 2.890625 | 3 | [] | no_license | N = int(input())
n = N
a = []
gt2 = 0
gt3 = 0
gt3o = 0
for i in range(N):
a.push(int(input())
if a[i] > 1:
gt2++
gt3o += a[i]
a.sort()
while true:
count = (gt2 + n) % 3
if count == 2:
# winning wait first or delay
for i in range(len(a)):
if a[i] ==... | true |
80a04192550e2d0bc304783c9d3b2e900a41a68a | ineed-coffee/PS_source_code | /BOJ/[BOJ]10655 마라톤1.py | UTF-8 | 555 | 2.796875 | 3 | [] | no_license | from sys import *
input = stdin.readline
N = int(input())
Cords=[]
for i in range(N):
x,y = map(int,input().split())
Cords.append([x,y])
dist_n=[]
dist_nn=[]
for i in range(N-1):
dist1 = abs(Cords[i][0]-Cords[i+1][0])+abs(Cords[i][1]-Cords[i+1][1])
dist_n.append(dist1)
if i+2<=N-1:
dist2 ... | true |
27f71b45d520b3461823ea082943d442d20ea59f | micheloosterhof/lantern | /tests/fitness/test_corpus.py | UTF-8 | 1,279 | 3.390625 | 3 | [
"MIT"
] | permissive | """Testing the corpus score fuction"""
from math import log10
from lantern.fitness import Corpus
def _test_corpus_constructor(words):
corpus = Corpus(words)
assert corpus.words == words
assert corpus.floor == log10(0.01 / len(words))
def test_corpus_constructor_with_set():
"""Testing corpus constr... | true |
f3d72f9f7167cd7e7d9ccb64fb49b2a52c35cf81 | cinnamonbreakfast/uni_implementations | /Semester 4/AI/Lab2/Lab2/models/Problem.py | UTF-8 | 2,089 | 2.828125 | 3 | [] | no_license | from copy import deepcopy
import numpy
from models.State import State
class Problem:
def __init__(self, initial):
self._initialConfig = initial
self._initialState = State()
self._initialState.addValue(deepcopy(self._initialConfig))
def expand(self, currentState):
expansion = ... | true |
549063878d4552c10fceb60c678ad23ce3892d82 | AlexaVega-lpsr/class-samples | /PrimeLister.py | UTF-8 | 1,101 | 3.96875 | 4 | [] | no_license | print("Here is a list of all the prime numbers from 2-100,000!!! It'll take a while to rpint out ALL of them so bear")
# I will now start the main thing!
# Takes myNum, an integer
# Returns True if n is prime
# Returns False if n is composite
def isPrime(y, list):
x = range(1,int(y))
num = y - 2
... | true |
3291a7039770f1293686f77617f7c9ec68c5457e | StefanDimitrovDimitrov/Python_Advanced | /Advanced level/Advanced/05. Functions Advanced - Lab +Ex/21. Odd or Even.py | UTF-8 | 272 | 3.40625 | 3 | [] | no_license | command = input()
numbers = list(map(int, input().split()))
sum_odd = (sum(filter(lambda number: number %2 != 0, numbers)))
sum_even =(sum(filter(lambda number: number %2 == 0, numbers)))
print(sum_odd * len(numbers) if command == "Odd" else sum_even * len(numbers))
| true |
9a3c073e2a7329e2a856713780998e3310a25291 | neong83/leetcode | /ex003_length_of_the_longest_substring.py | UTF-8 | 2,392 | 3.578125 | 4 | [] | no_license | # Third attemp:
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
longest_length = 0
non_repeated_string = ""
for c in s:
if c in non_repeated_string:
non_repeated_string = non_repeated_string.split(c)[1]
... | true |
d8226348a3fcaa6ba98585e7818d092f53d82f97 | yashpal410/Django | /labApp/populate.py | UTF-8 | 1,156 | 2.859375 | 3 | [] | no_license | from faker import Faker
from .models import User, ActivityPeriod
fake = Faker()
count = 10
def populateData():
for _ in range(count):
real_name = fake.name()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
str = ''
def populateId():
for i in range(8):
ch... | true |
7e14e244f2afe471d61fa66c0d0600be42cc8eff | EricPacefactory/VideoDrawing | /lineDrawer.py | UTF-8 | 19,278 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 15:49:35 2018
@author: eo
"""
import os
import cv2
import numpy as np
from collections import namedtuple
from local.lib.drawlib import loadImageResource, loadFromHistory, saveSourceHistory
from local.lib.windowing import SimpleWindow, breakByKe... | true |
536cac6168984dc7624c40baa428b93489c83d02 | Yoohu/easy_ne | /metric/metric_classifier.py | UTF-8 | 3,310 | 2.875 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
from sklearn.svm import LinearSVC
# from sklearn.linear_model import LogisticRegression as LinearSVC
from sklearn import metrics
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
import numpy
class Classifier:
def __init__(self,**kwargs... | true |
e97bb1b28f8dbb22ae7c806c18b07f432de1885b | healeycodes/websocket-benchmarker | /bench.py | UTF-8 | 3,842 | 3.203125 | 3 | [
"MIT"
] | permissive | import os
import time
import asyncio
import websockets
import argparse
parser = argparse.ArgumentParser(description='Benchmark a WebSocket server')
parser.add_argument('--h', dest='host',
help='Host address of WebSocket server',
default='localhost:3000')
parser.add_argument('--n... | true |
e6cf37ed5c13002ddaecf0a0ceaec2e1f3cc8920 | Tushar1157/Python_practice | /python assignments/doubling lambda.py | UTF-8 | 265 | 3.28125 | 3 | [] | no_license | L =list(filter(lambda x: x%5==0, range(1,1000)))
print("The list of numbers divisible by 5 in Range of 1 tyo 1000 : \n",L)
def double(integer):
return integer*2
doubling = list(map(double,L))
print("\nList of all elements of L doubled : \n", doubling)
| true |
832d72ebc97c905c77581011c7af89deda4fae61 | tbohne/AoC19 | /day4/main.py | UTF-8 | 1,288 | 3.75 | 4 | [] | no_license | def valid_password(password, part_one):
duplicate = False
for i in range(1, len(password)):
if password[i] < password[i - 1]:
return False
if part_one:
if password[i] == password[i - 1]:
duplicate = True
else:
# left bound
... | true |
d545fb67bb0ff73623fd8c0fd078917526706edf | Klotske/lab4 | /entities/entity.py | UTF-8 | 797 | 3.421875 | 3 | [] | no_license | class Entity:
name = ""
status = "Alive"
health = 0
heal_rate = 0
base_damage = 0
equipped = None
def heal(self):
self.health += self.heal_rate
def attack(self, enemy):
if enemy.status == "Alive":
if self.equipped is not None:
damage = self.e... | true |
302393a5663896f6817cf884019afe54dd59c085 | lifesucx/robot2018 | /src/commands/drive.py | UTF-8 | 1,334 | 2.5625 | 3 | [
"MIT"
] | permissive | import wpilib.command
from oi import getJoystick
class Drive(wpilib.command.Command):
def __init__(self):
super().__init__('Drive')
self.drivetrain = self.getRobot().drivetrain
self.requires(self.drivetrain)
def initialize(self):
self.drivetrain.voltage_ramp_off()
def exec... | true |
897f60a7efb5919fec7d742024b8183877c45901 | willle3456/recordexpungPDX | /src/backend/expungeservice/endpoints/users.py | UTF-8 | 2,962 | 2.671875 | 3 | [] | no_license | from flask.views import MethodView
from flask import request, abort, jsonify
from werkzeug.security import generate_password_hash
from flask import g
from expungeservice.database import user
from expungeservice.endpoints.auth import admin_auth_required
from expungeservice.request import check_data_fields
from psycopg2... | true |
df6ae81cf32ffaaeb455fbc53131d77910a6ffd3 | saippuakauppias/search-str-in-mso-files | /search_str/find_in_dir.py | UTF-8 | 1,306 | 2.703125 | 3 | [] | no_license | from optparse import OptionParser
from mso import DOCXFile, XLSXFile
from utils import fileslist
def main(directory, search):
result = []
files = fileslist(directory, ('.docx', '.xlsx'))
for filename in files:
if filename.endswith('.docx'):
reader = DOCXFile(filename)
else:
... | true |
bb42e052339feb33e5bca5130d2f75a67ee1411a | huxx-j/web_crawler | /bbq.py | UTF-8 | 978 | 2.796875 | 3 | [] | no_license | from itertools import count
import requests as requests
from bs4 import BeautifulSoup
import pandas as pd
def bbqStore():
bbqList = []
for page in count(start=1):
url = "http://changup.bbq.co.kr/findstore/findstore_ajax.asp?page=%s" % page
html = requests.get(url).text
soup = Beauti... | true |
59c255bddb5deba18aa7433b52b198eb88774aa1 | rahcosta/Curso_em_Video_Python_3 | /Parte 1/4.6. Primeiro e último nome de uma pessoa.py | UTF-8 | 357 | 4.09375 | 4 | [] | no_license | # FAÇA UM PROGRAMA QUE LEIA O NOME COMPLETO DE UMA PESSOA, MOSTRANDO EM SEGUIDA
# O PRIMEIRO E O ÚLTIMO NOME SEPARADAMENTE.
# EX: ANA MARIA DE SOUZA
# PRIMEIRO = ANA
# ÚLTIMO = SOUZA
nome = str(input('Digite seu nome completo: ')).strip().lower()
n = nome.split()
print(f'Seu primeiro nome é: {n[0].title()}')
print(f'... | true |
367daef8e15997b53de2a119238e1dd3eb268d72 | densitydesign/sketch | /sketchproject/sketch/recordprocessor.py | UTF-8 | 1,849 | 3.25 | 3 | [] | no_license | """
recordprocessor module
"""
from copy import deepcopy
class RecordProcessor(object):
"""
The recordprocessor class is a container for processing functions
"""
def __init__(self):
self.processingFunctions = {}
def registerProcessingFunction(self, function):
... | true |
f12c20a85b0b75c4de99e023cb3f5cc17bf3374a | statco19/doit_pyalgo | /ch1/skip1.py | UTF-8 | 218 | 3.890625 | 4 | [] | no_license | # skipping 8
for i in range(1,12):
if i == 8: # inefficient way to skip 8 since I ran 12 tines of if statement just to skip
# one number
continue
print(i, end=' ')
print()
| true |
7d7fdabca2ee4f4509322e61b6476b82f53a52d3 | richardhanksjr/MUStudy | /MUStudy.py | UTF-8 | 37,290 | 3.109375 | 3 | [] | no_license | #MUStudy.py
#########################################################################################################################
#This is a program written to assistant musicians in the Navy in studying for advancement exams. This program simulates#
#the types of questions a musician might experience on the actua... | true |
be83b1be12bb82f2d1a99a51661c537b0da4108e | Marcos556149/UNIDAD-3-ACTIVIDAD-1 | /ClaseLibro.py | UTF-8 | 1,269 | 2.8125 | 3 | [] | no_license | from ClaseCapitulo import Capitulo
class Libro:
__idLibro= ''
__titulo= ''
__autor= ''
__editorial= ''
__isbn= ''
__cantidadCapitulos= ''
__capitulos= []
def __init__(self,id='',tit='',aut='',edit='',isb='',cantCap=''):
self.__idLibro= id
self.__titulo= tit
... | true |
26706ce2a4f0d440c6ac1e7f892521f11d3e173f | igorlifar/debt-manager | /debtmanager/manager/utils.py | UTF-8 | 189 | 2.828125 | 3 | [] | no_license | import re
def calc_to_float(value):
if re.match(r'^[ \d\(\)\*\+\-\/\.]*$', value) == None or re.search(r'\*\*', value) != None:
raise SyntaxError
return float(eval(value))
| true |
70902305779ef0e9a98fcdf2bb5ab7cd5328cf19 | domyang/copulas | /copulaMS.py | UTF-8 | 24,683 | 3.046875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
import math
import utilities as ut
import copula as cop
from datetime import timedelta
# READ ME:
#
# In this class, we define a copula class for MULTIPLE SERIES of data and multiple offsets
# The goal is to take into account the dependencies b... | true |
b5604ff81e88dbb2a7644ea9f41e7bfeda62f252 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2511/60759/296815.py | UTF-8 | 320 | 2.609375 | 3 | [] | no_license | ns, s = map(int, input().split(' '))
nums = []
for n in range(ns):
nums.append(int(input()))
for i in range(len(nums) - 1):
ans = 0
for j in range(i + 2, len(nums) + 1, 2):
idx = (i + j) // 2
if sum(nums[i:idx]) <= s and sum(nums[idx:j]) <= s:
ans = j - i
print(ans)
print(0)
| true |
e433cd75b01a3fe7446455ad41508b94cfa0296f | yujie6/MLsystem | /Tinyflow/tinyflow/train.py | UTF-8 | 2,535 | 2.734375 | 3 | [] | no_license | from . import autodiff
from ._base import *
from ._func import *
class Optimizer(object):
learning_rate = None
optimize_target = None
def __init__(self, learning_rate):
self.learning_rate = learning_rate
def minimize(self, cost_function):
assert False
class GradientDescentOptimizer... | true |
6189515fd9dd5e5d5254336b4161c41ee82e1fdc | DaHuO/Supergraph | /codes/BuildLinks1.10/test_input/CJ_16_1/16_1_1_highOrderPoles_A.py | UTF-8 | 1,478 | 3.640625 | 4 | [] | no_license | import numpy as np
class A:
def readWord(self):
# raw_input() reads a string with a line of input, stripping the '\n' (newline) at the end.
# This is all you need for most Google Code Jam problems.
self.cases = []
self.numCases = 0
self.numCases = int(raw_input()) # read a... | true |
2ab17593af717f0663a24c69325808b1187fdb10 | DavidRussPrater/DungeonGamePython | /DungeonGame.py | UTF-8 | 1,466 | 3.59375 | 4 | [] | no_license | # Author: David Prater
currentRoom = "kitchen"
alive = "true"
keyPressed = ""
while (alive == "true"):
if (currentRoom == "kitchen"):
keyPressed = input("You are in the kitchen. There are doors to the west (w), south (s) and east (e).")
if (keyPressed=="w"):
currentRoom = "hallway"
... | true |
25867a9e66591a4fd23e03b19d10ddfa3286c219 | laurenCassidy/wiki-bert-pipeline | /scripts/letterfreq.py | UTF-8 | 1,177 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# Get frequencies of letter characters in text.
import sys
import re
from collections import Counter
def argparser():
from argparse import ArgumentParser
ap = ArgumentParser(description='Get letter frequencies.')
ap.add_argument('--ignore', default=None,
help=... | true |
2ab12d91358cacb8d8f0d6553c460d948f742aec | para-de-codar-alek/Respostas-Uri | /1557.py | UTF-8 | 655 | 3.21875 | 3 | [] | no_license | n = 99999
while True:
n = int(input())
if n == 0:
break
lista = list()
for i in range(n):
lista.append([])
for j in range(n):
lista[i].append(0)
lista[0][0] = 1
print(lista)
for l in range(0,n):
if i>=1:
... | true |
5c3a4ce2476d8d2328493fe0fd3e522921af0a1b | Bralmar/appbio17 | /Module 2 - Python Basics/Reformatting.py | UTF-8 | 2,850 | 3.953125 | 4 | [] | no_license | #Re-formatting Sequences
''' Takes Stockholm files as input and reformats them into fasta format files, with each line at
most 60 character long.
'''
import pdb
#Main function that is used to call and ask for the input file
def main():
filename = input("Enter filename that you want to input: ")
return filename
... | true |
f1b941bac13bfc303986f62691d7af159033ec58 | adelegi/Challenge_ENS | /toolkit.py | UTF-8 | 1,613 | 2.78125 | 3 | [] | no_license | import numpy as np
from tqdm import tqdm
def random_drawing(features_dict, output_dict):
"""
"""
train_buildings = np.random.choice(12, 9, replace=False) + 1
X_train = []
Y_train = []
X_test = []
Y_test = []
for i in tqdm(range(1, 13)):
for j in range(20):
... | true |
e2ce2ff93f2d2e57ec7a29b8e669e605e5f08831 | sansible/newrelic-api | /newrelic_api/users.py | UTF-8 | 2,613 | 3 | 3 | [
"MIT"
] | permissive | from .base import Resource
class Users(Resource):
"""
An interface for interacting with the NewRelic user API.
"""
def list(self, filter_email=None, filter_ids=None, page=None):
"""
This API endpoint returns a paginated list of the Users
associated with your New Relic account. ... | true |
b5bc66620b58a4039a032b249e238747443e8394 | ongbe/SimpleInteractiveInterface | /dragenabledscene.py | UTF-8 | 743 | 2.5625 | 3 | [] | no_license | from PyQt4.QtGui import QGraphicsScene
from PyQt4.QtCore import pyqtSignal
class DragEnabledScene(QGraphicsScene):
"""docstring for DragEnabledScene"""
modelchanged = pyqtSignal()
def __init__(self,rect=None,parent=None):
super(DragEnabledScene,self).__init__(rect,parent)
self.movingState = 0
def mousePressEv... | true |
9747e621e730c979b66b8ff4ff2bed3c55700482 | SharperJBCA/MFI-Pipeline | /Scripts/SourceFitting/SF_Plot.py | UTF-8 | 2,086 | 2.546875 | 3 | [] | no_license | fig = pyplot.figure()
samps = np.arange(volts.size)
isGaussian = (x**2 + y**2 < beam['X'][0]*0.8**2)
isBackground = (x**2 + y**2 < beam['X'][0]*6.**2) & (x**2 + y**2 > beam['X'][0]*3.**2)
... | true |
6415405cd49548eda86edccf5de5a6431f0d9ba6 | genomexyz/rainfall_estimation | /cstvi.py | UTF-8 | 3,530 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
import math
import numpy
import re
def read_pgm(filename, byteorder='>'):
"""Return image data from a raw PGM file as numpy array.
Format specification: http://netpbm.sourceforge.net/doc/pgm.html
"""
with open(filename, 'rb') as f:
buffer = f.read()
try:
header, width, height, maxval = re... | true |
61cb080fa2d03fa76d0a07bdf554d4ef16bcece7 | coolxv/DL-Prep | /04_Algorithms/Leetcode/JZ4 重建二叉树.py | UTF-8 | 1,042 | 3.375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# noinspection PyUnboundLocalVariable
# 只需要根据前/后序遍历找到根节点,然后利用根节点将中序遍历分割,再一次递归地传入就可以
class Solution:
# 返回构造的TreeNode根节点
def reConstructBinaryTree(self, pre, tin):
de... | true |
fafea219e6b2a075d8ef75167be59ed092a1cd89 | bcollinsNR/needsMoreJPEG | /Imgur/main.py | UTF-8 | 9,095 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import json, sys, time as dt, pprint, math
from Imgur.Factory import Factory
from Imgur.Auth.Expired import Expired
try:
from urllib.request import urlopen as UrlLibOpen
from urllib.request import HTTPError
except ImportError:
from urllib2 import urlopen as UrlLibOpen
from urlli... | true |
a71c58c81c4c41d7d89ca546323a80359701a495 | danielfess/Think-Python | /spiral.py | UTF-8 | 485 | 3.3125 | 3 | [] | no_license | import turtle
#unfinished - choices in code on website of a, b, length, dtheta are unclear to me.
#Questions: What is the equation of the spiral that is being drawn?
# From what calculation does the value of dtheta come?
def arch_spiral(t,a,b):
"""Draws the archimedean spiral r = a + b theta, with theta... | true |
6e47ca4f6ae790d31978c557b7a8ca3efdecdfe1 | pracowniaPK/generative_art | /generative_art/hilbert_dithering.py | UTF-8 | 1,791 | 2.90625 | 3 | [] | no_license | from hilbertcurve.hilbertcurve import HilbertCurve
from PIL import Image, ImageDraw
from math import log2, ceil
def hilbert_dithering(im_in, thresholds=[0, 255], verbose=True):
im_out = im_in.copy()
im_width, im_height = im_out.size
p = ceil(log2(max(im_width, im_height)))
if im_out.mode in ('RGB', '... | true |
269a6607cc6e31de724f0bf02e47741cea36a9d6 | demetoir/ps-solved-code | /boj/2884.py | UTF-8 | 69 | 2.734375 | 3 | [] | no_license | h,m=map(int,input().split());print((h+23+(m+15)//60)%24,(m+15)%60) | true |
b1e05e8cb80d73bbeedabbf972398b550dbeb2f1 | yangt8/ICS-31 | /lab3.py | UTF-8 | 6,763 | 3.40625 | 3 | [] | no_license | #Molly Taing 82155694 and Yang Tang 53979886 ICS 31 Lab Sec2
#c
#c1
print('---c1---')
def abbreviate(month:str)->str:
"Return the abbreviation of the month"
return month[0]+month[1]+month[2]
assert abbreviate('January')=='Jan'
assert abbreviate('abril')=='abr'
#c2
print('---c2---')
def fi... | true |
8aa9212f92f82ce9d3d9ba9e229228db6fda2ca4 | sastry17/HPC | /variant.py | UTF-8 | 8,189 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 13:28:54 2020
@author: JG07DA
"""
import numpy as np
from matplotlib import pyplot as plt
import os
import time
import multiprocessing as mp
from numba import jit, vectorize, complex64, int32
#########################################################################... | true |
251d2653879c5b927327a321f8260b170d2cfd0d | KonstantinosNakas/ProjectEuler-Python-Solutions | /40.py | UTF-8 | 379 | 2.921875 | 3 | [] | no_license | m = 0;
num = 0;
mult = 1;
while(1):
num = num + 1;
number_string = str(num);
for ch in number_string:
temp_num = int(ch);
m = m + 1;
if (m == 1 or m == 10 or m == 100 or m == 1000 or m == 10000 or m == 100000 or m == 1000000):
mult = mult * temp_num;
if (m == 1000000):
break;
if ... | true |
507a788e203e340dd4765e72573550eeee1f5896 | dankodak/Programmierkurs | /Meins/Blatt 4/Aufgabe1.py | UTF-8 | 174 | 2.875 | 3 | [] | no_license | import sys
import interest
for i in sys.path:
print(i)
print(interest.gesamt(10000,0.1,3600))
n=1
while interest.gesamt(10000, 0.1, n) < 20000:
n +=1
print(n/360) | true |
748fb30c4cfce88116b922bcb6418a1a1cda11a3 | cappccino/python_learn | /input_simple.py | UTF-8 | 300 | 3.921875 | 4 | [] | no_license | #result = input()
#print('юзверь написал', result)
#Вариант 2
#name = input('Как тебя ховут?: ')
#print('Привет', name)
age = int(input('Сколько вам лет? '))
period = 20
age_period = age + period
print('Через' , period, 'Вам будет' , age_period)
| true |
2e69dcf594acb34c5dbd6643613c7b924351beaa | iguanaus/makemit-checkin-2 | /server/server.py | UTF-8 | 1,880 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import time
import json
import urllib
import os
import BaseHTTPServer
from pymongo import MongoClient
import datetime
HOST_NAME = 'localhost'
PORT_NUMBER = 31337
DATA_FILE = 'checkin.log'
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
... | true |
0b9828e8b0d5e006b81cff79fadf38a941c9bf79 | mnvijay1998/GUVI-Programs | /Beginner/set4/count.py | UTF-8 | 55 | 3.0625 | 3 | [] | no_license | n=input().split()
c=0
for i in n:
c=c+len(i)
print(c) | true |
1c6b52b87626705e16d16bff48aa1c974cb845e8 | fanything/python | /wester.py | UTF-8 | 195 | 3.6875 | 4 | [] | no_license | '''
这是一个递归
'''
def print_lol(the_list):
'''
这是一个循环
'''
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item)
else:
print(each_item)
| true |
ed1a4b97bea2ee0167e38bc40dbf783c1af696d6 | ggsant/pyladies | /iniciante/Mundo 02/Anotações das Aulas e Desafios/Aula 03 - 14/Desafio 058.py | UTF-8 | 1,257 | 4.34375 | 4 | [
"MIT"
] | permissive | """
DESAFIO 058: Jogo da Adivinhação v2.0
Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um número entre 0 e 10.
Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos
palpites foram necessários para vencer.
"""
from random import randint
from time import sleep
print('Vou ... | true |
ae75b8f849a9f0afdf3a348550c94b1f002c7848 | vs-nth/SystemSecurity | /PRNG.py | UTF-8 | 1,314 | 3.375 | 3 | [] | no_license | from math import sqrt
import random
def confirmPrime(p):
# test if n is even
if p % 2 == 0:
return False
for i in range(3, int(sqrt(p)), 2):
if p % i == 0:
return False
return True
def goodPrime(p):
return p % 4 == 3 and confirmPrime(p)
def findGoodPrime(numBits=32):... | true |
15a191af9e40f01da09e673574158bc3ccc6487a | ymsk-sky/atcoder | /abc311/b.py | UTF-8 | 331 | 2.59375 | 3 | [] | no_license | n, d = map(int, input().split())
sl = [input() for _ in range(n)]
ans = 0
for i in range(d):
for j in range(i + 1, d + 1):
cnt = 0
for s in sl:
if not ("x" in s[i:j]):
cnt += 1
else:
break
if cnt == n:
ans = max(ans, j - i)
... | true |
083e0be8c55a470e4e2accd01fcb22d40cc817cb | witchtrash/aoc2019 | /day2/intcode2.py | UTF-8 | 803 | 2.734375 | 3 | [] | no_license | from AOC import l
def run(intcodes: list, a: int, b: int) -> int:
lim = len(intcodes) // 4 + 1
intcodes[1] = a
intcodes[2] = b
for i in range(lim):
index = i * 4
opcode = intcodes[index]
if opcode == 99:
return intcodes[0]
try:
intcodes[intco... | true |
acba1c98693514542388f491fe8466c6f9e623ee | wbruntra/book-maker | /get_page.py | UTF-8 | 2,191 | 2.84375 | 3 | [] | no_license | import requests
import codecs
from creds import headers
from bs4 import BeautifulSoup as Soup
import time
import os
from process_chapter import parse_page, make_chapter_html
def get_title_from_url(url):
return url.split('/')[-2] + '.htm'
def get_page(url):
title = get_title_from_url(url)
filepath = os.pat... | true |
c9d9ddd6b14d69ed6cd7972c80366dea9784e262 | wjt2015/ml_a | /src/main/nlp_a/basic_gensim.py | UTF-8 | 759 | 2.953125 | 3 | [] | no_license |
import gensim
text_corpus = [
"Human machine interface for lab abc computer applications",
"A survey of user opinion of computer system response time",
"The EPS user interface management system",
"System and human system engineering testing of EPS",
"Relation of user perceived response time to er... | true |
0239fd1dc49ab7bd2f0dc9e81b1133854330a567 | daniel-reich/turbo-robot | /PzyssSgqopkBjzTY2_3.py | UTF-8 | 1,683 | 3.921875 | 4 | [] | no_license | """
A maze can be represented by a 2D matrix, where `0`s represent **walkeable**
areas, and `1`s represent walls. You start on the upper left corner and the
exit is on the most lower right cell.
Create a function that returns `true` if you can walk from one end of the maze
to the other. You can only move up, down, ... | true |
1622ca771f5d508d7ec6a301f8357d584d1cc45e | ptmfitch/AdventOfCode2020 | /solutions/day4part2.py | UTF-8 | 1,823 | 2.8125 | 3 | [] | no_license | from utils import inputs
import re
req_fields = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']
def year_in_range(start, end, year):
return start <= int(year[4:]) <= end
def height_in_range(hgt):
if hgt[len(hgt)-2:] == 'cm':
try:
return 150 <= int(hgt[4:7]) <= 193
except Value... | true |
5eda823b6c0b4d3bd1b17d3678b974f5d3e1ff61 | pavelperc/isd_homework_1 | /tests/test_archive.py | UTF-8 | 2,219 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import pytest
import shutil
import tarfile
import zipfile
from ..config import Config
from ..app.archive import create_archive
UPLOAD_FOLDER = Config.UPLOAD_FOLDER
@pytest.fixture(scope="session")
def temp_file():
TEMP_FILENAME = "temp.txt"
TEMP_FILEPATH = os.path.join(UPLOAD_FOLDER, TEMP_FILENAM... | true |