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 |
|---|---|---|---|---|---|---|---|---|---|---|
ead787466b80db69d9cc224a0cf5ea8fa8fa1392 | ia-chile/towardsautonomy.github.io | /projects/semantic_segmentation_ssnet/create_video.py | UTF-8 | 3,043 | 2.640625 | 3 | [] | no_license | import numpy as np
import cv2
from PIL import Image
import matplotlib.image as mpimg
from os import system
import glob
import argparse
import matplotlib.pyplot as plt
from moviepy.editor import VideoFileClip
from moviepy.editor import ImageSequenceClip
import math
import os
data_folder = 'KITTI/testing/image_2/'
label... | true |
5d8dd3812126eb8eb614dfdeaef95f235e40c237 | difnajayashani/DatabaseBackupUpdate | /target/classes/mobitel/python2.py | UTF-8 | 1,689 | 3.953125 | 4 | [] | no_license | #!/usr/bin/python
import time
import datetime
from pip._vendor.distlib.compat import raw_input
raw_input("\n\nPress the enter key to exit.")
a,b,c = 1,2,"john"
print(a)
print(b)
print(c)
localtime = time.localtime(time.time())
print("Local current time :", localtime)
localtime = time.asctime( time.localtime(time.... | true |
d560418d45839ea72e96e6fc5b175fa93abe406f | anandsoraganvi/webautomation | /Selenium/Selenium Scripts/Scripts/assert_exm.py | UTF-8 | 352 | 3.015625 | 3 | [] | no_license |
try:
1/0
except:
ZeroDivisionError
print("Devide by zero")
try:
assert(1<0)
except:
print("AssertionError")
import unittest
class Test(unittest.TestCase):
def testu(self):
self.assertEqual("A","A","Exceprt")
a="D"
self.assertTrue(a=="E","Error")
if __name__ == '_... | true |
a8c565d3489fdeae58a094829dbff5eaf49bd6da | AmeKsinRT/PS | /PaS 2.0/PaS.py | UTF-8 | 1,752 | 3.796875 | 4 | [] | no_license | def a():
while True:
try:
print("Какая длинна одной стороны?")
a = float(input("Число: "))
break
except ValueError:
print("Не верное значение")
continue
return(a)
def b():
while True:
try:
print("Какая длинна вт... | true |
94979a71a94b99c646d5416cc394417678a4f3e1 | SashaZd/EmotionalNPCs | /Knowledge.py | UTF-8 | 5,835 | 2.75 | 3 | [] | no_license | from copy import deepcopy
import random
# 'science': {'num_facts':20, 'tags':['vaccination', 'abortion', 'health']},
class Knowledge(object):
"""docstring for Facts"""
def __init__(self):
# self.tags = []
self.topics = {}
self.views = {}
self.facts = {}
# def change_knowledge_after_discussion(self, fact, ... | true |
0e2d9df7892d7e1381383d3efb4f9c9e3c4a4cc3 | MattX/nanospectrum | /src/managers/dummy.py | UTF-8 | 415 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from .manager_base import ManagerBase, Panel
class DummyManager(ManagerBase):
def __init__(self, num_panels):
self.num_panels = num_panels
def get_num_panels(self):
return self.num_panels
def get_layout(self):
return [Panel(i, 75*i, 43 * (1 - i % 2), np.pi/3 *... | true |
fe1386f7b4573298deb17e1ddb492d2be78727f9 | grawe/pyrsss | /pyrsss/signal/spectrum.py | UTF-8 | 6,922 | 3.140625 | 3 | [
"MIT"
] | permissive | from __future__ import division
import math
import numpy as NP
import scipy.signal
def rect(t, a):
"""
Return a vector of the same length as $t$ that is equal to 1 for
absolute values of $t$ less than $a$/2 and 0 otherwise.
"""
x = NP.zeros_like(t)
x[NP.abs(t) < a/2] = 1
x[NP.abs(t) == a... | true |
b8a6807b06c0637e6ce7d954b74775370c0533a0 | Someshshakya/CodeChef | /nav_22.py | UTF-8 | 268 | 4.09375 | 4 | [] | no_license | '''Draw a flow chart to print Hello “name” for 20 times, here “name” is entered by the user
Sample Input:
Jane Doe
Sample Output:
Hello Jane Doe
..(18)
Hello Jane Doe
'''
input=input("Enter your name: ")
a = 1
while a <= 20:
print(" Hello "+input)
a +=1 | true |
6cd605e16968ddc94d00ca23892c8a0ac638c829 | albertium/Execution | /agent/agent.py | UTF-8 | 499 | 2.9375 | 3 | [] | no_license |
import abc
import numpy as np
class agent:
def __init__(self, n_features, n_actions):
self.n_features = n_features
# self.action_space = list(range(n_actions))
self.action_space = [8]
@abc.abstractmethod
def act(self, states):
pass
class RandomAgent(agent):
def __in... | true |
cba2d014fa342a9398c9f9c28a03c8bc495b9f0c | WesGtoX/Intro-Computer-Science-with-Python-Part02 | /Week4/Tarefa 02/Exercicio_01_Gerando_listas_grandes.py | UTF-8 | 143 | 3.078125 | 3 | [
"MIT"
] | permissive | import random
def lista_grande(n):
lista_g = []
for i in range(n):
lista_g.append(random.randrange(9999))
return lista_g
| true |
f2c0bf670977baeb2eab5f47782a8f05575e1015 | charlizhu/xzones_nvd | /bicycle_safety/visualizing/initial_concepts/trajectoryMap.py | UTF-8 | 4,495 | 2.828125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d, CubicSpline
from sklearn.linear_model import LinearRegression
import tracemalloc
def countObjects():
f = open("data3_2.txt", "r")
allObjects = []
everyID = []
record = []
count = 0
for x in f:
c... | true |
641b76804b712e55eaa432710c4c6075077fd425 | ErkmenB/Python-Ogrenirken | /fonksiyonlar_2/global_degiskenler.py | UTF-8 | 90 | 3.0625 | 3 | [] | no_license | def gerisayim(n=5):
for sayac in range(n, -1,-1 ):
print(sayac)
gerisayim(8)
| true |
1b3e8122d26963e95f6b18855b588323eee4fca4 | asek-ll/aoc2020 | /day17/main.py | UTF-8 | 2,269 | 2.796875 | 3 | [] | no_license | import sys
if len(sys.argv) <= 1:
raise Exception("No inputs")
with open(sys.argv[1], 'r') as f:
lines = f.readlines()
field = [list(l.rstrip()) for l in lines]
state = []
for i in range(0, len(field)):
for j in range(0, len(field[i])):
if field[i][j] == '#':
state.append((i,j,0))
... | true |
8b61642e9466388f8bf0e55fe81610228bf1b96e | fabriciogonzalez06/cursos-practicas-old | /Ejemplos python/VectoresFrutasCombinado.py | UTF-8 | 1,898 | 4.1875 | 4 | [] | no_license | #Crear un vector con frutas
frutas=["Manzana","Pera","Sandia"]
#Añadir dos frutas mas con append y mostrar todo
frutas.append("Mango")
frutas.append("Melón")
print(frutas[:])
#Insertar en el índice 3 y 4 (insert) dos frutas más y mostrar nuevo vector
frutas.insert(3,"Ciruela")
frutas.insert(4,"Melocotón")
print(fru... | true |
96c5ab29276d6b5c1ed600ba4b76934d4b57afdd | N3CROM4NC3R/python_crash_course_exercises | /functions/magicians.py | UTF-8 | 162 | 3.546875 | 4 | [] | no_license | def show_magicians(names):
for name in names:
print("The magician name is: "+name)
magicians = ["carlos","pedro","ignacio"]
show_magicians(magicians) | true |
c095ff6ee0fe87141bb5cf74bbb31ca569ee3b74 | CerebralMischief/voipy | /voipy/sdp/message.py | UTF-8 | 995 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# list of keys for parsing order
# when building, include media_session_descriptor_blocks
class Message(sdp.SDP):
sep = '\r\n'
def __init__(self, *args, **kwargs):
self.descriptors = []
super(Message, self).__init__(*args, **kwargs)
# self.current = global
... | true |
a502c24d06051c544daf85c793f2df01699cbb92 | ucefizi/CodeForcesPython | /PB630l.py | UTF-8 | 237 | 2.984375 | 3 | [] | no_license | # Problem statement: http://www.codeforces.com/problemset/problem/630/L
m = [int(i) for i in input()]
m[1], m[2] = m[2], m[1]
m[2], m[4] = m[4], m[2]
print(str(pow(m[0]*10000+m[1]*1000+m[2]*100+m[3]*10+m[4], 5, 100000)).zfill(5))
| true |
d5485c2773f72d988e3b3057e6a8fa829e02a1ca | Maneesha24/Leetcode-1 | /476. Number Complement/test.py | UTF-8 | 475 | 2.90625 | 3 | [] | no_license | import unittest
from index import sol
class Testing(unittest.TestCase):
#Check for input 5
def test_findComplement_input1(self):
self.assertEqual(sol.findComplement(5), 2)
#Check for input 1
def test_findComplement_input2(self):
self.assertEqual(sol.findComplement(1), 0)
#Che... | true |
c0f395415c160a9089878a70cb6f97e84d96b95a | gbcdef/sensorsdata-yaml2excel | /yaml_interpreter.py | UTF-8 | 2,131 | 3.390625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
from ruamel.yaml import YAML
from ruamel.yaml.comments import CommentedMap
class YAMLInterpretor:
"""
将YAML文件转为2维列表
eg.
a:
x: 1
y: 2
将被转为:
[[a, x, 1],
[None, y, 2]]
当指定
"""
def __init__(self, fill_with_none=True):
self... | true |
6bd40a2eff18ed7201190b0d4b49d982ea1201fd | ioannaMitropoulou/compas | /src/compas_rhino/artists/capsuleartist.py | UTF-8 | 1,667 | 2.71875 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_rhino
from ._shapeartist import ShapeArtist
class CapsuleArtist(ShapeArtist):
"""Artist for drawing capsule shapes.
Parameters
----------
shape : :class:`compas.geometry.Capsule... | true |
99c4ac7fd240454125f92a16773e9022ea9f4202 | vihini1208/python-program | /C.py | UTF-8 | 47 | 3.078125 | 3 | [] | no_license | x=int(input("number"))
C=5*x-160/9
print(C)
| true |
2c6376365b9a5bf32783d5f6beb34480d5b45a9e | thak123/ML2016 | /code-II/ensembleClassifier.py | UTF-8 | 4,250 | 3.078125 | 3 | [] | no_license | import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn import cross_validation, linear_model
import numpy as np
from sklearn.preprocessing import Imputer
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import cross_val_score
... | true |
42ec080073aae5edd8f4637fa139162feb9bf02c | codegik/pocs | /jython-dictionary/solution.py | UTF-8 | 871 | 3.75 | 4 | [] | no_license |
class Dictionary:
def replace(self, input_text, input_dict):
buffer = ""
result = input_text
startIndex = 0
endIndex = 0
for i, c in enumerate(input_text):
if (c == "$"):
buffer = c
startIndex = i
elif len(buffer) > 0:... | true |
05d55940cd3b6ec6e55c27de88f5cbac4fa40b67 | njaladan/hashpy | /hashpy/md2.py | UTF-8 | 1,772 | 2.84375 | 3 | [
"MIT"
] | permissive | from md2_stable import md2_stable
from hash import Hash
class md2(Hash):
def __init__(self, data=None):
self.hash = 0
self.data = bytearray(0)
self.table = md2_stable()
if data != None:
self.update(data)
def update(self, bytestring):
if type(bytest... | true |
40a71e361e4bcafaa9edbcf9c167523b56c8ffb7 | falipour/Ultrafast-Alignment-free-Viral-Genome-Classification | /Scripts/utils.py | UTF-8 | 4,455 | 2.859375 | 3 | [] | no_license | import numpy as np
from itertools import product
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score
from sklearn.decomposition import TruncatedSVD
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_baye... | true |
c5bd4d1ee6183701272197ef6d86ddda08064a4b | Vanderson10/Codigos-Python-UFCG | /roteir6/banco/banco.py | UTF-8 | 914 | 4.09375 | 4 | [] | no_license | #ler nome do cliente e saldo inicial da conta bancaria
#1 – Sacar, 2 – Depositar, 3 – Encerrar (operações que serão realizadas)
#valor envolvido
#Quando o código 3 for informado, o seu programa deve encerrar e imprimir o saldo final da conta.
#saida: Considere uma precisão de duas casas decimais
#receber a opção e ... | true |
4e8937f89f639ba9d7c8e8d7b022c0d86a68222c | eujuu/Algorithm | /프로그래머스/해시_완주하지못한선수/완주하지 못한 선수.py | UTF-8 | 396 | 2.890625 | 3 | [] | no_license | def solution(participant, completion):
answer = ''
data = dict()
end_data = dict()
for name in participant:
data[name] = 0
end_data[name] = 0
for name in participant:
data[name] +=1
for name in completion:
end_data[name]+=1
for name in end_data:
if d... | true |
0a1f06705a4d98acb8c08074c92c69e84eb21fc8 | costelra/BucketList | /src/main.py | UTF-8 | 3,947 | 3.140625 | 3 | [] | no_license | from tkinter import *
import tkmacosx as tkmac
from typing import overload
from PIL import ImageTk, Image, ImageGrab
from math import ceil
import pandas as pd
root = Tk()
root.title("Bucket List")
def image_resize(root: Tk, img: Image):
max_width = root.winfo_screenwidth()
max_height = root.winfo_screenheight... | true |
4e4ed34383edd9cf732585df1da66947bd25611c | trmrsh/trm-ultracam | /scripts/fcam3d2ucm.py | UTF-8 | 3,526 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
#
# Reads 3D FastCam data, dumps to a series of ucm files.
#
# Author: T.R.Marsh
usage = \
"""
fcam3d2ucm converts a 3D FITS file from FastCam into ucm files. These will
be named according to the root of the FastCam file... | true |
8052600d9333e82fe2cbe677eb574e2a57929517 | RitaWxy/PythonBase | /codeExercise/8_checkCoupon.py | UTF-8 | 776 | 3.65625 | 4 | [] | no_license | '''
time datatime
'''
from datetime import datetime
def checkCoupon(entered_code,correct_code,current_time,expiration_time):
'''
查看优惠券是否有效
:param entered_code: 输入的兑换码
:param correct_code: 正确的兑换码
:param current_time: 现在的时间
:param expiration_time: 优惠券过期的时间
:return: bool 是否有效
'''
curr... | true |
7f5116b1b0f9f4c9a6a8001c83d5ebbdb306389d | erezrubinstein/aa | /weather/weather_data_checks/weather/reasonable_precip_checks.py | UTF-8 | 902 | 2.515625 | 3 | [] | no_license | from core.data_checks.implementation.company_checks.weather.reasonable_weather_check_base import ReasonableWeatherCheckBase
__author__ = 'jsternberg'
"""
http://en.wikipedia.org/wiki/List_of_weather_records
Rain
Most in 24 hours: 1825 mm (71.9 in)
"""
MIN_MM = 0.0
MAX_MM = 1825.0
MIN_IN = 0.0
MAX_IN = 71.9
class Rea... | true |
ac3d58386e16ffb3388bd5ba933b4608f3776233 | munsangu/20190615python | /python_basic/while_test 1.py | UTF-8 | 856 | 3.890625 | 4 | [] | no_license | # treehit = 0
# while treehit < 10:
# treehit = treehit +1
# print("나무를 %d번 찍었습니다."%treehit)
# if treehit == 10:
# print("나무 넘어갑니다.")
# prompt = """
# 1. Add
# 2. Del
# 3. List
# 4. Quit
# Enter number: 4
# """
# number = 0
# while number != 4:
# print(prompt)
# number = int(input("숫자를 입력... | true |
a4dea1cb22ab16522a114420cb10cc4d97a41937 | j4s1x/crashcourse | /Projects/CrashCourse/buffet.py | UTF-8 | 369 | 3.90625 | 4 | [] | no_license | #Tuples..a restaurant buffet has five foods:
#tuples are cool
food = ('steak', 'potatoes', 'carrots', 'salad', 'ice cream')
for food in food:
print (food)
food = ('steak', 'potatoes','rice', 'carrots', 'salad', 'ice cream')
for food in food:
print(food)
#tuples are simple data structures. Use them when it... | true |
80549bcc641f3c935ec418d20969265b3d3edd92 | allthatjazzleo/my_tic_tac_toe_game | /my_tic_tac_toe_game.py | UTF-8 | 2,158 | 3.765625 | 4 | [] | no_license | choices = [[],[],[]]
for numberOfChoices in range (1, 4):
choices[0].append(str(numberOfChoices))
for numberOfChoices in range (4, 7):
choices[1].append(str(numberOfChoices))
for numberOfChoices in range (7, 10):
choices[2].append(str(numberOfChoices))
playerOneTurn = 1
winner = 0
def printBoard() :
... | true |
26f71ed375c4ad4aeeea6f3cd7829e3043ab8b90 | Dyryamo/all | /learnpython/learnpython/shipin/2/_syh~~私有化.py | UTF-8 | 199 | 3.15625 | 3 | [] | no_license | #这个程序展示变量的私有化
class Test(object):
__num=101
def __init__(self):
self.__num = 200
def printf(self):
print(self.__num)
t=Test()
t.__num=300;
print(t.__num)
t.printf()
| true |
491fcf1635531a2de2986a131bc430b303846df7 | benjamin-reichman/YHacks-Intellisurance-Quoting | /website/model_training.py | UTF-8 | 1,863 | 2.515625 | 3 | [] | no_license | import datetime
import numpy as np
import pandas as pd
from sklearn import model_selection
from keras.layers import Input, Dense
from keras.models import Model
from sklearn import preprocessing
from sklearn import neighbors as knn
data = pd.read_csv("extendedData.csv").dropna()
data.reset_index(drop=True, inplace=True... | true |
bd1d61bc01960d5a5918b1afe46ad4a3fced784a | rakesh-negit/PolycrystalGraph | /interpretation_data.py | UTF-8 | 4,942 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 26 10:27:44 2021
@author: daimi
"""
from __future__ import print_function
import numpy as np
import torch
import os
from torch.utils.data import Dataset
from scipy import sparse
class GraphDataSet_interpretable(Dataset):
def __init__(self):
... | true |
59d6576d95fc377d653929024e07dbf4c6235fb6 | M-Oirschot/INFDEV02-1_0910287 | /RPSExtension/RPSExtension/RPSExtension.py | UTF-8 | 2,458 | 3.734375 | 4 | [] | no_license | from random import randint
print("Time for Rock, Paper, Scissors. Write down your choice!")
print("Type 'help' to get an explanation of how the game works.")
userChoice = raw_input("")
if(userChoice == "help"):
print("Simple explanation how to play RPS with lizard & spock added.")
print("paper beats rock")
... | true |
8ebbcc06eacbbad848733a5b99d1160e2457bebe | Backlund/Fret-Calculator | /fret-calculator.py | UTF-8 | 362 | 3.59375 | 4 | [] | no_license |
scale = float(input ("Scale: "))
numfrets = int(input("Number of frets: "))
distance = 0
units = "mm"
if scale < 50:
units = "inches"
for fret in range(1, numfrets+1):
location = scale - distance
scaling_factor = location / 17.817
distance += scaling_factor
print ("Distance to fret {} in {}: {}".... | true |
810071e57374cb8498c38a70475dfc0742b20fd0 | stanford-policylab/surveilling-surveillance | /detection/eval/evaluator.py | UTF-8 | 5,846 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
from . import detection
class DatasetEvaluator:
"""
Base class for a dataset evaluator.
This class will accumulate information of the inputs/outputs (by :meth:`process`),
and produce evaluation results in the end (by :meth:`evaluate`).
"""
def reset(self):
"""
... | true |
cab26d5d60b2d84193b9bbc5f3fb99b43d65ff73 | matheusvictor/estudos_python | /outras_listas_de_exercicios/lista_04/q8.py | UTF-8 | 1,329 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# importando módulo datetime
from datetime import datetime
# armazena informações da data (ano, mês, hora, etc) do método now() na variável dataInfo
dataInfo = datetime.now()
nomeEmpregado = raw_input("Nome do(a) empregado(a): ")
while(True):
anoNasc = int(input("Digite o ano de nascimen... | true |
131e9d1f80f48698dc7c5040c35eac6073198001 | Sreeni34/DropDatabase | /visualize_graph.py | UTF-8 | 3,070 | 3.71875 | 4 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
from graph_structure import *
class VisualizeGraph:
"""
Class allows a L{GraphStructure} object to be displayed in a user-friendly
format.
"""
def __init__(self, gs):
"""
Stores the L{GraphStructure} object to visually display.
... | true |
710468a6645f51678d6f5b98762b74ad9c012e53 | sbyeol3/Algorithm-Study | /LeetCode/Q1-Q500/Q70.py | UTF-8 | 328 | 3.46875 | 3 | [] | no_license | class Solution:
def climbStairs(self, n: int) -> int:
if (n == 1) : return 1
elif (n == 2) : return 2
stair0 = 1
stair1 = 2
for i in range(2,n) :
temp = stair1
stair1 = stair0 + stair1
stair0 = temp
return... | true |
0a68996866a9bb7622c2f07d6170069b27e7d893 | Evandr0/python | /Python para Zumbis/TWP274_Notas.py | UTF-8 | 303 | 3.84375 | 4 | [] | no_license | #Faça um programa que leia quatro nota, mostra as notas e a média na tela
notas = []
i = 1
while i <=4:
n = float(input("Digite a nota: "))
notas.append(n)
i += 1
media = 0
i = 0
while i<=3:
media+= notas[i]
i += 1
print ("Notas:", notas)
print ("Média: ", media/4)
| true |
1d48b4dc5f776bec297daee3fbee651ef369537d | ran0527/Coding | /Leetcode/Majority Element.py | UTF-8 | 975 | 3.640625 | 4 | [] | no_license | # 1 O(n) Time, O(n) Space
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums) / 2
memo = {}
for element in nums:
if element not in memo:
memo[element] = 1
els... | true |
5abd25f0c805b60839510b5a556a8e90a079cf57 | Treinamento-Stefa-IA-DevOps/treinamento-dia-04-08-JessicaSousa | /tarefa/codigo/main.py | UTF-8 | 2,006 | 3.046875 | 3 | [] | no_license | import pickle
from fastapi import FastAPI, Query
from pydantic import BaseModel
from fastapi.responses import JSONResponse
class Response(BaseModel):
survived: bool
status: int = 200
message: str = "success"
app = FastAPI(
title="API de sobrevivência no Titanic",
description="Esta API realiza a ... | true |
6a76806a8e6daf7de014e081b405a0f11d19e99e | erande/TensorFlow-Deeplearning | /8_keras_high_level_api/1_keras_metrics.py | UTF-8 | 2,326 | 2.75 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras import datasets, layers, optimizers, Sequential, metrics
def preprocess(x, y):
x = tf.cast(x, dtype=tf.float32) / 255.
y = tf.cast(y, dtype=tf.int32)
return x, y
batchsz = 128
(x, y), (x_val, y_val) = datasets.fashion_mnist.load_data()
train_db = tf.data.Dat... | true |
764a8bceb1f69e1a50db3bfabd68f247b3b15a25 | cmgn/problems | /kattis/mirror/mirror.py | UTF-8 | 353 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
def main():
t = int(input())
for test in range(t):
n, m = map(int, input().split())
output = []
for _ in range(n):
output.append(input()[::-1])
print("Test " + str(test + 1))
for item in reversed(output):
print(item)
if _... | true |
7e18b4d7509ca8462cb8527ec63a217a071d44d4 | haru-256/toy_problem_GMM.chainer | /utils.py | UTF-8 | 5,090 | 2.6875 | 3 | [] | no_license | import pathlib
import numpy as np
import seaborn as sns
import chainer
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import chainer.backends.cuda
from chainer import Variable
sns.set()
def out_generated(gen, seed, dst, datasize=1000, **kwards):
"""
Trainer extension that plot Generat... | true |
12d42a7e1d4c20f1e21b0b80a4610140fef9be46 | gillesdami/python-sc2-bot-manyminds | /train_locally.py | UTF-8 | 1,853 | 2.53125 | 3 | [
"MIT"
] | permissive | import argparse
import importlib
from sc2 import run_game, maps, Race
from sc2.player import Bot
parser = argparse.ArgumentParser(description='Train a bot against one or many other')
parser.add_argument('--train',
help='Should be <ModelName>/<race>/<map>/<statefile>')
parser.add_argument('--against', nargs='+... | true |
0e3b0cf46a7dec960a7d30a037876847144c9ed0 | sundarseswaran/CarND-Vehicle-Detection | /lane_detection.py | UTF-8 | 4,529 | 3.09375 | 3 | [] | no_license | import cv2
import numpy as np
from lane_finder import *
def radiusOfCurvature(yValues, fitx):
""" Calculate radius of curvature
"""
## define pixel convertions to meter unit
ym_per_pix = 30/720
xm_per_pix = 3.7/700
# calculate radius of curvature
y_eval = np.max(yValues)
fit_cr =... | true |
9c48f416097cdaa2935b79c9b292cb0e48306d69 | DoubleBarrelBirds/sportsipy | /sportsipy/mlb/schedule.py | UTF-8 | 17,509 | 2.71875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import re
from ..decorators import int_property_decorator
from .constants import (DAY,
NIGHT,
SCHEDULE_SCHEME,
SCHEDULE_URL)
from datetime import datetime
from pyquery import PyQuery as pq
from sportsipy import utils
from sports... | true |
a24c64a012a1d31b028a52a6d8174ba3b6145eba | tagfa/yukicorder | /No5.py | UTF-8 | 1,206 | 3.484375 | 3 | [] | no_license | '''
yukicorder
No.5 数字のブロック
Ellenは数字のブロックで遊ぼうとしている。
数字が書かれているブロックはそれぞれ高さ1で幅はWiである。
(同じ幅のブロックが複数存在することがある。)
それらのブロックを高さ1,幅Lの箱の中に入れる。
Ellenは大きな箱にどれだけブロックがたくさん入るか気になったが。
組み合わせがたくさんあって大変なことに気づいて、すぐに夜になってしまいそうである。
あなたは、代わりに大きな箱に最大何個のブロックが入るかを求めてください。
入力
L
N
W1W2W3…WN
1行目は、大きな箱の幅を表すL(1≤L≤10000)
が与えられます。
2行目は、ブロックの数を表すN(1... | true |
34001ff899981e3f7b95589bfeef133f340be210 | zouliping/pythonChallange | /6/6.py | UTF-8 | 746 | 2.5625 | 3 | [] | no_license | import string,re,zipfile,os
prefixUrl = 'F://6/python challange/channel/'
suffixUrl = '.txt'
zip_file = zipfile.ZipFile(r'F://6/python challange/channel.zip','r')
comments = ''
num = '90052'
numlist = []
def getNum(url):
f = open(url,'r')
str = ''
for line in f:
str = "%s%s" %(str,line)
#print s... | true |
ee67580a7cbe1e693a67859a7ecb3c03568e7bc9 | abaker2010/python_design_patterns | /flyweight/flyweight.py | UTF-8 | 1,693 | 4 | 4 | [] | no_license | """
Flyweight
- A space optimization technique that lets us use less memory by
storing externally the data associated with similar objects
Motivation
- Avoid redundancy when storing data
- E.g., MMORPG
- Plenty of users with identical first/last names
- No sense in storing same first/last name over and over agai... | true |
f12c19d853828d03ce17009c3b69f7935d738191 | HSx3/TIL | /algorithm/day09/day9-A/power2.py | UTF-8 | 298 | 3.75 | 4 | [] | no_license | def power(base, exponent):
if exponent == 0 or base == 0:
return 1
if exponent % 2 == 0:
newbase = power(base, exponent/2)
return newbase * newbase
else:
newbase = power(base, (exponent-1)/2)
return (newbase * newbase) * base
print(power(2, 10)) | true |
12458fe9173fce3ac360b39194fada3a3bf06567 | mr6r4y/penlib | /crawl_domains.py | UTF-8 | 1,430 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import json
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from distutils.spawn import find_executable
from pwn import *
from selenium.common.exceptions import TimeoutException
CHROME_PATH = find_executable('google-chrome')
CHROMEDRIVER_PATH... | true |
fde31cb55a6476868f9460c4879678f001821036 | sunchenglong/python-learn | /src/sse/UpdateAlldata.py | UTF-8 | 2,122 | 2.90625 | 3 | [] | no_license | import datetime
from SseCraw import SseCraw
from RandomCrawl import RandomCrawl
import MySQLdb
from CleanDataDate import CleanDataDate
class UpdateAlldata:
def __init__(self):
self.db = MySQLdb.connect("localhost", "root", "root", "sse", charset='utf8')
self.cursor = self.db.cursor()
self.c... | true |
25be80a1f67b92723939d7e5f3fd4f01c7c013ec | embatbr/goto-project | /goto/commands.py | UTF-8 | 5,058 | 3.390625 | 3 | [
"WTFPL"
] | permissive | """Module defining the commands `goto` and `label`."""
import argparse
import os
import sys
from storage import Storage, StorageError, NotDirectoryError, format_label
TEMP_FILE = '/tmp/goto'
class Goto(object):
"""Defines command `goto`."""
def __init__(self, storage=Storage()):
"""Creates a Got... | true |
5fd9bd57cd80089a61ba7c039b36fe74795083d5 | 408824338/work | /python/source/class/show.py | UTF-8 | 204 | 2.96875 | 3 | [] | no_license | from student import Student
#实例化
student = Student('王八',20)
#student.__init__('张三',11) #在外部可以调用__init__()
student.print_file()
print(student.name)
print(student.age)
| true |
260e853306078ea575bafaeb6530b2ff857343da | Nerucius/1718.multimedia | /project/backup/main.py | UTF-8 | 4,355 | 2.671875 | 3 | [
"MIT"
] | permissive | import sys, zipfile, os
import argparse
import pygame
import time
import numpy as np
from scipy import signal
from cStringIO import StringIO
from effects import *
from natural_sort import sort_nicely
white = (255,255,255)
black = ( 0, 0, 0)
def get_frame(f):
next_frame = f % len(zip_images)
img_data = z... | true |
c9ca2267cd93f86214497b3e68e0fff8f775da3a | paulog/lpthw | /ex13.py | UTF-8 | 292 | 3.375 | 3 | [] | no_license | from sys import argv
script, first, second, third = argv
print "The script is called:", script
name = raw_input("What is your name? ")
print "%s, your first variable is:" % name, first
print "%s, your second variable is:" % name, second
print "%s, your third variable is:" % name, third
| true |
3db7f33ab4753804e02dcf4e03b85ffec426d3b1 | Aetheya/ebpf_monitor_IoT | /collector_server.py | UTF-8 | 622 | 2.96875 | 3 | [] | no_license | """
Naive statistics collector server
"""
import socket
import json
def main():
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
sock.bind(('', 10002))
while True:
print('Waiting data to collect...\n')
data, server = sock.recvfrom(4096)
if data:
... | true |
68a5455c122cc86f51de0c5b1407d62080e4a759 | nguyentrantuan/Twitter-Stream-NoSQL | /Tweets-Listener.py | UTF-8 | 3,451 | 2.640625 | 3 | [] | no_license |
#Import the necessary methods from tweepy library
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import json
import boto3
import boto.dynamodb2
from boto.dynamodb2.table import Table
from boto.dynamodb2 import connect_to_region
from boto.provider impor... | true |
f0e38589dfa61b93ea961ee516a4f7466da02fc6 | amisr/overspread | /src/Madrigal/cgi-bin/getInstrumentsService.py | UTF-8 | 7,120 | 2.625 | 3 | [] | no_license | #!/Users/mnicolls/Documents/Work/Madrigal/bin/python
import sys, os, traceback
import cgi
import time
class getInstrumentsService:
"""getInstrumentsService is the class that allows remote access to the "getInstruments.py":../scripts/getInstruments.py.html script.
Like all my python cgi scripts, getInst... | true |
9292280891124c5473cc06c80fc136d8ca918f83 | vasco989k/python_ml4nlp | /day9_cnn/textcnn.py | UTF-8 | 1,851 | 2.84375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class TextCNN(nn.Module):
def __init__(self, embedding_dim, num_words, num_filters,
num_classes, pretrained_wordvec, dropout_ratio=0.5):
super(TextCNN, self).__init__()
self.embed = nn.Embedding(num_words, embed... | true |
4ca1547c5eb50b5618876938ef7544fa929b4201 | ryanermita/kaizend | /session-5/extra_challenge5.py | UTF-8 | 920 | 3.25 | 3 | [] | no_license | from contextlib import contextmanager
class Job:
def __init__(self, label):
self.label = label
self.target_url = None
self.selector = None
self.save_file = None
def do_something(self):
print(f"[START {self.label}]")
print(f"[URL {self.target_url}")
prin... | true |
6e0bbaa1bb28ff90cd5c4da9060561c0619faec6 | marybm-dev/LeetCode | /wholeSq.py | UTF-8 | 239 | 3.1875 | 3 | [] | no_license | def wholeSq(A, B):
low = 0
if A < 0:
low = 0
else:
low = A
perf_sq = 0
for num in range(low,B):
if math.sqrt(num).is_integer():
perf_sq += 1
return perf_sq
print wholeSq(4, 17) | true |
e7b94bc9c88cc9fe37806c6da83af2cacf2d0af2 | masipcat/Informatica | /Q1/s1/primer.py | UTF-8 | 104 | 3.671875 | 4 | [] | no_license | d1 = input("Primer nombre: ")
d2 = input("Segon nombre: ")
print "El resultat de la divisio es:", d1/d2
| true |
0a6080e0197966c6840391d5447d900b1523bbce | CarsonScott/Evolutionary-Logic-Learning | /src/lib/util.py | UTF-8 | 1,988 | 2.890625 | 3 | [] | no_license | from goodata import Dict
from lib.types import *
from lib.functions import *
import numpy as np
from random import randrange as rr
import utilities
import math
def merge(space='', strings=[]):
y = ''
c = 0
for s in strings:
if isinstance(s, list):
s = merge(space, s)
y += str(s)
if c < len(strings)-1:
... | true |
b6046b6e5d472d1d5efdae4f2ec0334894535f89 | feiyue2022/nsd2010 | /nsd2021/NSDVN2010/exec/day20/url1.py | UTF-8 | 365 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
from urllib import request
url = 'http://www.baidu.com'
r = request.urlopen(url) #r是一个对象
# print(r.read()) #获取r的结果,类型为字节串
# print(r.read().decode()) #获取r的结果,类型为字符串
#保存到本地
with open('baidu.html','wb') as fobj:
fobj.write(r.read()) | true |
df8c3c39c65c388f152ee97ee44d21895358b7d1 | xioperez01/holberton-system_engineering-devops | /0x15-api/1-export_to_CSV.py | UTF-8 | 1,112 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
"""
Export data in the CSV format.
"""
import csv
import requests
from sys import argv
if __name__ == '__main__':
users = requests.get("http://jsonplaceholder.typicode.com/users")
todos = requests.get("http://jsonplaceholder.typicode.com/todos")
for user in users.json():
if use... | true |
5afce46e0e755c8dd7101eb9c3364836b0c033c9 | wkpk11235/games | /PixelBulletDoge/game.py | UTF-8 | 6,087 | 2.53125 | 3 | [] | no_license | DEBUG=True #launches debugger
framerate=60 #best
import pygame,pixelperfect,os,sys;pygame.init()
scrwidth,scrheight=(500,500)
curdir=os.path.dirname(sys.argv[0])
class Bullet(object):
def __init__(self,xpos,ypos,image,boxfit=False):
self.boxfit=boxfit
self.image=pygame.image.load(curdir+"\\sprites... | true |
cc650af327ad4825614098aa2faf52eca9364ed5 | madiou/advent-of-code-2020 | /Day12/ex12_2.py | UTF-8 | 1,623 | 3.703125 | 4 | [] | no_license | import sys
instructions = []
for line in sys.stdin:
line = line.rstrip('\n')
instructions.append((line[0], int(line[1:])))
# Starting coordinates
x, y = 0, 0
# Starting waypoint
w_x, w_y = 10, 1
def process(old_x, old_y, old_w_x, old_w_y, instruction):
action, value = instruction
if action == 'N':
... | true |
d2d40d43cdf92a8b853a441fe4602662813e424d | XJC552464955/Program | /Python学习/实例/单例模式.py | UTF-8 | 411 | 3.09375 | 3 | [] | no_license | class A(object):
instance = None
flag = False
def __new__(cls, *args, **kwargs):
#判断对象是否为空
if cls.instance is None:
cls.instance = super().__new__(cls)
return cls.instance
#TODO 让初始化只执行一次
def __init__(self):
if not self.flag:
print("a")
... | true |
421598e2334564acf1104c2d974db679e71e627a | Mirelda/Bestcloudfor.me | /main.py | UTF-8 | 674 | 2.609375 | 3 | [] | no_license | from flask import Flask, jsonify, request
import requests as req
app = Flask(__name__)
@app.route("/")
def index():
return "<h1>Mirelda Diker<h1>"
@app.route('/whoami', methods = ['GET'])
def whoami():
x = request.args
return jsonify({'firstname': x.get('firstname','Mirelda'),
'lastname':x.g... | true |
014b7a5a196941ade5a344ffcbce5b42fb734fdf | mojishoki/atpcurr | /deps/awarelib/awarelib/rl_misc.py | UTF-8 | 1,026 | 3.71875 | 4 | [] | no_license | import numpy as np
def linearly_decaying_epsilon(decay_period, step, warmup_steps, epsilon):
"""Returns the current epsilon for the agent's epsilon-greedy policy.
This follows the Nature DQN schedule of a linearly decaying epsilon (Mnih et
al., 2015). The schedule is as follows:
Begin at 1. until warmup_st... | true |
3c570d5c240165c1c092d2d0d415e7c1ab62005c | gsi-upm/soil | /soil/agents/SISaModel.py | UTF-8 | 3,385 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from hashlib import sha512
from . import Agent, state, default_state
class SISaModel(Agent):
"""
Settings:
neutral_discontent_spon_prob
neutral_discontent_infected_prob
neutral_content_spon_prob
neutral_content_infected_prob
discontent_neutral
... | true |
88ca58cb13f529a930b3608b985a0617e39b2fee | maribies/python_passion_project_app | /python_passion_project/tests/test_Scraper/test_create_designer.py | UTF-8 | 637 | 2.75 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from scraping import CreateDesigner
from retail_app.models import Designer
class TestCreateDesigner(TestCase):
def setUp(self):
self.name = "Issey Miyake"
self.url = "https://www.shopbaobaoisseymiyake.com/"
def test_create_designer(self):
designer = Cr... | true |
6e6f13b79211c2b6ebc242c03776b4cc36056aaf | omaspelikan/phpwebserver | /rocket_game/setting.py | UTF-8 | 410 | 2.953125 | 3 | [] | no_license | class Setting():
def __init__(self):
""" initial game setting """
self.bg_color = (0,0,0) # 背景顏色
self.width =1200
self.height=800
self.speed_factor=5.5
""" initial bullet """
self.bullet_speed_factor = 15
self.bullet_height = 3
self.bulle... | true |
b0ff6cc7cd4510e8a9950b02095f57a7b9a0d4c8 | bbrecht02/aprendendo.py | /listafinal/01.py | UTF-8 | 200 | 3.375 | 3 | [] | no_license | salario= float(input("digite quanto tu ganha bença? "))
porc= int(input("digite a porcentagem de aumento: "))
print(f" Aumento: {(porc*salario)/100} novo salario: {(porc*salario)/100+salario}")
| true |
0a82d52d3bab315e79c3c9800c7f371de7cee79d | opencivicdata/scrapers-us-municipal | /archive/albuquerque/people.py | UTF-8 | 2,334 | 2.640625 | 3 | [
"MIT"
] | permissive | from pupa.scrape import Scraper, Legislator, Committee
import lxml.html
class PersonScraper(Scraper):
def lxmlize(self, url):
entry = self.urlopen(url)
page = lxml.html.fromstring(entry)
page.make_links_absolute(url)
return page
def get_people(self):
yield self._scrap... | true |
7328ea036e0f771c4595e27400602582a5556c1a | RoutinoDesigns/LPTHW | /ex15.py | UTF-8 | 148 | 2.90625 | 3 | [] | no_license | from sys import argv
script,filename=argv
prompt = ">"
txt=open(input(prompt))
print(f"Here's your file {filename}:")
print(txt.read())
txt.close()
| true |
502bbc33e0ca8994dbc7f5be136e33b9f54fdd12 | emanueel-c/CODES.py | /5. listas/listas.py | UTF-8 | 418 | 4.21875 | 4 | [] | no_license | '''
Listas em Python
FATIAMENTO
append, insert, pop, del, clear, extend, +
min, max
range
'''
#texto = 'valor'
#lista = [1,2,3,4, 'Luiz Otávio', True, 10.5]
string = "ABCDE"
# 0 1 2 3 4
lista = ['A', 'B', 'C', 'D', 'E']
# - 4 3 2 1 0
print(lista[0:3]) # fatiamento
print(stri... | true |
f9337ffc1b06a51087602261ad430f1670e89574 | abditimer/mcompare | /mcompare/model_wrapper.py | UTF-8 | 4,540 | 2.71875 | 3 | [
"MIT"
] | permissive | # --------------------------------------------------------------
# Helper Function python script
# --------------------------------------------------------------
# general python packages
import pandas as pd
import numpy as np
__VERSION__ = '0.0.1'
__CREATOR__ = 'Abdi_Timer'
# -----------------------------------... | true |
5d8bc36361d3b1c77bfd0fc716dd88621dc6cc24 | fenwk0/TraderStore | /solution/reporting_app/application.py | UTF-8 | 1,237 | 2.546875 | 3 | [] | no_license | """
Reporting web application
=========================
1. Get a running client to connect to a Market web service. You have two options:
do it by hand which will require a lot of boiler plate code or generate
a client using swagger.
2. Allow the web service to be configured with a list of book services
3. Exp... | true |
298462874d5b98b3b3e036532cad86843aff0f04 | rfpremier/ah-django | /authors/apps/profiles/tests/test_unfollow.py | UTF-8 | 3,188 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | """
this file contains all tests pertaining unfollowing
"""
# import json
from rest_framework.test import APITestCase, APIClient
from rest_framework.views import status
import json
# import pdb
class RegistrationTestCase(APITestCase):
def setUp(self):
self.client = APIClient()
self.user_1 = {
... | true |
132b89fab672457184278fa57d78a5a68b455542 | nordsieck/python-problems | /leetcode/test_22.py | UTF-8 | 1,088 | 3.6875 | 4 | [] | no_license | import unittest
from typing import *
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
stack, result = [], []
stack.append((["("], 1, 0)) # text, # of (, # of )
while len(stack) > 0:
curr = stack.pop()
if curr[1] == n:
for _ in rang... | true |
8fbb9ef7f43cbd740e4600a271e4c9c9955b70da | MoyTW/7DayRoguelike | /Drone/level/level.py | UTF-8 | 2,573 | 3.1875 | 3 | [] | no_license | __author__ = 'Travis Moy'
import math
import warnings
from tile import Tile
class Level(object):
TILES_ACROSS = 2
def __init__(self):
self.all_entities = []
self.tiles = [[Tile() for _ in range(self.TILES_ACROSS)] for _ in range(self.TILES_ACROSS)]
# Returns the cell at x, y; otherwise... | true |
9679e36af4eee9a7e1738fc5a44148c9d2b51fca | KshitijSangar217/AutoMailSystem_using_Python | /AutoBulkMail.py | UTF-8 | 2,133 | 3.046875 | 3 | [] | no_license | import pandas as pd
import smtplib
from email.message import EmailMessage
import imghdr
file = pd.ExcelFile("YourExcelFile.xlsx") # ADD your Excel file ******************************
count = 1 # SrNO
# Email Setup
s = smtplib.SMTP("smtp.gmail.com", 587)
s.starttls() # Traffic encryption
s.login("You... | true |
db62dddbbd2829834ff61b1606b1eeab157e82bf | TScafeJR/nba-kevin-bacon | /src/write_gml_file.py | UTF-8 | 2,320 | 2.859375 | 3 | [] | no_license | import json
from helper_methods import create_split_list_vals
player_data_file = open('src/data/output.json')
player_data = json.load(player_data_file)
def get_nodes(file_data):
return [{'id': i, 'label': player['name'].replace('*', '') + ' ' + player['bref_id'], 'bref_id': player['bref_id']} for i,player in en... | true |
0c24692fbe6a83b4479b9ba2f568d97a5685e28c | pi408637535/Algorithm | /com/study/algorithm/dp/sequence/Word Break.py | UTF-8 | 1,026 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/7/17 09:53
# @Author : piguanghua
# @FileName: Word Break.py
# @Software: PyCharm
import numpy as np
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
n = ... | true |
4ac2b911cae9a176c79445b3401e2e26993a978f | uziel123/modules | /pico_status.py | UTF-8 | 6,391 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
#####################################################################################
# pico_status_hv3.0.py
# updated: 20-01-2017
# Script to show you some statistics pulled from your UPS CASI HV3.0A
#####################################################################################
# SET... | true |
c1ff32b7dbebb7a31a1b40dd99b160e08352b066 | rajul1306/python_lab | /anagram.oy.py | UTF-8 | 133 | 3.078125 | 3 | [] | no_license | str1 = char('enter string')
str2 = char('enter string')
if str1 == str2:
print("anagram")
else:
print("not anagram")
| true |
da1b35fd641efd928c09d472316a4357e08982af | christianstowers/project_docs | /python/area_calc.py | UTF-8 | 1,043 | 4.03125 | 4 | [] | no_license | '''
This is a calculator that will be able to determine the area of circles and triangles.
The user will select a shape and the calculator will calculate the area of the shape selected.
'''
from math import pi
from time import sleep
from datetime import datetime
now = datetime.now()
print "The calculator is starting ... | true |
580e8b76e43c3d7f1cdf5692b78051d7854e7d3e | anvesh2502/Leetcode | /Partition_List.py | UTF-8 | 1,220 | 3.171875 | 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 reverse(self,curr,prev=None) :
if curr==None : return prev
next=curr.next
curr.next=prev
return self.reverse(n... | true |
3e1e2805895601e1b16bbde60c7194bd2612cb20 | joeatbayes/StockCSVAndSMAPerformanceComparison | /testParseBarFileVector.py | UTF-8 | 1,333 | 2.609375 | 3 | [
"MIT"
] | permissive | import os.path
import os
import time
import sys
def curr_ms():
return time.time() * 1000.0
def elap(msg, start, end):
print "\n",msg, " elap=", end - start
def average(marr):
tot = 0.0
for aFloat in marr:
tot += aFloat
return tot / len(marr)
def do_main_test(fi_name):
beg_time = curr_ms()
run_start = ... | true |
47bc24237b852b6b87cbb4960724fbfab1d582e7 | mengyujackson121/CodeEval | /reverse_groups.py | UTF-8 | 573 | 3 | 3 | [] | no_license | import sys
def main():
lines = open(sys.argv[-1], 'r').readlines()
for line in lines:
num_line, sprit_num = line.strip().split(';')
num_list = num_line.strip().split(',')
int_split = int(sprit_num)
list_piece = []
while int(len(num_list)) >= int_split:
next... | true |
e68feb729ce7be2ce3e04fa4a46bcba18bb1d2ca | SMS-NED16/crash-course-python | /python_work/chapter_6/exercises/6_5_rivers.py | UTF-8 | 794 | 4.71875 | 5 | [] | no_license | #making dictionary of rivers and their countries
rivers = {
'indus' : 'pakistan',
'ganges' : 'india',
'nile' : 'egypt'
}
#Print a sentence about each river
print("Print a sentence about each river".upper())
for river, country in rivers.items():
print("The " + river.title() + " runs through " +
country.title() + ... | true |
f000c36dd4a4d79f9a42f7e1ec0fc60110a718c5 | sphippen/uofu-compilers-tests | /proj3/tests/decorator-chained.py | UTF-8 | 281 | 3.09375 | 3 | [] | no_license | def decoratorA(func):
def wrapped():
return "from decorator A!"
return wrapped
def decoratorB(func):
def wrapped():
return "from decorator B!"
return wrapped
@decoratorB
@decoratorA
def decorated():
return "from decorated"
print(decorated())
| true |