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 |
|---|---|---|---|---|---|---|---|---|---|---|
084a92d35cfa8c61102cd7a728c2bbe720a27074 | erickrubiol/PythonPrograms | /Load_flat_files_to_pandas.py | UTF-8 | 557 | 3.359375 | 3 | [
"MIT"
] | permissive | # How to load flat files to a Pandas Dataframe
import pandas as pd:
column_names = ['Col1', 'Col2', 'Col3']
# Load 1000 rows and some columns of the data to dataframe
data = pd.read_csv("file.tsv", usecols = column_names, nrows=1000,sep="\t")
# Process a file in chunks
column_names = ['Name', 'Adress', 'Zipcode']... | true |
7b59f797987d2bcaa8d1d4668c7fcb4f9a2abe70 | Aasthaengg/IBMdataset | /Python_codes/p02835/s396131750.py | UTF-8 | 113 | 2.6875 | 3 | [] | no_license | A_int_list = list(map(int, input().split()))
if 22 <= sum(A_int_list):
print('bust')
else:
print('win')
| true |
d300f5ae5d8ff1458a73b5b59dbce2a1ae5e218f | WhereaBoutSoftware/Beta-Testing | /coreClasses.py | UTF-8 | 9,751 | 2.59375 | 3 | [] | no_license | import re
import statistics
import tkinter as tk
from tkinter import ttk, filedialog, font, messagebox, Scale
#Stores information about a vertex representing a peak or valley in the data
class vert:
def __init__(self, index, temp, vertType):
#Initialize members
self.index = int(index)
self.temp = float(temp... | true |
b10cc1e24c8fd74b13796739b624935b22e18c0f | sunarainy/onmyoji | /game_controller.py | UTF-8 | 25,372 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*-coding:utf-8-*-
"""
定义识别对象
对游戏不同阶段的响应动作
"""
import time
import random
import win32gui
from PIL import ImageGrab
from utilities import logging, click_left_cur, move_curpos, get_hash, hamming, get_resolution, mypath
class ResolutionGetError(Exception):
pass
class OnmyojiObjectBase:
def __init__(self, h... | true |
85457246b9e63b0b2b5e49d3e6f7e78e4733f9cf | ZakirQamar/gems | /src/python-iterable/test_repeat.py | UTF-8 | 1,702 | 3 | 3 | [
"CC0-1.0"
] | permissive | import unittest
from unittest import mock
from repeat import repeat
class TestException(Exception):
pass
class Repeat_Function_Test(unittest.TestCase):
def test_Should_CallFunctionUntilStopIterationException_When_Called(self):
func = mock.Mock(spec=[])
func.side_effect = [ [1], [2]... | true |
31ad049130eea8ed732ad1c6296239ac6575db95 | JamesP2/adventofcode-2020 | /day/12/day12-1.py | UTF-8 | 1,694 | 3.59375 | 4 | [] | no_license | import argparse
from enum import IntEnum
parser = argparse.ArgumentParser(description="Rain Risk")
parser.add_argument("file", metavar="INPUT_FILE", type=str, help="Input filename")
parser.add_argument(
"--verbose", "-v", action="store_true", default=False, help="Verbose output"
)
args = parser.parse_args()
def... | true |
63cf85f047aa0236d85e7276d6f28dbcee82907d | satishsolanki1990/Leetcode | /1304_sumuptozero.py | UTF-8 | 646 | 3.921875 | 4 | [] | no_license | """
1304. Find N Unique Integers Sum up to Zero
Given an integer n, return any array containing n unique integers such that they add up to 0.
Example 1:
Input: n = 5
Output: [-7,-1,1,3,4]
Explanation: These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].
"""
class Solution:
def sumZero(self, n) :
... | true |
32c33a4fdd5ae36d5071e7e491abd034b71b2bdb | berli/facenet-vs-vggface | /tf2_basic.py | UTF-8 | 481 | 2.78125 | 3 | [] | no_license |
#-*- coding: utf-8 -*-)
import tensorflow as tf
import tempfile
ds_tensors = tf.data.Dataset.from_tensor_slices([1,2,3,4,5,6])
_,filename = tempfile.mkstemp()
with open(filename, 'w') as f:
f.write("""Line 1
Line 2
Line 3
""")
ds_file = tf.data.TextLineDataset(filename)
ds_tensors = ds_tensors.... | true |
9a4ff5a19ac7695ad698852a7b8b6997616e1f0a | Shubham0812/Python-Scripts | /part1.py | UTF-8 | 2,436 | 3.078125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
# global variables
counter = 1
test_data = [4]
test_data2 = [5,15]
result_set = set()
ideoneString = "https://ideone.com"
languageList = []
def get_content(path):
r = requests.get(path)
content = r.content
print(r.url)
soup = BeautifulSoup(cont... | true |
0fe8bea16e54a0c3c248da1620f43cd6c57d9984 | gtregoat/keras_text_classifier | /__main__.py | UTF-8 | 2,634 | 2.875 | 3 | [] | no_license | import argparse
import pandas as pd
from classifier import pipeline
parser = argparse.ArgumentParser()
parser.add_argument("--training_data",
help="path to training data",
required=False,
default=None)
# parser.add_argument("--output_model",
# ... | true |
97af84bcc3a4e661db04a13b17a0b47813e5d614 | lisprolog/python | /warriors.py | UTF-8 | 1,613 | 3.859375 | 4 | [] | no_license |
class Warrior:
def __init__(self):
self.health = 50;
self.attack = 5;
self.is_alive = True;
pass
class Knight(Warrior):
def __init__(self):
self.health = 50;
self.attack = 7;
self.is_alive = True;
pass
def fight(unit_1, unit_2):
fight_... | true |
98949256ff28c88c86a303c5fd38f2fdeee57876 | NVGR/HackerRank | /algorithms/sorting/quick_sort.py | UTF-8 | 788 | 3.71875 | 4 | [] | no_license | def quick_sort_impl(li):
"""
Runtime: O(nlogn)
"""
if len(li) <= 1:
return li
else:
pivot_index = len(li) // 2
pivot = li[pivot_index]
lesser, greater, pivot_list = [], [], []
for i, v in enumerate(li):
if i == pivot_index:
piv... | true |
2338839c6b2f414902862edf7ba4173327bfec06 | vmmqa/XenGT-CitrixServer-patch | /multiprocessQueue.py | UTF-8 | 1,723 | 2.890625 | 3 | [] | no_license | # Written by Vamei
import os
import multiprocessing
import time
#==================
# input worker
def inputQ(queue,i):
info = str(os.getpid()) + '(put):' + str(time.time()) +'(number):'+str(i)
#print(info)
queue.put(info)
def inputQ(queue,key, command):
#info = str(os.getpid()) + '(put):' + ... | true |
6c64ae00b66e2c9a174a21e28650546553205d5e | IgnacioBorello/MaPo | /MaPo_1.0.py | UTF-8 | 10,879 | 3.015625 | 3 | [] | no_license | #! /usr/bin/env python
import pilas
import sys
sys.path.insert(0, "..")
from pilas.escenas import *
import random
from pilas.actores import Aceituna
#Ponemos al enemigo (aceituna)
class AceitunaVigilante(Aceituna):
def __init__(self, x=0, y=15, num=1):
Aceituna.__init__(self, x, y)
self.num=num
#E... | true |
e2d75d3288ad2b5e6aa5faff40644dd30232dadb | guam68/class_iguana | /Code/Daniel/python/lab22-ari.py | UTF-8 | 2,452 | 3.296875 | 3 | [] | no_license | import re
ari_scale = {
1: {'ages': '5-6', 'grade_level': 'Kindergarten'},
2: {'ages': '6-7', 'grade_level': '1st Grade'},
3: {'ages': '7-8', 'grade_level': '2nd Grade'},
4: {'ages': '8-9', 'grade_level': '3rd Grade'},
5: {'ages': '9-10', 'grade_level': '4th Grade'},
... | true |
67642268a69bc89fcfab12c3374c8bb6e3337e1d | Koomook/djangofordemo | /demo/musicus/src/lyrics_gen.py | UTF-8 | 5,781 | 2.6875 | 3 | [] | no_license | from time import sleep
from konlpy.tag import Mecab
import numpy as np
import re
tagger = Mecab()
class Gen():
"""
TO-do:
모양 정리
쪼개기
작사 api 쓰는 다양한 경우의 수 생각하기.
1. 방금 만든 가사랑 엄청 비슷한 걸 뽑아보고 싶다.
2. keep_prob을 계속 변경하면서 뽑고 싶다. randomness
3. 길게/짧게 뽑고 싶다.
... | true |
cb48c6ecd32755d1bec0a988e57ec3963e4d8502 | NapoleaoHerculano/Introducao-a-Programacao-P1 | /Comando Condicional - IF and ELSE/Comando Condicional - 01.py | UTF-8 | 310 | 4.40625 | 4 | [] | no_license | #1. Escreva um programa que receba como entrada um número e
#exiba uma mensagem informando se ele é positivo, negativo ou neutro.
numero=int(input("Digite um número:"))
if numero > 0:
print("Número Positivo")
elif numero < 0:
print("Número Negativo")
else:
print("Número Neutro")
| true |
fe50924bc4cc29f99f3291d8620ebc85720c523b | andreybashtovoy/parsebot | /test.py | UTF-8 | 314 | 3.21875 | 3 | [] | no_license | def checkio(n):
result = ''
for arabic, roman in zip((1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1),
'M CM D CD C XC L XL X IX V IV I'.split()):
result += n // arabic * roman
n %= arabic
print('({}) {} => {}'.format(roman, n, result))
return result
print(checkio(12)) | true |
2872682be5224450d5d230572df0738dda3fec9b | BobiAce/prune_distill_test | /visdom_loss.py | UTF-8 | 1,559 | 2.5625 | 3 | [] | no_license | # coding:utf8
import visdom
import time
import numpy as np
## python -m visdom.server
## 在浏览器输入:http://localhost:8097/,即可启动
class Visualizer(object):
def __init__(self, env='default', **kwargs):
self.viz = visdom.Visdom(env=env, **kwargs)
x, y, z = 0, 0, 0
self.win_loss = self.viz.line(
... | true |
bbdbf65014c2d2c548de81af69dc572e71335d1f | luciengaitskell/Project-Euler-Answers | /answers/Problem_3/Problem_3.py | UTF-8 | 639 | 2.921875 | 3 | [
"Unlicense"
] | permissive | num=600851475143
#num=10
ii=num-1
primes = []
# primes
while ii > 1:
jj=ii-1
flag=False
while jj>1:
flag=True
if ii % jj == 0:
flag=False
break
jj= jj-1
if flag == True:
primes.append(ii)
print primes
ii= ii-1
print primes
# OTHER
... | true |
077fa1a3528614400290939a99b122d936999d4b | abhiranjan-singh/CodePY | /Scope.py | UTF-8 | 338 | 3.609375 | 4 | [] | no_license | a = 5
globalVar ="This Is Global"
def MyFunction():
localVar="This Is Local"
globalVar="This Is Local"
print("myfunction - LocalVar: "+ localVar)
print("myfunction -globalVar: "+ globalVar)
MyFunction()
print( globalVar)
def func(b):
c =a+b
return (c)
print (func(4)) #gives 4+5=9
print (c) ... | true |
3c77b6f835c127d9402e237705c2ba244ddea96d | axd8911/Leetcode | /1st_try/190_Reverse_Bits_1st_try.py | UTF-8 | 380 | 2.78125 | 3 | [] | no_license | class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
start = str(bin(n))[2:]
addup = 32-len(start)
end = '0'*addup + start
new = 0
for i in range(len(end)):
if end[i] == "1":
new += 2**i
... | true |
096df7aeeb6637189395f7f4fa45e67e6f2486f7 | wizdes/InfluencePrediction | /WithTwitter/getAvg.py | UTF-8 | 184 | 2.8125 | 3 | [] | no_license | import sys
f = open("ccr_data.txt")
lines = f.readlines()
dArray = [0,0,0]
for index, elt in enumerate(lines):
dArray[index % 3] += float(elt)
for elt in dArray:
print 1.0 * elt / 6 | true |
6fbe34dfe33e7ed928d4868e87cd2adb929f0e51 | zhiyang0310/mobile-robot | /raspi/src/encoders/scripts/arduino.py | UTF-8 | 5,056 | 2.9375 | 3 | [] | no_license | from serial import Serial
import threading
import sys
class Arduino:
def __init__(self, port="/dev/ttyUSB0", baudrate=57600, timeout=0.5, motors_reversed=False):
self.PID_RATE = 30 # Do not change this! It is a fixed property of the Arduino PID controller.
self.PID_INTERVAL = 1000 / 30
... | true |
1baab3de29197127d9511fdb4bff9dcb65d9cd23 | SoniaZhu/Lintcode | /Dropbox/1134. Find Duplicate File in System [M].py | UTF-8 | 541 | 3.21875 | 3 | [] | no_license | class Solution:
"""
@param paths: a list of string
@return: all the groups of duplicate files in the file system in terms of their paths
"""
def findDuplicate(self, paths):
# Write your code here
map = collections.defaultdict(list)
for path in paths:
root, *files ... | true |
267eaf5b4962a39c0fe96f72c9695ea0115bea84 | aliharakeh/M2-Project | /Project_Final_Scripts/topics/json_to_csv.py | UTF-8 | 675 | 2.71875 | 3 | [] | no_license | import json
import pandas
def json_to_csv(dict_, type_, filename):
data = []
for key, topics in dict_.items():
data.append([*key.split('_'), topics])
df = pandas.DataFrame(data, columns=['year', 'month', f'{type_}_ID', f'{type_}_AR', f'{type_}_EN', 'Topics'])
df.to_csv(filename, index=False)
... | true |
7b1c283c634c2145440cd1fb66e506aed9e6e035 | dr-data/blockchain-applications-book | /Chapter-7/trieex.py | UTF-8 | 1,514 | 2.6875 | 3 | [] | no_license | >>> import trie, utils, rlp
>>> state = trie.Trie('triedb', trie.BLANK_ROOT)
>>> state.update('\x0d\x91\x13\x32', rlp.encode(['1,2,a,b']))
>>> state.update('\x0d\x98\xb2\x37', rlp.encode(['3,4,c,d']))
>>> state.update('\x0d\x98\xb2\x49', rlp.encode(['5,6,e,f']))
>>> state.update('\x0d\x98\xb2', rlp.encode(['7,8,g,h'])... | true |
12f06225e269832c8f02f0210ea9a8492a49b8fb | moriaki3193/ridge | /ridge/models/learning2rank.py | UTF-8 | 592 | 2.890625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
from scipy import stats
# stats.norm.pdf(x, loc=0, scale=1)
class SoftRank:
"""SoftRank: Optimizing Non-Smooth Rank Metrics (2008).
モデルの出力は,エンティティのリスト(とそれを生成する確率).
その際の入力は,エンティティの素性のリスト(行列?).
"""
def __init__(self):
pass
def predict(self, ... | true |
f10a0286628ea7dbde6a871a3a1490d9a8ed6740 | mariarf/EII-GII-2021-07-RodriguezFelipe-MariaDeLosAngeles | /utils/model.py | UTF-8 | 2,679 | 2.84375 | 3 | [] | no_license | import pandas as pd
import os
from datetime import timedelta as timedelta
from datetime import datetime as dt
from tensorflow import keras
from utils.window_generator import WindowGenerator
from utils.data_processing import DataProcessing
from utils.predictions_processing import PredictionsProcessing
class Model:
... | true |
50560a86684b5f6007429f9900a96d51f13ccd8b | qause/python-slack-sdk | /tests/slack_sdk/models/test_init.py | UTF-8 | 934 | 2.671875 | 3 | [
"MIT"
] | permissive | import unittest
from slack_sdk.models import extract_json
from slack_sdk.models.blocks import PlainTextObject, MarkdownTextObject
class TestInit(unittest.TestCase):
def test_from_list_of_json_objects(self):
json_objects = [
PlainTextObject.from_str("foo"),
MarkdownTextObject.from_... | true |
8fd654dfc3e7c446950b7de1008f87f7661877cc | cchen4216/Euler-Project | /coin_sums.py | UTF-8 | 932 | 3.453125 | 3 | [] | no_license |
coins = set([1, 2, 5, 10, 20, 50, 100, 200])
summ = 200
count = 0
combinations = {}
def resetcombinations():
global combinations
for i in combinations.keys():
combinations[i] = 0
def decompose(summ, coins):
global count
global combinations
if summ!=0 and len(coins)==0:
return
if summ == 0:
count += ... | true |
8ef4b743e65ff67586c0f188f3e33815226c87d1 | euxcet/record | /backend/main.py | UTF-8 | 940 | 2.625 | 3 | [] | no_license | import camera
import counter
import argparse
import imutils
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-n", "--num-frames", type=int, default=100,
help="# of frames to loop over for FPS test")
ap.add_argument("-d", "--display", type=int, default=-1,
help="Whether or not frames should be displayed")
a... | true |
22c8f0f9ccfe99a8c9dc46122d6f0d3744705246 | asadquraishi/CarND-Vehicle-Detection | /detection.py | UTF-8 | 14,646 | 2.953125 | 3 | [] | no_license | import matplotlib.image as mpimg
import numpy as np
import cv2
from skimage.feature import hog
from sklearn.preprocessing import StandardScaler
from sklearn.svm import LinearSVC
from sklearn.cross_validation import train_test_split
import glob
import time
class Vehicle():
def __init__(self):
self.detected ... | true |
61e1b47f5e138939b01ee7e187594519457b8d7d | shrivastavshubham34/DistributedFileStorage | /node/utils/tree_node.py | UTF-8 | 2,448 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8
import logging
DEBUG = 0
PRINT_LIST_BREAK = 5
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class TreeNode:
node_left = None
node_right= None
size = 0
free_pages = []
def __init__(self, size=0, free_pages=[]):
self.size = si... | true |
52a1dec91097ab1ac188f317de2d7ee1f24b873d | yumechi/YukicoderHandoutCodes | /rank2/yuki365.py | UTF-8 | 207 | 2.84375 | 3 | [] | no_license | def solve():
n = int(input())
al = [int(i) for i in input().split()]
res = n
for i in al[::-1]:
if res == i:
res -= 1
print(res)
if __name__=='__main__':
solve() | true |
dd3e919726a4bca02b7981c00299e465e39bced0 | phoro3/atcoder | /ABC/ABC_117/C_problem.py | UTF-8 | 337 | 2.859375 | 3 | [] | no_license | N, M = map(int, input().split())
x_list = list(map(int, input().split()))
x_list = sorted(x_list, reverse = True)
diff_list = [0] * (M - 1)
ans = 0
if M > N:
for i in range(M-1):
diff_list[i] = x_list[i] - x_list[i+1]
diff_list = sorted(diff_list, reverse = True)
ans = sum(diff_list[N... | true |
cbf8c33ae5acc311c6fe5f08f53651da8af81290 | rlarsby/CS50x-Introduction-to-Computer-Science | /pset7/houses/roster.py | UTF-8 | 815 | 3.265625 | 3 | [] | no_license | from cs50 import SQL
import cs50
import csv
import sys
import sqlite3
# check command-line arguments
if len(sys.argv) != 2:
print("Usage: python roster.py 'house'")
sys.exit(1)
#set the command-line argument for which house
house = sys.argv[1]
#connect to database
connection = sqlite3.connect('students.db')
... | true |
859d7b327c907cf36cfbee1ac092575734342861 | manudubinsky/bigdata-2016-2c | /practicas/practica6/resolucion/Punto 5) b).py | UTF-8 | 276 | 2.515625 | 3 | [] | no_license | import pymongo
from pymongo import MongoClient
client = MongoClient()
db = client.test
cursor = db.tweets.find({"geo":{"$ne":None}},{"user.name":1, "coordinates":1})
for i in cursor:
print "Nombre: ", i['user'], " | Coordenadas: ", i['coordinates']
| true |
bdc8ad0331d6a11c5e983db9dc9e99ffc4698376 | python-cookbook/PythonStudy | /p02_personal_summary/p13_lee_yung_seong/p04_week/p01_tuesday/C6.4.py | UTF-8 | 2,533 | 3.640625 | 4 | [] | no_license | #매우 큰 xml파일 증분 파싱하기
#문제
#매우 큰 xml 파일에서 최소의 메모리만 사용하여 데이터를 추출하고 싶다.
#해결
#증분 데이터 처리에 직면할 때면 언제나 이터레이터와 제너레이터를 떠올려야 한다. 여기 아주 큰 xml 파일을 증분적으로 처리하며 메모리 사용은 최소로 하는 함수를 보자.
from xml.etree.ElementTree import iterparse
def parse_and_remove(filename,path):
path_parts = path.split('/')
doc = iterparse(filename,('start','... | true |
e8dd9db13f1a2ccbc2d27c50421339ddeb17e78b | HaohuiHU/IVUS | /contourshift_image.py | UTF-8 | 740 | 3.484375 | 3 | [] | no_license | # this function shifts an image so that its contour forms the first row
import numpy as np
from matplotlib import cm, pyplot as plt
def shift(image, contour):
# size of single image
imsize = np.array([image.shape[1] - np.min(contour), image.shape[2]]).astype(int)
# volume of single images
shifted_image ... | true |
f42f05444ee37b07de7797c508ff4969c9146e5b | PhasesResearchLab/ESPEI | /tests/test_utils.py | UTF-8 | 3,119 | 2.640625 | 3 | [
"MIT"
] | permissive | """
Test espei.utils classes and functions.
"""
import pickle
import pytest
from tinydb import where
from espei.utils import ImmediateClient, PickleableTinyDB, MemoryStorage, \
bib_marker_map, extract_aliases
from .fixtures import datasets_db, tmp_file
from .testing_data import CU_MG_TDB
def test_immediate_clie... | true |
77f7a48858b463f00c310fcef4388410c89d3659 | ritwiktiwari/AlgorithmsDataStructures | /archive/linked_list/link_list_reversal.py | UTF-8 | 1,419 | 4.0625 | 4 | [] | no_license | class Node(object):
def __init__(self,data):
self.data = data
self.nextNode = None
class LinkedList(object):
def __init__(self):
self.head = None
def insert(self,data):
newNode = Node(data)
if self.head == None:
self.head = newNode
else:
... | true |
882e9a4a6395f4815c0d0b599febd53f6af55fab | douglasrusse11/lists_dictionaries_lab | /exercise_d_advanced_logic.py | UTF-8 | 1,485 | 4.625 | 5 | [] | no_license | # For the following list of numbers:
numbers = [1, 6, 2, 2, 7, 1, 6, 13, 99, 7]
# 1. Print out a list of the even integers:
even_numbers = []
for number in numbers:
if number % 2 == 0:
even_numbers.append(number)
print(even_numbers)
# 2. Print the difference between the largest and smallest value:
p... | true |
f28e334a95e2911b51a3584aac7091316453a2de | gargi98/Introduction-Programming-Python | /operator/arithmetic operator/modulo.py | UTF-8 | 46 | 2.53125 | 3 | [] | no_license | #modulo operator gives remainder
print(24%5)
| true |
e01f93be99b121022d5fa6ebe4934f01f6f3971f | dyadav94/codesignal-solutions | /introduction/46-ElectionWinners.py | UTF-8 | 516 | 2.859375 | 3 | [] | no_license | from collections import Counter
def electionsWinners(votes, k):
if all(votes[0] == ix for ix in votes[1:]):
if k == 0:
return 0
else:
return len(votes)
m = max(votes)
my_dict = dict(Counter(votes))
if k == 0:
if my_dict[m] > 1... | true |
8b63791075f0e691740f6a71388f7b418e7f7f30 | Garve/scikit-bonus | /skbonus/pandas/tests/test_time_utils.py | UTF-8 | 714 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | """Test the time utilities."""
import pandas as pd
import pytest
from ..time_utils import explode_date
@pytest.fixture
def get_data():
"""Create simple input data."""
input_data = pd.DataFrame(
{
"Data": ["a", "b", "c"],
"Start": pd.date_range("2020-01-01", periods=3),
... | true |
994a1cee0723ff058e7e31dd3b81ed0efe659960 | texttest/storytext-selftest | /tkinter/widgets/checkbutton/target_ui.py | UTF-8 | 866 | 2.9375 | 3 | [] | no_license | # menu-example-3.py
try:
from tkinter import *
except:
from Tkinter import *
def printMusic():
print("Let the music play...")
top = Tk()
lf1 = LabelFrame(top, text="Settings", padx=6, pady=6)
CheckVar1 = IntVar()
CheckVar2 = IntVar()
CheckVar3 = IntVar()
C1 = Checkbutton(lf1, text = "Music",
... | true |
9efb8719fe788b445240f4354345acfccefdbcf5 | boeboe/meetup-selenium | /meetup_selenium/parsers/groupparser.py | UTF-8 | 6,137 | 2.921875 | 3 | [] | no_license | """Module to support parsing of meetup group pages """
import re
from .parseutil import *
from .exception import ParseError
from ..groupmember import GroupMember
from ..groupevent import GroupEvent
class GroupParser():
"""Class to interact with a group page """
def __init__(self, driver):
self.driver... | true |
b8274c8217aa493ef961517520171a658e07b972 | kms70847/Advent-of-Code-2020 | /19/main.py | UTF-8 | 6,677 | 3.359375 | 3 | [] | no_license | import copy
def parse(rule):
"""translate a string rule into an equivalent AST"""
if len(rule) == 3 and rule.startswith('"') and rule.endswith('"'):
return ("literal", rule[1])
elif "|" in rule:
return ("or", [parse(s) for s in rule.split(" | ")])
elif " " in rule:
return ("and"... | true |
c4910efbe52da71dfa083211ac4d66a7e617683b | opnsesame/Data-Structures-and-Algorithms-Exercises | /Exercises1_12/R-1.16.py | UTF-8 | 714 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | #In our implementation of the scale function(page 25),the body of the loop
#executes the command data[j] *= factor. We have discussed that numeric
#types are immutable, and that use of the *= operator in this context causes
#the creation of a new instance (not the mutation of an existion instance).
#how is it still pos... | true |
10b836c82c554fd85e64a3e999f42eb2469b08fb | omarbensalah/AER8500 | /interface.py | UTF-8 | 8,678 | 2.546875 | 3 | [] | no_license | import tkinter as tk
import time
import os
import errno
import threading
import sys
import subprocess
import signal
import psutil
import random
from dataConversion import encodeA429, decodeA429, encodeAfdx, decodeAfdx, getA429WordFromAfdx
from calcul import findAngleOfAttack
class Interface:
def __init__(self, m... | true |
2851fee7ecc6db3ab7ecebf361fe4752c3976e51 | itowers1/Profit_Maximisation_European_Forests | /src/TractLSM/Utils/modis_lai_lat_lon.py | UTF-8 | 21,799 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Get MODIS LAI data for a lat, lon point or area around a point. The lat,
lon coordinates can automatically be retrieved for a given FLUXNET site.
Useful definitions:
LAI QC:
https://lpdaac.usgs.gov/sites/default/files/public/
product_documentation/mod... | true |
326563304bf38377de6ccce3850abc3c7d33b420 | DBasoco/Daily-Interview-Pro | /2020-10-03.py | UTF-8 | 2,032 | 4.28125 | 4 | [] | no_license | # Today we have: Subarray With Target Sum
#
# You are given an array of integers, and an integer K. Return the subarray which sums to K. You can assume that a
# solution will always exist.
# The subarray will be continuous so I can use the sums of the continuous arrays to find the solution.
def find_continuous_k(list... | true |
b2609aaa2b34248abe4b09cd342d0b9cd641805b | ansobolev/shs | /shs/options.py | UTF-8 | 6,732 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding : utf8 -*-
from collections import OrderedDict
import fdftypes as T
import sio as SIO
import const as Const
''' Calculation options should be stored here
'''
class Options(object):
""" Options class must be instantiated with a dict of FDF data
"""
def __init__(self, d... | true |
6643d66438f4f7f5f2f8c7b625dcb1d96a97b2ce | wangaxe/Light-Networks | /mobilenet/mobilenets.py | UTF-8 | 7,976 | 2.765625 | 3 | [
"MIT"
] | permissive | '''
This file includes mobilenets' architecture.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
class dw_conv(nn.Module):
def __init__(self, in_dim, out_dim, stride):
super().__init__()
self.dw_conv_k3 = nn.Conv2d(in_dim, out_dim, kernel_size=3,... | true |
9fd11f30952f78b29cd3c2cf2aaedc7c34067b19 | stablegradients/AudioClassification | /Signal2RPi.py | UTF-8 | 902 | 2.53125 | 3 | [] | no_license | from gpiozero import MCP3008
import numpy as np
from Parameters import Parameters
import time
class Signal2Rpi(Parameters):
def __init__(self):
super(Signal2Rpi, self).__init__()
self.GPIOPinNumber=0
self.SamplePeriod=float(1.0/self.SamplingFrequency)
self.GPIOPin=MCP3008(self.GPIOPinNumber)
def GetSignalWi... | true |
5b249796b501478286f726dc54827a33c4c5544b | HarshithGudapati/python-map-reduce | /all.py | UTF-8 | 1,477 | 3.78125 | 4 | [] | no_license | print ("hello, world!")
print ('hello, bearcat!')
print ('\n')
for x in range(0, 3): # NOTE colon... whitespace matters; use spaces
print ("Now x is %i" % (x))
print ("Now x/3 is %.2f" % (x/3))
for x in range(0, 5):
print ('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))
for x in range(0, 5):
p... | true |
6cf49c7cfde10f376034dfebf763ae5920a38760 | CASH48/Codigo-Curso-Csibaja-2018280833 | /Recursion de Cola/Raiz.py | UTF-8 | 346 | 3.296875 | 3 | [] | no_license | import math
def raiz (lista):
if isinstance (lista,list):
return raiz_aux (lista, 0 ,0)
else:
return "Error"
def raiz_aux (lista,resultado,indice):
if indice == len(lista):
return resultado
else:
return raiz_aux ( lista, resultado + math.sqrt (lista[indice])... | true |
7b177a7e2e3f863d8867ac0deeef8109375b3209 | jduartea/dracaena | /utils/wunder/client.py | UTF-8 | 2,266 | 2.640625 | 3 | [] | no_license | import json
import requests
from .errors import WunderInternalServerError
DEFAULT_API_URL = "https://humanforest.backend.fleetbird.eu/api/v2"
VEHICLES_ENDPOINT = "/vehicles"
class WunderClient(object):
"""
Client for WunderMobility API
"""
def __init__(self, api_key, api_url=None):
self.ap... | true |
bef26a469c11d38a8700c37aaa98a42ca49d333b | Corleno/DynamicalComponentsAnalysis | /notebooks/depricated/gen_synth_data.py | UTF-8 | 955 | 2.84375 | 3 | [] | no_license | import numpy as np
import h5py
#import datetime
#datetime.datetime.now().strftime('%Y%m%d%H%M%S')
#Configure these params!
N = 250
dt = 0.004
tau = 0.010
gamma = 2.5
T_hours = 24.0
T = T_hours*60**2
#Get file
f = h5py.File("rnn_data.hdf5", "a")
f.attrs["dt"] = dt
f.attrs["tau"] = tau
f.attrs["gamma"] = gamma
f.attrs[... | true |
d6a2f9d98c089db5829a0412f6a2ae667ceaddff | bac01719/automation | /library/utilities.py | UTF-8 | 13,107 | 2.625 | 3 | [] | no_license | # bola coker
# 9th June, 2017
#
# utilities.py
# includes general functions
import urllib.request
import library.definitions as definitions
from Bio import Entrez
import os
import re
import xml.dom.minidom
from pathlib import Path
import math
""" function to return a string given a dictionary """
def return_string(dic... | true |
a22030ed2e4fb7699520ea29ec36748b12864fa1 | brianchiang-tw/Python_Toolbox | /Functional Programming/functional_programming_reduce.py | UTF-8 | 702 | 3.734375 | 4 | [
"MIT"
] | permissive | from functools import reduce
# remember to import reduce from functools
def demo_reduce():
num_list = list( range(1, 11) )
## Example_#1:
# compute summation over list
result = reduce( lambda x, s: x+s, num_list)
# 55
print( result )
## Example_#2:
# compute product over list
... | true |
98a4bb22bcf23376270c7f84d07c54cbebfb0e82 | pbhereandnow/schoolpracticals | /Class 11/q6.py | UTF-8 | 330 | 3.921875 | 4 | [] | no_license | """
Dhruv Jain
XI-D
Question 6
"""
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
o = str(input("Choose an operator + - * /: "))
if o == "+":
c = a+b
elif o == "-":
c = a-b
elif o == "*":
c = a*b
elif o == "/":
c = a/b
else:
c = str("unknown operator")
print("Your a... | true |
81f9fd5f16dfdc9adaad2a18d8ebc3da4a0b280d | sydroth/sydirv | /Financial_Module.py | UTF-8 | 4,459 | 3.140625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# ## Import the Libraries
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# ## Read in the Data
# In[2]:
the_numbers = pd.read_csv('unzippedData/tn.movie_budgets.csv')
bo_mojo = pd.read_csv('unzippedData/bom.movie_gross... | true |
44dbd99616af8afaa36c529389844082747de78a | traveling-desi/Courses | /Coursera/Data-Analysis/Data Science/hw3/assignment3/join.py | UTF-8 | 1,082 | 3 | 3 | [] | no_license | import MapReduce
import sys
"""
Word Count Example in the Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
key = record[1]
#del record[1]
mr.e... | true |
ad71f8c851c537a6b39013c06488f1807146213f | JonasRSV/tensor-jo | /test/test_tensor.py | UTF-8 | 1,250 | 3 | 3 | [
"MIT"
] | permissive | """Tensor module."""
import tensorjo as tj
import numpy as np
import logging
LOGGER = logging.getLogger(__name__)
invalid_tensors = [
"cookie",
bytes("cookie", encoding="utf8"), "", [], None, lambda x: x, 'a',
[1, [1, 1], 1], [1, "cookie", 1]
]
valid_tensors = [
0, -1, 1, 1.1, .1, 12312313123, [1, 2,... | true |
cc993add324446b435ba75e3291a0cca19ac7526 | sts-sadr/reinforcement-learning-experiments | /dqn/tabq_learn.py | UTF-8 | 1,355 | 2.546875 | 3 | [] | no_license | import sys
from os.path import abspath, join, dirname
# add the top level package to sys.path to access them
sys.path.insert(1, abspath(join(dirname(__file__), '..')))
sys.path.insert(1, abspath(join(dirname(__file__), '../ch6')))
sys.path.insert(1, abspath(join(dirname(__file__), '../environments')))
import time
impo... | true |
0bff1a76df4b49de9ec0fa69098fd2c9c83a044e | padamop/choiceModels | /Homework/models.py | UTF-8 | 2,411 | 3.0625 | 3 | [] | no_license | import numpy as np
from sympy import solve, Symbol, exp, simplify
from sympy.solvers import nsolve
import scipy
import scipy.optimize
'''
#xxx update for arbitrary dimensions
def model1_v1(data, n, price1, price2):
sample = float(data.shape[0])
shares = np.histogram(data[:,1].astype('float32').v... | true |
3bff2b7c038f3528f1859346733c81de43c51095 | ErkinJash/selenium-test-automation-final-task | /pages/login_page.py | UTF-8 | 1,566 | 2.609375 | 3 | [] | no_license | from .base_page import BasePage
from .locators import LoginPageLocators
from selenium.webdriver.common.by import By
class LoginPage(BasePage):
def register_new_user(self, email, password):
input_email = self.browser.find_element(*LoginPageLocators.EMAIL_INPUT)
input_email.send_keys(email)
... | true |
275f0d8ca59d92b04a0c4e139a3536719e2e704a | vicky41298/PositiveNegativeZero | /adjpow.py | UTF-8 | 259 | 2.96875 | 3 | [] | no_license | numpp=input()
sumo=0
convo=int(numpp)
if len(numpp)==1:
sumo=int(numpp)*int(numpp)
else:
for i in range(len(numpp)):
if i == (len(numpp)-1):
sumo+=(int(numpp[i])**int(numpp[0]))
else:
sumo+=(int(numpp[i])**int(numpp[i+1]))
print(sumo)
| true |
ebc4a6c95bd2aa137fb2d3f181f6dae6957c1b68 | mayelespino/code | /LEARN/python/SortingDictionaries/sortedDictionary2.py | UTF-8 | 657 | 2.84375 | 3 | [] | no_license | __author__ = 'mayelespino'
from operator import itemgetter
D = {}
DL = []
# why did this not work?
# D['item'] = 'a'
# D['count'] = 1
# DL.append(D)
#
# D['item'] = 'z'
# D['count'] = 1
# DL.append(D)
#
# D['item'] = 'v'
# D['count'] = 10
# DL.append(D)
#
# D['item'] = 'c'
# D['count'] = 15
# DL.append(D)
DL.append(... | true |
9779c2019e789cd9860cc83ee277daae6c3134ad | hyuntak03/parabolic_trajectory | /main.py | UTF-8 | 815 | 3.21875 | 3 | [] | no_license | import turtle as t
import math
angle = 0
v = 0
vx = 0;
vy = 0;
dx = 0;
dy = 0;
g = 9.8
tm = 0.3
distance = 0;
height = 0;
def draw_pos(x,y):
v = t.numinput("입력","속력:",50,10,100)
angle = math.radians(t.numinput("입력","각도:",45,0,360))
t.hideturtle()
t.goto(-200, 150)
t.clearstamps()
t.hideturtle()... | true |
372d753c7acb32f1c301693495edb61ff4457204 | gittc100/Intro-Python-II | /src/player.py | UTF-8 | 1,763 | 3.890625 | 4 | [] | no_license | # Write a class to hold player information, e.g. what room they are in
# currently.
class Player:
def __init__(self, name, current_room):
self.name = name
self.current_room = current_room
self.inventory = []
def get_items_selector(self):
return ", ".join([str(f"{i}") for i in se... | true |
403f12d1828b2f925fa74fd6e78c485536150b92 | metral/led_sign | /simplefont.py | UTF-8 | 5,554 | 2.921875 | 3 | [] | no_license | #-------------------------------------------------------------------------------
import re
import numpy
import math
numpy.set_printoptions(threshold=numpy.nan)
#-------------------------------------------------------------------------------
class SimpleFont:
def __init__(self, data):
self.glyphs = {}
... | true |
fcf9da293c3de1130d3d92c2c6730f801ea747f5 | abdullahkitr0/python | /Basit Örnekler/haber.py | UTF-8 | 358 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import feedparser
"""
cnn'den son dakika haberlerini çekme
"""
url = "http://www.cnnturk.com/feed/rss/news"
haberler = feedparser.parse(url)
i = 0
for haber in haberler.entries:
i += 1
print(i)
print(haber.title)
print(haber.link)
pr... | true |
9398d27705a794aa61047a76438f65815eedd622 | elamhut/BitCakeUnrealTools | /Outros/batchrenamer.py | UTF-8 | 2,868 | 2.90625 | 3 | [] | no_license | import unreal
import sys
from PySide6 import QtCore, QtGui, QtUiTools, QtWidgets
def rename_assets(search_pattern, replace_pattern, use_case):
# instances of unreal classes
system_lib = unreal.SystemLibrary()
editor_util = unreal.EditorUtilityLibrary()
string_lib = unreal.StringLibrary()
# get t... | true |
7dd762a587d1769ce43df64f02635b413e3640d3 | eric-switzer/algebra_base | /base.py | UTF-8 | 12,400 | 3.40625 | 3 | [] | no_license | import scipy as sp
import numpy as np
import cubic_conv_interpolation as cci
class AlgObject(object):
"""Base class for all vectors and matricies.
This is not an actual class by itself, just defines some methods common to
both `mat` objects and `vect` objects.
"""
def __array_finalize__(self, ob... | true |
cb5f2cbf5e3051288244c8a57e188804cb2004f2 | subash319/PythonDepth | /Practice8_sets/Prac_8_5_Vowel_Consonants.py | UTF-8 | 384 | 4.3125 | 4 | [] | no_license | # 5. Enter a string and create 2 sets v and c, where v is a set of vowels present in the
# string and c is a set of consonants present in the string.
text = input("Enter your string please:")
vowel = set('aeiou')
string_c = 'BCDFGHJKLMNPQRSTVWXYZ'
consonats = set(string_c.lower())
print(consonats)
v = set(text)& vowe... | true |
558a2f960c86496dfe832fdd18c3b6fd7b948a53 | nguyenthanhvu240/DataAnalyst | /DA-With-W3school-Course/MachineLearning/Scale.py | UTF-8 | 906 | 3.8125 | 4 | [] | no_license | """
The standardization method uses this formula:
z = (x - u) / s
Where z is the new value, x is the original value, u is the mean and s is the standard deviation.
If you take the weight column from the data set above, the first value is 790, and the scaled value will be:
(790 - 1292.23) / 238.74 = -2.1
If you take the... | true |
aa53a44ab73cb91f81c2c26ba51bbe86b248a585 | PaulDoree/ML-Forex-Forecasting | /ohlc_file_helper.py | UTF-8 | 1,359 | 2.828125 | 3 | [] | no_license | # ohlc_file_helper.py
import os
import zipfile
import tempfile
import sys
import csv
import pandas as pd
import numpy as np
import datetime
import math
import time
import random
# get_files_in_directory
def get_files_in_directory(directory, filter):
for dir_name, _, files in os.walk(directory):
... | true |
94516d29b250460ac2abf081398aefdca31df7b2 | keiffster/program-y | /test/programytest/parser/template/node_tests/test_program.py | UTF-8 | 1,665 | 2.671875 | 3 | [
"MIT"
] | permissive | import xml.etree.ElementTree as ET
from programy.parser.template.nodes.base import TemplateNode
from programy.parser.template.nodes.program import TemplateProgramNode
from programytest.parser.base import ParserTestsBaseClass
class MockTemplateProgramNode(TemplateProgramNode):
def __init__(self):
Template... | true |
41727bac67ce687342fb8f81beea85d374169793 | yvonne-yang/sudoku-contest | /SolutionConsistencyChecker.py | UTF-8 | 7,013 | 3.375 | 3 | [
"MIT"
] | permissive | import numpy as np
# this class checks the correctness of a sudoku solution given a set of clues (constraints)
class SolutionConsistencyChecker:
def __init__(self, debug=False):
self.ROWS = 9
self.COLS = 9
self.puzzle = None
self.clues = None
# set debug mode for more advan... | true |
45e4b398fb5ba927d0401cd1c8cf9e2dcdc024c3 | korowood/HackerRank | /algorithms/Sorting/Big Sorting.py | UTF-8 | 243 | 3.46875 | 3 | [] | no_license | n = int(input().strip())
unsorted = []
lengths = []
for k in range(n):
number = str(input().strip())
unsorted.append(number)
lengths.append(len(number))
biglist = zip(lengths, unsorted)
for i in sorted(biglist):
print(i[1])
| true |
7e943d78a9ade300bf0fbba695a272a824602cab | wantwantwant/api_robot | /《2》智能.py | UTF-8 | 689 | 2.703125 | 3 | [] | no_license | import optparse
import time
import apiutil # 这里我上端代码独立生成一个文件“apiutil.py",所以要导入一下
import json
app_key ="62RBGB9EyzFZ7sIZ"
app_id = 2110540682
questionS = '在吗?'
def anso(questionS):
str_question = questionS
session = 10000
ai_obj = apiutil.AiPlat(app_id, app_key)
rsp = ai_obj.getNlpTextChat(session, ... | true |
cfee13a7a4112ef80cda366fd11cc0398ca77e99 | itohamy/Relative_Trans-git | /Synthetic/Handle_SEYSYNC_output_Synthetic.py | UTF-8 | 3,846 | 2.59375 | 3 | [] | no_license |
import os,sys
sys.path.insert(1,os.path.join(sys.path[0],'..'))
import numpy as np
import matplotlib.pyplot as plt
from data_provider_Synthetic import DataProvider
from Plots import open_figure,PlotImages
import cv2
from image_warping import warp_image
from numpy.linalg import inv
def main():
# ---------- Upload... | true |
c4a1a7286a5c09d493a2d6f0464b5af8447c23c9 | kuangtao94/Python | /程序异常与调试/ch10_2.py | UTF-8 | 1,822 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# -----------------------------------------
# 异常捕获
# -----------------------------------------
# 在except语句中使用pass语句,忽略发生的异常
list1 = ['100', '200', '三百', '四百', '500']
total = 0
for e in list1:
try:
total = total + int(e)
except:
pass
print(total)
# 文件不存在
try:
file = ... | true |
452bcb5cb467edb1a23088065e797ea4e74a648f | marlboro233544951/pythonDate | /plt/draw_bar.py | UTF-8 | 2,234 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
def draw_bar(labels, quants):
font = {'family': 'serif',
# 'color' : 'darkred',
'weight': 'normal',
'size': 22,
}
lfont = {'family': 'serif',
# 'colo... | true |
243f3e76cf82c5114cc3dfea54147d3b7af782ea | j20232/mgeo | /mgeo/transform/homography.py | UTF-8 | 3,996 | 2.90625 | 3 | [] | no_license | import numpy as np
from PIL import Image
from scipy import linalg
from mgeo.transform.ransac import ransac
def rotate(img, angle=0):
if type(img) is np.ndarray:
img = Image.fromarray(np.uint8(img))
return np.asarray(img.rotate(angle))
def create_rotation_matrix(a):
# return a 3D rotation matrix... | true |
fa2b1c897064d0f697cc3995e6788ef6742bd1f6 | Baepeu/coding_training | /q03_01.py | UTF-8 | 406 | 4.21875 | 4 | [] | no_license | # 문자열 안에 따옴표 출력하기
# 1. escape 문자 사용하기
# 2. 문자열 보간(양식 문자열)
# 3. 문자열 대체(replace)
# 1. 문장 입력받기
sentence = input("What is the quote?")
# 2. 발언자 입력받기
speaker = input("Who said it?")
# 3. 문장으로 만들어 출력하기
msg = speaker + " says, \"" + sentence + "\""
print(msg)
"""
escaping -> \n,\t, \b, \", \'
""" | true |
a60d42e37f17903967b2bc4bfd6619584934ea60 | navnoorsingh13/GW2019PA2 | /venv/Session5.py | UTF-8 | 490 | 3.296875 | 3 | [] | no_license | """
Strings
Set
Dictionary
"""
# johnsShop = 'Johns Coffee Shop'
# johnsShop = 'John's Coffee Shop' #error
# johnsShop = 'John\'s Coffee Shop' #escape
# johnsShop = "John's Coffee Shop"
johnsShop = R'John\'s Coffee Shop' #Raw
print(johnsShop, type(johnsShop))
message = "This is a Good Day. " \
... | true |
732a42dd9749afe165dda6c94b213f6c7713b187 | weisisheng/nesta | /nesta/packages/geo_utils/lookup.py | UTF-8 | 1,831 | 2.796875 | 3 | [
"MIT"
] | permissive | import requests
import pandas as pd
from io import StringIO
def get_eu_countries():
"""
All EU ISO-2 codes
Returns:
data (list): List of ISO-2 codes)
"""
url = 'https://restcountries.eu/rest/v2/regionalbloc/eu'
r = requests.get(url)
return [row['alpha2Code'] for row in ... | true |
31bded486e639def34c11fc94622e5af5f6a7a5f | rahulnathr/auv | /cv2.py | UTF-8 | 203 | 2.625 | 3 | [] | no_license | import cv2
cap=cv2.VideoCapture(0)
while(cap.isOpened()):
ret,frame=cap.read()
cv2.imshow('image',frame)
k=cv2.waitKey(10) and 0xFF
if k==ord('q'):
break
cap.release()
cv2.destroyAllWindows() | true |
6d3c51aba064dd50e74cbd35ee10391dd972d5f3 | Reicher/AdventOfCode2019 | /day11/main.py | UTF-8 | 916 | 3.390625 | 3 | [] | no_license | # Day 11
import robot
from PIL import Image
print('Day 11')
def readProgramFromFile(filename):
with open(filename, 'r') as fp:
line = fp.readline().strip().split(',')
return [int(x) for x in line]
program = readProgramFromFile('input.txt')
paintBot = robot.Painter("Master Painter bot 900... | true |
b8170cb039ff06096c6000e7c6371fe813f11006 | natastro/python-bmi-calculator | /bmicalc.py | UTF-8 | 503 | 4.03125 | 4 | [] | no_license | # Project from https://theinsightfulcoder.com/5-more-python-projects-that-can-be-built-in-under-5-minutes
# Uses pounds and inches
height = float(input("Enter your height in inches: "))
weight = float(input("Enter your weight in lbs: "))
BMI = (weight / (height)**2) * 703
print(f"Your BMI is {BMI}")
if BM... | true |
5e812ab5e0152472715b6c5708f344d60bc681e9 | thiago-ximenes/curso-python | /pythonexercicios/ex074.py.98736aaad4c2044d76a1ebcd8a3a4311.py | UTF-8 | 316 | 3.40625 | 3 | [] | no_license | from random import randint
tupla = (randint(0, 1000), randint(0, 1000), randint(
0, 1000), randint(0, 1000), randint(0, 1000))
print(tupla)
print(f'O menor número da tupla é {sorted(tupla)[0]}')
print(f'O menor número da tupla é {sorted(tupla)[0]}')
print(f'O maior número da tupla é {sorted(tupla)[-1]}')
| true |
8d7d418a23a137b8832d4554ee9e8719278447cf | wiky2/mytestproject | /testforothers/testWordCount.py | UTF-8 | 1,574 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import requests
from bs4 import BeautifulSoup
import operator
def start(url):
word_list=[]
headers = requests.utils.default_headers()
headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
s... | true |
c3c5f88f2c01590f5ded212d74e3dab43461e20b | cohock13/atcoder | /abc/32/3.py | UTF-8 | 348 | 2.875 | 3 | [] | no_license | N,K = map(int,input().split())
s = [int(input()) for _ in range(N)]
if 0 in s:
print(N)
exit()
ans = 0
l,r = 0,0
f = 1
for l in range(N):
while r < N and f*s[r] <= K:##順序?
f *= s[r]
r += 1
ans = max(ans,r-l)
if r == l:
r += 1
else:
f //= ... | true |
34ef1eb64d4d24e3bd234886a82f3495bb2f2f78 | cljoly/telecomnancy-web | /tools.py | UTF-8 | 2,828 | 2.71875 | 3 | [] | no_license | from math import ceil
import time
from database.db_objects import Activity, Repository
from main import db
from sqlalchemy import func
PER_PAGE = 10
class Pagination(object):
"""Helper class for pagination - used in the activity table"""
def __init__(self, page, per_page, total_count):
self.page = p... | true |
0033a395f0ed358a1101a65bb0b6f9b69d9d03f5 | micdmy/advent-of-code | /2018-02/2018-02-main.py | UTF-8 | 1,402 | 3.59375 | 4 | [] | no_license |
def read_input():
with open("input.txt") as f:
return [line.strip()+"" for line in f]
return
lines = read_input()
s_lines = []
for line in lines:
s_lines.append(sorted(line) + ["_"])
twos = 0
threes = 0
for line in s_lines:
last_c = " "
counter = 0
two_found = False
three_found = ... | true |
25283b184ab152588133aa0517d4e059d487b7e3 | MicrohexHQ/Lunas | /lunas/readers/range.py | UTF-8 | 1,619 | 2.671875 | 3 | [
"MIT"
] | permissive | from overrides import overrides
from lunas.readers.base import BaseReader
import itertools
import sys
class Range(BaseReader):
def __init__(self, start: int=None, stop: int = None, step: int = None, bufsize: int = 10000, num_threads: int = 1):
super().__init__(bufsize, num_threads)
if stop is None:... | true |