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 |
|---|---|---|---|---|---|---|---|---|---|---|
02b9104fe9890699a6e93f0759929ef5b4c188aa | TTheHolyOne/storygame | /story.py | UTF-8 | 1,294 | 3.984375 | 4 | [] | no_license | # TTheHolyOne#1642
# Week one of me programming :)
print('Hello there!\nWelcome to my story game! You enter the inputs and I make it into a story!\n')
input()
while True:
name = input('Please enter a name! \n')
age = int(input('Please enter a age! \n'))
namefood = input('Please enter what you like to ... | true |
3772a597f4614e76e97ef13a345902ed0bf024e4 | JhonatasMenezes/8ProjetosemPython | /decida_por_mim.py | UTF-8 | 1,440 | 3.71875 | 4 | [] | no_license | # Projeto 5: Game Decida por Mim, onde você pergunta pro programa e ele te responde
# Projeto 6: Criar uma tela para ele
import random as rd
import PySimpleGUI as sg
# cirar classe do game
class DecidaPorMim:
def __init__(self):
# colocar algymas respotas predefinidas
self.respostas = [
... | true |
5ba1051198346d333339014f3cbc2dfc5c6d5805 | kim-taewoo/TIL_PUBLIC | /Algorithm/swexpert/5986_새샘이의_745_게임.py | UTF-8 | 360 | 2.890625 | 3 | [] | no_license | def sol(cnt, sum, cur_i):
if cnt == 0:
result.add(sum)
return
for i in range(cur_i + 1, len(a)):
sum += a[i]
sol(cnt-1, sum, i)
sum -= a[i]
T = int(input())
for t in range(1,T+1):
a = list(map(int, input().split()))
result = set()
sol(3, 0, -1)
print... | true |
9d4169e76e0f34985361832364b694414850e0e0 | daviddumas/mcs260fall2020 | /samplecode/quadroots.py | UTF-8 | 562 | 4.1875 | 4 | [] | no_license | # Determine the number of real roots of a quadratic polynomial
# MCS 260 Fall 2020 Lecture 6 - David Dumas
print("Enter the coefficients a,b,c of ax^2+bx+c, in that order, one per line.")
a = float(input())
b = float(input())
c = float(input())
print("You entered:",a,"x^2 +",b,"x +",c)
discriminant = b**2 - 4*a*c
if... | true |
0270790906c0b97d7f3886b31c33e0962b66d5fa | kendfss/misc | /2020/imagine.py | UTF-8 | 1,981 | 3.390625 | 3 | [] | no_license | import numpy as np
class Pixel:
def __init__(self,red=0,green=0,blue=0,alpha=0,location=(0,0)):
self.red = red if red < 256 else 255
self.green = green if green < 256 else 255
self.blue = blue if blue < 256 else 255
self.alpha = alpha if alpha < 256 else 255
self.x =... | true |
88f503eb77507129598b572f38ff613b268b8cd4 | JDiegoH/Operaciones_Posfija | /Operaciones_Posfija/operaciones.py | UTF-8 | 2,599 | 3.515625 | 4 | [] | no_license | from io import *
class Nodo:
def __init__(self, valor, izquierda=None, derecha=None):
self.valor = valor
self.izquierda = izquierda
self.derecha = derecha
def en_orden(arbol):
if arbol == None:
return ''
elif arbol.valor in ['+', '-', '*', '/']:
return "(" + en_orde... | true |
37c4a5373d402cd7a549a7a1e1ad600ab112af86 | amandamnf/amandamnf-amanda-sa-poo-python-ifce-p7 | /Atividades[Avaliação] - Etapa1/Avaliação 2/CodigoMorse.py | UTF-8 | 1,472 | 3.8125 | 4 | [] | no_license | dicionario = {'a': '.-', 'b': '-...', 'c': '-.-.', 'd': '-..', 'e': '.', 'f': '..-.', 'g': '--.', 'h': '....',
'i': '..', 'j': '.---', 'k': '-.-', 'l': '.-..', 'm': '--', 'n': '-.', 'o': '---', 'p': '.--.',
'q': '--.-', 'r': '.-.', 's': '...', 't': '-', 'u': '..-', 'v': '...-', 'w': '.--', '... | true |
3289bbcecb45d6af864a27070e618c7d45c1ac07 | vfdev-5/distracted-driver-detection | /common/helper.py | UTF-8 | 2,513 | 2.90625 | 3 | [] | no_license |
#
# Helper methods
#
# Python
import sys
import os
# Numpy & Matplotlib
import numpy as np
import matplotlib.pyplot as plt
# Caffe & lmdb
import caffe
import lmdb
from caffe.proto import caffe_pb2
def is_lmdb_file(filename):
try:
env = lmdb.open(filename, readonly=True)
env.close()
except... | true |
52791e6ec33938bbd8788b22748ac948d098a2ee | allieglotfelty/Coding-Challenges | /pangram.py | UTF-8 | 948 | 3.640625 | 4 | [] | no_license | """Given a string, return True if it is a pangram, False otherwise.
For example::
>>> is_pangram("The quick brown fox jumps over the lazy dog!")
True
>>> is_pangram("I love cats, but not mice")
False
"""
def is_pangram(sentence):
"""Given a string, return True if it is a pangram, False othe... | true |
57b16825333d8524fa646d1eca411f8a504f3f6a | astojmir/qmbpmn-tools | /common/db_parsers/tab_file.py | UTF-8 | 2,695 | 2.6875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-ncbi"
] | permissive | #
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It wa... | true |
d4a282275122c66fb957658eb8bca835f80aae6f | pelvoc/LeetCode-Summer | /692.py | UTF-8 | 493 | 3.09375 | 3 | [] | no_license | class Solution(object):
def topKFrequent(self, words, k):
"""
:type words: List[str]
:type k: int
:rtype: List[str]
"""
res=[]
if len(words)==0:
return res
d=dict()
for w in words:
d[w]=d.get(w, 0)+1
... | true |
e4818a11591fc7e813a057b66bf16eeb8ee63c99 | intermezzo-fr/libextract | /tests/html/test_article.py | UTF-8 | 621 | 2.75 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from tests.html import TestParseHtml
from libextract.html.article import get_node_length_pairs, node_text_length
class TestNodeTextLength(TestParseHtml):
def runTest(self):
res = self.etree.xpath('//body/article/div')
for node in res:
assert node_text_leng... | true |
69a067fbf42a8cac2762aef673178005e9f6a48b | gdgu/exudos-datatasks | /radstaskA.py | UTF-8 | 2,105 | 3.3125 | 3 | [
"Unlicense"
] | permissive | ''' Task A. '''
# task to do the following:
# parse the sample_bba_data_2017 excel sheet or csv document
# to obtain data in the following format as JSON
#
# primary structure (master model)
# [use the structure cited beneath as a reference]
'''
Student {
name: String,
gender: Enum(String) ['male' | 'female... | true |
f413b99d7f5184a16e20e5ce6bb576be238dda63 | rlaecio/CursoEmVideo | /aulas/aula09.py | UTF-8 | 137 | 3.40625 | 3 | [] | no_license | frase = input('Digite uma frase ')
print(frase.strip())
print(frase[3:13])
print(frase.count('o'))
lista = frase.split()
print(lista)
| true |
4f82cfc1bc048dad2a78f52c2fe62055f153aae9 | ranjaxt2012/LeetCode | /MyImplimentation/LeftRotation.py | UTF-8 | 491 | 3.4375 | 3 | [] | no_license | def array_left_rotation(array, n):
return_array = []
# Base Case
if n == 0:
return array
else:
for i in range(n, len(array)):
return_array.append(array[i])
for i in range(0, n):
return_array.append(array[i])
return return_array
array = [1, 2, 3, 4, 5... | true |
43257e463b0fe9dbbdd4080a87012151bdafdc60 | sunilktm23/Python-Practice | /csv2.py | UTF-8 | 369 | 2.828125 | 3 | [] | no_license | import csv
with open('Python.csv','w')as f:
fieldnames=['fname','lname','rank']
writer=csv.DictWriter(f,fieldnames=fieldnames)
writer.writeheader()
writer.writerow({'rank':'A','fname':'Parker','lname':'Brian'})
writer.writerow({'rank':'B','fname':'Sunil','lname':'Mahakud'})
writer.writerow({'rank':'C','fname':'Sa... | true |
f355207538180a8ae51a618e0467628120ffd701 | brainhackerbrain/pythonlessons | /5.py | UTF-8 | 503 | 3.828125 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
print("Введите выручку ")
v=int(input())
print("Введите издержки ")
iz=int(input())
if (iz>v):
print ("Фирма работает в убыток")
else:
print ("Фирма рентабельна. Рентабельность - "+str(v-iz))
print("Введите количество сотрудников ")
cso=int(input())
print ("Прибыль фирмы ... | true |
34907c3ad395256224f3407cef5a13a5e3ce66d6 | diepthuyhan/cloudQueryLogAndNotify | /cloudQueryLogAndNotify/baseClass.py | UTF-8 | 404 | 2.703125 | 3 | [] | no_license | from .customExceptions import IgnoreMessage
class BaseFormatMessage:
def validate(self, message):
return True
def ignore_message(self):
raise IgnoreMessage("ignore_message")
def format(self, message):
if self.validate(message):
return self.format_message(messa... | true |
3e2ab602b832d446b4eff872c2bdd0b83e75fb9a | Aria-K-Alethia/Text-Classification-Pytorch | /textcnn.py | UTF-8 | 2,555 | 2.96875 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2018 Aria-K-Alethia@github.com
# Licence: MIT
# textCNN for text classification
# Any use of this code should display all the info above; the user agrees to assume all liability for the use of this code.
import torch
import torch.nn as nn
import torch.nn.functional as F
class textCNN(nn.Module):
''... | true |
65dc019c6d17e5fffef5afa85e1293cb1ba8f972 | t1m0thyZhang/tensorflow | /test_main.py | UTF-8 | 756 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/3/17 16:07
# @Author : timothy
import numpy as np
import pandas as pd
def create_dict():
d= {'k1':'v1','k2':'v2','k3':'v3'}
# print(dct)
for k, v in d.items():
print(k)
print(v)
def test():
string = 'aaa'
print('hello main\n a')
def main... | true |
2391450711246e966209d4cfb809644c8c6156de | chenjienan/python-leetcode | /categories/hash-table/3.longest-substring-without-repeating-characters.py | UTF-8 | 791 | 3.515625 | 4 | [] | no_license | #
# @lc app=leetcode id=3 lang=python3
#
# [3] Longest Substring Without Repeating Characters
#
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
# start: track the position of the longest substring
res, start = 0, -1
# key: char
# value: the right-most index
... | true |
e7c9d03b70f7f1ec92399968ca23a1b96751922f | grewy/practice_py | /merge_sort.py | UTF-8 | 676 | 3.421875 | 3 | [] | no_license |
def merge(arr, l, m,r):
n1 = m - l +1
n2 = r - m
L = [0]*n1
R = [0]*n2
for i in range(n1):
L[i] = arr[l+i]
for j in range(n2):
R[j] = arr[m+1+j]
i, j = 0, 0
#initial index of merged array
k = l
while i < n1 and j < n2:
if L[i] <= R[j]:
arr[k] = L[i]
i += 1
else:
... | true |
58c04752bdbf6b099329f71b82a5ed23f4c344d1 | shifelfs/shifel | /38.py | UTF-8 | 63 | 3 | 3 | [] | no_license | a,b=map(int,input().split())
temp=a
a=b
b=temp
print(a,b)
| true |
47501fbfc8ced59d4360f2f8fbf8ae3b536ef1b6 | VamsikrishnaNallabothu/MITx-My-Python-Work | /ps4/ps4-3.py | UTF-8 | 467 | 3.5 | 4 | [] | no_license | def isValidWord(word, hand, wordList):
"""
Returns True if word is in the wordList and is entirely
composed of letters in the hand. Otherwise, returns False.
Does not mutate hand or wordList.
word: string
hand: dictionary (string -> int)
wordList: list of lowercase strings
"""
le... | true |
ccdce64aa3ef8202d2c9029dd9e501dbe6ece594 | afiebaanne/Digicap | /guess_my_number.py | UTF-8 | 744 | 4.5625 | 5 | [] | no_license | #Student: Antoinette Afieba Cudjoe
#-----------------
import random
#get random number between 10 and 90
random_number = random.randint(10, 90)
#continue taking guesses until player guess matches random_number
while True:
#prompt user for input
print("Guess the number: ")
#read and store user input
... | true |
8f3ace3b7c33dc0862853082f359af9dc98e5231 | AnastasiyaF97/pythonintask | /BIZa/2015/Falina_A_O/task_5_22.py | UTF-8 | 447 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive | # Задача 5. Вариант 22.
# Напишите программу, которая бы при запуске случайным образом отображала имя одного из двух сооснователей компании Google.
# Falina A. O.
# 15.09.2016
import random
WORDS = ("Пейдж", "Брин")
word = random.choice(WORDS)
print (word)
input ("\n\nНажмите enter, чтобы выйти") | true |
4bfc336b082a8578ed3d694a41f3eab31d95e210 | Dirus/Algorithms | /Merge_sort/merge_sort.py | UTF-8 | 1,076 | 3.8125 | 4 | [] | no_license | def main():
A = []
l = int(input("Enter the No. of elements: "))
print("Enter the array elements ")
for i in range(0,l):
A.append(int(input()))
mergeSort(A)
print("Array after sorting: ",A)
# T(n) = O(1) if n=1
# 2T(n/2)+O(n) if n>1 = O(nlgn)
def mergeSort(A):
l = len(... | true |
f78072b1352fde227d281b0df5834e96c8cce55f | haru-11/GPS_MAG. | /gps_serial.py | UTF-8 | 1,686 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import serial
import time
import threading
import pigpio
pi=pigpio.pi()
pi.set_mode(6,pigpio.OUTPUT)
time.sleep(1.0)
s = serial.Serial('/dev/serial0', 115200, timeout=10)
pi.write(6,0)
s.readline()
def get_gps():
global t,lat,lon
try:
while True:
sentence = s.readline().decode('utf-8... | true |
a23e4cd64ce880072c5979bdfacedbc8b18dbe70 | pawanpaudel93/Django-Upload-Download | /upload.py | UTF-8 | 816 | 3.015625 | 3 | [] | no_license | import requests
from pathlib import Path
import json, os, sys
import mimetypes
file_path = input("Enter file path? ")
if os.path.exists(file_path):
try:
file = open(file_path, 'rb')
files = {'file': (file_path, file, mimetypes.guess_type(file_path)[0])}
server = "http://127.0.0.1:8000"
... | true |
7b4e6348491f27e428a86b45159b6d386890feef | duchn92/transfer-object | /modules/models/feature_render.py | UTF-8 | 7,218 | 2.625 | 3 | [
"MIT"
] | permissive | # standard imports
import math
# third party imports
import numpy as np
import torch
import torch.nn as nn
# local imports
from config import DEVICE
class FeatureRender(nn.Module):
def __init__(self, config):
super(FeatureRender, self).__init__()
self.config = config
def forward(self, source_feature, targ... | true |
55ae97343632017751c587813d2f85fb7d0fcc4f | priyankakushi/machine-learning | /021_11_19 oops.py | UTF-8 | 1,557 | 3.0625 | 3 | [
"CC-BY-3.0"
] | permissive | l1 = [10,5,2,3,0.2,1.5,100]
count=0
for i in l1:
count = count+1
print(count)
j = l1[0]
for a in l1:
if j < a:
min = j
else:
min = a
j = min
print(min)
j = l1[0]
for a in l1:
if j > a:
max = j
else:
max = a
j = max
print(max)
import re
pat1 = "\w+@(\... | true |
153661900d31e58774a1ccb973fb46710e841a89 | piszewc/Automation | /WhiteCat/otomoto_master_scraper.py | UTF-8 | 10,526 | 2.703125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from time import sleep
cars_page_number = 1;
max_cars_page_number = 8444;
while cars_page_number < max_cars_page_number:
def get_listing(url):
headers = {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, li... | true |
900b9f0e0d633479b75a8cc430d6ec61e7f3115c | miloucarmen/programmeer_theorie | /mail/helpersSteven_MAIL.py | UTF-8 | 14,182 | 3.09375 | 3 | [] | no_license | import math
import scipy
# we moeten in de presentatie goed onderbouwen dat een strip doorbreken NOOIT goed is, ik twijfel hierover?
class GenomeSequence:
def __init__(self, genome):
self.genome = genome
# execute createBreakpointlist when initializing
self.breakpointList, self.breakpoint... | true |
ebe01a5448b4bf76a28afcf1c42138fb4d26aec0 | kirbuchi/ProductDevelopmentProject | /backend/api/validators.py | UTF-8 | 681 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from api import models
def validate_field_options(options, field_type):
"""
Validate the `field_options` object for a GenericField instance.
"""
if field_type != models.FieldType.ENUM:
# we currently only use extra options for the `enum` field type.
# other fiel... | true |
182c9c9928097d922e607dc1b61077dfa9080625 | Nur-A-Alam1997/BioInformatics-Algo-UCSD | /Genome sequencing/string recons check.py | UTF-8 | 491 | 2.765625 | 3 | [] | no_license | f=open("string recons.txt","r")
string=dict()
c=0
head=""
for lines in f:
if len(lines)>1:
head=(lines.strip())
c+=1
print(head,c)
# print(p)
# stringD={(lines.split())[0]:(lines.split())[1] for lines in f if len(lines)>1}
# print(stringD)
# head = filter(lambda x: x not... | true |
e3911a971499348e3f739bc250c340c0fb335ace | uvic-auvic/opencv | /adaptiveThreshold_contor.py | UTF-8 | 1,929 | 2.96875 | 3 | [] | no_license | import numpy as np
import cv2
from math import pi
cap1 = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture('trim1.MP4')
indicator = 0
## Processing Webcam or Video
text = input("Do you want use webcam(Yes/No) : ")
if( text == "Yes" or text == "yes" or text =='y'):
print("Processing Webcam....\n")
else:
print("Processing... | true |
6139d9df6f323d4688abc177383e5109bd8da97e | robertej19/utils | /test_db.py | UTF-8 | 1,569 | 2.90625 | 3 | [] | no_license | """
Informal tests for the database.py module. These must
be run from the utils/ folder due to the import structure. These should be
formalized into unittest.TestCase tests, but a test database structure
needs to be coded first.
"""
import fs
from database import (get_database_connection,
... | true |
9d5ebc9e6504b5469e746eee5b717918ba85c2cc | un-simp/gir | /cogs/commands/info/tags.py | UTF-8 | 9,870 | 2.546875 | 3 | [
"MIT"
] | permissive | import aiohttp
import traceback
from io import BytesIO
import discord
from data.tag import Tag
import datetime
import cogs.utils.permission_checks as permissions
import cogs.utils.context as context
from discord.ext import commands
from discord.ext import menus
class TagsSource(menus.GroupByPageSource):
async de... | true |
8810e23a711ea5a6ec84c7d67dd31df47c1ecca6 | maayank/cs7641assignment4 | /myfrozenlake.py | UTF-8 | 2,901 | 2.796875 | 3 | [] | no_license | import numpy as np
def make_lake(S=64, p_slip=.1, p_hole=.1, seed=None):
'''
0 - Up
1 - Left
2 - Down
3 - Right
'''
oldS = S
S = int(np.sqrt(S))
assert S * S == oldS
if seed is not None:
np.random.seed(seed)
def get_surrounding_coords(x, y):
res = []
... | true |
692f9cd1dad6fe666264a42a007fe49a57a2223f | PatoBengoechea/frro-soporte-2019-07 | /practico_01/ejercicio-12.py | UTF-8 | 263 | 3.9375 | 4 | [] | no_license | #Determinar la suma de todos los numeros de 1 a n. N es un numero que se ingresa por consola.
def suma_todos():
n = int(input("Introduce un numero: "))
i = 0
aux = 0
for i in range(n+1):
aux = i + aux
return aux
print(suma_todos())
| true |
d01e7596c78ee6b399721b745eba5b403b5abffd | hitalojta/Exercicios_Python_CeV | /Anotacoes_aula/21.3. Funções (parte 2).py | UTF-8 | 416 | 4.15625 | 4 | [
"MIT"
] | permissive | # Variáveis Globais e Locais
def teste(b):
global a # Colocando isso, chama o valor global de 'a'
a = 8 # Nesse caso não mostra a global, pois é local!
b += 4
c = 2
print(f'A variável \"a\" dentro vale {a}.')
print(f'A variável \"b\" dentro vale {b}.')
print(f'A variável \"c\" dentro vale... | true |
550ef963a557b49d5d40434d7ce66e642458cb65 | KcMeterCEC/explore | /trans2blog.py | UTF-8 | 3,153 | 2.578125 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# 将符合格式 xxx.org /xxx.md 文件复制一份出来并移动到博客的 _post 目录中
# 1. 读取 xxx.org 中的 "#+NAME:" 字段,并新建此字段所指定的文件
# 2. 将 xxx.org 中的内容复制一份到新建文件中
# 3. 将文件中的图片文件地址重定向到github中的地址去
import re
import os
import shutil
import filecmp
blog_source = "/home/cec/github/new_blog/blog/source/_posts/";... | true |
90d7fd93e92ff17cee8bd6e79d333c05631e44ff | Neveon/Coronavirus-Tracker | /corona.py | UTF-8 | 4,719 | 3.171875 | 3 | [] | no_license | # os and Path used to get path
import os
from pathlib import Path
# To use terminal command line
import subprocess
# For dealing with date and updating covid.csv
from datetime import datetime
from datetime import timedelta
# For downloading csv fileand writing to file
import requests
requests.packages.urllib3.disable_w... | true |
269dcec5820c8006684f885552f194bdfb14680e | BryanSWong/Python | /ex31/ex31sd2.py | UTF-8 | 1,808 | 4.09375 | 4 | [] | no_license | print "It's the final match of the world fighters tournament."
print "Your opponent is Mark 'King of kick' James."
print "do you '1' strike first or '2' defend and counter?"
action1 = raw_input("Enter action: ")
print
if action1 == "1":
print "Strike first is the way to go! whats your plan of attack?"
print "... | true |
4a0a8766d7ff3ddd7d40794ee18ea6f20e1d557e | mpluess/swiss-parliaments-corpus-paper | /swiss_german_alignment/alignment.py | UTF-8 | 1,930 | 2.609375 | 3 | [
"MIT"
] | permissive | # Assumption in downstream processing: returned alignments are global, i.e. include full transcript and STT strings.
from typing import Set
from Bio import Align
ALPHABET_ASCII = {chr(i) for i in range(128)}
ALPHABET_LATIN_1 = {chr(i) for i in range(256)}
def create_aligner_global(
alphabet: Set[str],
mat... | true |
c45879b6ddc28764a4270fd90f28fec2657a074e | ferrero-zhang/taiwan | /news/importance_sort.py | UTF-8 | 3,885 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#from langconv import *
import os
import csv
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import time
import datetime
import pymongo
from pymongo import MongoClient
import logging
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
conn = MongoClient(host=MONGODB_HOST, port=MONGODB_PORT)
... | true |
bec34f36ee47f5d8ea55d1a3ddcf826c583fcc0e | D1must/Diving-in-Python | /Client_for_metrics.py | UTF-8 | 2,808 | 3.1875 | 3 | [] | no_license | import socket
import time
import bisect
class ClientError(socket.error):
pass
class Client:
def __init__(self, host, port, timeout=None):
self.port = port
self.host = host
try:
self.connection = socket.create_connection(
(host, port), timeout)
exc... | true |
4c289609db22bb54b6a603c451533f99ca2b14cf | KritiKAl7/lintCode | /lcSubseq.py | UTF-8 | 364 | 2.765625 | 3 | [] | no_license | def lcSubseq(A, B):
dp = [[0] * (len(B)+1) for i in range(len(A)+1)]
for i in range(1, len(A) + 1):
for j in range(1, len(B) + 1):
if A[i - 1] == B[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return... | true |
4de4a1993bb0f99dd699cb82c24def21861d66f4 | cuponomia/dojo | /area-histograma-2021-04-09/team2/application.py | UTF-8 | 834 | 3.46875 | 3 | [] | no_license | def get_all_water_volume(array):
volume= 0
last_bar = 0
last_index = 0
last_bar_minor = 0
for i in range(0, len(array)):
val = array[i]
if val > 0 and last_bar == 0:
last_bar = val
last_index = i
elif val >= last_bar and last_bar > 0:
... | true |
dba97492031af4f745299f853753f628e03d0964 | Mitchu727/Allegro-summer-e-Xpereience-2021-recruitment-task | /GithubUserReposInfo.py | UTF-8 | 1,624 | 2.75 | 3 | [] | no_license | import requests
from fastapi import HTTPException
class GithubUserReposInfo():
def __init__(self, login):
self._login = login
self.check_login()
def load_repos(self):
self._repos = []
request = requests.get("https://api.github.com/users/" +
self.... | true |
53297a2236170db098d5c3a4e7bf3cd580a66aed | AntonioCenteno/Miscelanea_004_Python | /35.py | UTF-8 | 595 | 3.0625 | 3 | [] | no_license | #subsequences - subsecuencias de un array
# https://www.hackerrank.com/contests/w28/challenges/lucky-number-eight
lenPrin = int(raw_input())
numPrin = map(int,list(raw_input()))
def printSubsequences():
arr = [1,2,3,4]
n = 4
p = 2 ** lenPrin
s = ''
res = 0
for counter in range(1,p):
f... | true |
cc44bb1471103653da45cfa5814c5a20171e6459 | johnnyjw/oo_python | /assignment2_ec.py | UTF-8 | 769 | 3.09375 | 3 | [] | no_license | import datetime
class LogFormatter(object):
@staticmethod
def process_line(line):
return datetime.datetime.now().strftime('%Y-%m-%d %H:%M') + ' ' + line + '\n'
class CSVFormatter(object):
@staticmethod
def process_line(line):
updated = []
for item in line:
if it... | true |
b36c27dd5f3aa5c022ce660dbe8741d97acdea27 | Azimuth1/slopefinder | /slopefinder.py | UTF-8 | 2,957 | 2.546875 | 3 | [] | no_license | import tempfile
import elevation
import rasterio
from rasterio.enums import Resampling
import numpy as np
import pandas as pd
import geotiffTools as gtt
from osgeo import gdal
import argparse
def find_slope_direction(lat, lon):
lat, lon = float(lat), float(lon)
temp_files = create_temp_files()
data_bounds... | true |
6ec29829787ac3003b9f04275d37c7b1e410508a | EpichubS/chinese_word_segment | /HMM_train.py | UTF-8 | 5,958 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
#-*-coding:utf-8
import sys
import math
import pdb
class WordSegmentTrainer:
def __init__(self):
self._state_transfer_count = {}
self._state_emit_count = {}
self._state_count = {}
self._state_pi_count = {}
self._word_set = set()
self._state_list = ... | true |
14cc0f6315b164fb0fa051fe92394a5122e28b7c | pskrunner14/neural-networks | /nn/model.py | UTF-8 | 5,415 | 2.9375 | 3 | [
"MIT"
] | permissive | import numpy as np
np.random.seed(42)
from .data import iterate_minibatches
from .layers import (
Layer,
Dense
)
from .activations import (
ReLU,
Sigmoid,
Softmax
)
from .optim import (
Optim,
SGD,
RMSprop
)
from .loss import (
Loss,
CategoricalCrossentropy
)
class Model():
... | true |
9643b680b9485725da021e386d890280e8b27d24 | RyeHong/py | /10-8.py | UTF-8 | 162 | 3.734375 | 4 | [] | no_license | from datetime import date
# What day of the week was your day of birth?
birthday = date(1993,6,3)
fmt = "It's %A %B %d, %Y"
prt =birthday.strftime(fmt)
print(prt) | true |
120e274a3740581839bda0f4ba6bb9c32e512b5c | Aasthaengg/IBMdataset | /Python_codes/p03186/s656525084.py | UTF-8 | 86 | 2.9375 | 3 | [] | no_license | a,b,c = map(int,input().split())
if a+b < c-1:
print(b+a+b+1)
else:
print(b+c) | true |
4ed13b2be93147f8b157836d26d8827ba4679e47 | wonderharp/playground | /python/backtrack/anagram.py | UTF-8 | 360 | 3.5625 | 4 | [] | no_license | def anagram(s1, s2):
if len(s1) != len(s2):
return False
c1 = [0] * 26
c2 = [0] * 26
for s in s1:
pos = ord(s) - ord("a")
c1[pos] += 1
for s in s2:
pos = ord(s) - ord("a")
c2[pos] += 1
return c1 == c2
if __name__ == "__main__":
s1 = "abcde"
s... | true |
8409d0e1ff9d633cc0cfe5a88768d130fad0960f | sonsus/LearningPython | /pywork2016/1002pass.py | UTF-8 | 488 | 3.390625 | 3 | [] | no_license | p=['s','u','p','e','r']
str_p=""
for i in range(0,len(p)):
str_p+=p[i]
print(str_p)
print(p)
'''
a=range(1,10)
for i in range(0,9):
if range(0,1):
print(a[i], end=" ")
print("\n")
if range(0,0):
print("it shouldn't be printed")
if range(0,1):
print("one is done well")
i... | true |
a9497b9f4acf2a537ccf57986cfb0d24eb0dc804 | carlosgregoriorodriguez/OpenCV | /analisys/matching/videoMatchTemp.py | UTF-8 | 1,809 | 2.734375 | 3 | [] | no_license | import cv2
import numpy as np
import sys
def dummy(x):
print x
def getSquareLimits(img):
rows = img.shape[0]
cols = img.shape[1]
rowsUp = rows/3
rowsDown = 2*rowsUp
colsLeft = cols/3
colsRight = 2*colsLeft
return (rowsUp,rowsDown,colsLeft,colsRight)
def paintLimits(img,squareLimits):
imgCopy=img.copy()... | true |
0e7568b6767dc0f911b0facaaacc12cc48436a99 | mono0926/AlfredWorkflow | /reminder/pre_reminder.py | UTF-8 | 567 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
import time
from optparse import OptionParser
def output_message():
parser = OptionParser()
parser.add_option("-m", "--message", )
(options, args) = parser.parse_args()
wait_length = args[0]
wait_unit = args[1]
unit_dict = {'s': 'second', 'm': 'minute', 'h': 'hou... | true |
e0b66047e3bfa6ec42485dc084657b490eb90892 | cloud05/StormSurgeCodes | /Scripts/renameTidepoints.py | UTF-8 | 510 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 03 16:14:36 2014
@author: cloud
"""
"""
A code to rename tide files into text files
"""
import os, fnmatch
tidepath = raw_input("Enter tide path: ")
for root, dirnames, filenames in os.walk(tidepath):
for filename in filenames:
if filename not in fnmatch.filt... | true |
00ff7a9b381521cf54e3af2d6412ab63355ca45b | aarti7/Datastructures-Trees-LL-Python | /factorial recursion way.py | UTF-8 | 342 | 3.625 | 4 | [] | no_license | ###factorial recursion way###
# recursion always returns
# end condition is the first thing your need
# good way is to use that first condition in a 'if' loop
# http://www.codeskulptor.org/#user40_nM5B9iTTXA_1.py
def factorial(n):
if n == 1:
return 1
else:
return n*factorial(n-1)
... | true |
826dd0e7748ffc4d6f1c00ca41fc62de94d59eef | csy1993/PythonInterview | /python058_字典删除.py | UTF-8 | 286 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | '''
@Author: CSY
@Date: 2020-02-07 16:48:33
@LastEditors : CSY
@LastEditTime : 2020-02-07 16:49:14
'''
"""
58、使用pop和del删除字典中的"name"字段,dic={"name":"zs","age":18}
"""
dict01={"name":"zs","age":18}
dict01.pop("name")
print(dict01)
del dict01['age']
print(dict01) | true |
3f36c2f1a2656bf8cef9d56d2cf8cadc468ecd6b | renekabagamba/Cut-the-rope | /src/main/gameClasses.py | UTF-8 | 3,639 | 3.28125 | 3 | [] | no_license | # gameClasses.py
# Cut the Rope: Final project
# Rene Kabagamba + rkabagam + RW
import pygame
import math
from gameUtils import loadImage
black = (0,0,0)
white = (255,255,255)
class Frog(pygame.sprite.Sprite):
nomOm = loadImage('omNom.png')
def __init__(self, x, y):
super().__init__()
self.... | true |
e8d93047e6e9e7b7521e0470606a4f53eaf17013 | zforre/6.2-python-hangman | /hangman.py | UTF-8 | 1,136 | 4.34375 | 4 | [] | no_license | # a hangman game that allows the user to guess letters in the randomly selected word
import random
word_list = ['orange','intelligent', 'morning', 'haunt', 'detailed',
'rude', 'right', 'curious', 'pause', 'carry', 'code', 'python']
random.shuffle(word_list)
answer = list(word_list[0])
display = []
used = []
displa... | true |
12c8fc1f7ade16c74fb2509625e4ff7266171994 | zetonenine/random_chat_sqlite | /sqlighter.py | UTF-8 | 3,869 | 2.671875 | 3 | [] | no_license | import sqlite3
class SQLighter:
def __init__(self, tables):
self.connection = sqlite3.connect(tables)
self.cursor = self.connection.cursor()
def add_user(self, chatID, status=False):
"""Добавляем нового юзера в бд (неуверен)"""
with self.connection:
return self.c... | true |
95b3831e17173640aab8a502ff0fde6e7066afe4 | EstevaoNaval/URI_repository | /solutions/tier_02/python/uri_1383_sudoku.py | UTF-8 | 1,983 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
qntInstancias = int(input())
for instancia in range(qntInstancias):
matriz9x9Sudoku = [[0] * 9 for linha in range(9)]
EhSolucaoProblemaSoduko = "SIM"
for linha in range(9): matriz9x9Sudoku[linha] = list(map(int, input().split()))
# Analisa se as linhas da matriz estão numerado... | true |
e9b0ae0f6f10976549c1040b0e38c611f8d7b7f6 | ItsFa-tih/qualifier | /Utilities/calculators.py | UTF-8 | 436 | 3.265625 | 3 | [] | no_license |
'''
This function calculates monnthly debt to income ratio
'''
def calculate_monthly_debt_ratio(monthly_debt_payment, monthly_income):
monthly_debt_ratio = int(monthly_debt_payment) / int(monthly_income)
return monthly_debt_ratio
'''
This function calculates loan to value ratio
'''
def calculate_loan_to_v... | true |
b849f3e239174b28049f6d52ff9721ed13f8d860 | wenima/statistics | /codewars/Python/src/test_five_fig_summary.py | UTF-8 | 553 | 3.53125 | 4 | [
"MIT"
] | permissive | """Tests for https://www.codewars.com/kata/intro-to-statistics-part-1-a-five-figure-summary/python."""
import pytest
@pytest.fixture
def fiv_fig_summary_class():
"""Return a new instance of StatisticalSummary class."""
from five_figure_summary import StatisticalSummary
new_summary = StatisticalSummary(ran... | true |
dea97c5c8a7af4a6c1c3fb257a2da26d61f127ba | abhiInCalif/sentiment-analysis-socher | /code/network/RNN2.py | UTF-8 | 20,067 | 2.921875 | 3 | [] | no_license | """
This file is a network trial for a Recursive NN using word2vec as an absolute word vector generator
No learning is done on the word vectors. Gradients are used to learn the softmax weight matrix and the
NN weight matrix.
"""
import math
import pickle
import os
import numpy as np
import scipy.optimize
import scipy.... | true |
ca5d19f7d4204341c4604b91e62bd1402038f125 | Kumarved123/Basic-Data-Structure-Algorithm | /Interview_questions/tower of Hanoi.py | UTF-8 | 331 | 3.0625 | 3 | [] | no_license | def hanoi(n, from_rod, to_rod, aux_rod):
if n == 1:
print("Move disk 1 from rod", from_rod, "to rod", to_rod)
return
hanoi(n - 1, from_rod, aux_rod, to_rod)
print("Move disk", n, "from rod", from_rod, "to rod", to_rod)
hanoi(n - 1, aux_rod, to_rod, from_rod)
A= 'A'
B = 'B'
C = 'C'
hanoi(... | true |
901c5bca1e8375f35ab2ccde233bbf54a6210cc0 | codernirdesh/kathmandu-university-cs-notes | /Year III/COMP 314/3. HuffmanCoding/index.py | UTF-8 | 3,624 | 4.0625 | 4 | [] | no_license | '''
Date : Dec 24, 2018
Duration : ~1 hr
'''
class TreeNode:
def __init__(self, value, frequency):
self.left = None
self.right = None
self.value = value
self.frequency = frequency
def getFrequencyFromText(txt):
'''
Returns a dictionary
key = character
value = frequency
'''
frequency... | true |
60ed10ae93c5f01c1b820955398dba3506c4b531 | Davidhfw/python | /property/demo3.py | UTF-8 | 635 | 3.9375 | 4 | [] | no_license | class Money:
def __init__(self):
self.__money = 0
# 使用装饰器对money进行装饰,那么会自动会添加一个叫money的属性,当调用获取money的值时,调用装饰的方法
@property
def money(self):
return self.__money
# 使用装饰器对money进行装饰,当对money设置值时,调用装饰的方法
@money.setter
def money(self, value):
if isinstance(value, ... | true |
e630a9e60d935357d55483cf57893e7048c6f985 | jorisdemiraj/word-sense-disambiguation-system | /code/predict_multilingual.py | UTF-8 | 1,202 | 3.125 | 3 | [] | no_license |
def predict_multilingual(input_path : str, output_path : str, resources_path : str, lang : str) -> None:
"""
DO NOT MODIFY THE SIGNATURE!
This is the skeleton of the prediction function.
The predict function will build your model, load the weights from the checkpoint and write a new file (output_path)... | true |
6f25e5a2e292a87ad26482a77b345f66a16c5757 | alexlaplap/Pycharm-Exercises | /Exercise 11-Lists (Matrix)/main.py | UTF-8 | 178 | 3.265625 | 3 | [] | no_license | index = [
[1,2,3],
[4,8,12],
[13,26,39]
]
index[1][1] = 100
print(index[2][2])
print(index[0][0])
print(index[1][1])
for x in index:
for y in x:
print(y) | true |
612c230d86897e379fcd385fd4ed1174870d07a1 | Jiyun297/HUHS-python | /퀴즈_#1.py | UTF-8 | 244 | 2.546875 | 3 | [] | no_license | station='사당'
print(station + '행 열차가 들어오고 있습니다.')
station='신도림'
print(station + '행 열차가 들어오고 있습니다.')
station='인천공항'
print(station + '행 열차가 들어오고 있습니다.') | true |
3983ad2779daaaccaec012d1987c7edc4c7290c3 | pccode21/PythonLearn | /src/pentagram1.py | UTF-8 | 634 | 3.71875 | 4 | [] | no_license | import turtle
def draw_pentagram(size):
count=1
while count<=5:
turtle.forward(size) #从落笔点向前(也就是默认向右)走
turtle.right(144) #顺时针旋转144度
count+=1
def main():
turtle.tracer(False) #不显示画图轨迹
turtle.begin_fill()
turtle.penup() #先提笔
turtle.back(100) #在... | true |
192073e6e6a93f0c35406a883169fd0610204d80 | namjals/mask_rcnn_with_deepfashion | /bin/3.via_to_coco_format.py | UTF-8 | 4,202 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import os
import shutil
import json
import sys
import skimage
from skimage import io
def copytree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
... | true |
f59ca0b56a2e6907a52f5f7a21b97ce73a32df38 | ishioai/lambda-function | /ec2_stop.py | UTF-8 | 4,225 | 2.984375 | 3 | [] | no_license | """
Created by Takahiro Kajino
Creation Date: May 15, 2018
Changed Date: Febrary 22, 2019
Lambda function that would be triggered from CloudWatch Events.
This function is for stopping the EC2 which sorts files to depending on the enviornment and its purpose is for
cost efficient reasoning.
Change Detail: Change pytho... | true |
b1ecdc7e18a0f626db54358d932d48545b0b5838 | calyri/error_bot | /error_bot.py | UTF-8 | 2,148 | 2.953125 | 3 | [] | no_license | import random
from reconchess import *
import numpy as np
import time
class ErrorBot(Player):
def __init__(self):
self._error_probability = np.random.uniform(low=0.0, high=.005)
print("Error Probability: {0}".format(self._error_probability))
def __possibly_error_out(self):
if np.random... | true |
2288b000fdecc16fc750f23acc1b43a06876a591 | cheeseywhiz/cheeseywhiz | /math/complex/complex.py | UTF-8 | 1,573 | 2.890625 | 3 | [
"MIT"
] | permissive | import cmath
import numpy as np
# from matplotlib import pyplot as plt
import tint
def func(c):
return cmath.sqrt(c - 1)
def white_blank(shape):
array = np.empty(shape, np.uint8)
for i, row in enumerate(array):
for j, pixel in enumerate(row):
array[i, j] = 255
return array
cl... | true |
51b5d3602bf6aae3f076fc9b35b41fe273a35794 | misizeji/python_study_notes | /mutable.py | UTF-8 | 90 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
def ChangeInt(a):
a = 10
b = 2
ChangeInt(b)
print(b) # 结果是2 | true |
ba6303819949cf126da4b66a4212859bfc707e49 | wangbin2188/pat-basic | /python/1036.py | UTF-8 | 288 | 3.296875 | 3 | [] | no_license | def print_square(num,symbol):
col=num/2
for i in range(col):
if i==0 or i==col-1:
print '%s'%(symbol*num)
else:
print '%s%s%s'%(symbol,' '*(num-2),symbol)
if __name__=='__main__':
list=raw_input().split(' ')
digital,symbol=list[0],list[1]
print_square(int(digital),symbol) | true |
766553fb9a241a27350c3c8dab86c3d70bb44c20 | redien/reuse-lang | /parser/specification/function-application.spec | UTF-8 | 231 | 2.9375 | 3 | [
"CC0-1.0"
] | permissive |
Should parse minimal function application
> (def _ () (+))
= (def _ () (+))
Should parse single argument functions
> (def _ () (+ 1))
= (def _ () (+ 1))
Should parse n-ary functions
> (def _ () (+ 1 2 3))
= (def _ () (+ 1 2 3))
| true |
5928433db513553261d7afc2fe7bf587d0e0613b | shijiahu/Python-Program-3 | /Solution1.py | UTF-8 | 464 | 4.4375 | 4 | [] | no_license | # 1.
# Write a program which will find all such numbers which are
# divisible by 7 but are not a multiple of 5, between 2000 and 3200 (both included).
# The numbers obtained should be printed in a comma-separated sequence on a single line.
# Hints:
# Consider use range(#begin, #end) method
def findNum():
mylist = []... | true |
5cb0658862c234376c4fc38579a6be756eb43fb1 | pdbure15/python-practice | /python-practice/sort_list_occurence.py | UTF-8 | 355 | 3.640625 | 4 | [] | no_license | # Sort the list based on the number of occurences of elements
from collections import Counter
num = [3,4,1,6,6,2,5,2,7,-1, -1, -2]
num2 = dict(Counter(sorted(num)))
num3 = dict(sorted(num2.items(), key = lambda x:x[1]))
num4 = []
# print('\nNUM2 - {}\nNUM3 - {}'.format(num2, num3))
for k,v in num3.items():
num4.ex... | true |
76fbdacdf549351345fa908d8a13dbdc6b4429c6 | buithai911/Self-driving-car | /test_irsensor.py | UTF-8 | 416 | 2.96875 | 3 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.IN)
GPIO.setup(11,GPIO.IN)
GPIO.setup(13,GPIO.IN)
GPIO.setup(15,GPIO.IN)
GPIO.setup(19,GPIO.IN)
# 1 -> 5 trai qua phai
while True:
if GPIO.input(7):
print "1"
if GPIO.input(11):
print "2"
if GPIO.input(13):
... | true |
0d2120f467808e7dffee0353d4c39aad11da3649 | luigisayson/be-skillz | /reddit_noun_translator/decorators.py | UTF-8 | 1,038 | 2.796875 | 3 | [] | no_license | import time
from functools import wraps
import logging
# create logger
logger = logging.getLogger('RedditNounTranslator')
logger.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# create file handler which logs... | true |
d949beb3b72586f105c29536704bdf11265cba4e | dev-viche/machine-learning | /ml-python/Cluster_KM.py | UTF-8 | 1,912 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 12 17:52:45 2017
@author: viche
"""
# Import the libararies
import numpy as np #math tools
import matplotlib.pyplot as plt #plat charts
import pandas as pd #import/manage datasets
# Adjustable parameters
P_data_source_csv = 'Mall_customers.csv'
P... | true |
f628d99a5ef0cafdc68008d7c6b6b30a2c40b690 | uutzinger/camera_calibration | /test_calibrate_numba.py | UTF-8 | 1,923 | 2.65625 | 3 | [] | no_license | import numpy as np
from numba import vectorize, uint16, uint8, jit
import time
#@vectorize(['uint16(uint8, uint16, uint8)'], target='cpu')
@vectorize([uint16(uint8, uint16, uint8)], target='cuda')
#@jit(uint16(uint8, uint16, uint8))
def calibrate(data_cube, flatfield, bg):
return (data_cube - bg) * flatfield
# Si... | true |
c52744a19d2b874890a6a764cd27c7865a4c367f | Asphaltt/jq.py | /jq.py | UTF-8 | 1,734 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
import sys
import select
import json
def reverse(d):
try:
m = json.loads(d)
print(json.dumps(m))
except:
try:
with open(d) as f:
m = json.load(f)
print(json.dumps(m))
except:
sys.ex... | true |
d7721c1ca63b76fcff40e8d4e30766714d551200 | l31rb4g/box | /box/watcher.py | UTF-8 | 562 | 2.75 | 3 | [] | no_license | import time
from watchdog.observers import Observer
from event_handler import EventHandler
class Watcher:
def __init__(self, path, box):
self.path = path
self.box = box
self.observer = Observer()
self.observer.schedule(EventHandler(self.box), path=self.path, recursive=True)
... | true |
003e4d9424f59df62169608a0814728742c57017 | shahidul2k9/problem-solution | /leetcode/545. Boundary of Binary Tree.py | UTF-8 | 1,079 | 3.3125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from typing import List
class Solution:
def boundaryOfBinaryTree(self, root: Optional[TreeNode]) -> List[int]:
def... | true |
b03c79da017de7c5b89a36a8e9c64c5581db02da | q1park/homegrown | /mlp.py | UTF-8 | 5,544 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
## Identity function
def identity(X):
return X
## Activation functions
def sigmoid(X):
return 1 / (1 + np.exp(-np.array(X)))
def relu(X):
return np.piecewise((X),[X<0.0, X>=0.0], [lambda x: 0.001, lambda x: x])
def leakyrelu(X):
return np.piecewise((X),[X<0.0, ... | true |
5d3867f35e308d515f2018464a525447722d4255 | hmaerki/flask_livelog | /examples_pytest/test_long_running.py | UTF-8 | 176 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import time
import pytest
@pytest.mark.parametrize("counter", range(30))
def test_sleep(counter):
# print(f'Hallo {counter}')
time.sleep(0.5)
assert counter != 3
| true |
78a4ecc990bf99952a4d69e32b39c89a500185c3 | mkkycia/LOGIA_stage3_year14 | /roboty.py | UTF-8 | 848 | 2.859375 | 3 | [] | no_license | def spotkanie(robot1, robot2):
a = max(len(robot1),len(robot2))
robot1 += (a - len(robot1)) * '0'
robot2 += (a - len(robot2)) * '0'
x1 = 0
y1 = 0
x2 = 0
y2 = 0
for i in range(max(len(robot1), len(robot2))):
if i == 100:
break
if robot1[i] == 'g':
y... | true |
43d7c667912e4cca0e993c5aad8a5d857b19aa59 | nathanielatom/clockwork | /tests/test_angle_calc.py | UTF-8 | 955 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
import numpy as np
from clockwork.angle_calc import AngleCalc
@pytest.fixture
def calc():
return AngleCalc()
def test_boundTo180(calc):
"""
See more extensive tests in test_clockwork.test_principal_angle.
"""
assert np.allclose(calc.boundTo180(360), 0)
assert np.allclose(calc.... | true |
babe8af0bd393ec4020da5d25f206e2855775ed6 | mick-warehime/pygame_mvc | /src/main.py | UTF-8 | 780 | 2.65625 | 3 | [] | no_license | from game import Game
import logging
import os
from constants import constants
def clear_log(log_file: str) -> None:
f = open(log_file, 'r+')
f.truncate(0)
def initialize_logging() -> None:
log_file = 'src/logging/game.log'
clear_log(log_file)
fmt = "%(asctime)s {} [%(levelname)s] %(message)s"... | true |
3af46e88ed6c748ca912858ca9894b1575e2a4a8 | burnmg/LC_algorithms_practice | /Linked List/82. Remove Duplicates from Sorted List II.py | UTF-8 | 932 | 3.109375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head: return None
... | true |