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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
072988ddd38519237e86f4c699c9f59b0325b3f5 | Python | avoevodin/lab5 | /levy_curve.py | UTF-8 | 638 | 3.78125 | 4 | [] | no_license | """Draw Levy curve fractal.
"""
import turtle
turtle.speed('fastest')
def draw_levy_curve(edge_width: int, rec_deep: int):
"""Draw Levy curve fractal.
Keyword args:
edge_width -- current width of edge (int)
rec_deep -- current recursion deep (int)
"""
if rec_deep == 0:
... | true |
863a802ac3d73b40e6d2644d48b366a6e288bd78 | Python | asanchez78/max7219 | /matrix_scroll.py | UTF-8 | 642 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python3
import max7219.led as led
import argparse
device = led.matrix(cascaded = 3)
parser = argparse.ArgumentParser(description='Scrolls message on LED matrix')
parser.add_argument('-m','--message',help='The message to scroll on the LED matrix',required=True)
parser.add_argument('-r','--repeat',help='Th... | true |
b47de52c4bb3bf7c8ed72ac716ad80d43e4418a0 | Python | GudUgne/Block_3 | /Bit_1.py | UTF-8 | 1,244 | 3.046875 | 3 | [] | no_license | # `pc_transaction.py` example
from bitcoin.rpc import RawProxy
p = RawProxy() #sujungimas
# Pavyzdinis ID: "4410c8d14ff9f87ceeed1d65cb58e7c7b2422b2d7529afc675208ce2ce09ed7d"
txid = input("Iveskite transakcijos ID\n")
# First, retrieve the raw transaction in hex - is pavyzdzio visa tranzakcijos info
raw_tx ... | true |
ced559d875588c05039e1845b3dc10a43e38a30e | Python | Ruk288/Project-01 | /Chapter#05.py | UTF-8 | 4,059 | 3.9375 | 4 | [] | no_license | # simple if statement
cars=['audi','bmw','suzuki','toyota']
for car in cars:
if car=='bmw':
print(car.upper())
else:
print(car.title())
car='Audi'
car.lower() =='audi'
# checking for inequality
requested_topping='paproni'
if requested_topping != 'mashrooms':
print("hold the mashrooms!")
#... | true |
cb28b141fcfec1c03f55ea3f9300f19a911b2b2c | Python | manelmengibar/Python_Excel | /Pandas/Basic/Create.py | UTF-8 | 485 | 3.09375 | 3 | [] | no_license | import pandas as pd
# dataframe Name and Age columns
df = pd.DataFrame({'Empresa': ['Draexlmaier', 'Seat', 'Fujikura', 'Synergie'],
'Anys': [5, 20, 30, 10]})
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('demo.xlsx', engine='xlsxwriter')
# Convert the dataf... | true |
ee17411d4662f9c226544cc5d94ced0693e8d994 | Python | Instrumedley/hypothesis | /exceptions.py | UTF-8 | 371 | 2.984375 | 3 | [] | no_license |
class Error(Exception):
"""Base class for other exceptions"""
pass
class AddTransactionError(Error):
"""Raised when you can't create a transaction for Person"""
pass
class InvalidNumberError(Error):
"""Raised when input is not an int or float"""
pass
class InvalidDateError(Error):
"""Raise... | true |
dbf3b203ee329e31f718be93018b26afe9840068 | Python | beitay/SpamRepo | /Spammer.py | UTF-8 | 348 | 3.125 | 3 | [] | no_license | from pynput.keyboard import Key, Controller
import time
times_to_spam = input("Enter number of times to spam> ")
time.sleep(5)
i = 0
while i < int(times_to_spam):
keyboard = Controller()
# any letter
keyboard.press('A')
keyboard.release('A')
keyboard.press(Key.enter)
keyboard.rele... | true |
d5b191508f587b8cdde93f7003ba5e08f0858269 | Python | arkakrak/Jezyki_Skryptowe | /Zadanie9.py | UTF-8 | 714 | 3.609375 | 4 | [] | no_license | input_file = open("input_file.txt", "w")
input_file.writelines("I chose to write this line 1\n")
input_file.writelines("I chose to write this line 2\n")
input_file.writelines("I chose to write this line 3\n")
input_file.writelines("I chose to write this line 4\n")
input_file.writelines("I chose to write this line 5\n")... | true |
ad5ad7c50e54a80248f3008634983c2ddfc28675 | Python | mapoferri/Bioinformatics-projects | /GOR-SVM/extract_matrix.py | UTF-8 | 2,532 | 2.765625 | 3 | [] | no_license | import os
import numpy as np
import sys
#run with python3!
def extract_matrix(pssm_file):
with open(pssm_file, "r") as pssm:
a = 0
matrix=[[] for line in pssm]
with open(pssm_file, "r") as porcod:
for line in porcod:
line = line.split()
#print (line) #iterating for line
if a == 0: ... | true |
92b34099ca3cac42e8368a57b77c7200a24bf80e | Python | wuqingtao-GitHub/Speech-Transformer-tf2.0 | /test/test_input_mask.py | UTF-8 | 5,323 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
#####################################################
# NOTE:
# 这个mask是为了遮住att输出(N,seq_q,seq_k)中
# 被padding的部分(seq_k对应的那一轴,k是key,也就是被查询的句子)
#####################################################
def create_padding_mask(seq):
'''
:param seq: [batch_size * seq_len_k] ... | true |
efaa3bf10aee5ffe79b7dee0b6f85adb9385b2d2 | Python | zilongwang1993/MergeSortedFiles | /mergeFile.py | UTF-8 | 2,756 | 3.34375 | 3 | [] | no_license | import heapq
import fnmatch
import os
import sys
# Name: hw.py
# Author: Zilong Wang
# Goal: merge any number of sorted text files with one data per line into a single file.
# Requirements:
# 1. The program must compile and run without errors on the sample input files.
# 2. The program should be self-documenting. Ru... | true |
434c72767437a9fdfcd869aa94932a817d004552 | Python | svf55/get_image | /client/client.py | UTF-8 | 2,725 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
import io
from PIL import Image
import logging
from websocket import create_connection, ABNF
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'proto'))
import get_image_pb2
class WebSocketClient(object):
"""
Getting an image through a Websocket
"""
... | true |
bc0183f0b653f7114426f94fd340cc72fb234550 | Python | AbubakarSaad/NN-Assignment2 | /functions.py | UTF-8 | 561 | 2.921875 | 3 | [] | no_license | import math
import numpy as np
class Functions():
def neighbourhood(self, radius, numIteration, timeConstant):
return radius * np.exp(-(numIteration / timeConstant))
def guassin(self, radius, dist):
return np.exp(-(dist**2)/(2*(radius**2)))
# updating the learning rate
def up... | true |
66f39aa0f7da929f6b74eb0678719c9f598de6e0 | Python | dineshkumarkummara/my-basic-programs-in-java-and-python | /folders/python/instagram/90class.py | UTF-8 | 327 | 4.4375 | 4 | [] | no_license | #Creating a class in Python. In the example, the class has a single method called "talk",
# which prints a default greeting. Then, two objects (or instances) of that class are created,
# and "talk" is called on each of them.
class animal:
def talk(self):
print("i am an animal")
animal1=animal()
animal1.t... | true |
cf5cfb7497d9646be831c6f8d2f58598566dc853 | Python | SRH-BDBA/movie-data | /aggregation.py | UTF-8 | 538 | 2.5625 | 3 | [] | no_license | import pymongo
import config
conn = config.MONGO_URL
client = pymongo.MongoClient(conn)
db = client["movies"]
collection1 = db.movies_collection
collection2 = db.budget_collection
collection3 = db.aggregated_collection
data = list(collection1.aggregate( [
{ "$lookup" : {
"from" : "budget_collection",
"l... | true |
b280a01ec97b2770213f75e29d67faf276d4e857 | Python | mauromatsudo/brazilian-stocks-analyzer | /B3Analyzer/data/B3_list.py | UTF-8 | 4,196 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | '''
Author: Mauro Matsudo
This script uses the official B3 web site get the list of all thhe firm trade in brazilian stock market
'''
import openpyxl
import requests
from pandas import DataFrame
from zipfile import ZipFile
from io import BytesIO
from sys import exit
from os.path import exists
class Plan:
def __in... | true |
ee4281029b847a8422580fe79cf4f0a31d92432b | Python | viniciusarruda/genetic-algorithm | /src/Image/lena_polygon.py | UTF-8 | 3,629 | 2.796875 | 3 | [] | no_license | import time
import numpy as np
import matplotlib.pyplot as plt
from skimage.draw import polygon, set_color
from skimage.io import imread
from skimage.measure import compare_ssim
from skimage import img_as_float
from random import randint, random, uniform
# center, radius, color
# [x,y , r, r,g,b]
alpha = None
origi... | true |
f09773d08e6a70777646e0c7218780c701ecaed7 | Python | bundgus/py_curate_json | /xml_to_csv_pipeline.py | UTF-8 | 2,837 | 2.703125 | 3 | [
"MIT"
] | permissive | import xml.etree.ElementTree as ET
from xmljson import yahoo as jencoder
from py_curate_json import curate_json_core as cjc
from py_curate_json.flatten_denorm_json import flatten_denorm_json
import json
import csv
def fixup_element_prefixes(elem, uri_map, memo):
def fixup(name):
try:
return me... | true |
b6b961e924bc7a85a81716bedfadfa9068c596d4 | Python | JamesG-Projects/Misc_Projects | /Python/lab/lab11.py | UTF-8 | 2,114 | 3.296875 | 3 | [] | no_license | """Lab11.py: Coroutines"""
__author__ = "James Garrett"
__credits__ = [""]
__email__ = "garretjb@mail.uc.edu"
#####################
# Lab11 Co-Routines #
#####################
def supplier(ingredients, chef):
for ingredient in ingredients:
try:
chef.send(ingredient)
except StopIteratio... | true |
ba062c5e5a753908383a0c2497ea1656ceb94f53 | Python | reikoreinup/AdventOfCode2020 | /Day12/Ex2.py | UTF-8 | 1,237 | 3.640625 | 4 | [] | no_license | ship_pos, wp_pos = (0, 0), (1, 10)
def move(command, amount, current_pos):
if command == 'N':
return current_pos[0] + amount, current_pos[1]
elif command == 'E':
return current_pos[0], current_pos[1] + amount
elif command == 'S':
return current_pos[0] - amount, current_pos[1]
el... | true |
6d1418eeee22c94150d8d773fdd3b95033ff37ce | Python | rkapdi/SENG265 | /Assignments/assign3/.svn/text-base/s265fmt2.py.svn-base | UTF-8 | 2,746 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
import os
import sys
import optparse
import re
from formatting import seng265_formatter
def main():
s = """?pgwdth 50
?mrgn 15
Call me Ishmael. Some years ago--never mind how long precisely--having
little or no money in my purse, and nothing particular to interest me on
?mrgn +5
shore, I thought ... | true |
857479fbf7bc61d5abb25e2bcc1a93bf2a32521a | Python | frankurcrazy/SimpleFileTransfer | /SimpleFileTransfer/base.py | UTF-8 | 1,443 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import pickle
import asyncio
import struct
from .message import *
class SimpleFileTransferBase(asyncio.Protocol):
def __init__(self):
self.rcvbuf = bytearray()
self.pause = False
def message_received(self, msg):
raise NotImplemented... | true |
6d8f47465ee0320241d7df2bd94d935484b5e990 | Python | caranuial/ud036_StarterCode | /media.py | UTF-8 | 651 | 3.109375 | 3 | [] | no_license | import webbrowser
# Movie Class that supports required functionality
class Movie(object):
# This is the Constructor that initializes the object in memory
def __init__(self,
movie_title,
story_line,
poster_image_url,
trailer_youtube_... | true |
ed29c2579dabe47de5065cea960d50a6d86a2302 | Python | MiaZhang0/Learning | /QuestionTypes/demo05.py | UTF-8 | 341 | 4.1875 | 4 | [] | no_license | #分别统计列表[True,False,0,1,2]中True,False,0,1,2的元素个数,发现了什么?
list = [True,False,0,1,2]
a = list.count(True)
b = list.count(False)
c = list.count(0)
d = list.count(1)
e = list.count(2)
print(a,b,c,d,e)
#结果为2,2,2,2,1
#count()不区分True和1,False和0,但None、‘’不会被视为False | true |
a64481033a16a2b95fbd761b61fdb46e8ef25fb5 | Python | KVS-CODE/area_module | /unsolved q no_04.py | UTF-8 | 225 | 3.453125 | 3 | [] | no_license | #unsolved q no: 04
def star(n):
if n==0:
return print("please enter any natural number ")
else:
return "*"*n,"\n",star(n-1)
#ain inputs
a=int(input('enter a positive integer'))
print(star(a),sep='\n')
| true |
8adacf078fed3137eeaed70412c51dab4aac59d1 | Python | JiguangLi/quasar_variability | /z_luminosity_plot.py | UTF-8 | 3,657 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 8 14:11:49 2017
@author: jiguangli
"""
from astropy.io import fits
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from astropy.cosmology import FlatLambdaCDM
def compute_luminosity(sdss_name,sdss_magz_dict,cosmo):
z=sd... | true |
cd0e7a6e182def35292f2fdf0a1063989e461229 | Python | andreaslundin47/Advent-Of-Code-2020 | /day22/day22.py | UTF-8 | 2,162 | 3.765625 | 4 | [] | no_license | from queue import deque
with open('input', 'r') as f:
p1, p2 = f.read().strip().split('\n\n')
deck_one = [int(v) for v in p1.split('\n')[1:]]
deck_two = [int(v) for v in p2.split('\n')[1:]]
def combat(deck_1, deck_2):
mine_hand = deque(deck_1)
crab_hand = deque(deck_2)
turns = 0
while min... | true |
2eb1bc151b59ae8a66511ca2bf78231492e2a1fe | Python | onitonitonito/py_police | /py_police.py | UTF-8 | 3,071 | 3.046875 | 3 | [] | no_license | """-------------------------
# 경찰차 애니매이션 - 총 8장의 스프라이트
# 오브젝트 딕트와 리스트가 막 뒤죽박죽 됬는데 .. 일단은 놔두고
# 천천히 리펙토링을 해야겠다~ 지금은 여기서 끝!
#
#\n\n\n"""
print(__doc__)
import sys
import time
from asset.config import * # 따로 저장한 변수를 불러온다.
from asset.main import * # 따로 저장한 변수를 불러온다.
player = set_obj('player', DESTIN_DIR + ... | true |
37c936ae1e22170c8ae7ed44314bfee04d6671f1 | Python | wnagy/pymframe | /WEB-INF/mvc/domain/lovdomain.py | UTF-8 | 2,664 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: iso-8859-15 -*-
from dbaccess.core import *
class LovDomain(Domain) :
lovID = None
lovClass = None
lovKey = None
lovValue = None
lovFlag1 = None
lovFlag2 = None
lovFlag3 = None
lovFlag4 = None
lovRemark = None
meta = {
'tablename':'lov',
'primaryk... | true |
51496e34b0fccd109f0316e734be2a7845f9d35e | Python | bsk17/PYTHONTRAINING1 | /GUI/guidemo2.py | UTF-8 | 907 | 3.328125 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox as mb
def register():
name = e1.get()
password = e2.get()
print("NAME = ", name)
print("PASSSWORD = ", password)
mb.showinfo("DATA", "Welcome "+name+" Your Password is"+password)
window = Tk()
window.geometry("300x400")
window.title("First Pag... | true |
25f34b1c0777b9123c28adeb0ad2a41f319192ad | Python | abbyssoul/mood-prob | /emotions/emotion.py | UTF-8 | 374 | 2.734375 | 3 | [] | no_license | import json
class Emotion(object):
""" Representation of a single emotion
"""
def __init__(self, desc, dim, id=-1):
self.description = desc
self.dim = dim
self.id = id
def __str__(self):
return self.description
def to_JSON(self):
return json.dumps(self, de... | true |
d588701393ee593a9805d6e8c2a6ae608d192853 | Python | nuria/study | /advent/2021/advent5.py | UTF-8 | 2,608 | 3.15625 | 3 | [] | no_license | #!usr/local/bin
import sys
lines = list(open(sys.argv[1]))
lines_i = []
x_max =0
y_max = 0
# print matrix concisely for debugging
def print_matrix(G):
txt = ''
for i in range(0, len(G[0])):
for j in range(0, len(G[i])):
if G[i][j] == 0:
txt = txt + '.'
else... | true |
0b9ca43606893b5ba3b170f3f412051da3f4dac1 | Python | lizardnoises/daily-coding-problem | /033_running_median/running_median.py | UTF-8 | 2,438 | 4.40625 | 4 | [] | no_license | __author__ = "Sean Moore"
"""
Problem:
Compute the running median of a sequence of numbers. That is, given a stream of
numbers, print out the median of the list so far on each new element.
Recall that the median of an even-numbered list is the average of the two
middle numbers.
For example, given the sequence [2, 1... | true |
167237e4708d99f3344968f035e2c418ba4ab060 | Python | ccas08/prueba | /list.py | UTF-8 | 734 | 3.734375 | 4 | [] | no_license | """def run():
squares = []
for i in range(1, 101):
if i % 3 != 0:
squares.append(i ** 2)
print(squares)""" # funcion normal
def eleva_al_2(i):
return i ** 2
def run():
squares = [i ** 2 for i in range(1, 101) if i % 3 != 0]
ones = [1 for i in range(5)]
# [1, 1, 1, 1... | true |
ee05d48c995291cbb25cabc54df0ea4f67e624b1 | Python | tjuxiaoyi/qqZoneModeSpider | /qzoneMoodSpider.py | UTF-8 | 6,278 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 13:55:57 2019
@author: xy
"""
#以下为需要使用的库
from selenium.webdriver.support.ui import WebDriverWait as WebWait
from selenium.webdriver.chrome import options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains as AC... | true |
965daabaf3188d98f66dcfad1425fbc1c289c7c3 | Python | sevenian3/ChromaStarPy | /Planck.py | UTF-8 | 4,446 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import math
import Useful
def planck(temp, lambda2):
""" /**
* Inputs: lambda: a single scalar wavelength in cm temp: a single scalar
* temperature in K Returns log of Plank function in logBBlam - B_lambda
* dis... | true |
993ca8aaa805e6f982d63a0857749fd8a11d460f | Python | JohnSmitoff/blog_rest | /forum/models.py | UTF-8 | 945 | 2.5625 | 3 | [] | no_license | from django.db import models
from datetime import datetime
from django.utils import timezone
# Create your models here.
class Question(models.Model):
author = models.CharField(default="Anonymous", max_length=200)
question = models.TextField()
question_time = models.DateTimeField(default=timezone.now)
... | true |
dd7b5a401130437f064413ff4c24280d4353e393 | Python | jancijen/oas-hepb | /bin/model_performance.py | UTF-8 | 2,237 | 2.8125 | 3 | [] | no_license | from bin.prediction import predict_in_batches
def model_performance(model_tuple, data, metric_fns, sample_weights, verbose, batches_cnt=5):
model_name, model = model_tuple
X_train, X_valid, y_train, y_valid = data
try:
if verbose:
print(f'Training {model_name}...')
# Fit the m... | true |
35879ae589c85720d0cc08b479c3ebffb2ee4475 | Python | cwyz-dev/deal-scraper | /utils.py | UTF-8 | 503 | 3.40625 | 3 | [] | no_license | def convert_price_to_number(price):
price = price.split("$")[1]
try:
price = price.replace("\n", ".")
except:
Exception()
try:
price = price.split(",")[0] + price.split(",")[1]
except:
Exception()
return float(price)
def my_range(start, end, step, forwards):
... | true |
0f2780e64709ed227bae713fd46d168379362c4a | Python | ksercs/lksh | /2014/Работа в ЛКШ/Python/day11/A/turtle.py | UTF-8 | 600 | 3.234375 | 3 | [] | no_license | fin = open("turtle.in", "r")
fout = open("turtle.out", "w")
row, col = [int(x) for x in fin.readline().split()]
acid = []
for i in range(row):
acid.append(list(map(int, fin.readline().split())))
table = [[0] * col for i in range(row)]
ans = 0
for i in range(row):
ans += acid[i][0]
table[i][0]... | true |
75820f1251acc6b343c1c4d1479338a8f086b967 | Python | bar2104y/FunnyVKBots | /AvatarSecurity/avatar.py | UTF-8 | 2,593 | 2.78125 | 3 | [] | no_license | #Загрузка необходимых модулей
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api import VkUpload
from vk_api.utils import get_random_id
# Перменная-костыль для избежания рекурсии
IsMyUpdate = False
def main():
# Настройки
vk_token="" # Токен пользователя
app_id = "" # ID приложения
vk_c... | true |
6af9eeb6390544042d23a7f2befc9d140d8de257 | Python | praneethreddypanyam/DataStructures-Algorithms | /LinkedList/insertionInSortedList.py | UTF-8 | 1,264 | 4 | 4 | [] | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def insertion(self,data):
if self.head == None:
self.head = Node(data)
else:
current = self.head
while c... | true |
162b89ff997292cd1ece3e2aacd2def9a1d9c6b9 | Python | jangmyounhoon/python | /day3/turtle_run2.py | UTF-8 | 429 | 4.1875 | 4 | [] | no_license | import turtle as t
a = t.Turtle() # 주인공
b = t.Turtle() # 악당
c = t.Turtle() # 먹이
a.shape("turtle")
b.shape("turtle")
c.shape("circle")
a.color("blue") # 주인공 파란색
b.color("red") # 악당 빨간색
c.color("green") # 먹이 초록색
a.speed(0)
b.speed(0)
c.speed(0)
b.up()
b.goto(0, 200) # 위 방향으로 200 이동
c.up()
c.got... | true |
7b61bd05acb0bf4622058a1fb64f481cd0f0a43b | Python | rufusmitchellheggs/neuro_analysis | /preprocessing/lr_alignment_functions.py | UTF-8 | 23,303 | 2.859375 | 3 | [] | no_license | #All imports
import pandas as pd
import numpy as np
from numpy import *
import scipy.signal
import cv2
import os
from scipy import stats
from scipy.spatial import distance
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from math import floor
#Functions
def events_pivot_correction(events, ... | true |
922ccfd763646816d1fdaa5e7f862edc13477579 | Python | betteroutthanin/BrewComputer | /Dev/Zobjects/States/Recovery.py | UTF-8 | 4,421 | 2.578125 | 3 | [] | no_license | import Config
from Zobjects.States.State import State
from StateManager import StateManager
class Recovery(State):
##############################################################
def __init__(self):
super(Recovery, self).__init__()
self.loggingPrefix = "State.Recovery"
# Nor... | true |
3f4b1253c2a2e182ae6ef676f16c82ae804fac51 | Python | AK-1121/code_extraction | /python/python_27232.py | UTF-8 | 212 | 3.390625 | 3 | [] | no_license | # How can you tell if numbers in a list are bigger than 126? If it is bigger the program needs to add 94 to it
for i, element in enumerate(addOffset):
if element > 126:
addOffset[i] = element + 94
| true |
b6f44dc86674462620799c0311643c9b400d8f7e | Python | danielabud/Data_Science_Projects | /Transforming data with Python/count.py | UTF-8 | 484 | 3.453125 | 3 | [] | no_license | import read
import collections
df = read.load_data()
headlines = df['headline']
#join all headlines together
string = ""
for i in headlines:
string = string + " " + str.lower(str(i))
print("Successfully joined headlines into one string")
#split strings
headline_words = string.split()
print("Successfully split s... | true |
d421e32fc72dc715edadc2595e1489a9cc5fac90 | Python | happyhappyhappyhappy/pythoncode | /atcoder/mizuiro_h20/unionfind/ABC157D_FriendSuggestions/used/sample2.py | UTF-8 | 3,026 | 2.78125 | 3 | [] | no_license | # ライブラリのインポート
import sys
# import heapq,copy
import pprint as pp
from collections import defaultdict
# pypy3用
# import pypyjit
# 再帰制御解放
# pypyjit.set_param('max_unroll_recursion=-1')
# sys.setrecursionlimit(10**6)
from logging import getLogger, StreamHandler, DEBUG
# 入力のマクロ
def II(): return int(sys.stdin.... | true |
3a4cb9aa61cab0eac7c3dc41ac1818ac5d289b30 | Python | nishiyamayo/atcoder-practice | /src/main/scala/abc150/F.py | UTF-8 | 1,514 | 2.890625 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0] * (2 * N - 1)
D = [0] * N
for i in range(2 * N - 1):
C[i] = A[i % N] ^ A[(i + 1) % N]
D[i % N] = B[i % N] ^ B[(i + 1) % N]
class KMP:
def __init__(self, W):
self.W = W
self.L = len(W)
... | true |
afedd1171099a36870e9c586b13c58be59105ac7 | Python | Linxi-brave/HogwartsStudy | /testing_my_selenium_PO/base/seleniumAction.py | UTF-8 | 6,190 | 2.796875 | 3 | [] | no_license | import os
import time
from selenium.webdriver import ActionChains, TouchActions
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from util.handle_time import timenow
parent_dir = os.path.abspat... | true |
efc21d91b3513136fa29c353e7594a4ab7d767e6 | Python | perdikeas/python | /programs/constantine_space_invaders.py | UTF-8 | 5,355 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
import random
import turtle
import math
import time
#global variables
tick=0
aliens=[]
missiles=[]
aliens_escaped=0
kills=0
player_health=15
class Color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m... | true |
5c35bd554ab749fbe42de071819377389c91c853 | Python | schrismartin/434_proj2 | /PA1/AuthenticateHere.py | UTF-8 | 1,214 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
import socket
#set variables for server connection
TCP_IP = '127.0.0.1'
TCP_PORT = 2017
BUFFER = 1024
#create socket for server and listen for Alice
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
#connect to Alice
conn, addr = s.acce... | true |
7c762d0699a24e73b976e211960e170bb3661fbf | Python | ufbmi/olass-server | /app/olass/routes/oauth.py | UTF-8 | 5,698 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Goal: Implement routes specific to OAuth2 provider
@authors:
Andrei Sura <sura.andrei@gmail.com>
Client Credentials Grant: http://tools.ietf.org/html/rfc6749#section-4.4
Note: client credentials grant type MUST only be used by confidential clients.
--- Confidential Clients ---
Clients capable of maintaining... | true |
e5dfe0b34e123408cc50aaaf6e908df60d14c4dd | Python | Jaydeep-07/Python-Assignments | /Assignment 1/Assignment1_2.py | UTF-8 | 171 | 3.53125 | 4 | [] | no_license | def main(no):
if(no%2==0):
print("Even Number")
else:
print("Odd Number")
print("Enter The Number")
num=input()
num=int(num)
if __name__=='__main__':
main(num)
| true |
7f46b692ae0b4bcbaa6000519271e429f82221e6 | Python | Kennnnnnji/MapReduce | /problem3/python/frdMapper.py | UTF-8 | 476 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import sys
import json
friendsof_a = {}
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# parse the line with json method
record = json.loads(line)
a = record[... | true |
ad27fb722814a0d2a568bc4f8b1ba6e3a6740be2 | Python | jnshwu/py3gemast | /ANSWERS/file_count.py | UTF-8 | 427 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
"""
@author: jstrick
Created on Thu Mar 21 00:26:40 2013
"""
import sys
import logging
import os
logging.basicConfig(
filename='file_count.log',
level=logging.INFO,
filemode='w', # create new log each time program is run
)
start_dir = sys.argv[1]
for curr_dir, dir_list, file_list ... | true |
0aa043e3563307132af47edf045f329462223816 | Python | baigarkalpana/Python_Numbers | /Problems_on_Numbers/starpattrn1.py | UTF-8 | 404 | 3.953125 | 4 | [] | no_license | '''
program which accepting one number display * pattern
*****
*****
*****
*****
*****
'''
#accepting number fron user
num=int(input("enter number"))
#function defination for displaying star pattern
def stardisplay(star):
for x in range(star):
for y in range(star):
p... | true |
c196a87f68c52d2ca2e42998949c275029bb12ae | Python | jerryhanhuan/LearnPython | /re/do_re.py | UTF-8 | 589 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#File Name:do_re.py
#Created Time:2019-07-20 08:49:03
import re
# 使用 r 前缀,不用考虑转义的问题
match_re = r'^\d{3}\-\d{3,8}$'
def main():
str = input('Phone Num:')
if re.match(match_re,str):
print('match')
else:
print('Not match')
# 分组,用 () 表示的就是... | true |
acc34034a686217ab82ee0c6a411da87d3b56288 | Python | sgiardl/LeafClassification | /classifiers/Ridge.py | UTF-8 | 865 | 3.03125 | 3 | [] | no_license | from sklearn.linear_model import RidgeClassifier
from classifiers.Classifier import Classifier
class Ridge(Classifier):
"""
CLASS NAME:
Ridge
DESCRIPTION:
Child class for the Ridge classifier,
inherits from the Classifier parent class.
"""
def __init__(self):
... | true |
e9cb4c9858b0f392e46dece2c11f3f6af2ef1dd6 | Python | Leberwurscht/eartrainer | /guitar.py | UTF-8 | 3,007 | 2.859375 | 3 | [
"WTFPL"
] | permissive | #!/usr/bin/python
import gtk, gobject
from playnote import play_note
import random
strings = "ebgdaE"
current_fret = 0
current_note = 0
buttons = {}
status = gtk.Label()
status.set_markup('<span size="x-large"> </span>')
right = 0
total = 0
def play(*args):
global current_note
play_note(current_note)
def n... | true |
08c7d456f9ddf0e9da23beea4477409a55c090a4 | Python | IEEE-NITK/NLQ_to_SQL | /chandana/ml/_rnn1.py | UTF-8 | 1,133 | 3.203125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import numpy as np
class SingleRNN(nn.Module):
def __init__(self, n_inputs, n_neurons):
super(SingleRNN, self).__init__()
self.Wx = torch.randn(n_inputs, n_neurons) # 4 X 1
self.Wy = torch.randn(n_neurons... | true |
be90a24bc3ced1411b2a889c776bde96b8f5ae76 | Python | tehwentzel/cd_map | /backend/Stats.py | UTF-8 | 379 | 2.765625 | 3 | [] | no_license | import numpy as np
import pandas as pd
def records_to_array(record_list,keys = None):
#should take a list of dicts from json stuff
#[{x0: 1, x1: 1...},{x0: 0...}...] -> np.array([[x0,x1,x2...],[ x0...]...]
if keys is None:
keys = record_list[0].keys()
keys=set(keys)
records = [[v for k,v in entry.items() if k i... | true |
2784a2db1d55796b62c258762aab60e7acdaa746 | Python | atulanandnitt/arun | /uploadFileToAWS.py | UTF-8 | 843 | 2.53125 | 3 | [] | no_license | import boto3
bucket_name = 'bucket_name' # having public access
def upload_text_file():
content = open('local_file.txt', 'rb')
s3 = boto3.client('s3')
s3.put_object(
Bucket=bucket_name,
Key='remote-file.txt',
Body=content
)
upload_text_file()
def upload_media_file(f1):
con... | true |
514a140cdfbcf4bc1c2da6fc2e8f3dc2c9857b81 | Python | atavares75/MQP-URL_Classifier | /src/Metrics/AlgorithmPerformance.py | UTF-8 | 6,182 | 3.140625 | 3 | [] | no_license | from itertools import cycle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score, roc_curve, auc
from sklearn.preprocessing import label_binarize
class AlgorithmPerformance:
def __init__(self, test_urls, test_o... | true |
122c69caa2d9159acc6c47e46adbe825539ded96 | Python | nimadorostkar/img-size | /a.py | UTF-8 | 478 | 3.171875 | 3 | [] | no_license |
import cv2
# read image
imgA = cv2.imread('p1.jpg', cv2.IMREAD_UNCHANGED)
imgB = cv2.imread('p2.jpg', cv2.IMREAD_UNCHANGED)
# height, width
heightA = imgA.shape[0]
widthA = imgA.shape[1]
heightB = imgB.shape[0]
widthB = imgB.shape[1]
print('Image A :')
print(' Height : ',heightA)
print(' Wi... | true |
f478d87a40506ae09e10affcb01210685ef6dac9 | Python | Samuel-Maddock/Zilean | /league_api/graphs/games_per_month.py | UTF-8 | 2,662 | 2.953125 | 3 | [] | no_license | from riotwatcher import RiotWatcher
import datetime
import matplotlib.pyplot as plt
from .base_graph import Graph
class GamesPerMonthGraph(Graph):
def __init__(self, api_watcher, region):
super(GamesPerMonthGraph, self).__init__(api_watcher, region)
def retrieve_matchlist(self, summoner):
ca... | true |
888d8c467c55d5279dfdfda38dfdf92f989084a7 | Python | ankurtaly/Integrated-Gradients | /IntegratedGradients/integrated_gradients.py | UTF-8 | 4,902 | 3.375 | 3 | [] | no_license | import numpy as np
def integrated_gradients(
inp,
target_label_index,
predictions_and_gradients,
baseline,
steps=50):
"""Computes integrated gradients for a given network and prediction label.
Integrated gradients is a technique for attributing a deep network's
prediction to its input featu... | true |
fe49fe70acacca4c739a28860c6900d166d5616a | Python | sparshagarwal16/Assignment | /Assignment18.py | UTF-8 | 1,477 | 3.171875 | 3 | [] | no_license | import tkinter
from tkinter import *
import tkinter as tk
#Question 1
print("Question 1")
dict={}
for i in range(2):
name=input("Enter the name: ")
mob=int(input("Enter mobile number: "))
dict[name]=mob
r= Tk()
z=Label(r,text="DATA",width=15,bg="blue")
z.pack()
scrollbar = Scrollbar(r)
scrollbar.pack( side ... | true |
ce2eb2a5232159594b23316331ee21f2c39e721c | Python | zhuyanxi/CarnoFinance | /pythonVer/main.py | UTF-8 | 903 | 2.78125 | 3 | [
"MIT"
] | permissive | import xlrd
CSI_300_GROWTH_INDEX_EXCEL = "csi_300_growth_index.xls"
CSI_300_VALUE_INDEX_EXCEL = "csi_300_value_index.xls"
print("hello py")
bookGrowth = xlrd.open_workbook(CSI_300_GROWTH_INDEX_EXCEL)
sheetGrowth = bookGrowth.sheet_by_index(0)
growthList = sheetGrowth.col_values(5)[1:]
# print(growthList)
bookValue ... | true |
04d15225faec3a4a70e7f3db4ac3ddabf78f5cde | Python | RuolinZheng08/phonetic-acoustic-word-embeddings | /lib/data/batch_samplers.py | UTF-8 | 2,611 | 2.703125 | 3 | [] | no_license | import logging as log
import random
import numpy as np
class _StatefulBatchSampler:
def __len__(self):
return len(self.batches)
def __iter__(self):
while self.iter < len(self):
batch = self.batches[self.iter]
self.iter += 1
yield batch
self.init_iter()
def state_dict(self, itr):... | true |
483ea429b898a70e49dda119ca8d460329ca22e0 | Python | blackglowen/BookManager | /books/management/commands/seed.py | UTF-8 | 2,056 | 2.65625 | 3 | [
"MIT"
] | permissive | from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from faker import Faker
from books import models
from data import genres, authors
def create_authors():
for author in authors.DEFAULT_AUTHORS:
auth = models.Author(name=author['name'], country=auth... | true |
92b7f82c0b66b874f9839be4bdd804b226557e97 | Python | shonenada/crawler | /tests/test_link_item.py | UTF-8 | 834 | 2.78125 | 3 | [
"MIT"
] | permissive | #-*- coding: utf-8 -*-
import unittest
from crawler.link import Link
from crawler.item import Item
class LinkItemTestCase(unittest.TestCase):
def setUp(self):
self.item = Item('img', r'(?P<img><img [^>]+?>)')
self.link = Link('movie.douban', 'http://movie.douban.com/', [self.item])
def test... | true |
bad3b25b62280567cf51c2caff704cd4ad0a6a12 | Python | mdauthentic/ETLProject-Batch | /src/config.py | UTF-8 | 400 | 2.71875 | 3 | [] | no_license | from os import path, getcwd
import json
class Config:
def __init__(self) -> None:
pass
def __get_path_from_rel(self, rel_path: str):
return path.join(getcwd(), rel_path)
def load_config(self):
config_path = self.__get_path_from_rel("config.json")
with open(config_path, '... | true |
e6664a43bde9dde96c1e42eab1927c6a70aaaa5d | Python | shhuan/algorithms | /py/codeforces/321D.py | UTF-8 | 2,470 | 3.03125 | 3 | [
"MIT"
] | permissive | """
created by huash06 at 2015-07-15
"""
__author__ = 'huash06'
import os
import sys
import functools
import collections
import itertools
import math
h, q = [int(x) for x in input().split()]
def rightIndex(index, height):
res = index
for _ in range(height):
res = res * 2 + 1
return res
def ... | true |
23483e674d518c890e571643ac48c6ddd3ca0f70 | Python | ZwEin27/wedc-one-class-classification | /wedc/common/str.py | UTF-8 | 1,459 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# @Author: ZwEin
# @Date: 2016-08-09 13:52:35
# @Last Modified by: ZwEin
# @Last Modified time: 2016-08-09 13:55:11
import re
import string
def hasNumbers(inputString):
# return any(char.isdigit() for char in inputString)
return bool(re.search(r'\d', inputString))
def hasUnicode... | true |
89ea8c5fd4225ed700d2926bfb75f3e21b8b2cf6 | Python | jmstudyacc/python_practice | /POP1-Exam_Revision/repl_problems/session_4/matrix_max_index.py | UTF-8 | 1,063 | 3.96875 | 4 | [] | no_license | # M = matrix of numbers, list of lists
# m = number of rows in M
# n = number of columns in M
def matrix_max_index(M, m, n):
# init the var to hold the current max int from matrix
ele_max = 0
idx = 0
# iterate over the matrix
for i in range(0, m):
# if the value of ele_max is less than th... | true |
bc6df96d75dd8988f9ba02619e85b6bd99254a17 | Python | Panda3D-public-projects-archive/sfsu-multiplayer-game-dev-2011 | /branches/johanbranch/clientTeam/src/net/ServerResponseTable.py | UTF-8 | 1,143 | 2.640625 | 3 | [] | no_license | from common.Constants import Constants
from net.response.ResponseLogin import ResponseLogin
from net.response.ResponseRegister import ResponseRegister
class ServerResponseTable:
responseTable = {}
@staticmethod
def init():
"""Initialize the response table."""
ServerResponseTable.add(Cons... | true |
b2072e435d9974fe95f9482d2aa04f09dd563208 | Python | Breast-Cancer-Team/Final-Project | /Final-Project/logistic_regression.py | UTF-8 | 1,526 | 3.328125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Import cleaning and splitting functions
from clean_split_data import clean_data
from clean_split_data import split_data
# Import pandas and plotting libraries
import pandas as pd
# Import Scikit-Learn library for the regression models and confusion matrix
from skl... | true |
6fada24729ca97253cf05cdd0aa3c34279a81ad7 | Python | yerlantemir/HandwrittenLetterRecognition | /script.py | UTF-8 | 3,334 | 2.578125 | 3 | [] | no_license | from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpi... | true |
c0258edd2eb883b3d849c2942862c7d80536412a | Python | 1oglop1/rst2text | /src/rst2text/elements.py | UTF-8 | 11,927 | 3.265625 | 3 | [
"MIT"
] | permissive | """
Extracted from sphinx.writers.text
"""
import math
import re
import textwrap
from itertools import chain, groupby
from typing import cast
from docutils import writers
from docutils.utils import column_width
from rst2text import MAXWIDTH
class Cell:
"""Represents a cell in a table.
It can span on multipl... | true |
89fe4bb55154aa2fc662cbf574ae67cabda9bd42 | Python | Noxy3301/AtCoder | /OtherContest/dp/dp_a.py | UTF-8 | 235 | 2.96875 | 3 | [] | no_license | n = int(input())
h = tuple(map(int, input().split()))
dp = [0]
for i in range(1,n):
if i == 1:
dp.append(abs(h[i]-h[i-1]))
else:
dp.append(min(dp[-1]+abs(h[i]-h[i-1]), dp[-2]+abs(h[i]-h[i-2])))
print(dp[-1]) | true |
7b58820f730f011f4cb285dfb5c219b5982dcc69 | Python | snaress/studio | /lib/system/seqList.py | UTF-8 | 2,791 | 2.96875 | 3 | [] | no_license | import os
class SeqLs(object):
""" List given directory with a sequence compact view
ex: ima_1.[001:005:1].txt ([start:stop:step])
:param dir: Directory to list
:type dir: str """
def __init__(self, dir):
if not os.path.exists(dir):
raise IOError, "!!! ERROR: Direc... | true |
09dca82f0d4b5de3d2ef41cc5384c37993d0e016 | Python | rcburnet/PHYS-437A | /Assignment_6/Ryans_list/315_primaries_compare_to_274.py | UTF-8 | 1,834 | 3.21875 | 3 | [] | no_license | import numpy as np
from sklearn.neighbors import BallTree
#This script will read my list of 315 primaries and compare it to Ryan's list
# to make sure all of Ryan's primaries are in my list (which they are).
# Identical to script in Assignment_3.
#read files
file_284_primary = open('CasJobs_315_primaries_in_SDSS.txt... | true |
4b52c8cc5f884e0e931437bb55886b4edfedf835 | Python | elimoss/broad_malaria | /snp_call_mods/util_cmd.py | UTF-8 | 6,149 | 2.703125 | 3 | [] | no_license | # util_cmd.py - This gives a main() function that serves as a nice wrapper
# around other commands and presents the ability to serve up multiple
# command-line functions from a single python script.
#
# requires python >= 2.5
#
# dpark@broadinstitute.org
# $Id: util_cmd.py 7351 2013-01-22 22:53:06Z dpark $
import os, ... | true |
a028b2814142246d733143a223d8f9770a76dfcc | Python | secreter/QA | /offline/answerTheQuestion.py | UTF-8 | 986 | 2.515625 | 3 | [] | no_license | # 进行图匹配找到答案
from getRelFromN import getTriple
import json
import requests
# 根据谓词短语查询到patternid
fRelT=open('./txt/dist/my/relT.txt','r',encoding='utf-8')
relT=json.load(fRelT)
# 根据patternid查询谓词路径path
fPaths=open('./txt/dist/my/paths_tf-idf.txt','r',encoding='utf-8')
paths=json.load(fPaths)
# sents="where does Aaron Ke... | true |
49118b0ce721fb878cb7e853391710aaccf21e72 | Python | abdibogor/Thenewboston | /03_Software Engineering/004_Python Reverse Shell/011_Selecting a Target/server.py | UTF-8 | 2,894 | 2.90625 | 3 | [] | no_license | import socket
import threading
import sys
from queue import Queue
NUMBER_OF_THREADS = 2
JOB_NUMBER = [1, 2]
queue = Queue()
all_connections = []
all_addresses = []
# create socket (allows two computers to connect)
def socket_create():
try:
global host
global port
global s
host = ''... | true |
d9d0ddca41cb7fda6786175790dadd6534c6a57f | Python | okomeshino/python-practice | /applications/class_method.py | UTF-8 | 848 | 3.765625 | 4 | [] | no_license | # encoding:utf-8
import datetime
class TestClass:
def __init__(self, year, month, day):
self.year = year
self.month = month
self.day = day
# クラスメソッド
@classmethod
def sample_class_method(cls, date_diff=0):
today = datetime.date.today()
d = today + datetime.tim... | true |
5da744fc1c2da4557980f9b55dc650b9208390ec | Python | N2BBrasil/text-processing | /text_processing/pos_processing/test_correct_text.py | UTF-8 | 322 | 2.75 | 3 | [
"MIT"
] | permissive | from .correct_text import CorrectText
def test_texts(texts):
for incorrect, correct in texts:
print(incorrect, correct)
assert CorrectText().transform(incorrect)==correct
def test_sent_tokenizer():
assert 'Olá Como Vai' == CorrectText().captalize(
'olá como vai', lambda _: _.split(' ')... | true |
42b86c19ac74b3f8557b248a721031bb5a5d5783 | Python | JahouNyan/learningpython | /wikipediaextract.py | UTF-8 | 933 | 3.71875 | 4 | [] | no_license | #Import the requests and json libraries
import requests
import json
#Ask the user for an article and strip it and replaces the spaces with underscores (_)
article = input("What wikipedia article do you want? ")
article = article.strip().replace(" ", "_")
#Format the API endpoint with the article
url = f"https://en.wi... | true |
b4814c270ee40d26f08ed7824c142ff402bd13ce | Python | mikecasey93/CSSI-Lucky7 | /main.py | UTF-8 | 5,937 | 2.671875 | 3 | [] | no_license | import webapp2
import os
import random
import jinja2
import datetime
from database import seed_data
from app_models import Lottery
jinja_current_dir = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class DisplayHandl... | true |
2f5259450d59c94e82cbcf6712a8b04d3409576f | Python | ipinak/naftis | /test/tools.py | UTF-8 | 1,244 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/bin/env python
# -*- coding:utf-8 -*-
import sys
import os
import HTMLTestRunner
import time
from unittest import makeSuite, TestSuite
__author__ = 'ipinak'
def run_tests(test_cases, location='', title=None, description=None):
suite = TestSuite()
[suite.addTest(makeSuite(tc)) for tc in test_cases]
ti... | true |
c489568e2e0ba9741b7fbb6d050438b192730631 | Python | sidparasnis/client-server | /UDP_Client.py | UTF-8 | 894 | 2.84375 | 3 | [] | no_license | # UDP_Client
from socket import *
serverName = '127.0.0.1'
serverPort = 50069
clientSocket = socket(AF_INET, SOCK_DGRAM)
again = "Y"
while True:
message = input("\nInput int,int,operation or 'quit' to quit: ")
if message == 'quit':
break
print ("\n ")
print ("-->> Sending: " +... | true |
ed0ff468239cdb5edd9a7afea962c6b310c7e09d | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/CJ/16_1_2_ManojPammi_2.py | UTF-8 | 508 | 2.609375 | 3 | [] | no_license | f=open("B-large.in",'r')
g=int(f.readline())
for d in range(g):
a=int(f.readline()[:-1])
g={}
for i in range(2*a-1):
m=f.readline()[:-1]
t=m.split()
for l in t:
if l in g:
g[l]=g[l]+1
else:
g[l]=1
c=[]
for ... | true |
5379cb328d150bda28397e4356438732db738082 | Python | nxexox/python-rest-framework | /tests/test_fields.py | UTF-8 | 54,382 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """
Fields testing
"""
import datetime
from unittest import TestCase
import six
from rest_framework.exceptions import SkipError
from rest_framework.serializers.exceptions import ValidationError
from rest_framework.serializers.fields import (
Field, CharField, IntegerField, FloatField, BooleanField, BooleanNullFi... | true |
603ba9dda00da362b46b5d4f37471b84f918c8c4 | Python | luispuentesvega/util-scripts-py | /get_directory_size.py | UTF-8 | 300 | 2.96875 | 3 | [] | no_license | import os
total_size = 0
start_path = 'This PC\Luis Puentes (Galaxy A5)\Card' # To get size of current directory
for path, dirs, files in os.walk(start_path):
for f in files:
fp = os.path.join(path, f)
total_size += os.path.getsize(fp)
print("Directory size: " + str(total_size)) | true |
d2a5c5093d93c845ca4e5a8b2445ff524c29dbde | Python | anishpdm/SNIT-IEDC-PYTHON-PGM | /add.py | UTF-8 | 36 | 2.96875 | 3 | [] | no_license | a=10
b=33
c=a+b
print("Result is",c) | true |
41d6026f11457df61e4592a92e6e35bbeb31b1a9 | Python | ColdMatter/PhotonBEC | /learning/daq-board-fast-read/daq-read-individual.py | UTF-8 | 763 | 2.75 | 3 | [
"MIT"
] | permissive |
#read data from the daq board with lots of individual calls
#written around 11/4/2017
import sys
sys.path.append("D:\\Control\\PythonPackages\\")
import time, datetime
import SingleChannelAI
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
reading_count = 200
Npts = 1000
rate = 1e4
interval ... | true |
e588cb7284af979df1d9e6b2814ae4b8552f86a1 | Python | yassinhc/Building_digital | /test/CoridorTest.py | UTF-8 | 1,406 | 2.546875 | 3 | [] | no_license |
import unittest
import sys
sys.path.append('..')
import src.coridor as Corridor
import src.Wall as Wall
import src.coordinate as Coordinate
from test.areaTest import AreaTest
class Test_Coridor(AreaTest,unittest.TestCase):
global List_Walls
def createArea(self):
global ... | true |
a65fed5c478757d78926a9958b962f0b47106bd6 | Python | vikulovm5/Homeworks | /Урок 2. Практическое задание/task_4.py | UTF-8 | 1,114 | 4.09375 | 4 | [] | no_license | """
4. Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ...
Количество элементов (n) вводится с клавиатуры.
Пример:
Введите количество элементов: 3
Количество элементов: 3, их сумма: 0.75
Подсказка:
Каждый очередной элемент в 2 раза меньше предыдущего и имеет противоположный знак
Решите через рекурс... | true |
76d511ada20317db568944c7820f62db9fa63778 | Python | janmarkuslanger/clean-flask | /app/user/models.py | UTF-8 | 587 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from passlib.apps import custom_app_context as pwd_context
from app import db
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
username = db.Column(db.String, unique=True, nullable=Fa... | true |