blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
7c04503054c59114a95205a3834ffe85c8f29b5c | Python | lyyiangang/python_test | /rigid-transform-with-scale.py | UTF-8 | 1,822 | 3.203125 | 3 | [] | no_license | import numpy as np
import numpy.linalg
# Relevant links:
# - http://stackoverflow.com/a/32244818/263061 (solution with scale)
# - "Least-Squares Rigid Motion Using SVD" (no scale but easy proofs and explains how weights could be added)
# Rigidly (+scale) aligns two point clouds with know point-to-point correspon... | true |
ec3afb781ba15d09558bb2a9001c4b88e112c277 | Python | alenFMF/edge-transitive | /misc/format.py | UTF-8 | 2,522 | 2.515625 | 3 | [] | no_license | def initialType(s):
if s in {"1", "2", "2ex", "3", "4", "5"}: return s
else: return s[:-1]
def convertType(s):
if s in {"1", "2", "2ex", "3", "4", "5"}: return s
if s in {"2D", "2exD", "4D", "5D"}: return s[:-1] + "$^*$"
if s in {"2P", "2exP", "4P", "5P"}: return s[:-1] + "$^P$"
return ... | true |
df58c07852240c63d6860a0e5c3a964331b32c5f | Python | hbyyy/TIL | /study/python_100quiz/quiz3.py | UTF-8 | 42 | 2.71875 | 3 | [
"MIT"
] | permissive | l = [100, 200, 300]
print(type(l))
# list | true |
0f135045077a75820ba552f396ba78d2ad2a877c | Python | 0x464e/comp-cs-100 | /7/sanakirja_a.py | UTF-8 | 1,857 | 3.890625 | 4 | [] | no_license | """
COMP.CS.100 sanakirja_a.
Tekijä: Otto
Opiskelijanumero:
"""
def main():
english_spanish = {"hey": "hola", "thanks": "gracias", "home": "casa"}
while True:
command = input("[W]ord/[A]dd/[R]emove/[P]rint/[T]ranslate/[Q]uit: ")
if command == "W":
word = input("Enter the word t... | true |
eb46ef2ea503ec4ee74828fe1b9cf93f0cb64931 | Python | RafaelHuang87/Leet-Code-Practice | /567.py | UTF-8 | 684 | 3.140625 | 3 | [
"MIT"
] | permissive | class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
l1, l2 = len(s1), len(s2)
if s1 == s2:
return True
if l2 < l1:
return False
s = "abcdefghijklmnopqrstuvwxyz"
dict1 = {}
dict2 = {}
for i in range(len(s)):
... | true |
b661d95ce1409c0d40829a3a35efaf5e378ff4ce | Python | honheil/LPTHW | /EX45/junction.py | UTF-8 | 1,253 | 3.515625 | 4 | [] | no_license | from random import randint
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enter()."
exit(1)
class Junction(Scene):
def __init__(self):
super(Junction, self).__init__()
self.Junction = Junction
def enter(self):
... | true |
e0c791737b3769bce1b7105c04090111d62f919f | Python | lldaniel23ll/python | /Prueba10.py | UTF-8 | 792 | 4.3125 | 4 | [] | no_license | '''hacer un programa que simule un cajero con un saldo inicial de 1000
y tendra el siguiente menu de opciones
1-ingresar dinero a la cuenta
2-retirar dinero de la cuenta
3- mostrar dinero disponible
4-salir'''
saldo=1000
usuario=float(input("Digite 1 para ingresar dinero a la cuenta\n 2 para retirar dinero de la cuent... | true |
482c9058bce569dbaf15e89c4c03ab47717e0c9d | Python | austinawolf/BLE-Spinal-Motion | /python/libraries/file.py | UTF-8 | 831 | 2.71875 | 3 | [] | no_license |
#standard libraries
import sys
import time
#pip libraries
#sds python libraries
sys.path.append('..\libraries')
from logger import _print, APP, ERROR, WARNING, DEBUG
HEADER = "Session Data:\n"
class File:
def __init__(self,filename):
_print("Creating File: " + str(filename), DEBUG)
se... | true |
d5f7593d1d5476a94d43d941ad4a1bf987bebe7a | Python | fernandosalas1987/cursopython2021 | /UNIDAD123/ejercicio9.py | UTF-8 | 712 | 4.34375 | 4 | [] | no_license | """EJERCICIO 9.- Escribe un programa que pida un número entero
entre uno y doce e imprima el número de días que tiene el mes correspondiente."""
numero_mes=int(input("Ingrese un número entero entre uno y doce : "))
if numero_mes>0 and numero_mes<13:
if numero_mes==1 or numero_mes==12 or numero_mes==7 or numero_me... | true |
d5bc8061c36d41f41259be127acb65571faf8d11 | Python | MarshallMicuit/pendu | /pendu/fonctions.py | UTF-8 | 2,718 | 3.359375 | 3 | [] | no_license | import donnees
import json
from random import randrange
#Contient toutes les fonctions du programme
#On veut vérifier si le nom d'utilisateur existe déjà et mettre ses scores à jour, sinon on le créée dans le fichier score
def verifier_utilisateur(nom_utilisateur):
# On ouvre le fichier et on importe son co... | true |
eea6cacf4326f2509b38808a6b71fa008725813d | Python | murugesan-narayan/hr_python | /hr_python/numpy/easy/MeanVarStd.py | UTF-8 | 272 | 2.84375 | 3 | [] | no_license | import numpy
if __name__ == '__main__':
a = []
for i in range(int(input().split()[0])):
a.append(input().split())
a = numpy.array(a, numpy.int)
print(numpy.mean(a, axis=1))
print(numpy.var(a, axis=0))
print(numpy.around(numpy.std(a), 12))
| true |
0cf1320cdea5af108f5b785ea5cf60ada83ef0a2 | Python | clarkbains/simple-scripts | /epoch | UTF-8 | 156 | 2.71875 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
import sys,time
if sys.argv:
local_time = time.localtime(int(sys.argv[1]))
print(time.strftime('%m/%d/%Y %H:%M:%S %Z',local_time))
| true |
68f989938939c9c51b8893dc06d6daaec3763521 | Python | flybywind/job_review | /minJumpstoEnd.py | UTF-8 | 2,770 | 3.1875 | 3 | [] | no_license | #User function Template for python3
import sys
import heapq
class AttempAction:
cur: int
steps: int
def __init__(self, p, step=0) -> None:
self.cur = p
self.steps = step
def __lt__(self, other) -> bool:
if self.steps == other.steps:
return self.cur > other.cu... | true |
81934325f54be45ca50a2ae250da2efd011495e5 | Python | nimiw0821/Fairness-AutoML-OpenSource | /src/common/utils.py | UTF-8 | 10,348 | 3.046875 | 3 | [
"MIT"
] | permissive | from collections import OrderedDict
from aif360.datasets import StandardDataset
from aif360.metrics import ClassificationMetric
import autosklearn.classification
import numpy as np
import warnings
warnings.filterwarnings("ignore")
def generate_formatted_dataframe(df, label_name, favorable_classes,
... | true |
4bf1ddcb7048269d160741f88516af38da57b887 | Python | RiddhiDumre/Zack_AI_Virtual_Assistant | /.vscode/speachrec.py | UTF-8 | 897 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | import pyttsx3
from pygame import mixer
import speech_recognition as sr
mixer.init()
mixer.music.set_volume(0.13)
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.setProperty('rate', 190)
def speak(audio):
engine.say(audio)
engine.runAndWait... | true |
a7ad31a36963a3b3bb5104053a684fcd4c10ba36 | Python | jbheard/GeneticAlgorithms | /sga.py | UTF-8 | 4,901 | 3.53125 | 4 | [] | no_license | import random
from copy import deepcopy
TOURN_MAX = 3
# Get a True value with certain probability, otherwise False
# 0 <= probability <= 1
def flip(probability):
return random.random() < probability
def mutate(gene, pmutate, flip_bit):
updated = False
if flip(pmutate):
flip_bit(gene.chrom)
# Update chromosome... | true |
1f25c7ce28479c0db1b0940774fb7a59f656fc4e | Python | PlamenaTodorova/EpidemiologyModel | /spreadingDisease.py | UTF-8 | 2,232 | 2.90625 | 3 | [] | no_license | import random
from socialGraph import generateGraph
class Human:
def __init__(self, id):
self.id = id
self.status = 0
self.friends = [];
def setAsImmuned(self):
self.status = 3
def getInfected(self):
if self.status == 0:
self.status = 1
def getRemoved(self):
self.status = 2
... | true |
512d611e67ee57120f028b61ddb66c543ae2165f | Python | cloebuster/comp110-21f-workspace | /exercises/ex01/relational_operators.py | UTF-8 | 506 | 4.03125 | 4 | [] | no_license | """This is the relational operators program. """
__author__ = "730239378"
string_1: str = input("Left-hand side: ")
string_2: str = input("Right-hand side: ")
integer_3 = int(string_1)
integer_4 = int(string_2)
print(string_1 + " < " + string_2 + " is " + str(integer_3<integer_4))
print(string_1 + " >= " + string_... | true |
1dad59db23562e879bfcb7ec0d8e3600b5cb28b5 | Python | Helabrak/Hangman | /Hangman/utils/game.py | UTF-8 | 1,512 | 3.96875 | 4 | [] | no_license | import random
class Hangman:
def __init__(self, word):
self.word = word
self.possible_words = ['becode', 'learning', 'mathematics', 'sessions', 'just', 'trust', 'pedagogy']
self.word_to_find = []
self.lives = 5
self.correctly_guessed_letters=[]
self.wrongly_... | true |
0398623c4f49cfd05b63b2d48a520e154bc0d8b9 | Python | mbdemoraes/simulation-cep | /charts/discards_cases.py | UTF-8 | 1,008 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from math import log10
x = np.arange(1250, 11250, 1250)
yCase1 = [136253, 135038, 135030, 135081, 131299, 135060, 131312, 130091]
yCase2 = [1124950, 1200026, 1046295, 1045063, 1275086, 1042595, 665040, 1350065]
yCase3 = [10658698, 8510122, 12652660, 10655213, 1096283... | true |
18b148e0e87cfe318564f967553247ffdcd60903 | Python | andgomes95/HTTP-GET | /browser.py | UTF-8 | 2,147 | 2.5625 | 3 | [
"Beerware"
] | permissive | import socket
import sys
if len(sys.argv) == 3:
HOST = sys.argv[1]
PORT = int(sys.argv[2])
elif len(sys.argv) == 2:
HOST = sys.argv[1]
PORT = 80
else:
print "Faltam argumentos"
sys.exit()
def connect(HOST,PORT):
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = HOST.replace... | true |
55fcab518eccd0b4a49677e18ebaf6eb71c98b17 | Python | lperret42/DSLR | /src/logistic_regressor.py | UTF-8 | 1,015 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import time
import csv
from src.math import logistic_function, logistic_cost, partial_derivative_n
class LogisticRegressor(object):
def __init__(self, X, Y):
self.X = X
self.Y = Y
self.ndims = len(X[0])
self.theta = [0 for _ in range(self.ndims)]
... | true |
55a56c537fc1380bade5a360b31e21d8e18df276 | Python | ThomasJagielski/mp4 | /mario.py | UTF-8 | 4,013 | 3.546875 | 4 | [] | no_license | from character import Character
import pygame as pg
class Mario(Character):
def __init__(self, x=0, y=0, vx=0, vy=0):
""" Iniaitialize mario with a position (x and y) and a change in position (vx and vy)"""
# initialize the x and y positon of mario
self.x = x
self.y = y
# in... | true |
47a984410c96fe6762635840c9bb02ea8bd27d97 | Python | JunhongXu/WGAN-TF | /src/wgan.py | UTF-8 | 14,592 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.contrib import layers as layers
from src.utilities import *
import numpy as np
from scipy.misc import imsave
# TODO: Finish MLP
class GAN(object):
def __init__(self, sess, name, batch_size=128, image_size=(32, 32, 3), z_dim=100, g_size=64, d_size=64,
optimi... | true |
7a6b2ad8c18c46e46815c6ac5874c4a537c3612c | Python | azheng2010/HSJ | /myaes.py | UTF-8 | 2,780 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
class MYAES():
def __init__(self,key=None,iv=None,mode='CBC'):
if key is None:
self.key="hi_O/*GK{o)bAL4V"
else:
self.key=self.keep_key(key)
print(se... | true |
ea91c10bf828138f5a6f642eb1033cb25e462bc0 | Python | mrjakobdk/fraud_detector | /src/sentences.py | UTF-8 | 325 | 2.59375 | 3 | [] | no_license | from utils import data_util, tree_util, helper
_data_util = data_util.DataUtil()
data = _data_util.get_data()
roots_size = [tree_util.size_of_tree(root) for root in data.train_trees]
roots = helper.sort_by(data.train_trees, roots_size)
for root in roots[-5:]:
print(root.label)
print(root.to_sentence())
pr... | true |
a9fc5323235292dc9a6f965f3c0c1626c349823f | Python | dab0ss1/TensorFlow-Python-Projects | /Testing/Testing TF1.py | UTF-8 | 2,211 | 3.171875 | 3 | [] | no_license | # dependencies
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import tensorflow as tf
# locations
IMPORT_PATH = '../../ShrunkData/AUD_CAD_H1.csv'
# main
def main():
''' Load in data '''
global IMPORT_P... | true |
e139b9c97e4f92583b7780a0cf8e41448c0ac5d4 | Python | 300-iq/Edith-Virtual-Assistant | /Engine.py | UTF-8 | 779 | 2.921875 | 3 | [] | no_license | # Utility Program to call Actual Assistant
import speech_recognition
import gtts
import os
import time
# Write your own Wake word
wake_word = "jarvis"
def main():
os.chdir("Assistant")
recogniser = speech_recognition.Recognizer()
while True:
time.sleep(0.2)
flag = True
try:
... | true |
e5bd02b9cfdf97562bb86189fd0058e153689cae | Python | PotatoTaco/Programming-Crappy-Solutions | /Frameworks Testing/Raspberry Pi/Servo.py | UTF-8 | 846 | 3.390625 | 3 | [] | no_license | #Not really Working
import time
import RPi.GPIO as gpio
gpio.setmode(gpio.BCM)
pin = 27 #Whatever gpio pin servo is attached to
gpio.setup(pin, gpio.OUT)
Servo = gpio.PWM(pin, 50) #Frequency must be 50Hz
#DutyCycle = PulseWidth/Period = PulseWidth*Freq
#DutyCycle = ((x)milliseconds*1second/1000milliseconds*50times/se... | true |
a658db1ce8ba14d2a0de1da9550da07c8a483f44 | Python | pianoboy8705/numerical_computing | /Source/chebyshev.py | UTF-8 | 3,274 | 3.234375 | 3 | [] | no_license | import scipy as sp
import math
from timer import timer
@profile
def chebyshev2(values, degree=1):
"""Calculate the Chebyshev Polynomials using previous results"""
values = sp.asarray(values)
A = sp.zeros((degree, len(values)))
A[0,:]=1
try:
A[1,:]=values
except IndexError:
... | true |
4fdf210d83687f15c902ee8e237b911cf944b17a | Python | zzwang11/pytest | /cc.py | UTF-8 | 1,473 | 2.71875 | 3 | [] | no_license | import sys
import os
import time
# class Solution:
# def hasGroupsSizeX(self, deck):
# deck.sort()
# n = len(deck)
# a = []
# for i in deck:
# c = deck.count(i)
# a.append(c)
# b = min(a)
# # print(b)
# print(a)
# if b<2:
# ... | true |
d550d910b23fbc3ee26218efdfabc4c444dcbf77 | Python | LKaMe/Machine_Learning | /code/python深度学习/第6章/使用散列技巧的单词级的one-hot编码.py | UTF-8 | 593 | 3.328125 | 3 | [] | no_license | import numpy as np
samples = ['The cat sat on the mat.','The dog ate my homework.']
dimensionality = 1000 #将单词保存为长度为1000的向量。如果单词数量接近1000个(或更多),那么会遇到很多散列冲突,这会降低这种编码方法的准确性
max_length = 10
results = np.zeros((len(samples),max_length,dimensionality))
for i,sample in enumerate(samples):
for j,word in list(enumerate(sam... | true |
f7c0c17c179606e3efd78ab2838ed59b6d638650 | Python | dwhisler/autonomous_four_way_stop | /main.py | UTF-8 | 5,377 | 2.828125 | 3 | [] | no_license | from agent import *
from mdp import *
from util import *
import numpy
import os
import matplotlib.pyplot as plt
import argparse
################################################################################
# Arguments
################################################################################
parser = argpars... | true |
ad104a1b6ec306316feb1d435445a2e64b627961 | Python | szhu3210/LeetCode_Solutions | /LC/50.py | UTF-8 | 745 | 3.296875 | 3 | [
"MIT"
] | permissive | class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
# one-liner
# return x**n
# binary search
# deal with n<0
# if n<0:
# x=1/x
# n=-n
# retu... | true |
bdc848ac4b24449ecb1f2b4ac4bcd466cc3497ab | Python | Ramzy993/python-mocking | /calculator/test_calculator.py | UTF-8 | 255 | 2.578125 | 3 | [] | no_license | from unittest import TestCase
from unittest.mock import patch
from claculator import Calculator
class TestCalculator(TestCase):
@patch('claculator.Calculator.sum', return_value=8)
def test_sum(self, sum):
self.assertEqual(sum(3, 5), 8)
| true |
6306b4f77803106d12fb403e32ffba1b286fd9c7 | Python | TinaYTZ/TwitterAnalysis | /afinn.py | UTF-8 | 1,117 | 2.78125 | 3 | [] | no_license | import os
import sys
import json
## Please run data_processing.py firist
## Assume this file , With_hashtags.json and AFINN-111.txt in the same folder
#open afinn111 txt
afinn = dict(map(lambda (k,v): (k,int(v)), [ line.split('\t') for line in open("AFINN-111.txt") ]))
rate=0
hashtags=[]
pos=0
neg=0
with open ("With... | true |
9b1b2f3c397f35cb5e002d5bf128f9c486d33fda | Python | mt-caret/reversi | /ai.py | UTF-8 | 1,318 | 2.859375 | 3 | [] | no_license | from multiprocessing import Pool
import game as g
import random
def playout(state, player, coord):
(cx, cy) = coord
state = state.update(cx, cy)
while True:
if state.no_valid_moves():
state = state.skip_turn()
if state.no_valid_moves():
break
else:
(cx, cy) = random.choice(state... | true |
f7504f5826342a39f19219f5d7ee850498951475 | Python | huazhaozhe/DSAAInPython | /chapter9_Sorting/merge_sort.py | UTF-8 | 1,073 | 3 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/7/10 9:24
# @Author : zhe
# @FileName : merge_sort.py
# @Project : PyCharm
def merge(lfrom, lto, low, mid, high):
i, j, k = low, mid, low
while i < mid and j < high:
if lfrom[k] <= lfrom[i]:
lto[k] = lfrom[i]
i... | true |
05850fdadb6829d91a99b427b535a81e403a2760 | Python | mbagrianski/Music | /FugueaMionr_old.py | UTF-8 | 18,861 | 2.71875 | 3 | [] | no_license | import pygame.midi
import pygame
A0 = (23,21)
Ash0 = (22.5,22)
Bb0 = (22.5,22)
B0 = (22,23)
C0 = (21,24)
Csh0 = (20.5,25)
Db0 = (20.5,25)
D0 = (20,26)
Dsh0 = (19.5,27)
Eb0 = (19.5,27)
E0 = (19,28)
F0 = (18,29)
Fsh0 = (17.5,30)
Gb0 = (17.5,30)
G0 = (17,31)
Gsh0 = (16.5,32)
Ab0 = (16.5,32)
A1 = (16,33)
Ash1 = (15.5,34)... | true |
402e792266a99995cb64a62211655b405884d00e | Python | rubenglezant/playBetterBets | /getConsultas.py | UTF-8 | 412 | 2.6875 | 3 | [] | no_license | IMEI_ANT =""
with open("/home/ruben/temp2/dataSorted.dat", "r") as f:
for line in f:
partes = line.split("|")
IMEI = (partes[0])
if (IMEI==IMEI_ANT):
print ("Consultar - IMEI "+ IMEI + " - " +(partes[1])+ " - "+BTs_ANT + " - con diferencia de tiempo en minutos: " + str(int(partes[2])-TEMPO... | true |
ed0e5dc829b4c9373a52c7d8fb00d8488eabb223 | Python | ThinkerBoy/pythonProject | /polynomialRegression.py | UTF-8 | 2,165 | 3.125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
#加载数据
train = np.loadtxt('click.csv',delimiter=',',skiprows=1)
train_x = train[:,0]
train_y = train[:,1]
#损失函数
def E(x,y):
return 1/2*np.sum((f(x)-y)**2)
#归一化
mu = train_x.mean()
sigma = train_x.std()
def standardize(x):
return (x-mu)/sigma
train_z = st... | true |
c1ca3df4002b6089b1fe134f89b04a899c7876ed | Python | weizhixiaoyi/leetcode | /lcof/1/31.栈的压入、弹出序列.py | UTF-8 | 1,554 | 3.3125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from typing import List
class Solution:
def validateStackSequences(self, pushed: List[int], poped: List[int]) -> bool:
push_len = len(pushed)
k = 0
help_stack = []
while True:
if k < push_len:
help_stack.append(pushed[k])
... | true |
e7381f8a130d21b2e54d0bd63ba14c5eee984d19 | Python | jizwang/pythonOOP | /OOP/OOP面向对象.py | UTF-8 | 374 | 3.65625 | 4 | [] | no_license | '''
定一个学生类,形容学生
'''
# class Student():
# # 一个空类
# pass
# mingyue = Student()
class PythonStudent():
name = None
age = 8
course = "python"
def doHomeWork(self):
print("I 在做作业")
return None
#在函数末尾使用return语句
yueyue = PythonStudent()#实例化
yueyue.age
yueyue.course
| true |
e23db31bf3389171763cd3ec4d7a9a789208be02 | Python | gabriel514/IN104_Derrida_Gabriel_Loire_Baptiste | /IN104/GIT/Hello_word.py | UTF-8 | 137 | 2.75 | 3 | [] | no_license | print("Hello, Word!")
#Bonjour Gabriel, ce commentaire je l'écris en tant que collaborateur, donc tout marche comme sur des roulettes.
| true |
d1ab1028bf6f5aeda12339090680ce55e14d56a1 | Python | anirudhbelwadi/music-application-using-machine-learning | /detect_cnn.py | UTF-8 | 3,485 | 2.75 | 3 | [
"MIT"
] | permissive | import json
import numpy as np
from sklearn.model_selection import train_test_split
import tensorflow.keras as keras
import matplotlib.pyplot as plt
from process import *
import shutil
import glob
import os
DATASET_PATH="./test"
IP_DATA_PATH="top.json"
def load_data(data_path):
"""Loads training dataset from json... | true |
141924bc639191be0ae70acabb66a78e69da61bd | Python | prasanthunnam/Toshiba | /digital_twin/day4/exception/six.py | UTF-8 | 431 | 3.640625 | 4 | [] | no_license | lista = [3, 5, 7, 8, 10, 6]
try:
i = int(input("enter the index:\n"))
print(lista[i])
print(listb[i]/0)
except IndexError:
print("sorry, your index should have been within", len(lista))
except ZeroDivisionError:
print("division by zero not allowed")
except ValueError:
print("sorry, your in... | true |
e1f339ddbb42ad2868115bc0bbf77e03f678d1de | Python | PARKINHYO/Algorithm | /BOJ/2667/2667번(단지번호붙이기).py | UTF-8 | 2,136 | 3.390625 | 3 | [] | no_license | from collections import defaultdict
from sys import stdin
class Graph():
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self, u, v):
self.graph[u].append(v)
def BFS(self, vertices):
apart = []
apartCount = 0
visited = [False] * 630
que... | true |
b657fb5094758997237a9452bf5b8d5dca6bd285 | Python | cutewindy/CodingInterview | /LintCode_Python/minimumPathSum.py | UTF-8 | 873 | 4 | 4 | [] | no_license | # Given a m x n grid filled with non-negative numbers, find a path from top left
# to bottom right which minimizes the sum of all numbers along its path.
# Have you met this question in a real interview? Yes
# Example
# Note
# You can only move either down or right at any point in time.
def minimumPathSum(grid):
... | true |
e80652ef1a91ee0bf8a0cd0b22fae53005603e57 | Python | harrisonBirkner/PythonSP20 | /Lab5/Lab5/PaintJobEstimator.py | UTF-8 | 1,896 | 4.34375 | 4 | [] | no_license | #This program asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon.
#The program should display the following data:
# The hours of labor required
# The cost of the paint
# The labor charges
# The number of gallons of paint required
# The total cost of ... | true |
20ba02c0fb047a7eb3d29f109477105406a4c860 | Python | jhuanini/automation_python | /practice/fb_test.py | UTF-8 | 2,124 | 2.578125 | 3 | [] | no_license | import unittest
from selenium import webdriver
#waits for the page to load
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver import FirefoxOptions
import time
class LoginTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
#self.driver = webdri... | true |
b57cc3c48f645f5444d7745635749022503d7842 | Python | Brunokrk/PIM | /ex2d.py | UTF-8 | 246 | 2.578125 | 3 | [] | no_license | from PIL import Image
import numpy
img = Image.open("mandril.jpg")
img = img.convert('L')
img.show()
a = numpy.array(img)
#reticulado de linhas de espessura 10 pixels
a[ ::10, : ] = 0
a[ : , ::10] = 0
img= Image.fromarray(a)
img.show()
| true |
3208ebbfdfb8db43bdb4c97ffa4856b4301e3b3e | Python | allenbao64/Shoot | /battle_state.py | UTF-8 | 3,687 | 3.09375 | 3 | [] | no_license | import cards
import random
class BattleState: # instantiated whenever a new battle begins, keeps track of HP and selections by both players
def __init__(self, player, opponent):
self.turn_counter = 1
self.player = player
self.opponent = opponent
self.playerRPS = ""
self.opp... | true |
f0fcec42f120bc0cbdd07b30e48dd259684ee2e7 | Python | suhaskamathn/pyx12 | /pyx12/rawx12file.py | UTF-8 | 2,635 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | ######################################################################
# John Holland <john@zoner.org>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
#
###########################################################... | true |
38695e186863ac5571a77637cfd58da737681ae1 | Python | alpha1bah/Python-bootCamp | /Week 1/Day 2/ramdom_numbers.py | UTF-8 | 447 | 4.125 | 4 | [] | no_license |
import random
winning_number=random.randint(0,10)
print(winning_number)
num_guesses=5
user_won=False
while num_guesses !=0 and user_won == False:
user_guess = int(input("Enter your guess: "))
if user_guess == winning_number:
print("Congratulation, you won!")
user_won=True
else:
nu... | true |
0069a67b5e8403683502d8c3eb81e4fe38d820b0 | Python | jayantsi/NVETg-mapper | /collection_GRIDMET.py | UTF-8 | 7,872 | 2.8125 | 3 | [] | no_license | import logging
import ee
#===========================================
# GRIDMET
#===========================================
def get_gridmet_collection(variable, logger=None):
"""Return the daily image collection for GRIDMET
Args:
variable: string indicating the variable/band to return
(... | true |
656bacc5531ed47ede968e2a644c727c0c36a1e3 | Python | 5tsuki/RaiPlayRadioDownloader | /main.py | UTF-8 | 926 | 2.875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import argparse
parser = argparse.ArgumentParser(description='Download audio files from RaiPlayRadio')
parser.add_argument("-l", "--link", type=str, required=True, dest='link', help="Define playlist link")
parser.add_argument("-v", "--verbose", required=False, help="Increa... | true |
2a229f2588574e4bb31c1e9e6c4294f6b7f3da0a | Python | fjluartes/pcc | /ch6/cities.py | UTF-8 | 1,140 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python
# cities.py: Exercise 6-11, 6-12
# 19 Aug 2018 | fjgl
# 6-11. Cities
cities = {
'paris': {
'country': 'france',
'population': 12405426,
'fact': 'Paris is known for its architectural landmarks, like the Louvre.'
},
'new york': {
'country': 'usa',
... | true |
828be804c3a9cf709325cb298d508b9c3eda09fa | Python | payne/longbaonguyen.github.io | /courses/apcsp/processing_arcade/Labs/resolving_collisions/objects.py | UTF-8 | 3,098 | 3.625 | 4 | [] | no_license | """
Resolving Collisions Lab
Do the following:
1) Create a SpriteList of "brick.png" Sprites.
2) Initialize two rows of brick sprites. One with all adjacent bricks and one with spacing
enough for the tank to go in between.
3) Use PhysicsEngineSimple class to detect/resolve collision!
See the arcade.py for the sour... | true |
f104391bef3c5cc2bf752ac296fd5a4693dcabd7 | Python | marcocaldera/ai-thesis-brainstorming | /web-scraping/ig-scraping.py | UTF-8 | 1,982 | 2.875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import urllib.request
import time
from selenium.webdriver.common.keys import Keys
from collections import Counter
from functions import set_browser, login
def get_first_12_photos():
# url = "https://www.instagram.com/marcocaldera_/"
... | true |
7cebe56b528d7723bb880e40c2524ab0ba5e6eb5 | Python | AhmadBasha/python-Intermediate | /HirstPainting/main.py | UTF-8 | 1,384 | 3.75 | 4 | [] | no_license | # Using this package https://pypi.org/project/colorgram.py/
import colorgram
from turtle import Turtle, Screen, colormode
import random
# Extract 6 colors from an image.
colors = colorgram.extract('image.jpg', 40)
# colorgram.extract returns Color objects, which let you access
# RGB of the image was that color.
hirst_... | true |
613475bf579e909d100afc5ac4ae92cd13ef15f6 | Python | beyonddoor/wepython | /game_click.py | UTF-8 | 1,286 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : daruida
# @Time : 2021/1/8 15:38
import os
from time import sleep
# 点击方法
def click_screen(x, y):
os.system('adb shell input tap {} {}'.format(x, y))
def repeat(zidong):
print('开始挑战')
# 闯关
click_screen(1697, 861)
sleep(10)
# 跳过
print('点击跳过')
cl... | true |
83df194c5a7d7f62821ba5f4daa9b95b46b0a2f6 | Python | ybenigot/cnn-imagenet | /imageutils.py | UTF-8 | 3,397 | 2.96875 | 3 | [] | no_license | from PIL import Image,ImageDraw,ImageFont
import numpy as np
def unpickle(file):
import pickle
fo = open(file, 'rb')
dict = pickle.load(fo, encoding='bytes')
fo.close()
return dict
def display_image(im1,image_size,imageTitle):
im1=im1.reshape((3,image_size,image_size)).transpose(1,2,0)
img = Ima... | true |
0dd40c34ef7b59a5bda96c8ce7928aeb7f64d9f9 | Python | Bingwen-Hu/hackaway | /projects/olds/image-utils/mimic.py | UTF-8 | 2,441 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | import glob
from PIL import Image, ImageDraw, ImageFont
import random
import numpy as np
from uuid import uuid1
def merge_char(charimg, img, color):
width, height = img.size
char_w, char_h = charimg.size
x = random.randint(char_h // 2, height - char_h)
y = random.randint(0, width - char_w * 3)
im... | true |
475f13734d9a88afa0e3c60af4f7163b78d16f6c | Python | inquisitivefrog/data-store-review | /rdbms/mysql/tables/test_mysql_table_update.py | UTF-8 | 1,570 | 2.71875 | 3 | [] | no_license |
from _mysql_exceptions import DataError, OperationalError, ProgrammingError
from unittest import TestCase
from my_mysql import MyMySQL
from my_utils import Fixture
class TestMySQLTableUpdate(TestCase):
"""
"""
def setUp(self):
self.m = MyMySQL()
self.f = Fixture('fixtures/update')
de... | true |
17a296dc0e5b301d76785860a2e00092040a12ec | Python | Vastyjoy/SupercomputersPMI_2018 | /IndivTask46Tihonov Version 2/python/generate.py | UTF-8 | 1,878 | 3.015625 | 3 | [] | no_license | import numpy as np
import os
def generateBlockSymmetricMatrix(block_size, matrix_size, is_integer=True):
block_count = matrix_size // block_size
matrix = [[0 for i in range(0, block_count)]
for j in range(0, block_count)]
for i in range(0, block_count):
for j in range(0, i + 1):
... | true |
e0725606625b1b7d35a8b32b0a348cbcfc415219 | Python | lewisExternal/DataIngestion | /main.py | UTF-8 | 3,890 | 2.734375 | 3 | [] | no_license | import sqlite3
import pandas as pd
import glob
import db_lib
import os
import re
import time
from datetime import datetime
import subprocess
import sys
# imports from script
import utils
import db_lib
def main():
# database name
database = r"pythonsqlite.db"
# create the db if it doesn't alread... | true |
c98d2923da1734de7d2c22a18029ece92ed2fd25 | Python | IMMM-SFA/jones-etal_2023_scidata | /figures/tempest/filter_WRF_domainedge.py | UTF-8 | 2,551 | 2.578125 | 3 | [] | no_license | from netCDF4 import Dataset, num2date, date2num
import numpy as np
import datetime as dt
import os
import pandas as pd
simulation_name = "SSP585_HOT_FAR"
#reading in the text file and the data
with open("trajectories.txt."+simulation_name+"_17min") as f, open("traj_temp.txt","w") as f_out:
data = f.readlines... | true |
996efb8b2bdc8dce1aeca51548318f687333f1d0 | Python | ezhang-dev/competitive-programming | /DMOJ/DMOPC/DMOPC '14 Contest 1 P3 - New Students.py | UTF-8 | 125 | 2.796875 | 3 | [] | no_license | q=0
a=input()
for _ in xrange(a):
q+=input()
for _ in xrange(input()):
q+=input()
a+=1.
print "%0.3f" % (q/a) | true |
0622f8c1147c94f833c6ee6c4619d30e7d51648f | Python | omriiluz/gsync | /libgsync/crawler.py | UTF-8 | 5,285 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (C) 2013 Craig Phillips. All rights reserved.
import os, re, sys
from libgsync.sync import Sync
from libgsync.output import verbose, debug
from libgsync.options import GsyncOptions
from libgsync.drive import Drive
from libgsync.drive.mimetypes import MimeTypes
from libgsync.bind import bind
# os.walk doe... | true |
db36f7e055fe35c7597d3f6f5f07d072a684510d | Python | 100paperkite/computer-vision | /CV_Assignment_1/A1_image_filtering.py | UTF-8 | 3,126 | 3.234375 | 3 | [] | no_license | import cv2
import numpy as np
import A1_function as func
import math
import time
def nine_different_GF_images(image_path):
image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
kernel_size = [5, 11, 17]
sigma_value = [1, 6, 11]
# make cases
cases = [(i, j) for i in kernel_size for j in sigma_value... | true |
950fff8cedc3d0727807c49a8f73d4da8dafaaf6 | Python | kle622/EClass | /implementation/source/python/model/Person/Roster.py | UTF-8 | 783 | 3.25 | 3 | [] | no_license | class Roster:
def __init__(self):
self.students = ["Carson Carroll", "Tim Anderson", "Ryan Ginsberg", "Mike Sevilla"]
print("Students (in class) listed before being sorted:")
for i in range(0, len(self.students)):
print(self.students[i])
self.SortList(self.students)
self.remote... | true |
4434d4c5e38fbc1dd02e19b8eafa189ef8b99961 | Python | presleyreverdito/processamentoimagem | /carregandoImagem.py | UTF-8 | 558 | 3.21875 | 3 | [] | no_license | ###############################################
#Algoritmo que simplesmente dedtecta bordas
#
#
#
#Criado em : dezembro/2017
###############################################
from PIL import Image #Importar a biblioteca
import ImageFilter
im = Image.open("/home/presley/Dropbox/ECA/Processamento de Imagens/Processing_w_P... | true |
2e5247868720a2cfb05df479e24b7aaa3debcdeb | Python | changsuchoi/cspy | /SNColorBS.py | UTF-8 | 2,427 | 2.515625 | 3 | [
"MIT"
] | permissive | def MakeColorBS(incat_name='hgSN2021hpr.LCfinal.txt', band1='B', band2='V', sameobs=True):
"""
Make color catalog using bisect.
Put host, mw reddening-corrected catalog
Sameobs == True : 같은 천문대끼리 묶어줌.
"""
import bisect
incat = ascii.read(incat_name)
if sameobs :
obslist ... | true |
cbcb38a2296171f4a6bb493212a68232b6ccc374 | Python | bzhao2718/REALSumm | /scoring/get_scores.py | UTF-8 | 6,035 | 2.671875 | 3 | [] | no_license | import argparse
import logging
import os
import glob
import pickle
from pprint import pprint
from joblib import Parallel, delayed
from joblib import parallel_backend
from os.path import join as pjoin
from utils import init_logger
ARTICLE_FILENAME = "src.txt"
REFERENCE_SUM_FILENAME = "ref.txt"
SYSTEM_SUM_FILE_REGEX = ... | true |
8ab24113b8419b28001ddc7c718d9a432e848d06 | Python | olegValensa/pyhtonEducation | /algorithms/w1/fib1.py | UTF-8 | 942 | 3.5 | 4 | [] | no_license |
a = 23#47905881698199969
b = 6#76940
print(a % b)
'''
#1
n = int(input())
i = 2
fib_array = [1]*(n+1)
fib_array[0] = 0
for d in fib_array[2:]:
fib_array[i] = fib_array[i-1] + fib_array[i-2]
i += 1
print(fib_array[n])
#2
n = int(input())
i = 2
fib_array = [1]*(n+1)
fib_array[0] = 0
for d in fib_array[2:]:
... | true |
16a9c8c9b07748f4265e557d38a83582126b5584 | Python | muratkeremozcan/python | /1/code/course/5/modules/orders.py | UTF-8 | 1,844 | 4.09375 | 4 | [] | no_license | def print_menu(menu):
for name, price in menu.items(): # for key & value (name & price) in the dictionaries items (.items() is a thing)
print(name, ': $' , format(price, '.2f'), sep='') # print puts a space between each world by default, sep= configures what that space can be instead
# dict_name.key... | true |
3737835fe90fdd8c7d726656dfe038ee695687ab | Python | Jamiu-Tijani/Simple-port-scanner | /scanner.py | UTF-8 | 1,087 | 2.703125 | 3 | [] | no_license | import sys
import socket
from datetime import datetime
#Define our target
print("_"*50)
print("WELCOME TO JAY PORT SCANNER 1.0")
print("_"*50)
print("")
IP = input("Please input IP")
if len(IP) > 5:
target = socket.gethostbyname(IP)
else:
print("Please Check your ip if it's correct.")
print(... | true |
80a805e23f9f91079a00c72d6c0209b9caf3a19b | Python | SachinDangayach/session12-SachinDangayach | /calculator/math_func/cos_func.py | UTF-8 | 620 | 3.6875 | 4 | [] | no_license | # cos_func.py
import math
import numbers
from ..helper import string_rep
@string_rep
def cos(x:float)->float:
"""
Function expects value x in radian ( math.pi radian = 180 Degree)
and returns the sin(x)
"""
if not isinstance(x, numbers.Real):
raise TypeError("Input value of invalid type")
... | true |
35e8680da03cb67eab527ba26b44a81294244f8c | Python | mrpandrr/My_scripts | /2.1.4/28.py | UTF-8 | 984 | 3.28125 | 3 | [] | no_license | import tkinter as tki
class App(object):
def __init__(self):
self.root = tki.Tk()
self.root.wm_title("Play With python")
for r in range(8):
self.root.rowconfigure(r, weight=1)
for c in range(2):
self.root.columnconfigure(c, weight=1)
#... | true |
daebbaaa1805eba477fdba89ddff768cf3fea1a1 | Python | arettew/Tigerbites | /scraper.py | UTF-8 | 7,420 | 3.15625 | 3 | [] | no_license | import urllib
import urllib.request
import re
from bs4 import BeautifulSoup
from fooditem import FoodItem
import fooditem
from datetime import datetime, timezone
# Helper method to throw out result if it a meal header
def isMeal(item):
if item == "Lunch" or item == "Breakfast" or item == "Dinner":
return ... | true |
1eba2dec78c9334383d051a37569c971ef2cca8b | Python | amirharati/Trump_tweeter_bot | /legacy_stuff/data_preprocessing_annakarenina.py | UTF-8 | 2,462 | 2.796875 | 3 | [] | no_license | """
extract and normalize tweets from raw data and save the resutls.
Amir Harati, April 2018
issues:
1- chunking is not used (e.g. new york would be new + york)
"""
import json
import textacy as tc
import glob, os
import spacy as sp
import re
regex = re.compile('[^0-9a-zA-Z\s+\.\?]')
outdir = "./data"
#nlp = sp.... | true |
e6d51b6e0ef138db917209d3dc930ffb1bd6d208 | Python | JeffTheAggie/Laptop-Recommend | /py_scripts/Laptop_Rec_UI.py | UTF-8 | 18,860 | 3.9375 | 4 | [] | no_license | '''
Overview: User-input interface for laptops they should be recommended.
Details:
-User is given an initial prompt (a greeting + a brief introduction)
-User wants a laptop that bests suits their needs.
-Each prompt would slowly break down various questions regarding different computer specifications (e.g. memory, sc... | true |
68bb5ce4e35448c507811d0e58bc7514f3a4551a | Python | HomebyTwo/homebytwo | /homebytwo/importers/geonames.py | UTF-8 | 6,006 | 2.75 | 3 | [
"MIT"
] | permissive | import csv
from io import TextIOWrapper
from typing import IO, Iterator, Optional
import requests
from lxml import html
from requests import ConnectionError, HTTPError
from ..routes.models.place import PlaceTuple, PlaceType
from .utils import download_zip_file, get_csv_line_count, save_places_from_generator
PLACE_TY... | true |
ce1ea3bc3775bc0ba7a9ca69810a260a47dba86a | Python | zlszhonglongshen/NLP | /PMML/xgbPMML.py | UTF-8 | 1,840 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on 2018/12/17 17:49
@Author: Johnson
@Email:593956670@qq.com
@Software: PyCharm
"""
import pandas as pd
from xgboost.sklearn import XGBClassifier
from sklearn2pmml import PMMLPipeline
from sklearn_pandas import DataFrameMapper
from sklearn2pmml import sklearn2pmml
from sklearn.datas... | true |
5af428b99adea13f6945ae83c05342190f614f2f | Python | Lipika16/programming_lab | /dotplot.py | UTF-8 | 1,990 | 3.09375 | 3 | [] | no_license | import matplotlib.pylab as plt
import numpy
def dotplot(seqA,seqB,w,s):
dp=numpy.zeros((len(seqA),len(seqB)),dtype=int)
a=int(w/2)
for i in range(0,len(seqA)-w+1):
#print(seqA[i:i+w])
for x in range(0,len(seqB)-w+1):
counter=0
#print(seqA[i:i+w],seqB[x:x+w])
... | true |
5318e6029b4e9353b380adb5d255b3566f84f621 | Python | AbhinaVChandr/Credit_Risk | /creditrisk.py | UTF-8 | 11,975 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 12 15:24:51 2021
@author: abhinav
"""
# Import Libraries
import pandas as pd
import numpy as np
import statsmodels.api as sm
from sklearn.metrics import classification_report as cr
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as ... | true |
c624e3b87a9169b9d367f5ecb5fcd729c8e59c48 | Python | jiadaizhao/LeetCode | /1401-1500/1438-Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit/1438-Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit.py | UTF-8 | 750 | 3.015625 | 3 | [
"MIT"
] | permissive | import collections
class Solution:
def longestSubarray(self, nums: List[int], limit: int) -> int:
start = maxLen = 0
maxDq = collections.deque()
minDq = collections.deque()
for i, num in enumerate(nums):
while maxDq and num > maxDq[-1]:
maxDq.pop()
... | true |
2710f9ae1f9e16422e29dd14085449eea3fa15f2 | Python | hit-lacus/GhcndDataEventSender | /source/metadata_reader.py | UTF-8 | 2,592 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# This file read dimension table information and transfer its format
import json
def read_state_us(path):
state_dict = {}
with open(path, 'rb') as pf:
while True:
text_line = pf.readline()
if text_line:
state_dict[text_line[0:2]] = text_l... | true |
19e101765d2446e9417a32539c74171a632c00c5 | Python | vinlok/vinlok.github.io | /_posts/algorithms/linked_list/remove_duplicate.py | UTF-8 | 1,587 | 3.84375 | 4 | [] | no_license |
class Node:
def __init__(self,value):
self.value=value
self.prev=None
self.next=None
def print_linked_list(head):
cur_node=head
while cur_node != None:
print(cur_node.value)
cur_node=cur_node.next
def rev_linked_list(head):
'''
Algo:
head->7->14->... | true |
e659f4a4addfafc46905dc4ddf408bef334230c5 | Python | volkamerlab/kissim | /kissim/viewer/pair.py | UTF-8 | 2,348 | 3.078125 | 3 | [
"MIT"
] | permissive | """
kissim.viewer.pair
Visualizes a two structures' fingerprint difference in 3D.
"""
import pandas as pd
from kissim.viewer.base import _BaseViewer
class StructurePairViewer(_BaseViewer):
"""
View a kinase's fingerprint variability.
Attributes
----------
Inherited from kissim.viewer.base._Bas... | true |
961427c462dfdd9f218e8bb01a8fb94217866412 | Python | bgoonz/UsefulResourceRepo2.0 | /_PYTHON/DATA_STRUC_PYTHON_NOTES/python-prac/leetcode/Fibonacci_Number.py | UTF-8 | 397 | 4.40625 | 4 | [
"MIT"
] | permissive | # Fibonacci Number
# 0 1 1 2 3 5 8 13 21 .....
# find 6th number in Fibonacci series which is 8
def fib(n):
a = 0
b = 1
if n == 0:
return a
elif n == 1:
return b
for i in range(2, n + 1):
value = a + b
a = b
b = value
return value
if __name__ == "_... | true |
0d291834518cf4bca67a003baad4ac96de264b47 | Python | florije1988/Suggestions | /others/assignment/linkedlist(2).py | UTF-8 | 6,209 | 4.15625 | 4 | [] | no_license | '''
Name: Xiaoqi (cecilia) Zhong
Student Number: 10113208
Date: August 4th, 2014
Assignment: 4
'''
"""
Creates and returns a linked list containing all of the elements
of the Python-style list parameter. A useful shortcut for testing.
"""
def createList(plist):
linkedList = None
# go... | true |
b580ccae69de707e0e0ee8acba6dcde4d110a9e5 | Python | escape0707/usaco_trainings | /numtri.py | UTF-8 | 550 | 3.203125 | 3 | [] | no_license | """
ID: totheso1
LANG: PYTHON3
TASK: numtri
"""
from typing import Any, List
fin = open("numtri.in", "r")
fout = open("numtri.out", "w")
def fprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=fout, **kwargs)
# Code start
number_of_rows = int(fin.readline())
dp: List[int] = [0] * number_of_rows
for i... | true |
7be55233105edd5fd93cf9c81d9c46a1654d45c1 | Python | miniyk2012/bopytest-code | /ch4/test_warnings.py | UTF-8 | 832 | 3.21875 | 3 | [] | no_license | import warnings
import pytest
def lame_function(message="Please stop using this"):
warnings.warn(message, DeprecationWarning)
# rest of function
def test_lame_function(recwarn):
message = "hahah"
lame_function(message+'x')
lame_function(message)
assert len(recwarn) == 2
w = recwarn.pop()... | true |
4c0aad5862f3e8650c7df63e54e1cd5443c2298b | Python | neoformit/cukeweb | /home/forms.py | UTF-8 | 1,045 | 2.609375 | 3 | [] | no_license | """Cukeweb homepage forms."""
from django import forms
from django.contrib import auth # login, logout, authenticate
from django.core.exceptions import ValidationError
class LoginForm(forms.Form):
"""Validate and process user login."""
username = forms.CharField(max_length=200)
password = forms.Char... | true |
c67f16c7594e5a0873fe1c18c65c6dc06ca48a3e | Python | shiho-aoki/CompetitiveProgramming | /biginnersSelection/Traveling.py | UTF-8 | 897 | 3.09375 | 3 | [] | no_license | N = int(input())
T = []
X = []
Y = []
for i in range(0, N):
t_i, x_i, y_i = map(int, input().split())
T.append(t_i)
X.append(x_i)
Y.append(y_i)
t_base = 0
x_base = 0
y_base = 0
ng = 0
for x, y ,t in zip(X,Y,T):
if t-t_base == (x-x_base)+(y-y_base):
t_base = t
x_base = x
y_bas... | true |
c32efb068bba87b6a75665be66db21052c57b740 | Python | EvilsystemDK/fetchTweets | /fetchTweets.py | UTF-8 | 2,161 | 3.34375 | 3 | [] | no_license | import json, requests
import oauth2 as oauth
import os
# Customer keys & secret
CONSUMER_KEY = "INSERT HERE";
CONSUMER_SECRET = "INSERT HERE";
ACCESS_KEY = "INSERT HERE";
ACCESS_SECRET = "INSERT HERE";
def main():
# prompt user for input
query = input("What would you like to search for: ");
lang = input("... | true |
1e3004838ea30669ac318cfdc519240d0cc21522 | Python | gmega/ntfs-chattr | /ntfschattr/ntfsutils.py | UTF-8 | 2,078 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | import xattr
#: Table mapping symbolic attribute names into actual attribute masks.
NTFS_ATTRIBUTE_TABLE = {
'readonly': 0x1,
'hidden': 0x2,
'system': 0x4,
'archive': 0x20,
'temporary': 0x100,
'compressed': 0x800,
'offline': 0x1000,
'content_not_indexed': 0x2000
}
class NtfsFile(objec... | true |
054d3f8904da9b54400db550d3e470ef983ee6eb | Python | adobs/project | /seeding_database/seed_adjective_table.py | UTF-8 | 1,165 | 3.28125 | 3 | [
"MIT"
] | permissive | """
seed_adjective_table.py
Based on entries in the oldadjectives table that has an array as a field type,
inputs adjectives and usernames into the adjectives table.
"""
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir)
from model import Adjective, Ol... | true |
3ad45868832896ddb7a31c379bae4e688328d285 | Python | abittante/pycul_homemade | /pycurl.py | UTF-8 | 289 | 2.890625 | 3 | [] | no_license | import os
import sys
try:
URL = sys.argv[1]
myCmd = 'curl' + ' ' + URL
os.system(myCmd)
except IndexError:
print("you need a url")
except Exception:
print("something else went wrong")
else:
print("it worked")
finally:
print("do something else")
| true |