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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a943f3d1dfc2078095d3139b29321bf241247bde | Python | TheCodingMonkeys/checkin-at-fmi-client | /setup_manager.py | UTF-8 | 1,629 | 2.6875 | 3 | [] | no_license | import os.path
import urllib, urllib2, time
from datetime import datetime
import sqlite3 as lite
class Setup_Manager:
def __init__(self, server_address, reading_device, mac):
self.server_address = server_address
self.reading_device = reading_device
self.mac = mac
self.io_works = ... | true |
60e92cab940356323841686d96646ac14020e0bc | Python | sushruta/cs231n_vision | /assignment2/cs231n/layers.py | UTF-8 | 10,434 | 3.296875 | 3 | [
"MIT"
] | permissive | import numpy as np
def affine_forward(x, w, b):
"""
Computes the forward pass for an affine (fully-connected) layer.
The input x has shape (N, d_1, ..., d_k) where x[i] is the ith input.
We multiply this against a weight matrix of shape (D, M) where
D = \prod_i d_i
Inputs:
x - Input data, of shape (N, ... | true |
9ac2388460f5947cf64cd4338b49d3d1d7015776 | Python | santosfamilyfoundation/Traffic | /trafficintelligence/scripts/init_tracking.py | UTF-8 | 2,584 | 2.828125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
import sys, argparse, os.path, storage, utils
from cvutils import getImagesFromVideo
from matplotlib.pyplot import imsave
# could try to guess the video
# check if there is already a tracking.cfg file
parser = argparse.ArgumentParser(description='The program initilizes the files for tracking: ... | true |
ed3f51b381e8164a3b71ab670edda71bde50cd80 | Python | ZivGrinblat/ImageProcessingProjects | /Projects/ExerciseOne.py | UTF-8 | 8,979 | 2.796875 | 3 | [] | no_license | import numpy as np
import imageio
import matplotlib.pyplot as plt
from skimage.color import rgb2gray
r_to_y = np.array([[0.299, 0.587, 0.114],
[0.596, -0.275, -0.321],
[0.212, -0.523, 0.311]])
y_to_r = np.array([[1, 0.956, 0.619],
[1, -0.272, -0.647],... | true |
82081e02517bacf210027ccbd7c43c56b70539c6 | Python | antonellaBerchesCj/python-exercises | /2_client.py | UTF-8 | 811 | 3.359375 | 3 | [] | no_license | '''
2. [net] Write a client / server pair of sources in which the client requests random numbers of a specific number of digits from the server.
'''
# Client
#!/usr/bin/env python
import socket
import string
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 1024
client_socket = socket.socket(socket.AF_INET, socket... | true |
892eae8642e86e6c69f227c3654a5153271be85a | Python | fuyunguagua/mafengwoqainfo | /qa/restract.py | UTF-8 | 3,599 | 2.671875 | 3 | [] | no_license |
__author__ = 'WY'
import re
from scrapy.selector import Selector
def filter_text2(text,flags):
for item in flags:
if text.find(item) is -1:
pass
else:
text = text.replace(item,' ')
return text
def restract(regex, text, func=None):
pattern = re.compile(regex,re.S)
... | true |
86fec3e617beb71f861e1c84d52b7d80da69603b | Python | TejasAvinashShetty/qm-computing-projects | /cp6/cp6.py | UTF-8 | 2,899 | 2.640625 | 3 | [] | no_license | #
# cp6: Solution to Computing Project 6: Quantum Wire Project
#
from visual import *
from visual.graph import *
from safcn import SetArrowFromCN # defined in a file safcn.py
gd = gdisplay(title="<x> vs. t", xtitle="t", ytitle="<x>",
foreground=color.black, background=color.white)
... | true |
5a3c950bc940b6ed8260389e68350c3c476302f3 | Python | bonbonben/BigData | /Parking violations/Task 3/map.py | UTF-8 | 303 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import csv
import os
import string
reader=csv.reader(sys.stdin,delimiter=',')
#license_type is at the third column
for type in reader:
key=type[2]
try:
value=float(type[12])
except ValueError:
continue
print ('{0:s}\t{1:f}'.format(key,value)) | true |
73d3f3aa8cd9ab6c0248932a1901e1ad13b072b2 | Python | xiwang-chen/encryption_and_decryption | /各种算法/五、加密库pycryptodomex/3、AES.py | UTF-8 | 2,254 | 3.359375 | 3 | [] | no_license | '''
高级加密标准(英语:Advanced Encryption Standard,缩写:AES),在密码学中又称Rijndael加密法,
是美国联邦政府采用的一种区块加密标准。这个标准用来替代原先的DES,已经被多方分析且广为全世界所使用。
经过五年的甄选流程,高级加密标准由美国国家标准与技术研究院(NIST)于2001年11月26日发布于FIPS PUB 197,
并在2002年5月26日成为有效的标准。2006年,高级加密标准已然成为对称密钥加密中最流行的算法之一。
AES在软件及硬件上都能快速地加解密,相对来说较易于实作,且只需要很少的存储器。
作为一个新的加密标准,目前正被部署应用到更广大的范围。
特点... | true |
2981eb45c3d96b682b7159a5e7daac26cb0b77c4 | Python | ellisk42/ec | /dreamcoder/domains/misc/napsPrimitives.py | UTF-8 | 8,258 | 2.53125 | 3 | [
"MIT"
] | permissive | #napsPrimitives.py
from dreamcoder.program import Primitive, prettyProgram
from dreamcoder.grammar import Grammar
from dreamcoder.type import tlist, tint, arrow, baseType #, t0, t1, t2
#from functools import reduce
#types
PROGRAM = baseType("PROGRAM")
RECORD = baseType("RECORD")
FUNC = baseType("FUNC")
VAR = baseT... | true |
8993e0499226fed2162532546b19ba566715c6e8 | Python | syahrulhamdani/randomiser | /src/randomiser/__init__.py | UTF-8 | 1,637 | 2.8125 | 3 | [
"MIT"
] | permissive | import requests
from requests.exceptions import RequestException
from randomiser.config import RESOURCE_TO_ENDPOINT
from randomiser.exception import ResourceNotFound, RandomizerReadError
class Randomizer:
"""A random generator class of anything.
For detailed resources see here:
https://random-data-api.c... | true |
b20990452bf9eba76bd20283fccdb1f0d4671915 | Python | SilviaSanjose/Portal_Anuncios_Flask | /clases/modelo.py | UTF-8 | 371 | 2.578125 | 3 | [] | no_license |
class Anuncio():
def __init__(self, nombre = "", categoria = "", precio = 0.0, descripcion = "", envio = "", contacto = "", num_id= 0 ):
self.nombre = nombre
self.categoria = categoria
self.precio = precio
self.descripcion = descripcion
self.envio = envio
sel... | true |
463c4eae1ef1a69cf3255480c8af1fbf55fd849d | Python | cragod/CYWidgets | /cy_widgets/exchange/order.py | UTF-8 | 4,535 | 2.96875 | 3 | [
"MIT"
] | permissive | import math
from enum import Enum
from functools import reduce
from cy_components.utils.coin_pair import CoinPair
class OrderSide(Enum):
BUY = 'buy' # 多
SELL = 'sell' # 空
CLOSE = 'close' # 平
class OrderType(Enum):
MARKET = 'market' # 市价
LIMIT = 'limit' # 限价
class Order:
"""订单类... | true |
82b2c38e4a973d306202896aa78feceac3aad82d | Python | jhchiu1/weather_api | /weatherapi.py | UTF-8 | 601 | 2.96875 | 3 | [] | no_license | # Weather API
# Code sample from https://www.wunderground.com/weather/api/d/docs?d=resources/code-samples&MR=1
import urllib.request
import json
# URL where API is called
call = urllib.request.urlopen('http://api.wunderground.com/api/66bc345f90882b9f/geolookup/conditions/q/CA/San_Jose.json')
json_string = call.read()... | true |
bed3649da136c17559de9175ea4293d049d665b0 | Python | guymatz/gcf | /gcf.py | UTF-8 | 1,809 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
import sys
import math
if len(sys.argv) < 3:
print "Please enter two numbers to find their GCF"
exit(1)
num1 = int(sys.argv[1])
num2 = int(sys.argv[2])
def gcf(num1, num2):
# Sadie said to find prime factors
num1_pfs = find_prime_factors(num1)
#print "PFs for num1 = ", ... | true |
d16eccf331c14d366e3527538eb00c91bdda600f | Python | Nellrun/VyatSU | /6 Семестр/Параллельное программирование/Лабы/lab_1/main.py | UTF-8 | 163 | 3 | 3 | [] | no_license | import numpy as np
def makeMatrix(h, w):
m = np.arange(1, h*w)
np.random.shuffle(m)
m = np.append(m, 0)
return np.reshape(m, [h, w])
print(makeMatrix(3, 4)) | true |
ce5c7f582e1eed8987abf0ef9e3e27808d378a24 | Python | tjbotfan/tbf7 | /ch11/OLED.py | UTF-8 | 2,747 | 2.6875 | 3 | [] | no_license | # coding: utf-8
import sys
import Adafruit_SSD1306
import time
# import Image
# import ImageDraw
# import ImageFont
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
# argument
args = sys.argv
sel = args[1]
# Raspberry Pi pin configuration
RST = 1
# Initialise Libraly
disp = Adafruit_SSD1306.... | true |
9906a1841420a549ee874f1ccc119b07a15a6087 | Python | chengzi-lizi/CHENGZI | /009.py | UTF-8 | 323 | 3.5 | 4 | [] | no_license | # coding=utf-8
def josephus(n,k):
loop = [number for number in (range(1,n+1))]
a = 0
while True:
b = loop.pop(0)
a += 1
if a == k:
a = 0
continue
loop.append(b)
if len(loop) == int(k-1):
print(loop)
break
josephus(50,3... | true |
d3367ce3ff03acf83a9e1f9fba552f8227f4514c | Python | iontrapnet/LaF | /Jupyter/mktemp.py | UTF-8 | 85 | 2.53125 | 3 | [] | no_license | import tempfile
f = tempfile.NamedTemporaryFile(delete=False)
f.close()
print(f.name) | true |
3148a6f5701ff59f51059d38649e45ffcc4ea0d2 | Python | 7kbird/learning_notes | /yama/vision/datasets/storage.py | UTF-8 | 1,152 | 2.828125 | 3 | [] | no_license | import os
class Storage(object):
"""An abstract class represent an image storage
All image storage should subclass it. All subclasses should override
``root``, that provide the storage path for the source
"""
def root(self, source_name):
raise NotImplementedError()
class PaperSpaceGrad... | true |
000054715378a31a14aa80eb1bc2001b226f6979 | Python | alexartwww/python-faq | /classes.py | UTF-8 | 232 | 3.171875 | 3 | [] | no_license | class A(object):
def __init__(self):
self.a = 1
class B(object):
def __init__(self):
self.a = 2
class C(A, B):
def __init__(self):
self.a = 3
super().__init__()
obj = C()
print(obj.a)
| true |
117f69511983ec3daa2fea742ba748f4998f53d0 | Python | Spartabariallali/API_json | /python_json_one.py | UTF-8 | 1,124 | 4.1875 | 4 | [] | no_license | #import json
import json
car_data = {"name": "tesla",
"engine":"electric"}
print(car_data)
print(type(car_data)) # <class dict>
# json.dumps changes python dictionary to json string
car_data_json_string = json.dumps(car_data)
print(type(car_data_json_string)) # returns <class string>
# removes the ... | true |
8548afd816222be6dd5c41a0ae87969177aa85a6 | Python | cryptomental/megaphone | /megaphone/post.py | UTF-8 | 4,368 | 2.828125 | 3 | [
"MIT"
] | permissive | import json
import time
from contextlib import suppress
from dateutil import parser
from piston.steem import Post as PistonPost
from megaphone.helpers import parse_payout, time_diff
from megaphone.node import Node
class PostError(RuntimeError):
pass
class Post(PistonPost):
"""
Piston Post enhanced with... | true |
3f12c17196541dc6c673bb8197ea24591835244f | Python | malidrsn/OpenCV-Tutorial-w-Basic-Examples | /cizim/cizim.py | UTF-8 | 1,229 | 3.234375 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
canvas = np.zeros((512, 512, 3), dtype=np.uint8) + 255 # +255 dersek canvasın rengini beyaza çevirir
# print(canvas)
cv2.line(canvas, (50, 50), (512, 512), (255, 0, 0), thickness=5)
cv2.line(canvas, (100, 50), (200, 250), (0, 0, 255), thickness=1)
cv2.rectangle(canvas, (20, 20), (50,... | true |
72d7d81e52ef7b8e847a82cc710f2b547df7b4f3 | Python | green0range/IoT-ecosanctuary-web-monitoring-collector | /main.py~ | UTF-8 | 3,130 | 2.953125 | 3 | [] | no_license | #! /usr/bin/python
# Imports
import time
import serialinterface
import server
from threading import Thread
# This system creates 2 threads, 1 to constantly check for new data, and 1 to process already found data.
# Multi-threading is used so that the collector doesn't miss any new data while processing older data.
... | true |
91ca1270f290843e1ed92d22d41c2519d15b0f45 | Python | obround/ppci | /test/graph/test_relooper.py | UTF-8 | 1,239 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive | """ Test algorithms which reconstruct structured flow blocks from cfg """
import unittest
import io
from ppci.graph import relooper
from ppci import irutils
class RelooperTestCase(unittest.TestCase):
def test_return_from_loop(self):
""" Check the behavior when we return from within a loop """
mod... | true |
ba2ff42e7b24d2fcbd26ac7880f07b567c25b295 | Python | cligmanowski/work-at-olist | /work-at-olist/olistconnect/management/commands/importcategories.py | UTF-8 | 2,685 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import csv
from django.core.management.base import BaseCommand, CommandError
from django.db.utils import IntegrityError
from olistconnect.models import *
class Command(BaseCommand):
help = ' Import categories from specified CSV file '
channelObj = None
def add... | true |
94852969a654216ec5227cc40ea847743bab3abf | Python | macoto35/Algorithms_Kata | /python/pythonds/8_graphsAndGraphAlgorithms/test_graph_impl_edge_list.py | UTF-8 | 4,558 | 3.234375 | 3 | [] | no_license | import unittest
from graph_impl_edge_list import EdgeListGraph
class TestGraphImplEdgeList(unittest.TestCase):
def setUp(self):
self.g = EdgeListGraph()
def test_undirected_unweighted(self):
arr = [('A', 'D', 1), ('A', 'C', 1), ('B', 'C', 1), ('C', 'D', 1), ('C', 'E', 1)]
for fromKey,... | true |
4d42f50f0fff7fdc71bd342396aef5ce186d184d | Python | serfedor/Programm | /python_work/vars/2-6.py | UTF-8 | 115 | 2.890625 | 3 | [] | no_license | #by SerLonic
phrase = "God lead's us"
autor = "Sergey Fedorenko"
message = phrase + " here autor is " + autor
print(message)
| true |
55963ccfa017517a87aeaa5d2006898fe167e382 | Python | Mschikay/leetcode | /526. Beautiful Arrangement.py | UTF-8 | 1,797 | 3.640625 | 4 | [] | no_license | # DFS
# default every number on 1 works
# input: 4
# output:
# [False, True, True, True, False] 0
# [False, True, False, True, True] 1
# [False, True, True, False, True] 2
# [False, True, True, True, False] 3
# [False, False, True, True, True] 4
# [False, True, True, False, True] 5
# [False, True, False, True, True] 6... | true |
1b61ea4d2307020f2fa511b862c1dd7c3d813c0a | Python | SpectrePrediction/warrior | /warrior/StaticGraph/Operation/nn/nn.py | UTF-8 | 14,829 | 2.546875 | 3 | [] | no_license | from ..Operation import *
class Conv2d(Operation):
def __init__(self, x, filter_num, kernel_size, padding=0, stride=1, bias=True, data_format='NCHW', name=None):
"""
[n, c, h, w]
:param x: 应当是一个值类型为numpy.array的节点
:param filter_num:
:param kernel_size:
:param paddin... | true |
8c10688451b7912d7574427f75d7c5714223613b | Python | anaobana/CAPG_DESAFIO | /insira_dados.py | UTF-8 | 516 | 3.328125 | 3 | [] | no_license | #CADASTRO DE ANÚNCIOS
import os
base_geral=[]
def insira_dados():
print ("Insira aqui os dados do seu anúncio:\n")
nome = input ("Nome do anúncio: ")
cliente = input ("Nome do cliente: ")
inicio = input ("Data de início: ")
termino = input ("Data de término: ")
investimento_diario = int(input ("Investim... | true |
4a5ca9962fe766d031176ffc497ccb028b3c5a81 | Python | donmajkelo/kurs_Python | /31_2.py | UTF-8 | 500 | 3.734375 | 4 | [] | no_license |
lista = []
x = input (f" podaj liczbe nr 1: ")
lista.append(x)
x = input (f" podaj liczbe nr 2: ")
lista.append(x)
x = input (f" podaj liczbe nr 3: ")
lista.append(x)
x = input (f" podaj liczbe nr 4: ")
lista.append(x)
x = input (f" podaj liczbe nr 5: ")
lista.append(x)
print(f" LISTA TWOICH LICZB: {l... | true |
49d9ba3d6bd6d794ca46b84e16ebeb9bdc9039dc | Python | aobo-y/leetcode | /282.expression-add-operators.py | UTF-8 | 1,017 | 2.9375 | 3 | [] | no_license | #
# @lc app=leetcode id=282 lang=python3
#
# [282] Expression Add Operators
#
# @lc code=start
class Solution:
def addOperators(self, num: str, target: int) -> List[str]:
def dfs(i, t, accum=1):
res = []
if i >= len(num):
return res
for j in range(i + ... | true |
d40586a55e93c0d0c488a14853cd6db547e659d6 | Python | oeg-upm/GEnI | /core/influence_detection.py | UTF-8 | 3,253 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
import operator
def sig(x, y, type):
if type == 'semantic':
result = -np.dot(x, np.transpose(y))
elif type == 'translation':
result = -(x + y)
return 1 / (1 + np.exp(result))
def point_hess(e_o, nei, embd_e, embd_rel, type):
dim = np.shape(e_o)[0]
H = np.zeros((... | true |
961eae463911aa8a31c79afe209af53958fa67dc | Python | pmoracho/openerm | /tests/test_Config.py | UTF-8 | 2,162 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
# Copyright (c) 2014 Patricio Moracho <pmoracho@gmail.com>
#
# test of Config class
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation. A copy of this lic... | true |
7093ddcafc485c29373db7964fc97d3c6e0a7c62 | Python | 2099454967/python_wang | /09day/4.乘法口诀.py | UTF-8 | 116 | 3.171875 | 3 | [] | no_license | a = 1
while a <= 9:
b = 1
while b <= a:
#1*1=1
print("%d*%d=%d"%(a,b,a*b),end='\t')
b+=1
print('')
a+=1
| true |
fb014f34723807d72539311721545dd0022d7d5c | Python | sjdeak/interview-practice | /cp3/ch3/greedy/(caseNum)uva11369/main.py | UTF-8 | 750 | 2.71875 | 3 | [] | no_license | """
AD exchange arguments 例题变体 (轻微变化)
所有任务只要没有开始做,每天都要付罚款
"""
import os, sys
from functools import cmp_to_key
from itertools import count, combinations
from collections import namedtuple, Counter
from operator import itemgetter
from math import sqrt
class CustomException(Exception): pass
if os.getenv('SJDEAK'):
... | true |
b10420fdef7bc8e8cde6e9aecb84a0cf48dd3069 | Python | karlosos/reinforcement_learning_fundamentals | /lab3/grid_qlearn.py | UTF-8 | 4,996 | 3.359375 | 3 | [] | no_license | import random
import numpy as np
class Grid:
def __init__(self):
self.height = 10
self.width = 10
self.actions = [0, 1, 2, 3]
self.state_count = self.height * self.width
self.action_count = len(self.actions)
self.policy_print_characters = {0: "<", 1: ">", 2: "^", 3... | true |
40e8310b522da5a56d95ca2acb230604fcaf2cad | Python | bluerwf/bear | /src/queue.py | UTF-8 | 1,460 | 3.703125 | 4 | [] | no_license | #! /usr/bin/env python
# coding=utf-8
class Queue:
def __init__(self, size):
self._lst = []
self.size = size
def enqueue(self, i):
if len(self._lst) < self.size:
self._lst.append(i)
else:
print'full'
def dequeue(self):
try:
... | true |
4e9de4299f66dce51b67e28e8fdff69cb144d2cc | Python | ziqingW/python-exercise-flex-Mar06 | /turtle_graphics/exercise3/new.py | UTF-8 | 345 | 2.890625 | 3 | [] | no_license | import shapes
if __name__ == "__main__":
shapes.polygon(3, 80, True, "red", "green")
shapes.polygon(4, 100, False, "black")
shapes.polygon(5, 80, False, "blue")
shapes.polygon(6, 60, True, "yellow", "purple")
shapes.polygon(8, 50, False, "black")
shapes.star(100, False, "red")
shapes.cir(80... | true |
6a83efef9e8c9f3ee22302b23904a0dfa751f6eb | Python | limiao06/DSTC4 | /scripts/dstc_thu/preprocessor.py | UTF-8 | 7,017 | 2.734375 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding: utf-8 -*-
'''
preprocessor
'''
import sys
sys.path.append('../')
import nltk
import re
from GlobalConfig import GetConfig
class stemmer(object):
MY_ID = 'STEMMER'
def __init__(self, flag=True):
#self.config = GetConfig()
#from nltk.stem.lancaster import LancasterStemmer as Ste... | true |
1a8457e416d3ffc8b314fd48b5e650420228dc77 | Python | ochaplashkin/cybertonica-client | /CybertonicaAPI/auth.py | UTF-8 | 3,492 | 2.703125 | 3 | [] | no_license | import json
from types import FunctionType, LambdaType
from email.utils import parseaddr
import time
class Auth:
"""Auth class.
Attributes:
root: Object of `CybertonicaAPI.Client`
"""
def __init__(self, root):
self.root = root
def login(self, api_user, api_user_key_hash):
"""Create web session.
Args... | true |
b07e4de7fc5fec4b2e14b341740a6fdf7d9a1cf3 | Python | davestroud/Algorithm_Fundamentals | /educative/Lists/List_Of_Products.py | UTF-8 | 406 | 3.890625 | 4 | [] | no_license | def find_product(lst):
# get product to start from left
left = 1
product = []
for ele in lst:
product.append(left)
left = left * ele
# get product starting from right
right = 1
for i in range(len(lst)-1, -1, -1):
product[i] = product[i] * right
right =... | true |
e4d268bd17d495cc4b67f67ddeadecd1dd16112e | Python | slash-segmentation/DP2 | /test_files/test_xml.py | UTF-8 | 684 | 2.9375 | 3 | [] | no_license | # http://www.postneo.com/projects/pyxml/
from xml.dom.minidom import Document
# Create the minidom document
doc = Document()
# Create the <wml> base element
object = doc.createElement("object")
object.setAttribute("identifier", "object1")
object.setAttribute("class", "Vesicle")
doc.appendChild(object)
# Create the... | true |
bf71df9e044b4ac5cd32e7e9029230c2f474d6cb | Python | jf115/python-lesson | /Clase 5/listas.py | UTF-8 | 903 | 3.859375 | 4 | [] | no_license | # numeros = [8, 5, 6]
# print(len(numeros))
# print(numeros[2])
# numeros[2]=3 #Así cambio el valor de algo sin tener que tocar toda la lista
# print(numeros)
# numeros.append(25) #Agrego mas elementos
# print(numeros)
# print(sum(numeros)) #Suma toda la cantidad de resultados de numero que se han generado... | true |
fa1ec0affdf83c64e5cbbfa9bcc36954f5768487 | Python | takedah/hinanbasho | /tests/test_scraper.py | UTF-8 | 3,332 | 2.859375 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import Mock, patch
from requests import ConnectionError, HTTPError, RequestException, Timeout
from hinanbasho.scraper import OpenData, PostOfficeCSV
class TestOpenData(unittest.TestCase):
@patch("hinanbasho.scraper.requests")
def test_lists(self, mock_requests):
cs... | true |
c7eae74be8bdd5741cba1bb6e1e570d47fef0671 | Python | guoyc21/finance-cheatsheets | /Variance reduction/antithetic_variates_method.py | UTF-8 | 3,520 | 3.140625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
from time import time
import pandas as pd
# Underlying informations
S0 = 100
mu = 0.1
sigma = 0.1
# European option informations
T = 1.0
K = 100.0
r = 0.05
# Simulation parameters
nbr_steps = 100
dt = T/nbr_steps
t = np.linspace(0, T, nbr_steps)
m... | true |
5b7ed03fdf9f6d0aa4d32fbfaeb5230fec2df0ed | Python | sauravbasak/Codehall-Python | /S1_ Easy.py | UTF-8 | 316 | 3.828125 | 4 | [] | no_license | name = input('input your name name')
age = input('input your age')
height = input('input your heigh in cm')
#because python takes any input as a string. don't need to cast age and height here to concatinate it with the string
print('your name is ' + name + ' you\'r age is ' + age + ' you\'re height is ' + height)
| true |
7a32345d7004d1576e0ee94f21e6c97be6aa733b | Python | uranusjr/packaging-repositories | /src/packaging_repositories/repositories.py | UTF-8 | 2,627 | 2.640625 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import posixpath
from packaging.utils import canonicalize_name
from six.moves import urllib_parse
from .endpoints import Endpoint
from .entries import list_from_paths, parse_from_html
def _is_filesystem_path(split_result):
if not split_result.scheme:
... | true |
c943e9e13526a9cc3986050eeff7d1f4ae3b12b0 | Python | AnnaWillis/MultiplyQuiz1-12 | /1-12multiply.py | UTF-8 | 852 | 4.125 | 4 | [] | no_license | __author__ = 'Anna'
import random
print("Hello, operators!")
print("I will ask you a 1-12 multiplication problem. If you get it right, I will say, 'Correct!'")
while True:
factor1 = random.randint(1, 12)
factor2 = random.randint(1, 12)
guess = ""
while guess=="":
guess = input("What is %d ... | true |
493ee6d93d5990e07ff427a9f93a03449c06ee01 | Python | skojaku/hokusai-plot | /scripts/point2net.py | UTF-8 | 1,422 | 2.515625 | 3 | [
"CC0-1.0"
] | permissive | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import spatial
import networkx as nx
import sys
if __name__ == "__main__":
POINTFILE = sys.argv[1]
OUTPUTFILE = sys.argv[2]
df = pd.read_csv(POINTFILE, sep="\t")
N = df.shape[0]
M = (N - 1) / 2 * 3.2 # number ... | true |
4d21da1b4c75b8e289c38d67602db50340cc11a8 | Python | comDennis/model-server | /music_recommender/ml_model/recommender.py | UTF-8 | 1,200 | 2.75 | 3 | [] | no_license | import os
import pickle
from ml_server.settings import BASE_DIR
import pandas as pd
def get_artist_recommendations(artist_name, number=5):
"""
Returns recommendations for a specific artists.
:param artist_name: Input artist.
:param number: Number of recommendations to be made. Max = 20.
:return: L... | true |
2d3df84dcc8235c2204695d721dc70524c2b9ef3 | Python | benleowing29/Savemammy | /savemammy.py | UTF-8 | 29,266 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import time
import getpass
import csv
width = 44
login_tried = 0
endProgram = False
account = {}
job ={}
captcha_list = ['heLL0', 'HoW', "R", "YoU?"]
def update():
with open('mammydata.csv', newline='') as csvfile:
rows = csv.DictReader(csvfile)
for row in r... | true |
8ebe59b37983a4a0babe17371ec25ff3af9e7d6b | Python | bulat15g/for_the_trees | /pairs/lib_homo.py | UTF-8 | 3,233 | 2.96875 | 3 | [] | no_license | class Point2d:
x = float
y = float
def __init__(self, x, y):
self.x, self.y = x, y
def get_dxdy(self, point2):
return self.x - point2.x, self.y - point2.y
def get_norm(self, point2):
import math
return math.sqrt((self.x - point2.x) ** 2 + (self.y - point2.y) ** 2)
... | true |
373944866ff8e07763aebea0ace66887f3ba7f7c | Python | JoeyDP/REST-Client | /RESTapi/api.py | UTF-8 | 4,855 | 2.59375 | 3 | [
"MIT"
] | permissive | import sys
from urllib.parse import urljoin
import requests
from .util import decorator
@decorator
def API(cls, base_url):
b = base_url
class A(cls):
base_url = b
suffix = ""
@property
def api(self):
return self
return A
class RequestPage(object):
def ... | true |
1265c876b5f3c800a376716b9e9c519d488d849d | Python | marcoleonmora/algorithms | /8. volumenesFuncionYRepetir.py | UTF-8 | 1,244 | 4.3125 | 4 | [] | no_license | #******************************************
# Algoritmo para calcular y mostrar el área de
# un cubo o de un cilindro, usa funciones
# Programo: MLM
# Version: 3.0
# Fecha: 27/03/2019
#*****************************************/
import math
#Funcion para mostrar menu y capturar la opcion
def mostrarMenu():
print ("... | true |
c476e79877ec6ed0d42943a92778379bc812a4e6 | Python | danielhasan1/star-wars-api | /starWarsApi/star_wars_data/api/tests.py | UTF-8 | 2,085 | 2.53125 | 3 | [] | no_license | from rest_framework.test import APITestCase
from rest_framework import status
from star_wars_data.models import StarWarsPlanets
MOVIE_DATA_SET = {
"count": 6,
"movie_titles": [
{
"title": "A New Hope",
"created": "2014-12-10T14:23:31.880000Z"
},
{
"tit... | true |
263cdb588ca7e634b03a0bb9e9dc8ea01ec0b791 | Python | BenLangmead/qtip | /bwamem.py | UTF-8 | 4,092 | 2.5625 | 3 | [
"MIT"
] | permissive | """
Copyright 2016, Ben Langmead <langmea@cs.jhu.edu>
Concrete subclass for BWA-MEM aligner.
"""
import os
import logging
import sys
from subprocess import Popen
from aligner import Aligner
try:
from Queue import Queue
except ImportError:
from queue import Queue # python 3.x
class BwaMem(Aligner):
... | true |
c032b327e9aac6b14bb1c77cd5eece8eb0ff80e7 | Python | chenxu0602/LeetCode | /1016.binary-string-with-substrings-representing-1-to-n.py | UTF-8 | 1,183 | 3.25 | 3 | [] | no_license | #
# @lc app=leetcode id=1016 lang=python3
#
# [1016] Binary String With Substrings Representing 1 To N
#
# https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n/description/
#
# algorithms
# Medium (59.30%)
# Likes: 58
# Dislikes: 212
# Total Accepted: 9.3K
# Total Submissions: 15.8K
# T... | true |
1bcdf4cdc4069e27597a48f1b59b00247e96d1e5 | Python | bibhashthakur/data-structures-and-algorithms | /stackarray.py | UTF-8 | 1,242 | 3.828125 | 4 | [] | no_license | import numpy as np
class Stack:
def __init__(self, datatype):
#print("Datatype is ", datatype)
self.arr = np.empty(5, dtype=datatype)
self.top = -1
self.size = self.arr.size
def push(self, val):
if (self.top == self.size - 1):
self.size *= 2
... | true |
37af425025c6b2aa25e849418e6c3915b695f6e6 | Python | P4ll/robotics | /3/src/robot.py | UTF-8 | 7,399 | 2.546875 | 3 | [] | no_license | import vrep
import sys
import math
import time
import numpy as np
import matplotlib.pyplot as plt
import cv2
import array
from PIL import Image
import imutils
class Robot():
"""
Robot class
Consts:
propConst - proportional constant in PID
integralConst - integral constant in PID
di... | true |
a961de5c1d3b4232e20a0cc3956614726f8133b6 | Python | DragonPG2000/GroupNorm | /GroupNorm/groupnorm.py | UTF-8 | 1,836 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer
from tensorflow.keras.backend import image_data_format
class GroupNorm(Layer):
"""
Reimplementation of GroupNorm using the excellent post
https://amaarora.g... | true |
dfd9007424c657182d931797ac69c4c1a4d80b37 | Python | vovabcps/university_management_service | /university/migrations/0003_insertDataRest.py | UTF-8 | 31,751 | 2.625 | 3 | [] | no_license | from django.db import migrations, transaction
from ..models import *
from django.conf import settings
import math
import random
from django.contrib.auth.models import User
from datetime import datetime, timedelta
from django.shortcuts import get_object_or_404
import collections
import re
import ast
#the @transa... | true |
1e8e0bfa1c2d3bf0d0eaa50f4662ea7c10e032c2 | Python | arvidbt/KattisSolutions | /python/arrangement.py | UTF-8 | 345 | 3.28125 | 3 | [] | no_license | rooms = int(input())
teams = int(input())
if rooms == 1:
print("*" * teams)
exit()
rest = teams % rooms
if rest == 0:
rooms += 1
big_rooms_boys = int((teams - rest)/2)
if rest == 0:
big_rooms_boys = int(big_rooms_boys / 2)
for i in range(rooms-1):
print("*" * int(big_rooms_boys... | true |
85dae62a9a2a6355276d94017c65e5145bdb7386 | Python | AlexDeimon/Udemy | /Python_sin_fronteras/archivos.py | UTF-8 | 531 | 3.484375 | 3 | [] | no_license | # c = open('chanchito.txt', 'w') #(nombre del archivo, permisos r(read), w(write), a(append), x(create))
# c.write('\nagregaremos una nueva línea a nuestro archivo')
# c.close()
# x = open('chanchito.txt')
# print(x.read()) lee todo el archivo
#print(x.readline()) lee una linea del archivo
import os #libreria pa... | true |
dec154e893fb399e191ea73c8ba271917d8a4f32 | Python | Gafanhoto742/Python-3 | /Python (3)/Ex_finalizados/ex078.py | UTF-8 | 2,044 | 4.65625 | 5 | [
"MIT"
] | permissive |
'''Faça um programa que leia 5 valores numéricos e guarde-os em uma lista.
No final, mostre qual foi o maior e o menor valor digitado e as suas respectivas posições na lista. '''
''' como eu escrevi'''
maior = menor = 0
val = []
for cont in range (0,5): #5 ler valores para uma lista
val.append(int(input(f'\nDi... | true |
3cd83c46f5eee589744a328285454cd5a042545c | Python | CeciFerrari16/Compiti | /es28.py | UTF-8 | 1,282 | 4.15625 | 4 | [] | no_license | '''
I nomi delle città e i corrispondenti Codici di Avviamento Postale (CAP) vengono inseriti da tastiera
e memorizzati in un dizionario, dove il CAP è la chiave. Fornito poi da tastiera il nome di una città,
costruisci un programma che visualizzi il suo CAP oppure un messaggio nel caso la città non sia compresa
nel... | true |
464baded20b55c8b287ada48a17eb81d83424a8b | Python | tihonich/otus-python-developer-2020 | /hw_week_1/log_analyzer/test_log_analyzer.py | UTF-8 | 6,677 | 2.765625 | 3 | [] | no_license | import datetime
import os
import unittest
from typing import NoReturn, Tuple, NamedTuple
from log_analyzer import LOG_FILE_PATTERN
from log_analyzer import find_latest_log, parse_log_file, calculate_url_stats
class Config(NamedTuple):
"""
Class with final config parameters such as:
- report_size: size o... | true |
bd4dfcac7eb0585005b374a35f32e1d46a97bf2d | Python | zhaohui8969/OSX_speak_bot | /speaker_input.py | UTF-8 | 1,469 | 3 | 3 | [] | no_license | #!/usr/bin/env python2
# coding: utf-8
from __future__ import print_function
import subprocess
import sys
import threading
import time
class speaker_and_typeer(object):
def __init__(self, delay, lock):
self.delay = delay
self.lock = lock
def dynamic_char_output(self, msg, delay):
fo... | true |
304007156b82675872fb846871d10862884e2e50 | Python | nehalrawat/AI-Nutrition-Project | /nutrition_facts.py | UTF-8 | 1,221 | 3.265625 | 3 | [] | no_license | # based on a 2000 calorie diet
# suggested diet = 40 % carbs, 40% protein, 20% fat ,1500 mg of sodium (American Heart Association), 300 mg cholesterol
class Food:
food_facts = {}
def __init__(self, name, calories, fat, cholesterol, sodium, carbohydrates, protein):
self.name = name
self.calories ... | true |
f6fb793208bc98dcdf60191530e4192ceae06f8a | Python | Aasthaengg/IBMdataset | /Python_codes/p03797/s389824102.py | UTF-8 | 277 | 2.765625 | 3 | [] | no_license | import sys
input = sys.stdin.readline
def main():
N, M = [int(x) for x in input().split()]
if M < N * 2:
print(M // 2)
else:
ans = N
M = M - N * 2
ans += M // 4
print(ans)
if __name__ == '__main__':
main()
| true |
2abff1c15da55329c9e4d2ff35e8e0644375fbfb | Python | abadrinath15/python-leetcode | /problem_118/test_problem_118.py | UTF-8 | 447 | 2.75 | 3 | [] | no_license | import pytest
from problem_118 import Solution
class TestCase:
def test_1(self, get_sln):
assert get_sln.generate(0) == []
def test_2(self, get_sln):
assert get_sln.generate(1) == [[1]]
def test_3(self, get_sln):
assert get_sln.generate(2) == [[1], [1, 1]]
def test_4(self, g... | true |
37d859787f3f3a159b1722a52595b9f27141575f | Python | sriramsv/Mark2 | /utils/state.py | UTF-8 | 877 | 3.4375 | 3 | [] | no_license | import ping
def device_is_present(host, tries=3, timeout=3):
"""
Determines whether a device is present on the network
using its IP address or hostname. If the device can be
pinged successfully, it will return True, and False
otherwise.
Winston needs to run as root to use this function, since
... | true |
3cd4f9b5c5f0d9e0b95ddd86a4b36efa849b4152 | Python | xin1314/learngit | /rabbitmq/fanou_send.py | UTF-8 | 685 | 2.78125 | 3 | [] | no_license | import pika
# fanout 广播模式,错过消息就接收不到了,通过exchange绑定
credentials = pika.PlainCredentials('xin', 'xin5655')
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost',
credentials=credentials))
channel = connection.channel() # 建立了rabbit协议的通道
# 声明exchange
channel.exch... | true |
ea7dfbeb32a7499452097cf1fba94b982be92ba2 | Python | uestcljx/pythonBeginner | /digit.py | UTF-8 | 936 | 4.4375 | 4 | [] | no_license | ###Digits output###
###INSTRUCTION:
###本题要求编写程序,分解任意正整数
### 输入格式:
###一个正整数n
###输出格式:
###按照以下格式输出:
###n = 个位数字 + 十位数字*10 + 百位数字*100 +...
###(注意字符之间有空格)
import pdb
def digit(n):
'''
Function to break up an integer
Examples:
>>> digit('152')
152 = 2 + 5*10 + 1*100
>>>... | true |
08e6fa74a792ffe467c8d5bf3671973499bd48e3 | Python | ashleyrback/utils_cm | /error_utils.py | UTF-8 | 1,959 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python
#
# error_utils.py
#
# Collection of methods for common error handling constructions
#
# Author A R Back
#
# 18/07/2014 <ab571@sussex.ac.uk> : First revision
# 28/08/2014 <ab571@sussex.ac.uk> : Moved to utils_cm repo
###########################################################################
impo... | true |
8b5e5d6815ec9fd40fdc71ce3c4faca4fbcaedc4 | Python | kyungsubbb/Coding-Test | /Programmers/Python/위장.py | UTF-8 | 338 | 3.03125 | 3 | [] | no_license | def solution(clothes):
answer =1
dic = dict()
for i in range(len(clothes)):
if clothes[i][1] not in dic :
dic[clothes[i][1]] = [clothes[i][0]]
else :
dic[clothes[i][1]].append(clothes[i][0])
for k in dic:
answer *= len(dic[k])+1
answer -= 1... | true |
1f60c96524c526419ce6214fa220588877dc085e | Python | Elgava/python-crash-course | /chap06/pg_156 chap6(6-1 to 6-3).py | UTF-8 | 944 | 3.96875 | 4 | [] | no_license | #6-1 person
person = {
'first name' : 'elgin',
'last name' : 'malouw',
'age' : '19',
'city' : 'johanesburg',
}
for key, value in person.items():
print(f'\n{key}: {value}')
for things in person.keys():
print(f'{things.title()}\n')
for names in person.values():
print(names.title())
for names in sorted(person.ke... | true |
03de42c9c639df8ca44f0c7427aa5a6b09de23b8 | Python | SonaliSihra/Guess_a_number | /Main.py | UTF-8 | 537 | 4.125 | 4 | [] | no_license | import random
x = random.randrange(1, 10)
print(x)
print("Let the game begin!! \n guess the number:")
try:
input1 = int(input("Hint=[it is between 0 to 10]: "))
except ValueError:
print("Please enter integer only!!")
exit(0)
if input1 == x:
print("Congratulations!!! this is a correct answer.")
elif... | true |
8bd6f7c9dcbc9512704310bd10dc04554de276ee | Python | PIUphil/project_euler | /001~025/problem17.py | UTF-8 | 1,332 | 3.96875 | 4 | [] | no_license | '''
1부터 5까지의 수를 영어로 쓰면 one, two, three, four, five 이고,
각 단어의 길이를 더하면 3 + 3 + 5 + 4 + 4 = 19 이므로 사용된 글자는 모두 19개입니다.
1부터 1,000까지 영어로 썼을 때는 모두 몇 개의 글자를 사용해야 할까요?
참고: 빈 칸이나 하이픈('-')은 셈에서 제외하며, 단어 사이의 and 는 셈에 넣습니다.
예를 들어 342를 영어로 쓰면 three hundred and forty-two 가 되어서 23 글자,
115 = one hundred and fifteen 의 경우에는 20 글자가 ... | true |
834d1609dec01613b7df77e1f53bd591d677bcab | Python | peterpaiter/pastepwn | /util/threadingutils.py | UTF-8 | 718 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from threading import Thread, current_thread
import logging
def start_thread(target, name, exception_event, *args, **kwargs):
thread = Thread(target=thread_wrapper, name=name, args=(target, exception_event) + args, kwargs=kwargs)
thread.start()
def thread_wrapper(target, exception_ev... | true |
d85e357eda2fe4a0e1f68a8c8ba402af6deb237f | Python | transcranial/filopod | /resprocess/parser_generic.py | UTF-8 | 2,189 | 2.75 | 3 | [] | no_license | # Parser
# Generic
import re
'''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gets metadata information
Returns metadata, which is a list of the following:
0 identifier
1 type
2 language
3 title
4 date
5 publisher
6 author
7 journal
8 volume
9 issue
10 firstpage
11 lastp... | true |
e4a01b754e2e36cc412f43479817c4e7ba0deb0d | Python | n18015/programming-term2 | /src/algo-s2/task20180717_1.py | UTF-8 | 178 | 3 | 3 | [] | no_license | x = 0
x += +1
print("現在位置はx={0}です。".format(x))
x += +1
print("現在位置はx={0}です。".format(x))
x += +1
print("現在位置はx={0}です。".format(x))
| true |
80e5e77476d9747018ecdc991a94a41966f62d01 | Python | acabhishek942/ProjectEuler | /Solutions/pe#36brute-force.py | UTF-8 | 394 | 3.28125 | 3 | [] | no_license | from time import time
t1 = time()
def isPalindrome(number):
if str(number)[::-1] == str(number):
return True
return False
def toBinary(n):
return ''.join(str(1 & int(n) >> i) for i in range(64)[::-1])
total = 0
for i in range(1000000):
binaryRe = '{0:b}'.format(i)
if isPalindrome(i) and isPa... | true |
2cd06598651d07ac06668e83eaf8a1cdf49c0c0f | Python | francosebastian/python | /variables/variables.py | UTF-8 | 49 | 2.765625 | 3 | [] | no_license | name = "Fazt"
print(name)
name = None
print(name) | true |
d9a8151fef28fd32366745dcd03de819074bbb7d | Python | ShotaHamano/WannaGo | /script/python/01.py | UTF-8 | 307 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
MySQLデータベースを作成する
'''
import sys
import MySQLdb
db_name = sys.argv[1]
db = MySQLdb.connect(host="localhost", user="root", passwd="root")
cursor = db.cursor()
command = 'CREATE DATABASE IF NOT EXISTS %s' % db_name
cursor.execute(command)
cursor.close() | true |
bb863e15e8f9f2ce558bedf8c187cd764589eef0 | Python | whitneygriffith/Introduction-to-Com-Sci-Labs | /find_missing_number.py | UTF-8 | 1,619 | 4.65625 | 5 | [] | no_license | '''
Problem 2: Find missing number
Create a file named find_missing_number.py. In it, write a function named FindMissingNumber that finds the missing number in a list of numbers ranging from A to B. For example, the missing number in the list [45, 51, 47, 46, 50, 49] is 48. FindMissingNumber should take a single para... | true |
22bb60f5fcccedd09ea0b217c4300042433a018f | Python | HidoiOokami/Projects-Python | /Lacos/Desafio.py | UTF-8 | 308 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from random import randint
def given_away():
return randint(1, 6) # o 6 entra
for i in range(1, 7):
if i % 2 == 1:
continue
if i == given_away():
print(f"Acertou!!! seu n° = {i}")
break
else:
print(f"Opss não foi desta vez! seu n° = {i}") | true |
1c449bbbe7a42425c7697fb0d18146cd26497bf0 | Python | Ali-Sahili/Generative_Architectures | /Image_Alignement/FeatureBased.py | UTF-8 | 4,519 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
from skimage.transform import AffineTransform
from skimage.measure import ransac
# (ORB,SIFT or SURF) feature based alignment
def featureAlign(im1, im2, detector = 'SIFT', max_features = 5000, feature_retention = 0.15, MIN_MATCH_COUNT = 10):
# Convert images to grayscale
... | true |
f4228db54bcca8cea807cf8054823deb1bb354e0 | Python | engsopha/PythonProgram | /HelloWorld/Test_code/List.py | UTF-8 | 220 | 3.03125 | 3 | [] | no_license | pow2 = [2 ** x for x in range(1, 11) if x < 4]
print(pow2)
lang = [x+y for x in ['Python ','C '] for y in ['Language','Programming']]
# ['Python Language', 'Python Programming', 'C Language', 'C Programming']
print(lang) | true |
180732b06b3b722f7128ab6548ee005d866e5915 | Python | Lakshadeep/osm_navigation | /osm_topological_planner/src/osm_topological_planner/compute_orientation.py | UTF-8 | 4,380 | 2.859375 | 3 | [] | no_license | import math
from geometry_msgs.msg import Pose, Point, Quaternion
from tf.transformations import euler_from_quaternion, quaternion_from_euler
from osm_planner_msgs.msg import *
class ComputeOrientation(object):
def __init__(self):
pass
# computes door orientation based on next area
def get_door_... | true |
64cbeae4a5074f6a1cb216cf29f8a7f65738f823 | Python | sgrsigma/euler | /problem013.py | UTF-8 | 279 | 3.421875 | 3 | [] | no_license | rangedigits = []
with open('100x50digits.txt') as f:
while True:
c = f.readline()
if not c:
print "End of file"
break
else:
d1 = int(c[:12])
rangedigits.append(d1)
#print firstdigits
total = 0
for n in rangedigits:
total = n + total
print str(total)[:10] | true |
8b6dde32dcafaff3385804c69a15029f94ffe0f9 | Python | gmr/rabbitstew | /rabbitstew.py | UTF-8 | 9,508 | 2.625 | 3 | [] | permissive | """
Rabbit Stew
===========
A CLI application for piping delimited input to RabbitMQ as messages.
Example Use
-----------
.. code:: bash
cat /var/log/messages | rabbitstew -H rabbit-server -r syslog.messages
"""
import argparse
import getpass
import sys
import time
try:
import urllib.parse as urllib
except... | true |
25cd9f626526310f08b75bdb1531d8194c104e0d | Python | GlenboLake/DailyProgrammer | /C215I_validating_sorting_networks.py | UTF-8 | 1,262 | 3.65625 | 4 | [] | no_license | '''
http://www.reddit.com/r/dailyprogrammer/comments/36m83a/20150520_challenge_215_intermediate_validating/
'''
def is_sorted(nums):
#print 'checking',nums
for item in range(len(nums)-1):
if nums[item] > nums[item+1]: return False
return True
class SortingNetwork(object):
def __init__(self, ... | true |
811a7c896bff8e6356d7d47b61debb665a233824 | Python | callumfrance/brailler | /views/view_braille.py | UTF-8 | 7,862 | 3.109375 | 3 | [
"MIT"
] | permissive | """
This is the ViewBraille class, used to interface this program via a
hardware device such as the Raspberry Pi Zero W or equivalent.
The class seeks to replicate the same functionality as the ViewCLI class,
but instead of displaying on the CLI, it displays on the GPIO pins.
Despite being referred to as a 'view' it ... | true |
49c0e5c023356a7877fe14b27689484e744b6b91 | Python | orwell-int/proxy-robots-python | /orwell/proxy_robots/action.py | UTF-8 | 3,584 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
from orwell.proxy_robots.status import Status
LOGGER = logging.getLogger(__name__)
class Action(object):
"""
Object functor to wrap a function and possibly the notification associated
to the function (the function sends the message and the notification is
triggered when the reply is ... | true |
89116340a2f2471effa37426cf44288a309af1de | Python | gardenia-homsi/holbertonschool-python | /0x07-python-test_driven_development/4-print_square.py | UTF-8 | 518 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python3
"""This module does one class that has one private integer attribute with 2 exc
eptions."""
def print_square(size):
"""this function is for printing square"""
if type(size) is int:
if size >= 0:
for iter in range(size):
for iter2 in range(size):... | true |
7d6f88d5c0c5b9fe139cfd7ee81eb6b9dcbeadf3 | Python | gjq91459/mycourse | /23 Miscellaneous Topics/GUI Frameworks/wxPython/02-menus.py | UTF-8 | 1,359 | 3 | 3 | [] | no_license | ############################################################
#
# menus
#
############################################################
import wx
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame("Hello")
self.frame.Show()
self.SetTopWindow(self.frame)
r... | true |
464810a7d8aa697b4de3747a26cf62eeaaa11ac1 | Python | idabayev/extracting-data-from-emails | /writing_hits_into_table.py | UTF-8 | 3,379 | 3.015625 | 3 | [] | no_license | import pandas
# For writing to excel file
import openpyxl
# For writing to google spreadsheet
import gspread
from oauth2client.service_account import ServiceAccountCredentials
COL_OF_TZ = 2
COL_OF_HIT = 8
COL_OF_TREATS = 9
COL_OF_FILENAME = 10
GOOGLE_SHEET_NAME = "Copy of Leumit For Ida"
SHEET_PAGE_NAME = "New Hith... | true |