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 |
|---|---|---|---|---|---|---|---|---|---|---|
fde9b426426b5194907a94f90d824181c44fbce0 | quintelligence-health/medline_classifier | /medline_classifier/src/python/parsers/medline_xml.py | UTF-8 | 3,460 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import sys, traceback
from lxml import etree
from structs.medline_structs import MedlineArticle
class MedlineFileParser:
def __init__(self, only_major_topics=False, allow_empty_headings=False):
self._articles = []
self._only_major_topics = only_major_topics
self._allow_empty_headings = al... | true |
7c0f58a78d9843793638639c00e6f03d828c0c4b | shjang1013/Algorithm | /BAEKJOON/그리디/모험가 길드.py | UTF-8 | 674 | 3.734375 | 4 | [] | no_license | # 여행을 떠날 수 있는 그룹 수의 최댓값 출력하기
N = int(input())
adventure = sorted(list(map(int, input().split())))
group = 0 # 그룹의 수
count = 0 # 현재 그룹에 포함된 모험가의 수
for i in adventure: # 공포도를 낮은 것부터 하나씩 확인하기
count += 1 # 현재 그룹에 해당 모험가를 포함시키기
if count >= i: # 현재 그룹에 포함된 모험가의 수가 현재의 공포도 이상이라면, 그룹 결성하기
... | true |
58404109dd07dfaa5bc09d19fc34fbc808b172f6 | shaun-h/istaflow | /elements/NumberInput.py | UTF-8 | 1,263 | 2.78125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
from ElementBase import ElementBase
from ElementParameter import ElementParameter
from ElementValue import ElementValue
import console
class NumberInput(ElementBase):
def __init__(self):
self.status = 'running'
self.output = None
self.params = None
self.type = 'Standard'
self.setup_params(... | true |
350f4b9974cec88b3bf5f7c3c6e61332e99fd741 | EtiennePerot/kozo | /src/kozo/roles/bluetooth-discover.py | UTF-8 | 2,139 | 2.765625 | 3 | [] | no_license | from kozo import Role
import bluetooth
class BluetoothDiscoverer(Role):
def localInit(self):
self._currentKnownDevices = {}
def run(self):
self.sleep(self['cooldown'])
devices = bluetooth.discover_devices(duration=self['searchDuration'], lookup_names=True)
currentDevices = {}
for address, name in devices:
... | true |
bd34ef18f9792f48d96a302a9ac885b43ae3bed4 | thetheos/StrainGauge | /test python/test kivy plot data logger/classFileLogging.py | UTF-8 | 1,833 | 3.28125 | 3 | [] | no_license | import logging
import time
class FileLogging(object):
def __init__(self, fileName = 'data'+time.strftime("%Y-%m-%d_%H-%M-%S"), logLevel = 'INFO'):
self.log = logLevel#respect the order because method open()
self.fileLogger()#requires filelogger
self.fName = fileName
... | true |
0d333b994f4b9fe1e15d6bba9cdc3b031c95df50 | hrustbb2/env-example | /env | UTF-8 | 4,536 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python3
import os
import configparser
import time
import yaml
import sys
import argparse
# Работа с переменными
# Считываем/записываем в .ini
#
class Variables():
__config = None
__iniFileName = None
def __init__(self, iniFile):
self.__iniFileName = iniFile
self.__config = co... | true |
3d1a6e0a1a5a34950af5bfc93dff4645085f7ab1 | suobida/csv_pokemon | /main.py | UTF-8 | 678 | 3.125 | 3 | [] | no_license | import requests
import csv
pokemon = requests.get('https://raw.githubusercontent.com/fanzeyi/pokemon.json/master/pokedex.json')
json = pokemon.json()
jsonArray = []
for dic in json:
jsonArray.append(dic)
with open('pokemon.csv', mode='w') as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quotin... | true |
46ac729be007874f12392bda2e4b62b0b0b89305 | malte70/pyCLIApp | /CLIApp/__init__.py | UTF-8 | 2,455 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Malte Bublitz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notic... | true |
7ce861b5c5a32a69a38bd84d64a1e5fe2ff33bfa | eiofmv/data_structures_and_algorithms | /1. Algorithmic toolbox/week5_dynamic_programming1/5_longest_common_subsequence_of_three_sequences/lcs3.py | UTF-8 | 793 | 3.046875 | 3 | [] | no_license | #Uses python3
def lcs3(s, t, v):
d = [[[0 for _ in range(len(v) + 1)] for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
for k in range(1, len(v) + 1):
d[i][j][k] = max(d[i-1][j][k],
... | true |
50c2a695974f16a849bdb727761e1268a04b44b0 | roiti46/Contest | /aoj/aoj-icpc/250/2321.py | UTF-8 | 584 | 2.65625 | 3 | [] | no_license | from collections import defaultdict
while 1:
n = int(raw_input())
if n == 0: break
L = [0]*n
T = [0]*n
for man in xrange(n):
m,l = map(int,raw_input().split())
L[man] = l
t = 0
for date in xrange(m):
s,e = map(int,raw_input().split())
t |= 2**(... | true |
d7ae3ca7e527b1aa1dcd5ec089ab9a60bae18087 | Xietler/Overlap-Text-Segmentation | /segmentation/cluster/kpp.py | UTF-8 | 2,277 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/3/6 19:01
# @Author : Ruichen Shao
# @File : kpp.py
from __future__ import division
import numpy
import time
import random
import numpy as np
class Point:
def __init__(self, p, dim, id=-1):
self.coordinates = []
self.pointList = []
self.id = i... | true |
d19b282466be0e649c1fa58f1bbf034131f318ed | ChangxingJiang/LeetCode | /0701-0800/0740/0740_Python_1.py | UTF-8 | 665 | 3.25 | 3 | [] | no_license | from typing import List
class Solution:
def deleteAndEarn(self, nums: List[int]) -> int:
if not nums:
return 0
lst = [0] * (max(nums) + 1)
for num in nums:
lst[num] += num
if len(lst) <= 3:
return max(lst)
dp = [0] * len(lst)
d... | true |
c426beec2468a2572eead47543439d332d13dac3 | wright-group/WrightTools | /tests/data/collapse.py | UTF-8 | 4,743 | 2.75 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
"""Test collapse."""
# --- import -------------------------------------------------------------------------------------
import WrightTools as wt
import numpy as np
# --- tests --------------------------------------------------------------------------------------
def test_integrate():
... | true |
cadd966512aa8b8f4b487e17ff3c34a87561421c | ManaicLaughter/10-Seconds-Project- | /screen_prank.py | UTF-8 | 239 | 2.96875 | 3 | [] | no_license | import rotatescreen
import time
screen = rotatescreen.get_primary_display()
#you can change time and range from 13 to 1000 to 100000000....to make it look more crazy.
for i in range(13):
time.sleep(1)
screen.rotate_to(i*90 % 360)
| true |
ca4334eee522cad8ed6dfad67676f4ca78372eac | jemmott/dada-science | /virtue_vice/analysis.py | UTF-8 | 4,278 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 17 09:21:34 2014
CWJ
"""
import csv
import json
import wordCloudHTML
import scipy.spatial
import numpy as np
# DATA IMPORT
with open('Virtue Data Jan 2014.csv', 'rb') as csvfile:
virtuereader = csv.reader(csvfile, delimiter=',')
firstRow = True
data = []
... | true |
88c1608461a97bc3a123a775e84e2d0744635344 | Appex213/CellOpt-Project | /CellOpt_SERA/SERA/plot_spectre_print.py | UTF-8 | 3,209 | 2.515625 | 3 | [] | no_license |
import matplotlib.pyplot as plt
import re
import copy
import sys
import get_spice_plot_data as gspd
def extractPlotData(spicePrintFile,argNames,argVecs,argScales):
argIdx_base = 0
firstPrintGroup = True
titleOn = False
with open(spicePrintFile) as printFile : # open the print file
found_x = False
... | true |
bbd9e1bb68520be8dfe1ab17191fe2b3a9f5eba6 | ahdavies6/NLP_QA | /src/question_classifier.py | UTF-8 | 3,791 | 3 | 3 | [] | no_license | from parse import get_dependency_parse
from nltk.parse.corenlp import CoreNLPParser
# todo: have this inherit from DependencyNode
class Question(object):
def __init__(self, sentence_structure, question_word):
self._root_node = sentence_structure
self._q_pair = question_word
def __str__(self)... | true |
c168a2bdd009425f0c7e4c8e552b1c8313dece32 | orianagonzlez/Proyecto-COVID-19-Tracker | /Funciones.py | UTF-8 | 923 | 4.0625 | 4 | [] | no_license | from colorama import init, Fore, Style
init(autoreset=True)
def validar_entero_positivo(n):
'''
Función para verificar si el argumento pasado es un numero entero positivo.
Retorna verdadero si se cumple dicha condición y falso de lo contrario.
'''
es_entero = False
try:
int(n)
... | true |
a20d2c22d152592a9ec1c76c1b9b8d539d1fbb32 | AnatkhQ/python-Sorting-Algorithm | /二分查找与Lowb三人组/time_calculate.py | UTF-8 | 377 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# __author__ = "Anatkh"
# date: 2018/11/20
import functools,time
def cal_time(func):
# 装饰器
@functools.wraps(func)
def wrapper(*args, **kwargs):
t1 = time.time()
result = func(*args, **kwargs)
t2 = time.time()
print("{0} running {1}".format(func.__name... | true |
21a24bf6ab518790f3a762159e1a23a62ef2fe97 | vandeppce/DeepLearning | /ImproveDeepNN/PracticalAspects/Initialization.py | UTF-8 | 6,561 | 3.125 | 3 | [] | no_license | import numpy as np
import matplotlib.pylab as plt
import sklearn
import sklearn.datasets
from ImproveDeepNN.PracticalAspects.init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation
from ImproveDeepNN.PracticalAspects.init_utils import update_parameters, predict, load_dataset, plot_decis... | true |
c83606d04665704eaf8a25b3e2035a8a9e919e76 | x56gogogo/shiyanlou-code | /jump7.py | UTF-8 | 101 | 2.96875 | 3 | [] | no_license | for a in range(1,101):
if a % 10 == 7 or a // 10 == 7 or a % 7 == 0:
continue
else:
print(a)
| true |
0ab1842ab47370f651770f6ba984aaba0fced2c7 | bssughosh/Agri-Guide-API | /statistics_data_fetcher.py | UTF-8 | 2,852 | 2.84375 | 3 | [] | no_license | import numpy as np
import pandas as pd
def fetch_rainfall_whole_data(state, dist):
dist1 = dist.replace('+', ' ')
state1 = state.replace('+', ' ')
base_url = 'datasets/weather/'
file1 = 'rainfall_data_3.csv'
rain = pd.read_csv(base_url + file1)
rain1 = rain[rain['State'] == state1]
rain1... | true |
fb5779e11700ccad0f2212f6a79d132f375fd45d | vispamir/osintin | /components/osint/osint_cli.py | UTF-8 | 1,468 | 2.765625 | 3 | [] | no_license | """
created on June 01 21 23:00:00
@author: Amir Koulivand
Osint Commands
"""
import components.osint.find
from PyInquirer import prompt
import bootsrap.common
class osint_cli():
def __init__(self):
print("Loaded Osint CLI")
def define(self):
return [
{
'command': 'find... | true |
e430b0197af3cf3bf14677b476dfeb13b2898bf3 | matthewgleason/BluetoothSignals | /send_data.py | UTF-8 | 2,105 | 2.640625 | 3 | [] | no_license | try:
import os
from script import *
import sys
import datetime
import time
import boto3
import threading
from getters import *
except Exception as e:
print('Error importing in send_data.py: {}'.format(e))
LOCATION = 'Mhome'
TABLE_NAME = 'BluetoothSignals'
class MyDb():
def __in... | true |
862999eb2da530d96d2df222cb00e155a71f73d7 | kouhei-k/atcoder_submissions | /abc009/abc009_2/8100059.py | UTF-8 | 186 | 3.15625 | 3 | [] | no_license | import collections
N = int(input())
table = collections.defaultdict(list)
for i in range(N):
table[int(input())].append(i)
table = list(table.keys())
table.sort()
print(table[-2])
| true |
d8ab22c0c25b81362927ea1058c54aae3db6cda9 | insomn14/CTFindo | /2020/KKST-CTF2020/Umum-Qual/Cryptography/Fine?/actually is fine/secret_message.py | UTF-8 | 704 | 3.359375 | 3 | [] | no_license | import string, random
alphabet = dict(zip([x for x in range(len(string.printable[:-6]))],[x for x in string.printable[:-6]]))
def get_key(val):
for key, value in alphabet.items():
if val == value:
return key
def my_heart(number):
try:
return [i for i in range(94) if i*number%94=... | true |
e6b7d56d7edc38a1a7283cfd8083888cbce271fb | kirega/Class_Work | /funny.py | UTF-8 | 717 | 3.328125 | 3 | [] | no_license | from random import randint
def RSelect(array,ith):
starti=0
endi=len(array)
if endi==1:
return array[0]
pivot_index=randint(starti,endi)
p_index=partition(array,pivot_index)
if(ith==p_index):
return array[p_index]
if(ith < p_index):
RSelect(array[:p_index],ith)
if(ith > p_index):
ith=ith-p_index
... | true |
0de1c41f88f63b4c08e1eeae9f0c103dbde96e7c | rodolfoghi/urionlinejudge | /python/2968.py | UTF-8 | 588 | 3.671875 | 4 | [] | no_license | import math
# Ler a entrada
entrada = input()
valores = entrada.split()
# Calcular o total de placas (nro de voltas * nro placas)
total_de_placas = int(valores[0]) * int(valores[1])
result = []
# Calcular a qtd de placas para 10%
# Calcular a qtd de placas para 20%
# Calcular a qtd de placas para 30%
#...
# Calcula... | true |
f0d4c9c981f12dec3c6b10cc9d3623888284cf75 | forspy/python | /test_py_SocketServer2/introduence.py | UTF-8 | 904 | 2.78125 | 3 | [] | no_license | # 当有多个客户端连接请求时,需要能够同时处理多个连接
# 主要方法有三种:分叉(forking)、线程化和异步I/O
# 缺点:
# 1. fork是一种轻量化的进程复制,需要占用资源较多,而且客户端很多时可能出现伸缩性不佳,取决于CPU的数量(fork进程可以理解为平行宇宙)
# 2.线程化可能会带来同步和互斥的问题
# 在分叉服务器中,对于每一个客户端连接,都将通过分叉创建一个子进程,父进程继续监听新连接,而子进程负责处理客户端的请求,客户端请求结束后,子进程直接退出
# 使用类似于线程的并行方式,名为微线程,其伸缩性比真正的线程高的多
# 线程共享进程的资源,减少了资源的占用
# 异步I/O的基本机制时模块select... | true |
7e41a1797146457cf3ced120ef0ab1fda9d830ed | JennaScript/cs-quiz-3-python | /quiz3/Question 3/main.py | UTF-8 | 202 | 3.203125 | 3 | [] | no_license | # Quiz 3: Question 3
# Part 1
hats = { "snapback": 10,
"beanie": 5,
"baseball cap": 3 }
# Part 2
hats["weird top hat"] = 1
# Part 3
hats["snapback"] += 1
# Part 4
hats.pop("weird top hat")
| true |
2f4a857e5d24f229dd671f0e3171273e6698f5ef | wxywxyyxw/algorithm_interview | /python_knowledge/thread/thread_test_lock.py | UTF-8 | 1,530 | 3.5625 | 4 | [] | no_license | """
使用锁实现线程同步
"""
import time
import threading
# 创建锁
lock = threading.Lock()
# 全局变量
global_resource = [None] * 5
def change_resource(para, sleep):
print('{} before acquire'.format(para))
# 请求锁
if para == 'hi':
lock.acquire()
else:
lock.acquire(blocking=False)
print ('{} acquire... | true |
bef84b8eb611ee731ca6e53aa6e69c9e830e6ba2 | kartikeyagup/SURA-Work | /VideoTracking/VideoCorr.py | UTF-8 | 1,147 | 2.59375 | 3 | [] | no_license | import csv
f1='1439189804924_corrpairs.csv'
fileread=[]
with open(f1,'rb') as csvfile:
spamreader= csv.reader(csvfile)
for row in spamreader:
fileread.append(row)
fform =map(lambda x: map(float,x),fileread)
def getPoints(l):
ans=[]
for i in xrange(len(l)/2):
ans.append((l[2*i],l[2*i+1]))
return ans
fforme... | true |
ee5a516aaee172b269694ba46d03101d88c4317b | MRadianLogs/TheDataCodex | /motorTest1.py | UTF-8 | 489 | 2.859375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
in1 = 17
in2 = 18
GPIO.setup(in1, GPIO.OUT)
GPIO.setup(in2, GPIO.OUT)
print("Test 1")
for x in range(100):
GPIO.output(in1,1)
GPIO.output(in2,0)
time.sleep(0.02)
GPIO.output(in1,0)
GPIO.output(in2,0)
time.sleep(0.02)
print("Test 2")
f... | true |
29564394916f4320327d18ed3f470c74199b20c7 | VinhMaiVy/learning-python | /src/10 days of stats/s10_spearman_rank_correlation_coefficient.py | UTF-8 | 760 | 3.359375 | 3 | [] | no_license | #!/bin/python3
"""
Pearson correlation coefficient
Input:
10
10 9.8 8 7.8 7.7 1.7 6 5 1.4 2
200 44 32 24 22 17 15 12 8 4
Output:
0.903
"""
def mean(a):
return sum(a)/(len(a))
def stddev(a):
return (sum([(n-mean(a))**2 for n in a])/n)**0.5
def ranked(a):
r = {}
_sa_ = sorted(a)
for i in ... | true |
4afaba1bbaaed1ae6b90aa3b026ca0ee59763451 | gabriellaec/desoft-analise-exercicios | /backup/user_280/ch135_2020_04_01_11_24_32_988806.py | UTF-8 | 225 | 2.828125 | 3 | [] | no_license | def equaliza_imagem(lista, k):
final = [0]*len(lista)
i=0
while i < len(lista):
if lista[i]*k < 255:
final[i] = lista[i]*k
else:
final[i] = 255
i+=1
return final | true |
31d1b5936901e0c38eb8f03093e3ce6547601639 | vdelimpa/SublimeText2-FTPSync | /ftpsyncpubsub.py | UTF-8 | 2,769 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Jiri "NoxArt" Petruzelka
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,... | true |
3f022b019900a31884916ed0fda21330dc277255 | ual/DOE-repo-deliverable | /SUE_TA/Check_for_Missing_Paths.py | UTF-8 | 827 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | import networkx as nx
import csv
import numpy as np
def main():
#Loading the graph from file into variable g
#g = igraph.Graph.Read_GraphML("bayarea_tertiary_simplified.graphml")
nxgraph = nx.read_graphml("bayarea_tertiary_simplified.graphml")
demand = np.loadtxt('no_paths.csv', delimiter=',', skiprow... | true |
df22f5e8f2d674668a28d3268f6dfc0e1d2a369e | huangyingw/submissions | /39/39.combination-sum.234400288.Accepted.leetcode.py | UTF-8 | 451 | 2.71875 | 3 | [] | no_license | class Solution:
def combinationSum(self, candidates, target):
res = []
candidates.sort()
def dfs(target, index, path):
if target < 0:
return
if target == 0:
res.append(path)
return
for i in range(index, len(... | true |
a753db20a489849b5b1aa240fcbc0424ae185d34 | aldenwalker/sagescl | /scallopFC.py | UTF-8 | 11,317 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
"""this script takes an integer linear combination of words in Z/nZ * Z/mZ,
generated by x and y, and computes scl of it using scallop by lifting the
chain to the finite index free normal subgroup which is the kernel of the
map to Z/nZ x Z/mZ. It's generated by strings of the form
x^iy^jx^{n-i}y... | true |
e8e2fb9a316f7692a0eb22f3aca9bb560ef2886f | FoCDoT/Udacity-Capstone | /preprocess.py | UTF-8 | 1,837 | 2.859375 | 3 | [] | no_license | import joblib
from tqdm import tqdm
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
def preprocess(dataset, args, train=True):
"""
:param dataset: pandas dataframe
:param args: config vars... | true |
3f8419acba10f2d9ca039d8ac72c99c36e6fc2ab | Slonna/neural-network-deep-learning | /project3/code/extract_chars.py | UTF-8 | 846 | 2.96875 | 3 | [] | no_license | """ 提取出训练集所有出现过的字符 """
import os
from tqdm import tqdm
from config import HOME, DATA_ROOT
S = set()
# train_img_path = os.path.join(DATA_ROOT, "train", "img")
train_gt_path = os.path.join(DATA_ROOT, "train", "gt")
for gt in tqdm(os.listdir(train_gt_path)):
if not gt.endswith(".txt"):
continue
with op... | true |
38fdaa87917cb4d3fae7132c1fcaeff8e027484a | fagan2888/timemachines | /timemachines/optimizers/odious.py | UTF-8 | 2,912 | 2.65625 | 3 | [
"MIT"
] | permissive | from timemachines.optimizers.alloptimizers import OPTIMIZERS
from timemachines.objectives.classic import CLASSIC_OBJECTIVES
from typing import List
import numpy as np
from pprint import pprint
def optimizer_name(solver):
return solver.__name__.replace('_cube','')
def objective_name(objective):
return object... | true |
237877b4ac56f8ad094f07c4d673f380b9adfc5e | bochap-udacity/dsand-p1 | /least_recently_used_cache/problem_1.py | UTF-8 | 14,940 | 3.515625 | 4 | [] | no_license | class CacheNode(object):
def __init__(self, key, value):
self.next = None
self.previous = None
self.key = key
self.value = value
def __str__(self):
return f"CacheNode({self.key}, {self.value})"
class LRU_Cache(object):
def __init__(self, capacity):
# Initia... | true |
5cd673ffa5f8c36cc8d4224d583da24a0ee18350 | mikaelszm/homeworks | /TicTacToe.py | UTF-8 | 2,816 | 3.703125 | 4 | [] | no_license | import os
tableau = [1,2,3,4,5,6,7,8,9]
def show():
print("|",tableau[0],"|",tableau[1],"|",tableau[2],"|")
print("-------------")
print("|",tableau[3],"|",tableau[4],"|",tableau[5],"|")
print("-------------")
print("|",tableau[6],"|",tableau[7],"|",tableau[8],"|")
print("-------------")
... | true |
3083c718e8909a782b1403e78533364cb97e64ae | NIKHILDUGAR/googlekickstartpy | /2018bNoNine.py | UTF-8 | 386 | 2.890625 | 3 | [] | no_license |
# The following solution faces TLE. question link https://codingcompetitions.withgoogle.com/kickstart/round/0000000000050ff4/0000000000051183
T = int(input())
for x in range(1, T + 1):
N, P = map(int, input().split())
c=0
for i in range(N,P+1):
if i%9!=0:
if str(i).count('9')==0:
... | true |
fbc307c0ca1bcb53d95d6f5b624c24ed75c23f3c | cravo123/LeetCode | /Algorithms/0188 Best Time to Buy and Sell Stock IV.py | UTF-8 | 713 | 3.015625 | 3 | [] | no_license | class Solution:
def help(self, prices):
res = sum(max(y - x, 0) for x, y in zip(prices, prices[1:]))
return res
def maxProfit(self, k: int, prices: List[int]) -> int:
if not prices or len(prices) == 1:
return 0
if k >= len(prices) // 2:
r... | true |
dd89f2f89855dbf68b7ed1706d64aed21f058139 | pua2/tempus_challenge | /dags/challenge/retrieve_data.py | UTF-8 | 6,174 | 3.265625 | 3 | [] | no_license | """
Tempus Challenge - Retrieve Data
Functions required to retrieve and transfer data to S3 Buckets
Handles challenge and bonus
"""
import os
import os.path
import pandas as pd
import boto3
import requests
CURR_DIR = os.getcwd()
NEWS_API_KEY = os.getenv("NEWS_API_KEY")
def make_dir(path, name):
"""
Creates ... | true |
09842bfc97f32436dfe98651a7d809a033b38272 | zalanfarkas/cs4025 | /main.py | UTF-8 | 6,596 | 3.09375 | 3 | [] | no_license | import nltk
import pickle
from sys import argv
from classification import Classification
from lemmatizer import Lemamatizer
from multiprocessing import Pool
classification = Classification("rf",
{
'n_estimators': 5000,
}
)
lemmatizer = Lemamatizer()
pool_size = 4
def proccess_line(line):
fields =... | true |
e1bc7919fb680857c955779c6856f98c6862a012 | joserincon0206/Tensorflow-Artificial-Intelligence | /housing_prices.py | UTF-8 | 610 | 3.015625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from tensorflow import keras
# GRADED FUNCTION: house_model
def house_model(y_new):
xs = np.arange(start=1, stop=11, dtype= float)
ys = np.arange(start=0, stop=10, dtype= float)*.5 + 1
print(xs)
print(ys)
model = tf.keras.Sequential([keras.layers.Dense(... | true |
5e8205cc600d45654f3d943937315669872eaaab | srinath047/Python-for-Industrial-Engineering | /Quality Control Charts/Z chart and MW chart.py | UTF-8 | 2,252 | 3.46875 | 3 | [] | no_license | ### Z chart and MW chart ###
# Import required libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import statistics
# Set random seed
np.random.seed(42)
# Define sample number
sample = pd.Series(np.arange(0,16))
# Set readings
X = pd.Series(np.... | true |
5e68d30dbeb2d1a68be0f7edd54beeadf3a8f46a | junanote/Algorithm | /code001.py | UTF-8 | 306 | 3.390625 | 3 | [] | no_license | ## 함수 선언부 (클래스 선언)
## 전역 변수부
katok =[]
select = -1 #1. 추가 2. 삽입 3. 삭제 4. 종료
## 메인 코드부
if __name__ == '__main__' # 메인함수(진입점)
while(select !=4) :
select - int(input('1. 추가 2. 삽입 3. 삭제 4. 종료 --->')) | true |
f206d896ad83d69c4c986651bb149475c5e52c42 | mayurnewase/Flask-Blog | /app/tasks.py | UTF-8 | 2,947 | 2.671875 | 3 | [] | no_license | """
this is used for background tasks
this will use application context, db, user info
so this need
app context
db access
when we do flask run blog.py create app -> but background task doesn't know it and can't access it
so it need to create its own app and push context to make current_app accessible
so if any task... | true |
e3a7d02785bc7bb023caaca9a20c183997b2fac5 | DumezErika/ProjetMachineLearning | /exercises/Chapitre 5/exercice6.py | UTF-8 | 1,879 | 3.171875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
from sklearn.linear_model import LogisticRegression
default_ = pd.read_csv("Default.csv")
default = default_.copy()
# a
# Première approche
X = default[['income', 'balance']]
y = default['default']
clf = Logistic... | true |
472fc9257e823a647e73717c2ddb19f133c44b9b | dbaile6/leet.py | /box.py | UTF-8 | 452 | 3.796875 | 4 | [] | no_license | def main():
# variables width and height
width = 0
height = 0
# Takes input from user for variables
width = int(input("Please enter the width: "))
height = int(input("Please enter the height: "))
i = 0
max_num = width * height
while i < max_num:
i += 1
needed_space ... | true |
4e604154d32c9f6befb0a75d9963f8f901e21b37 | kalina/log_redactor | /append_file.py | UTF-8 | 186 | 2.734375 | 3 | [] | no_license |
f = open('sample_log2.txt', "r")
lines = f.readlines()
f.close()
f = open('sample_log2.txt', 'a')
i = 0
while i < 100000:
i+=1
f.writelines(lines)
f.close
| true |
e4d50938a321cdd8b71973e90cee6c5b3eb018d0 | g-alvarez/herding-ros | /get_alpha_comparisons.py | UTF-8 | 3,850 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# coding=utf-8
# author: Gabriel Álvarez
# email: 781429@unizar.es
import matplotlib.pyplot as plt
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description='Plot the minimun distances between robots.')
parser.add_argument('-n', '--robots', type=int, required=True, choic... | true |
e0a60c0dc39b8bf4bc8b996c4cf72d62f33df951 | Iapetus-11/brainfuck-interpreter | /brainfucker.py | UTF-8 | 1,203 | 3.53125 | 4 | [] | no_license |
def cleanup(bf: str) -> str:
return ''.join(c for c in bf if c in '><+-.,[]')
def make_bracemap(bf: str) -> dict:
bracemap = {}
temp = []
for i, c in enumerate(bf):
if c == '[':
temp.append(i)
elif c == ']':
start = temp.pop()
bracemap[start] = i
... | true |
3a6398a99ba21edd1e7943db72de55b2d8613536 | Carlosmave/iTunesDataExtractor | /process.py | UTF-8 | 28,185 | 2.859375 | 3 | [] | no_license | from config import countries, session, api_key, chrome_options
import sys, time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.common.exceptions import WebDriverException
from bs4 import BeautifulSoup
import mar... | true |
25dbeb899073c8b778f706e7964f1efb674d087a | papagr/TheLMA | /thelma/entities/racklayout.py | UTF-8 | 5,533 | 2.96875 | 3 | [
"MIT"
] | permissive | """
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Rack layout entity classes.
Created Nov 26, 2010
"""
from everest.entities.base import Entity
__docformat__ = "reStructuredText en"
__all__ = ['RackLayout'... | true |
106da5032f97a68e7afc8e1bdf3e2cd3d968ebe2 | xumq1009/code2vec | /train_log/loganalyze.py | UTF-8 | 6,614 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
import abc
import matplotlib.pyplot as plt
import numpy as np
o_path = os.path.dirname(os.path.realpath(__file__))
root_folder_path = os.path.abspath(os.path.join(o_path,os.path.pardir))
class Analyzer(metaclass = abc.ABCMeta):
def __init__(self):
self._data = {}
# 开关
self._con... | true |
633b611a3675c9bf512f0b64a64e6ba151f2946d | vizance/Python_Data_Analysis | /第三章_Excel檔案處理/pandas_column_by_name_worksheets.py | UTF-8 | 716 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!usr/bin/env python3
#(pandas)讀取所有工作表worksheets-篩選所有worksheets中特定欄位_by欄位標題(col_name)
"""
Created on Wed Oct 4 09:05:38 2017
@author: vizance
"""
import pandas as pd
import sys
input_file = sys.argv[1]
output_file = sys.argv[2]
data_frame = pd.read_excel(input_file, sheetname=None, index_col=N... | true |
ab2d97f55d1b1d1a36425e8a7d04c80b85969d0e | frankn172/super-mario-bros-FReAK-Games | /venv/backgroud.py | UTF-8 | 1,958 | 3.125 | 3 | [] | no_license | from gamefunctions import *
class Background:
def __init__(self, screen):
self.color = pygame.Color("white")
self.tiles = None
self.stagePosX = 0
self.stagePosY = 0
self.tileHeight = 0
self.tileWidth = 0
self.screen = screen
self.surface = screen.cop... | true |
507a7777d12d9d561e302b3bc949f1931d64fe0e | Matusz27/Celest-bot | /src/database_handle/pictures.py | UTF-8 | 1,064 | 2.78125 | 3 | [] | no_license | from database_handle import conn
with conn:
def check_for_picture(picture_name):
with conn.cursor() as cursor:
sql = "SELECT name FROM pictures WHERE name LIKE %s"
cursor.execute(sql, (picture_name,))
data = cursor.fetchone()
if not data:
... | true |
1426ed1504606d726870e2a8827ec5cd179644c3 | baoyoubing/EtherCAT-Implementation-Tool | /PythonScripts/sample_calc_offset.py | UTF-8 | 1,274 | 2.8125 | 3 | [] | no_license | import time
def main():
CalcOffset()
output.println('')
output.println('Finished Calc Offset')
def CalcOffset(mode=0, angle=30, amplitude=75, target_duration = 500, pairs_of_poles = 3):
output.println('Calculating offset in stepper mode')
output.println('')
offset = list()
device.SdoWrite(0x28... | true |
0bdbfaa9c553cda3480d7a29c976d39abd90bae5 | theand/once_upon_a_time | /clipboard_manipulate/remove_space.py | UTF-8 | 364 | 2.734375 | 3 | [] | no_license |
from cStringIO import StringIO
import clipboard_lib
import re
def remove_space(aString):
result=[]
pat = re.compile("\s")
for each in aString.splitlines():
each = pat.sub('',each)
if each != "":
result.append( each )
return '\n'.join(result)
if __name__=='__main__':
cl... | true |
fc65ee4e127327a9ec6afb5b25b2bc0fd77187aa | DenisPil/Project-4 | /app/utils/menus.py | UTF-8 | 2,512 | 4.03125 | 4 | [] | no_license |
class MenuEntry:
"""
Classe qui modélise les entrées du menu
"""
def __init__(self, option, handler):
"""
Arguments:
option = description textuelle de l'option du menu
handler = objet d'une classe du contrôleur d'application
"""
... | true |
bb94d127ecf2ba46f9dc143419c91bfa6b34f51b | johnbartlett19/Rubiks | /routines.py | UTF-8 | 33,722 | 3.4375 | 3 | [] | no_license | from rubiks_classes import *
from constants import *
from utilities import *
from input_txt import *
def init_game_smart(game):
"""
Set up a Rubiks Cube game by assigning the locations to each cube and the colors to each cube facet.
This routine keeps track of which cubes have been assigned and colors any ... | true |
359adc8bafadef6698da203ffa789077e5a3c3e0 | Athenian-ComputerScience-Fall2020/guessing-game-yesak1 | /game1.py | UTF-8 | 2,525 | 4.4375 | 4 | [
"Apache-2.0"
] | permissive | #collaborators: Kasey, help from Megan
import random #this imports the random number, depending on the range the user prompts.
def guess():
print ("we are going to play a guessing number game ")
print ("press a to reveal the correct answer if you're stuck ")
range2=int(input("what range do you wan... | true |
c544416a5053fef1bfbbad8987d387a1bb396527 | utkarshpandey12/supply-demand-prediction | /source.py | UTF-8 | 4,863 | 2.96875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import pandas as pd
import os
#from sklearn import datasets, linear_model
def read_demand_dataframe():
"""Returns a dataframe with the results for demand updated csv features"""
# Point to where you've stored the CSV file on your local machine
"remember read demandv1.... | true |
2f1d47ef5c07e71f5cfabda08b48e052f45c3495 | JonnyKelso/coinvalues | /coinvalues.py | UTF-8 | 1,369 | 2.921875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
import requests
import time
from datetime import datetime
# *** from https://coinmarketcap.com/api/
# Misc
# All 'last_updated' fields are unix timestamps.
# Limits
# Please limit requests to no more than 10 per minute.
# Endpoints update every 5 minutes.
BITCOIN_API_URL = 'https://a... | true |
4decc7e2a59f61f31a6274e3c1a85e7cb895771b | qj/lc | /727.py | UTF-8 | 431 | 2.65625 | 3 | [] | no_license | class Solution:
def minWindow(self, S: str, T: str) -> str:
l, m, minLen, res = 0, 0, float("inf"), ""
for r in range(len(S)):
if S[r] == T[m]:
m += 1
while m == len(T):
if len(S[l: r + 1]) < minLen:
minLen = len(S[l: r +... | true |
3f534c9ce09c62b9bce43bd2b9c7828d593190b9 | nlomeli/nlp-with-python | /modules/04_corpus_processing.py | UTF-8 | 8,797 | 3.09375 | 3 | [] | no_license | import os
import sys
import json
import nltk
from nltk.stem.porter import *
from collections import Counter
try:
directory = sys.args[1]
except:
directory = '../review_json/'
def load_reviews(directory):
file_names = os.listdir(directory)
reviews = [json.loads(open(directory+fn, 'r').read()) for fn in... | true |
e9c42acbd96637f45353885e9c864b379e7873b5 | zbanks/cursedlight | /effects.py | UTF-8 | 10,561 | 2.59375 | 3 | [
"MIT"
] | permissive | import colorsys
import logging
import urwid
logging.basicConfig(filename="/tmp/cl.log", level=logging.DEBUG)
logger = logging.getLogger(__name__)
def rgba_to_hsva(rgba):
r,g,b,a = rgba
h,s,v = colorsys.rgb_to_hsv(r/255.0, g/255.0, b/255.0)
h *= 255
s *= 255
v *= 255
return map(int, [h, s, v, a... | true |
c9a6b1f0b2678edfb3eb6bb9a9a0cc359fbdee62 | VincentAuriau/automated_scraping | /auto_scraping_information.py | UTF-8 | 13,295 | 3.796875 | 4 | [] | no_license | """
Input : CSV file with two columns : UEN, URL
URL is a url of the website of the company which uen is UEN and with a high probability of having project(s) on this
webpage
Output : Depending the cases, the script returns two lists:
-One with Webpages that describe each only ONE PROJECT
-One with Webpages with a lis... | true |
4689cb8b8f98085520dc71110c17f5fd80a9eabf | rrw23/NoiseAndVibrationTools | /acoustics/tools.py | UTF-8 | 11,892 | 3.375 | 3 | [] | no_license | # Basic tools to calculate a range of acoustic properties
#
# Authors:
# Robin Wareing - r.r.wareing@gmail.com
# John Bull -
# Michael Smith
#
# Sources:
# Engineering Noise Control - Fourth Edition - Bies & Hansen
# Guide to assessing road traffic noise - NZ Trasport Agency
# BS5228-1
# BS5228-2
import math
def BS5... | true |
61d2ec3064c102efd7c7b602f711fb553ba03880 | technicalhub-io/placement-programs-using-python | /pdf_ex.py | UTF-8 | 308 | 2.734375 | 3 | [] | no_license | import fpdf
import csv
with open("data1.csv")as f1:
records=list(csv.reader(f1))
pdf=fpdf.FPDF()
for i in records[1:]:
pdf.add_page()
pdf.image("img.jpg",0,0,210,297)
pdf.set_font("Times","B",12)
pdf.set_xy(100,100)
pdf.cell(0,0,i[1])
pdf.output("download.pdf")
| true |
a7dfa0affe71c51db96fdd7b077b83f1724e005d | K-K-J/Python | /Counting Organisations in e-mails/Counting Organisations in e-mails.py | UTF-8 | 1,672 | 3.375 | 3 | [] | no_license |
##This application will read the mailbox data (mbox.txt) count up the number email messages per organization (i.e. domain name of the email address) using a database with the following schema to maintain the counts.
import sqlite3
conn = sqlite3.connect('Organisations_Count.sqlite')
cur = conn.cursor()
cur.execute(... | true |
20f28e49f61380b53f6ed32179725a7bb6a0bd18 | tenten0113/python_practice | /9/iterator1.py | UTF-8 | 166 | 3.5 | 4 | [] | no_license | data = [1, 2, 3]
itr = iter(data)
print(next(itr)) # 結果:1
print(next(itr)) # 結果:2
print(next(itr)) # 結果:3
print(next(itr)) # 結果:StopIteration
| true |
2948f3e12f53de8883a70ddf7997c947e2181593 | Plabrum/bp | /code/bp_igt.py | UTF-8 | 530 | 2.625 | 3 | [] | no_license | import os
class Model_dirs():
def __init__(self, dir_name=None):
if dir_name is None: dir_name = "stan_files"
self.cur_dir = os.getcwd()
self.stan_dir = os.path.join(os.getcwd(), dir_name)
try:
os.mkdir(self.stan_dir)
except:
print("overwriting di... | true |
d2efaa769274d9c70ae835a64d14309a5c3389bc | yoma75/ejemplos-python | /Ejemplos/ingreso_mensual.py | UTF-8 | 596 | 4.5 | 4 | [] | no_license | # Para tributar un determinado impuesto se debe ser mayor de 16 años y tener unos ingresos iguales o superiores a 1000 € mensuales.
# Escribir un programa que pregunte al usuario su edad y sus ingresos mensuales y muestre por pantalla si el usuario tiene que tributar o no.
print("")
edad = int(input("Digita tu edad: ... | true |
e59c2c1e64c09cba26d18815370870301617bba2 | florinvistig/python-ledger | /test_app.py | UTF-8 | 2,445 | 2.84375 | 3 | [] | no_license | import unittest
from datetime import datetime
import app
class AccountTest(unittest.TestCase):
def test_account_balance_to_date(self):
a1 = app.Account('john')
e1 = app.Transaction(datetime.strptime('2015-01-15', '%Y-%m-%d'), 125, 0, 'mary')
e2 = app.Transaction(datetime.strptime('2015-01... | true |
fdac2d8d09f4f1f6c5253c40562fbe29a582ac02 | Zemliakov-Sasha/python-online-marathon | /sprint_3/Sprint_3_task_5.py | UTF-8 | 781 | 3.703125 | 4 | [] | no_license | def logger(func):
def wrapper(*args, **kwargs):
vals = ""
for a in args:
vals += str(a) + ', '
for k in kwargs.values():
vals += str(k) + ', '
x = func(*args, **kwargs)
print(f"Executing of function {func.__name__} with arguments {vals[:-2]}...... | true |
b3c4a59aa7b1c871310e7aead0c26a39ff4928fd | TrellixVulnTeam/Demo_933I | /leetcode/1619.Mean of Array After Removing Some Elements.py | UTF-8 | 1,949 | 3.28125 | 3 | [] | no_license | # Given an integer array arr, return the mean of the remaining integers after re
# moving the smallest 5% and the largest 5% of the elements.
#
# Answers within 10-5 of the actual answer will be considered accepted.
#
#
# Example 1:
#
#
# Input: arr = [1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]
# Output: 2.00... | true |
d891b9df99bb957b78d9367e59d72f374f496da6 | arkalim/Computer-Vision | /bar graph.py | UTF-8 | 399 | 3.84375 | 4 | [] | no_license | import matplotlib.pyplot as plt
#[x values],[y values]
plt.bar([1,3,5,7,9],[5,2,7,8,2], label="Example one" , color = 'r')
plt.bar([2,4,6,8,10],[8,6,2,5,6], label="Example two", color = 'g')
plt.legend() #box designating the colour
#labels on x and y axes
plt.xlabel('bar number')
plt... | true |
a0363c36cc57653f61a57bed0233768d890d02c0 | shubhamgarg1/AutomatedDeliverySystem | /areaverification.py | UTF-8 | 2,456 | 2.71875 | 3 | [] | no_license | __author__ = 'Shubham'
import urllib
import json
import csv
j=1
try:
'''area="Yeshwantpur"
city="Bangalore"
pincode="560022"'''
area="Yeshwantpur"
city="Bangalore"
pincode="560022"
area="Sector 121 Gymkhana Club"
city="Faridabad"
pincode="121102"
i=0
while i<len(are... | true |
3cd71004c4d928467346971621c6fd8fa416a38d | mltreiber/functional_metagenomics | /scripts/sensitivty_specificity_beta_gal_evalue.py | UTF-8 | 6,369 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
##########################################################################
# Copyright (C) 2017-2018 Michelle Treiber
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation;
#
# Thi... | true |
bc9f715d265cff092008445aba7e061ed94ad63b | dgottlieb/storyteller | /tiles.py | UTF-8 | 1,312 | 3 | 3 | [
"WTFPL"
] | permissive | import spritesheet
tiles_sheet = spritesheet.SpriteSheet("images/tiles.png", background_color=(0, 128, 128, 255))
mountain_tile = tiles_sheet.get_item(1, 5, 64, 64)
hill_tile = tiles_sheet.get_item(1, 4, 64, 64)
city_tile = tiles_sheet.get_item(1, 0, 64, 64)
grass_tile = tiles_sheet.get_item(1, 2, 64, 64)
brick_tile... | true |
f8f82329f7b2947e90d077107d4f3dd1078e0745 | piszewc/Blog-Code | /Selenium/Unit 2/automate_forms.py | UTF-8 | 3,624 | 2.96875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 21:16:59 2020
@author: piotr
"""
from selenium import webdriver #import webdriver - launch browser
from selenium.webdriver.common.by import By # search using specific parameters.
from selenium.webdriver.support.ui import WebDriverWait #wait for a page to load.
from s... | true |
1f36ee75c21a30351f895517578d367cc26948eb | tankpit-analytics/tankpit-analytics.github.io | /scripts/get_sword_decorations.py | UTF-8 | 5,319 | 2.5625 | 3 | [] | no_license | from helper import *
import pickle
import os
#---- helpers, part 1: concat new backups
def concat_new_backups(backups_concat_df, dir_backups, done_filenames_list):
for filename in os.listdir(dir_backups):
if filename.startswith('all_tanks') and filename not in done_filenames_list:
# add to ba... | true |
832609c7a092c37cebcd2e6d2374e6df2b11c182 | Yozi47/Data-Structure-and-Algorithms-Class | /Homework 5/R 5.4.py | UTF-8 | 247 | 3.40625 | 3 | [] | no_license | def __getitem__(self, k):
if k >= 0 and k < self._n:
return self._A[k] # return the item at k position
else:
raise IndexError("invalid index") # raise error if the number is less than 0 or more than the length of list | true |
bc68d34c0f987e769ec39995cf0f7d7860e96e5f | zmcddn/Data_Import_2_SQLite | /import_to_db.py | UTF-8 | 9,258 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""SQLite uses dynamic data structure, which converts
the inserted data type to the following 5 categories:
1. NULL: empty value
2. Integer: signed int
3. Real: float
4. Text: string
5. Blob: binary
"""
import sqlite3 as sqlite
import pandas as pd
import numpy as np
impo... | true |
a9707b35b8c6874be0587d5f85ee58b0cf2b4cd5 | zsiciarz/pyaavso | /tests/parsers/test_webobs.py | UTF-8 | 3,320 | 2.609375 | 3 | [
"MIT"
] | permissive | import unittest
from pyaavso.parsers.webobs import WebObsResultsParser
# this is a simplified actual HTML code from WebObs results page
RESULTS_HTML = """
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table class='observations'>
<thead>
<tr>
<th class='empty' colspan='3'></th>
<th>Star</th>
... | true |
cdb1b1d4ca999ea5aaa81b14c4dfcc92ef6f2f5c | saltstack/salt | /tests/unit/utils/test_msgpack.py | UTF-8 | 17,629 | 2.53125 | 3 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | """
Test the MessagePack utility
"""
import inspect
import os
import pprint
import struct
import sys
from io import BytesIO
import pytest
import salt.utils.msgpack
from salt.utils.odict import OrderedDict
from tests.support.unit import TestCase
try:
import msgpack
except ImportError:
import msgpack_pure as m... | true |
7797a90721bab10bcae38682137e9c9842220825 | labroid/OldPhotoManager | /Photo/src/pickle_manager.py | UTF-8 | 2,639 | 2.671875 | 3 | [] | no_license | '''
Created on Dec 25, 2011
@author: scott_jackson
TODO: make pickle print pretty. Also consider zipping it.
'''
#pylint: disable=line-too-long
import sys
import os.path
import logging
from cPickle import Pickler, Unpickler
from pickle import PickleError, UnpicklingError
class PhotoPickler(object... | true |
cf32a8e642a1fb5d4d50f5a7ad6195222cbcadad | geonwoomun/AlgorithmStudy | /programmers/level2/pro42586.py | UTF-8 | 1,109 | 3.578125 | 4 | [] | no_license | # 프로그래머스 기능개발
def solution(progresses, speeds):
answer = []
temp = [0 for i in range(len(progresses))] # 0이면 배포 안 된것. 1이면 배포한것.
check = False # 다 했는지 체크하는 것.
while(1):
num = 0
for i in range(len(progresses)):
progresses[i] += speeds[i] # 스피드만큼을 계속 더해준다.
if(progre... | true |
f32be35ae55ccb1c2c94c3d9efbaf3ffc0d95d50 | mimik91/CodeCool | /game statistics/printing.py | UTF-8 | 1,051 | 3.359375 | 3 | [] | no_license | # Printing functions
print("What is the name of data file?")
datafile=input()
print("How many games are in the file?")
from reports import count_games
print(count_games(datafile))
year=input("Is there a game from a given year?")
from reports import decide
print(decide(datafile, year))
print("Which is the latest game?")... | true |
b77fb708886db1547c69f557cfc70766564eb5b3 | RossySH/Mision_06 | /MisiónImposible.py | UTF-8 | 1,773 | 3.484375 | 3 | [] | no_license | # Rosalía Serrano Herrera
# Dibuja como un esporógrafo
import pygame
import math
ANCHO = 700
ALTO = 700
# Colores
BLANCO = (255, 255, 255)
AZUL = (100,149,237)
MORADO = (154,50,205)
NEGRO = (0, 0, 0)
VERDE = (154, 205, 50)
NARANJA = (255, 160, 0)
def dibujar(r, R, l, r2, R2, l2):
pygame.init()... | true |
74e15b27dd5d6c49ad54645e80a8b505cb785666 | BoatInTheRiver/codes_algorithm | /剑指Offer/剑指 Offer 54. 二叉搜索树的第k大节点.py | UTF-8 | 442 | 3.46875 | 3 | [] | no_license | #coding:utf-8
'''
给定一棵二叉搜索树,请找出其中第k大的节点。
示例:
输入: root = [3,1,4,null,2], k = 1
3
/ \
1 4
\
2
输出: 4
'''
class Solution:
def kthLargest(self, root, k):
res = []
def dfs(root):
if not root:
return
dfs(root.right)
res.append(root.val)
... | true |
d6777c6dd6d0cf7e2b07185c0b02589612ed0178 | lohsuan/Multimedia-Tech | /Project2_第三組_小組報告/test.py | UTF-8 | 605 | 2.6875 | 3 | [] | no_license | import numpy as np
import cv2
# circle
img = cv2.imread("./circle.jpg", 0)
img = cv2.dilate(img, np.ones((7, 7)), iterations=3)
img = cv2.erode(img, np.ones((7, 7)), iterations=3)
ret, out = cv2.threshold(img, 170, 255, cv2.THRESH_BINARY)
cv2.imwrite("./circle_out.jpg", out)
# man
img0 = cv2.imread("./... | true |
6414635208d382775f2fda1f8736b1fa1581d49f | Chaitra-Bhat383/NLP-Text-Classifier | /app.py | UTF-8 | 4,237 | 2.921875 | 3 | [] | no_license | # Core Pkgs
import streamlit as st
import altair as alt
import plotly.express as px
# EDA Pkgs
import pandas as pd
import numpy as np
from datetime import datetime
# Utils
import joblib
pipe_lr = joblib.load(open("Emotion_Classifier.pkl", "rb"))
# Track Utils
from track_utils import create_page_visited_table, add_p... | true |