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 |
|---|---|---|---|---|---|---|---|---|---|---|
6c25c9a35e2b3493951f32af210b1ca908eee539 | snaiperskaya96/ChunxBudBackend | /src/test.py | UTF-8 | 1,913 | 2.546875 | 3 | [] | no_license | import socket
import sys
from proto import updater_pb2
def connect_to_server():
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((socket.gethostbyname('updater'), 6684))
return client
def print_message():
print('Printing message structure')
message = updater_pb2.FChunxMess... | true |
1117048e31c6f1d174c4b6195ebb63148ab60d89 | githhhh/taskschedule | /genmergesort.py | UTF-8 | 2,287 | 2.515625 | 3 | [] | no_license | import sched
import argparse
class ToggleAction(argparse.Action):
def __call__(self, parser, ns, values, option):
setattr(ns, self.dest, bool("-+".index(option[0])))
def main():
parser = argparse.ArgumentParser(description='Generator for MergeSort - Emanuele Ruffaldi 2016 SSSA',prefix_chars='-+')
... | true |
1aff78a0db5369ae386e52d4d65b43b1c84acb33 | DatenBiene/Bayesian_Time_Series_Classification | /Bayesian_hmm/bayes_hmm.py | UTF-8 | 15,791 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import random
import scipy
import matplotlib.pyplot as plt
from random import shuffle
class bayesian_hmm:
""" Hidden Markov Model object with bayesian estimation of the parameters (theta, P). The number of Hidden states
is an implicit parameters and is not estimated. For now this class... | true |
695cb3c6f384e9c6e4730c3e093aa6363c018ceb | Pavlikkkk/Homework | /Hometask_1_1.py | UTF-8 | 6,446 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import pyodbc
import os
import shutil as sh
from pathlib import Path
from xml.dom import minidom
import collections
import re
class ReadFiles:
""" Только читает файлы в указанной директории"""
def __init__(self, directory, directory_files_incorrect):
self.directory = directory
... | true |
ecd584a24fb598869074897f045fe2af86fb50ed | kexinshine/leetcode | /97.交错字符串.py | UTF-8 | 604 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=97 lang=python3
#
# [97] 交错字符串
#
# @lc code=start
class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
n, m, t = len(s1), len(s2), len(s3)
if n + m != t: return False
f = [False] * (m + 1)
f[0] = True
for i in range(n + 1):
... | true |
1d8781c7c0d1c5e4a116669913f8d3fc7ae34292 | mixbened/python_snippets | /todo_programm.py | UTF-8 | 497 | 3.78125 | 4 | [] | no_license | print 'Welcome to the ToDo Programm.'
keep = raw_input('Would you like to enter a Todo Task? (y/n): ').lower()
todos = {}
while keep == 'y':
new = raw_input('Enter your Todo: ')
print 'Your Todo task is: ' + new
status = raw_input('Did you complete the task? (y/n): ')
if(status == 'y'):
status... | true |
d1d7b0d16757fc3dfed362b83348aac0cf30cefb | jtlai0921/MP31601 | /CH06/CH6.3/CH0634B.py | UTF-8 | 597 | 4.46875 | 4 | [] | no_license | # 集合的數學運算(2) -- 產生新集合
st1 = {23, 24, 26} #準備集合1
st2 = {23, 24, 33, 45}#準備集合2
print('差集計算 -- st1:', st1 - st2)
print('差集計算 -- st2:', st2 - st1)
print('差集-difference()方法')
print(st1.difference(st2))
print(st2.difference(st1))
print(st1.difference([78, 26, 91]))
print(st2.difference((33, 35, 21)))
# XOR 對等差集
print(... | true |
96a75a75d2f53d67e6f0a9f544ee6baf3ec62503 | fed0rus/ATM | /stage2/2-2[RUS].py | UTF-8 | 1,062 | 3.171875 | 3 | [] | no_license | import sqlite3
database = sqlite3.connect('database.db')
gnome = database.cursor()
clerk = database.cursor()
customer = input()
cashLowerBound = int(input())
amountOfPurchasesLowerBound = int(input())
# Fetching Customer ID
queryCustomer = (customer,)
for atom in gnome.execute('''SELECT id FROM customers WHERE name=?''... | true |
8b931c4f9348ed3c52f31b40b072b28df138409e | yalaska04/carreraPyGame | /main.py | UTF-8 | 1,305 | 3.21875 | 3 | [] | no_license | import pygame
import sys
class Game():
corredores = []
def __init__(self):
# crear pantalla
self.__screen = pygame.display.set_mode((1002, 632))
# título de la pantalla
pygame.display.set_caption('Carrera de bichos')
# hay que cargar la imagen de fond... | true |
a01f416b1bc5116f545ea7d10d7e4d2a57e97481 | singhblom/autocorrelation | /datasets.py | UTF-8 | 4,772 | 3.015625 | 3 | [
"MIT"
] | permissive | """Convenience methods to preprocess sound data into formant stuff"""
from collections import namedtuple
import numpy as np
import torch
from torch.utils.data import Dataset
from torch.utils.data.sampler import WeightedRandomSampler
import scipy.io.wavfile as wavfile
SoundData = namedtuple('SoundData', ['rate', 'data... | true |
03bc20ca1e6a66ddd3396db91519b95575ff14cd | gabialeixo/python-exercises | /exe037.py | UTF-8 | 901 | 4.65625 | 5 | [] | no_license | #Escreva um programa que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão:
#1- para binário 2- para octal 3- para hexadecimal
escolha = str(input("""Este é um programa de conversão de bases! Escolha abaixo para qual deseja converter:
1 - BINÁRIO
2 - OCTAL
3 - HEXADECIMAL
""... | true |
63f9cc65ea34aa200f766d6216cf2e83130a3668 | Aasthaengg/IBMdataset | /Python_codes/p03806/s451135649.py | UTF-8 | 760 | 2.953125 | 3 | [] | no_license |
N, Ma, Mb = map(int, input().split())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
a[i], b[i], c[i] = map(int, input().split())
INF = float("inf")
sA = sum(a)
sB = sum(b)
# 薬A,Bの合計がi,jになるのに必要な最小金額
dp = [[[INF for _ in range(401)] for _ in range(401)] for _ in range(N+1)]
dp[0][0][0] = 0
for i in... | true |
2cd40410fbac4f8c7bdb49510ca400dd14fcf602 | maurizioabba/tannico-leverage | /scripts/runner.py | UTF-8 | 2,036 | 2.6875 | 3 | [] | no_license | """
Run a single instance of tannico.
"""
import argparse
import logging
import json
import os
import datetime as dt
from tannico.ingester import Ingester
from tannico.comparator import Comparator
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--ita", help="The list of italian pages"... | true |
36966bfca93eef92551b29d953be0fa99bd6ff4b | fretboardfreak/code | /py_lib/rst.py | UTF-8 | 7,277 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
libRst
======
This module is intended to provide compilation support for rst. The intention
is to keep the required libraries all in one place to provide a deployable,
python 2.6/2.7 compatible, rst compiler.
RST Constructs to be supported:
- paragraph
- heading
- list (unordere... | true |
5ab1b2c23f4d8311ee566fada07387e15284be8c | Environmental-Informatics/10-statistics-and-metrics-warre112 | /program_10.py | UTF-8 | 12,253 | 3.40625 | 3 | [] | no_license | #!/bin/env python
# Created on April 01, 2020
# by Les Warren
#
# This script servesa as the solution set for assignment-10 on descriptive
# statistics and environmental informatics. See the assignment documention
# and repository at:
# https://github.com/Environmental-Informatics/assignment-10.git for more
# detail... | true |
18c2ce14712e1ab7bc206e1116df37a37b66e8c0 | dvysardana/graphclustering | /src/Phase1Data.py | UTF-8 | 35,713 | 2.546875 | 3 | [] | no_license | __author__ = 'divya'
import numpy as np
from ClusteringData import ClusteringData
from CNodeData import CNodeData
from EdgeData import EdgeData
from EdgeData import EdgeType
from ClusteringVisualizer import ClusteringVisualizer
from EvaluationData import EvaluationData
from ClusteringPrinter import ClusteringPrinter
f... | true |
dc47522fa98b2cef387863753d729a17b0a5d0cd | rodriguez-jan/leetcode | /Arrays/skyline_grid.py | UTF-8 | 1,077 | 3.40625 | 3 | [] | no_license | class Solution(object):
def maxIncreaseKeepingSkyline(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
total_changes = 0
if not grid:
return 0
row_max = [0] * len(grid)
col_max = [0] * len(grid[0])
# Find the max in eac... | true |
f5083514cc74d1685af0ee907f29e5edd4a4a896 | Wesleysou/Exer-CRS- | /Programas/Aula-03/IMC.py | UTF-8 | 323 | 3.71875 | 4 | [] | no_license | #Elaborar um programa em Python que solicite os dados de estatura (em metros)
#e peso (em Kg) de uma pessoa e calcule/visualize seu IMC (Índice de Massa
#Corporal). Lembre que IMC = peso/estatura²
tura=float(input("Digite sua altura"))
pe=float(input("Digite seu peso"))
pap=tura*tura
imc=pe/pap
print("Seu imc é",imc)
| true |
d53ce0ca2a701ffffa873951e72a1a8da25c28f6 | jonathan-j-lee/SARBayes | /old/machine_learning/formatting.py | UTF-8 | 2,904 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
# SARbayes/machine_learning/formatting.py
import openpyxl
import Orange
import yaml
import datetime
def main():
with open('settings.yaml') as settings_file:
settings = yaml.load(settings_file)
with open('ISRID.tab', 'w+') as tab_file:
workbook = openpyxl.load_work... | true |
08c82b8a039f2d75ee8604f1fcba55f02480cdcc | psy2013GitHub/dsa | /string/leetcode_valid_number.py | UTF-8 | 1,963 | 3.46875 | 3 | [] | no_license | #-*- encoding: utf8 -*-
__author__ = 'flappy'
class Solution(object):
def isNumber(self, s):
"""
这种问题一般dfa,值得注意得是:
1,dfa状态合并问题,
2,只画有用得路径,
:type s: str
:rtype: bool
"""
# row as current-state, key as step, value as next-state
... | true |
5d9823af6366f1e9810bb86f0add22269d074b80 | midsuman/c2raytools | /misc/misc.py | UTF-8 | 809 | 3.34375 | 3 | [] | no_license | import numpy as np
def gauss_kern(size, sizey = None, sigma=1.0):
''' Return a normalized gaussian kernel.
if sizey is not set, it will be the same as sizex '''
size = int(size/2)
if not sizey:
sizey = size
else:
sizey = int(sizey/2)
x,y = np.mgrid[-size:size, -sizey:sizey]
#g = exp(-(x**2/float(size) + y... | true |
bb61c55817c5f7e8db7179cd1c009179849cf3d5 | zeufi/unittest | /Package2/TC_PaymentTest.py | UTF-8 | 316 | 2.953125 | 3 | [] | no_license | import unittest
class PaymentTest(unittest.TestCase):
def test_PaymentDollar(self):
print("This is payment in Dollar")
self.assertTrue(True)
def test_PaymentEuro(self):
print("This is euro in Dollar")
self.assertTrue(True)
if __name__ == "__main__":
unittest.main()
| true |
65ce3ca126770d05c30a9e6f71e0ef2634910c85 | mwillsey/goddity | /astar.py | UTF-8 | 1,299 | 3.140625 | 3 | [] | no_license | import networkx as nx
import goddity
class State(goddity.State):
def __init__(self, graph, src, dst):
self.graph = nx.DiGraph(graph)
assert src in graph
assert dst in graph
self.src = src
self.dst = dst
self.visited = {n: float('inf') for n in graph}
self.... | true |
7034507d385ef57c14e99d9e1b235c30109b3550 | emre/instasteem | /instasteem/post_template.py | UTF-8 | 527 | 2.96875 | 3 | [
"MIT"
] | permissive | def get_images(images):
content = ""
for image_url in images:
content += f"\n***\n"
return content
def get_body(images, location, description, url, upload_date,
include_metadata=False):
content = f"{description}\n***\n"
content += get_images(images)
if ... | true |
eeb69d49117859d69f4932da50eca13d6e6ffb51 | stormvirux/Result-retrieval-analyser | /buttontest.py | UTF-8 | 6,516 | 2.703125 | 3 | [
"MIT"
] | permissive | import wx
#######################################################################
class PageOne(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "This is a PageOne object", (20,20))
####################################################################... | true |
958f3c515dccc0f31d3b27cd02e0cb248803d0b8 | jhonasiv/rl-algorithms | /src/rlalgs/value_based/annealing.py | UTF-8 | 1,024 | 3.421875 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from dataclasses import dataclass
class BaseFunction(ABC):
def __init__(self, val_init: float):
self.val = val_init
def value(self) -> float:
return self.val
@abstractmethod
def step(self, episode: int):
"""
Run a step on th... | true |
3d9476dc078dfa35178fe8b3d17f6492d4a381b9 | anArkitek/TriNet | /pareto.py | UTF-8 | 1,975 | 2.875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import seaborn as sns
import pickle
import matplotlib.pyplot as plt
with open('loss.pickle', 'rb') as handle:
loss_dict = pickle.load(handle)
n = len(loss_dict["img_name"])
x = [i+1 for i in range(n)]
imgs = loss_dict["img_name"]
front_error = loss_dict['degree_error_f']
right_error = loss_di... | true |
79b59b27bccbf394ec792a6f0d8d8951fa2241e5 | qiuyingyue/ReinforcementLearning | /run_six_legs_DDPG.py | UTF-8 | 5,124 | 2.921875 | 3 | [] | no_license | import gym
import sys
sys.path.append("algs")
sys.path.append("envs")
#from DQN import DeepQNetwork
from DDPG_six_legged import DDPG
from six_legged_env import SixLeggedEnv
import matplotlib.pyplot as plt
import numpy as np
plot = 0 #Plot the learning curve?
class DynamicPlot():
plt.ion()
def __init__(self)... | true |
b554d6ec81ef3697318e3fac237c2333107fb75c | clarkbulleit/bme590hrm | /test_count_beats.py | UTF-8 | 253 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pytest
@pytest.mark.parametrize("a,expected", [
(np.array([1, 2, 3, 4]), 4),
(np.array([1, 2]), 2),
])
def test_count_beats(a, expected):
from count_beats import count_beats
assert count_beats(a) == expected
| true |
a54f45aea856145facdba2c55b0553ccd4d40aaa | Jprichard314/python-workbook | /basic/Test2.py | UTF-8 | 296 | 3.796875 | 4 | [] | no_license | class Animal:
def talk(self, animal):
animal.speak()
class Cat(Animal):
def speak(self):
print("Meow meow")
class Dog(Animal):
def speak(self):
print("Bark bark")
hund = Animal()
cato = Animal()
hund.talk(Dog())
cato.talk(Cat())
| true |
271d1a255026adbfa25e7babc9b292f456008d95 | UtsavRaychaudhuri/leetcode | /minimum_path_sum.py | UTF-8 | 703 | 2.921875 | 3 | [] | no_license | class Solution(object):
def __init__(self):
self.low=999999999999
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
self.minpathsum(grid,0,0,0)
return self.low
def minpathsum(self,grid,i,j,count,dp=[]):
if i==len(... | true |
e0324a12931abce3f55bedb5217fb015a645d989 | CppbetterC/Rider-Behavior | /Algorithm/Keras/Main.py | UTF-8 | 6,057 | 2.828125 | 3 | [] | no_license | """
This script implement the deep neural networks by the Keras
The model structure have one input layer, eight hidden layer, one output layer
More detail, you can print the "model.summary" to show.
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import confus... | true |
31e028796ee6d2007751a9ef40ce1a5f4d3c4ec5 | curiousyogurt/Quantum | /Grover.py | UTF-8 | 24,481 | 3.625 | 4 | [] | no_license | #############################################################################
# This script implements Grover's Algorithm. Grover's Algorithm is an
# unstructured search algorithm. For this script, we take an <input_string>,
# which is a string of 0s (the "haystack"), with the exception of a single
# 1 (the "needle")... | true |
c5d1d600a44bac8e549a90f9e43881de05dd3f06 | makalaaneesh/increSTS | /metrics.py | UTF-8 | 1,140 | 3.21875 | 3 | [] | no_license | import nlp
# constants
D = 2
T = 50
NGRAM = 5
def get_term_vector(comment):
# print "COMMENT", "[[[", comment, "]]]"
terms = []
for i in range(1,NGRAM+1):
# for 1,2,3
iterms = nlp.extract_ngrams(comment, i)
terms = terms + iterms
# print terms
terms = [term for term in terms if len(nlp.remove_stopwords(te... | true |
859154715c61c4effe80267d9dc6acaa82188f34 | mbrner/taco_salad | /taco_salad/layer.py | UTF-8 | 11,533 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
from concurrent.futures import ProcessPoolExecutor, as_completed, wait
from fnmatch import fnmatch
import logging
import pandas as pd
import numpy as np
from .component import BaseComponent
class BaseLayer... | true |
5140dc5483160d5b4b8a7953c564fcdc919ce669 | mrtztg/subtitle_batch_translator | /util_trans.py | UTF-8 | 6,300 | 2.828125 | 3 | [
"MIT"
] | permissive | import re
import execjs
import urllib.request
import urllib.parse
import urllib.error
import json
import time
class TkGenerator:
"""
Compute the "TK" of the string.
TK is a str generated by js, and you should post the string and the corresponding TK when you translate.
Just like the hash of a string.
... | true |
3b42279905e1d90ba85b81b065deb7be4da727f7 | edurfey/Intro-to-Prog-Python | /Assignment06_Starter.py | UTF-8 | 721 | 2.734375 | 3 | [] | no_license | # ---------------------------------------------------------------------------- #
# Title: Assignment06
# Description: Working with functions in a class,
# Add the each dictionary "row" to a python list "table"
# ChangeLog (Who,When,What):
# EDurfey, 05/11/2021, Added scripts as part of Assignment 5
# EDurfey, 05/... | true |
6b5da6e522803635ab031666abd688734d8ace0f | savadev/interviewbit | /Dynamic Programming/best-time-to-buy-and-sell-stocks-i.py | UTF-8 | 694 | 3.703125 | 4 | [] | no_license | '''
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
Example :
Input : [1 2]
Return : 1
'''
class Solution:
# @pa... | true |
1f20071d5aa10c69a41080c41e205c5c7e3696b9 | LeonardoZanotti/zamarf | /zamarf.py | UTF-8 | 2,753 | 2.921875 | 3 | [] | no_license | # Leonardo Zanotti
import sys,os,platform
args = sys.argv
extensions = ['md','pdf','html','txt']
##### colors
colors = True # output colored c:
machine = sys.platform # detecting the os
checkPlatform = platform.platform() # get current version of os
if machine.lower().startswith(('os', 'win', 'darwin', 'ios')):
c... | true |
60ba68157a2a69504b759a4e4a4415aef5ad5c73 | Kovalchuk1/__al.li | /Practice_15_KM-03_Kovalchuk_/main.py | UTF-8 | 3,795 | 4.15625 | 4 | [] | no_license | from factorial import factorial
from exp_root import exponentiation, root
from logarithm import logarithm
import sys
def better1_input():
try:
return float(input('> '))
except:
print('Oops. Valid characters are real numbers. Try again!')
return better1_input()
def better3_input(numbe... | true |
99af0e34c3a2ffbd0dc08a788ddf82f3ccbdd9f8 | king-michael/md_utilities | /general_utils/pandas.py | UTF-8 | 1,699 | 3.25 | 3 | [] | no_license | import pandas as pd
import numpy as np
def dataframe_to_mediawiki(dataframe, columns=None, use_index=True):
"""
Creates a MediaWiki table from a pandas dataframe.
Parameters
----------
dataframe : pd.DataFrame
columns : list or None, optional
Define custom column names.
use_index :... | true |
2e63116cc727905a63444d7c655c7010991f7a14 | yushaoji/Study-notes | /Strategies/Turtle_strategy.py | UTF-8 | 5,883 | 3.171875 | 3 | [] | no_license | #海龟策略的核心是头寸管理
#特别是根据盈利选择加仓的力度
#而期货则具有自带杠杆以及双向交易等特点
#标的:沪深300
#频率:日线
#信号:
#1. 根据20日的最高、最低、收盘价计算出ATR
#2. 计算出近十日的最高与最低价
#3. 价格突破2最高时,多单入场
#4. 如果价格继续上涨0.5倍真实波幅则再次加仓
#5. 价格回落2倍真实波幅或者突破10日最低则止损止盈出场
#6. 空仓思想类似
from WindPy import *
from datetime import *
import pandas as pd
import talib as ta
w.start()
from WindAlgo import ... | true |
6cb0a4e9ac21bf3e3e4f7e8efae0bec4a8ccae39 | akashrev/tccrawler | /chimpcrawler/image_color.py | UTF-8 | 552 | 2.75 | 3 | [] | no_license | import glob
import numpy
from PIL import Image
import scipy.misc
image_name = 'download.gif'
infiles = glob.glob('image/' + image_name)
infile = "".join(infiles)
im = Image.open(infile)
avg = numpy.average(im, axis=0)
print(avg)
numavg = (numpy.average(avg, axis=0))
image_json = (numavg.tolist())
print(image_json)
... | true |
6daa6ac14e4509d7c683a9cdb47f64fc13486a69 | Muhammad-Rehan-Farooq/SP | /Lab05/task2.py | UTF-8 | 210 | 3.5 | 4 | [] | no_license | x=0
while x==0:
try:
num=int(input("Enter a Number : "))
x=1
except:
print("Invalid Input ! ")
x=0
dict={}
for i in range(1,int(num)+1):
dict[i]=i*i
print(dict)
| true |
6940bdd7f6d5e99d342d9526fd19b95f035a0fd9 | ammuaj/CodeSignal-PySolutions | /leetCode_30DaysOfCode/day_13/Contiguous_array.py | UTF-8 | 473 | 3.78125 | 4 | [] | no_license | """
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
"""
def findMaxLength(nums):
d = {}
subarr, count = 0, 0
for i, v in enumerate(nums):
count += 2*v - 1
if count == 0:
subarr = i+1
if count in d:
... | true |
05e847208896fdad63b0b6a432553a851fb143f6 | ictr/gelcc | /20200908_fam34_sibs_case.py | UTF-8 | 4,981 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
#20200908 fam34 siblings 3-34: case
import vcf
import pandas as pd
import csv
import argparse
def calculate_sib_count(vcf_path, output_path, phen_path):
phen_df = pd.read_csv(phen_path, sep = '\t')
# create a dictionary that maps CID_CIND to samples names in vcf
cind2sample_name = di... | true |
388ed96650bcb9440a3a75fc80ef8699a4bcd233 | johanngerberding/adventofcode2020 | /advent_python/day05.py | UTF-8 | 1,555 | 3.34375 | 3 | [] | no_license | TEST_INPUTS = [
'BFFFBBFRRR',
'FFFBBBFRRR',
'BBFFBBFRLL'
]
TEST_RESULTS = [
567,
119,
820
]
# range 0,127
# F -> lower
# B -> upper
def get_row(boarding_pass: str) -> int:
rows = boarding_pass[:7]
row_range = list(range(128))
for i in rows:
m = len(row_range) // 2
i... | true |
f7fdec901f130c7ebafdfaef412eddb1c56c9c9c | catVSdog/design_patterns | /chain_of_resposibility.py | UTF-8 | 2,296 | 3.671875 | 4 | [] | no_license | """
职责链模式:
链条上的每个环节有自己的职责范围,在自己的职责范围内就立即处理,入股超过自己的职业,那么就传给链条的一下环节
"""
from abc import ABC, abstractmethod
class BaseHandler(ABC):
@abstractmethod
def hande(self, money):
pass
class Kuaiji(BaseHandler):
def __init__(self):
self.next_handler = None
def set_next_handler(self, next_hand... | true |
3af0499ad781f86b54eefadb4c102f9738acd389 | selenologist/hanzi-srs | /database.py | UTF-8 | 8,653 | 3.21875 | 3 | [] | no_license | import os
import math
import pickle, json
import hashlib
import numpy as np
from charhandling import *
DB_PATH = "db.pickle"
# Database contains the following keys:
# "cycle":
# Integer representing how many times the generate feature has been used.
# "chars":
# Dict of CJK characters mapped to a tuple (as a lis... | true |
d68b057dc1cb999a53cea8f6594d6dfa80cb2357 | voicihojun/leetCode | /algo/romanToInt.py | UTF-8 | 2,756 | 4.4375 | 4 | [] | no_license | # 13.Roman to Integer
# Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
# Symbol Value
# I 1
# V 5
# X 10
# L 50
# C 100
# D 500
# M 1000
# For example, two is written as II in Roman numeral, j... | true |
da6c118849abf3a80b152d8c98b04bd7a720287d | zhulf0804/Coding.Python | /codeforces/1065C_Make_It_Equal.py | UTF-8 | 518 | 2.734375 | 3 | [] | no_license | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
mmin, mmax = h[0], h[0]
d = [0]*200001
for i in range(n):
cur= h[i]
d[cur] += 1
if h[i] < mmin:
mmin = h[i]
if h[i] > mmax:
mmax = h[i]
if n == 1 or mmax == mmin:
print(0)
else:
ans = 0
i = 200000
... | true |
4cb0bc61d4c31b2c2a609138a5f2495eebb8abdd | Domsdev/Library_Managment_Interface | /interface/gui_login_page.py | UTF-8 | 3,736 | 2.6875 | 3 | [
"MIT"
] | permissive | from tkinter import *
from tkinter import messagebox
from gui_frame_page import *
from gui_normalised_widgets import *
from gui_user_page import *
from gui_librarian_page import *
from gui_administrator_page import *
from connect_db import *
###########################################################################... | true |
f3424b78f09215ba9f6bac73652025af4512fba0 | PeterZhouSZ/feasible-form-parameter-design | /relational_lsplines/helper.py | UTF-8 | 1,915 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 22:37:42 2017
@author: luke
http://chatterbot.readthedocs.io/en/latest/training.html
You can also specify file paths to corpus files or directories of corpus files when calling the train method.
chatterbot.train(
"./data/greetings_corpus/... | true |
47dd334a43c3ea8ffa0ce173d353a5c70c85bfa7 | wook1990/insomnia | /02. STUDY/[2020]/07.AI_CHAMPIONSHIP/00.make_dataset.py | UTF-8 | 2,526 | 3 | 3 | [] | no_license | import pandas as pd
PATH = "C:/Users/wook1/Documents/WAI/2020/02.K스타트업_빅데이터경진대회/개발/"
#################################################
'''
TEST 데이터 생성
validation 데이터의 끝의 일주일을 검증 데이터로 활용
validation max ord_dt 20200915
일별 업체별 어뷰징 케이스 상관없이 어뷰징 여부 판단
그룹핑 : shop_no, ord_dt, max(abuse_yn)
기간 : 2020-09-09 ~ 2020-09-15
... | true |
16ffa97087cd0d97da2b8fb7880cb28cec1bbadd | macisamuele/git-worker | /src/worker.py | UTF-8 | 5,975 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import logging
import subprocess
from abc import ABCMeta
from abc import abstractmethod
from sys import stderr
import return_codes
from autologging import TRACE
from autologging import traced
from configuration import Configuration
from git_commands import GitCommand
logging.basicConfig(level=... | true |
e0caaddbcaf2eb2a6605707bb096d13a05262b84 | Entropy-xcy/GitDrop | /main.py | UTF-8 | 1,973 | 3.1875 | 3 | [] | no_license | import tarfile
import os
def handle_file(path):
tar_path(path)
split_file(path + '.tar', path + '.tar', 2097152)
def tar_path(path):
tar = tarfile.open('./buffer/' + path + '.tar', 'w:gz')
for root, dir, files in os.walk(path):
for file in files:
fullpath = os.path.join(root, fil... | true |
7282ee442e5a0b35b4a6be7add197613dba2cff8 | mtebenev/intprep | /pyprep/shortest_way_to_form_string_test.py | UTF-8 | 4,120 | 3.640625 | 4 | [] | no_license | # https://leetcode.com/problems/shortest-way-to-form-string/
# Tags: medium, greedy, array, dynamic programming
# TODO: this is M*N solution. Optimize.
from typing import DefaultDict, List
from collections import defaultdict
import math
from bisect import bisect_right, bisect_left
class Solution:
def ... | true |
a137c9680b89c2d0e37c3cc0752bc9949a331e58 | hellotunmbi/sendgrid-oai | /test/test.py | UTF-8 | 560 | 2.671875 | 3 | [
"MIT"
] | permissive | import unittest
import datetime
class TestLicenseYear(unittest.TestCase):
def setUp(self):
self.license_file = 'LICENSE.txt'
def test_license_year(self):
copyright_line = ''
with open(self.license_file, 'r') as f:
for line in f:
if line.startswith('Copyrigh... | true |
ac8b2ac6fcfffb834fc87e0f9c9e3ba44ddc9f71 | LeoKuhorev/data-structures-and-algorithms | /challenges/get_edges/test_get_edges.py | UTF-8 | 2,036 | 3.15625 | 3 | [] | no_license | import pytest
from data_structures.graph.graph import Graph
from challenges.get_edges.get_edges import get_edges
class TestGetEdges:
def test_proof_of_life(self):
assert Graph
assert get_edges
@pytest.fixture()
def graph(self):
graph = Graph()
# Create nodes
vert... | true |
d3ab95094e111bb332827c17ca2234c6105b401a | PARKJUHONG123/turbo-doodle | /BOJ/remote.py | UTF-8 | 646 | 2.578125 | 3 | [] | no_license | import sys
N = sys.stdin.readline()[:-1]
N_list = []
for i in range(len(N)):
N_list.append(int(N[i]))
N = int(N)
nature = abs(N - 100)
length = len(N_list)
M = int(sys.stdin.readline())
WB = list(map(int, sys.stdin.readline().split()))
B = []
for i in range(10):
if i not in WB:
B.append(str(i)) # 2... | true |
324c7ee0a99cc12a5574be725e7eadf1b164e8a7 | warpgate3/CondingDJ-Python | /128.py | UTF-8 | 588 | 3.875 | 4 | [] | no_license | '''
자기 자신을 제외한 모든 양의 약수들의 합이 자기 자신이 되는 자연수를 완전수라고 한다. 예를 들면,
6과 28은 완전수이다. 6=1+2+3 // 1,2,3은 각각 6의 약수
28=1+2+4+7+14 // 1,2,4,7,14는 각각 28의 약수
입력으로 자연수 N을 받고, 출력으로 N 이하의 모든 완전수를 출력하는 코드를 작성하라.
'''
r = 3000
def chk(input):
self = 0
for n in range(1, input):
if input % n == 0:
self += n
r... | true |
71f9116b02eb2762d6021c5a2c166f4136a0015e | kvyuan/NBAMatchPredictor | /statsScraper.py | UTF-8 | 1,646 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Main File: NBAMatchPredictor.py
This File: StatsScraper.py
Purpose: Retrive data from configured url and pre-process with beautifulsoup
@author: Hao Yuan
"""
import pandas as pd
import bs4 as bs
import urllib3
import certifi
import math
def getSoup(url):
http = urllib3.PoolManager(cert... | true |
f1a1d368ceffed5d0a7d82ea950f54705e362d56 | l2radamanthys/MailSearch | /db_export.py | UTF-8 | 2,334 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
exporta los mails a una DB en SQLite
"""
import sqlite3 as dbapi
import os
def crear_bd():
print "creando BD"
conecion = dbapi.connect("mails.db")
cursor = conecion.cursor()
#ejecutamos un instrucion sql en este caso creamos una tabla
cursor.... | true |
73a5d36e9e0b5b8ebceaadfefc7c61156dd1ad8d | prateekchhikara/UAV_AQI_LSTM | /test.py | UTF-8 | 401 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from keras.models import load_model
class Testing:
def __init__(self):
self.best_model = '/model_weights/model-046-0.008206-0.006697.h5'
def test(self, X_test, ytest):
model = load_model(self.best_model)
model.evaluate(X_test)
if __name__ == "__main__":
obj =... | true |
88bf76162358a0e13e35c560cb3b777ba439e580 | helldog136/WaDaGame-backend | /main.py | UTF-8 | 2,143 | 2.625 | 3 | [] | no_license | import time
from flask import Flask, request, Response
import database
import analyser
import os
import opencv as ocv
if __name__ == "__main__":
app = Flask(__name__)
db = database.Database()
@app.route('/<appId>', methods=['POST'])
def addImage(appId):
if request.headers['Content-Type'] ==... | true |
1463bb4561a428cd788a3e9b7c7a004c03d2d7fc | Sumetjutha/002_Machine_Learning_Python | /17_K_Nearest_Neighbor.py | UTF-8 | 764 | 3.140625 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('/Users/Admin/Documents/Python/machine_learning/people_wealth.csv')
df.head()
# Checked Data Balancing
df['Group'].value_counts()
import matplotlib.pyplot as plt
Xx = df['Income']
Xy = df['Age']
y = df['Group']
plt.scatter(Xx, Xy, c=y)
plt.show()
# Normalization
fr... | true |
ef1e0ede73b34dfd631eccecab3b819d0134439e | abulusu-del/pySuStaIn | /plotting/plotting.py | UTF-8 | 5,980 | 2.6875 | 3 | [
"MIT"
] | permissive | # Authors: Nicholas C. Firth <ncfirth87@gmail.com>
# License: TBC
import numpy as np
from matplotlib import pyplot as plt
from mixture_model import ParametricMM
colors = ['C{}'.format(x) for x in range(10)]
def greedy_ascent_trace(greedy_dict):
fig, ax = plt.subplots()
for key, value in greedy_dict.items():
... | true |
5b34b79c038ab8c4ed1e892fda30fc28c4932d8f | akhilanil/roster | /roster-backend/roster_project/auth_api/models/user_models/password_reset_manager.py | UTF-8 | 2,475 | 2.609375 | 3 | [
"MIT"
] | permissive | from django.db import models
import datetime
import pytz
from django.core.exceptions import ObjectDoesNotExist
class PasswordResetManager(models.Manager):
"""
Manager class for Password Reset
"""
def is_record_expired(self, token):
created_date = super().get_queryset().get(token=token).cr... | true |
171993e15a58eece7e34a082071259e458ec4396 | alifa-ara-heya/My-Journey-With-Python | /day_13/exercise3.py | UTF-8 | 796 | 3.96875 | 4 | [] | no_license | # Day_13: August/09/2020
# In the name 0f Allah..
# Me: Alifa
# From: Book : Python for everybody
# chapter: 3
# Conditional operator: Exercises
# Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a gr... | true |
828a71f6ba6b64f83c54f86b1cfe2d14cc801b29 | Neverous/ii-python11 | /Projekt/data/trap.py | UTF-8 | 4,065 | 2.828125 | 3 | [] | no_license | # -*- encoding: utf8 -*-
# Maciej Szeptuch 2012
import random
import pygame
import engine
import field
from map import MAP_SIZE
from fire import Fire
from iceblast import Iceblast
class Trap(field.Field):
"""Logika pułapki."""
def __init__(self, _grid):
super(Trap, self).__init__(_grid)
def launch(self, creatu... | true |
0ce4be5f641fdf637a22d3c397450df90f18ec8d | simpleweiwei/Python.NetworkProgramming | /Socket/ConvertIP4Address.py | UTF-8 | 685 | 3.328125 | 3 | [] | no_license | import socket
from binascii import hexlify
# 通过socket将ipv4转换为其他格式
# 调用hexlify()是为了将二进制数据转换为十六进制
def convert_ip4_address():
ip_list = ["127.0.0.1", "192.168.0.1"]
for ip in ip_list:
packed_ip = socket.inet_aton(ip)
unpacked_ip = socket.inet_ntoa(packed_ip)
print(type(packed_ip))
... | true |
ef7703f5dcbba2b77131f906ae7ea11b8911c9c0 | gkdlepdj/PhotoLog | /main.py | UTF-8 | 1,029 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tr
import sys
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
from flask import Flask
# create our little application :)
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def index():
text="""
영어->한글 변환 https://ickyoung-pho... | true |
f03087e3b9e7b31f8b57944c3a11a6419c875266 | LokkoLori/arokwall | /gamepadcode.py | UTF-8 | 5,769 | 2.5625 | 3 | [] | no_license |
import threading
import struct
import time
class GamePadBase(object):
def dprint(self, s):
if self.printing:
print(s)
def v_up(self):
self.dprint("v up")
self.status["v_dir"] = 0
def h_up(self):
self.dprint("h up")
self.status["h_dir"] = 0
def X_... | true |
809a50da4483c660080c772b5aa352941d23a26b | yamabook37/atcoder | /ABC_problems/abc249_b.py | UTF-8 | 485 | 3.484375 | 3 | [] | no_license | def has_duplicates(seq):
return not(len(seq) != len(set(seq)))
# ユニークならfalse
S = list(input())
#L=["a","b","c","A","B"]
#print(has_duplicates(L))
num = len(S)
#print(S[0], num)
small = False
big = False
for i in range(0,num):
if S[i].islower():
small = True
#print(S[i], "low")
if S[i]... | true |
fd26ea672d5e5843c91f23f153cd09c20334fcaa | betty29/code-1 | /recipes/Python/579027_Publish_SQLite_datPDF_using_named/recipe-579027.py | UTF-8 | 2,771 | 3.59375 | 4 | [
"BSD-2-Clause",
"MIT"
] | permissive | # SQLiteToPDFWithNamedTuples.py
# Author: Vasudev Ram - http://www.dancingbison.com
# SQLiteToPDFWithNamedTuples.py is a program to demonstrate how to read
# SQLite database data and convert it to PDF. It uses the Python
# data structure called namedtuple from the collections module of
# the Python standard library.
... | true |
161d5a8c6d5514ac1799fcfd6d3352dcd81d2a18 | digdendes/wfoijiofe | /survey_utils.py | UTF-8 | 3,887 | 2.8125 | 3 | [] | no_license | import bpy
import bmesh
import time
from mathutils import Vector, Matrix
def silouette_brute_force(context, ob, view, world = True, smooth = True, debug = False):
'''
args:
ob - mesh object
view - Mathutils Vector
return:
new mesh of type Mesh (not BMesh)
'''
if debug:
... | true |
0ae2ccb4d4c8fe319f998d797755d7b0cd34b52b | ChildishhAlbino/Winter | /winter.py | UTF-8 | 3,379 | 3.171875 | 3 | [] | no_license | import pyperclip
import random
import json
from re import compile
words = []
winterKeyRegex = "^([A-Za-z]{1}|[#]+|[\?]+)(\s{1}([A-Za-z]{1}|[#]+|[\?]+))*$"
filteredCache = {}
def generateLetterWildcard(winterKeyItem):
generated = getRandonWord(length=len(winterKeyItem))
return generated
def generateNumericWi... | true |
aeaa811e887f9e778a3544cd690953d4c8144911 | yaesolKim/tuza_diary | /app/library/trading_indicators.py | UTF-8 | 1,326 | 2.8125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | from datetime import datetime
import FinanceDataReader as fdr
import numpy as np
def bollinger_band(price_df, n=20, k=2):
bb = price_df.copy()
bb['mbb'] = price_df['close'].rolling(n).mean() # 중앙 이동 평균선
bb['ubb'] = bb['mbb'] + k * price_df['close'].rolling(n).std() # 상단 밴드
bb['lbb'] = bb['mbb'] - k ... | true |
bf0611dc1c62648cd477710575fd46ceb4a72b5c | dapianzi/leetcode | /101-200/N-120/answer.py | UTF-8 | 485 | 3.453125 | 3 | [] | no_license | from typing import List
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
n = len(triangle)
if n == 0:
return 0
dp = triangle[n-1]
for i in range(n-1, 0, -1):
for j in range(i):
dp[j] = triangle[i-1][j] + min(dp[j], dp[... | true |
c9a1b0844d1af29c761f4326c0384dacf44f63d4 | knightwalkha/atm | /atm.py | UTF-8 | 2,936 | 3.515625 | 4 | [] | no_license | import datetime
import random
userData = {}
now = datetime.datetime.now()
#STARTUP MESSAGE
def startup():
print('Welcome to Bank Knightwalkha')
prompt = int(input("Do you have account with us: 1 (yes) 2 (no) \n"))
if(prompt == 1):
login()
elif(prompt == 2):
register()
else:
... | true |
aeae5102ce2af2d0973003e8260bccb60a010821 | ChristophMetzner/neurolib | /neurolib/models/subdivwc/loadDefaultParams.py | UTF-8 | 4,576 | 2.71875 | 3 | [
"MIT"
] | permissive | import numpy as np
from ...utils.collections import dotdict
def loadDefaultParams(Cmat=None, Dmat=None, seed=None):
"""Load default parameters for the subtractive-divisive Wilson-Cowan model
:param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not... | true |
153e8f1602c03bedc693f8a42ede673a14ff9f41 | JasoSalgado/algorithms-with-python | /chapter-four/recursive_insertion_sort.py | UTF-8 | 269 | 3.515625 | 4 | [] | no_license | """
Recursive insertion sort
"""
def recursive_insertion_sort(seq, i):
if i == 0: return
recursive_insertion_sort(seq, i-1)
j = i
while j > 0 and seq[j-1] > seq[j]:
seq[j-1], seq[j], seq[j-1]
j -= 1
recursive_insertion_sort(3, 3)
| true |
648ca15941573969e0f2ca20882ced394775c712 | waws520waws/waws_spider | /selenium_test/selenium_test_20.py | UTF-8 | 652 | 2.78125 | 3 | [
"MIT"
] | permissive | # encoding:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
import time
"""
下拉菜单的实践
Select(sel).select_by_index(2)
"""
driver = webdriver.Chrome(r"C:\Users\19663\Desktop\chromedriver.exe")
driver.get("https://www... | true |
5eda11c6718968fcabf2c3f7b53c6ac68f6cf346 | anemashkalo/CellTracker | /LiveCellAnalysis_fromIdse/stemcells-master/fluidic_system_code/fluidmasterClean.py | UTF-8 | 3,843 | 3.234375 | 3 | [] | no_license | """
Name: fluidMasterClean
collects cleaned up version of code used in experiments
"""
# for python2 compatibility
from __future__ import print_function
## We need these modules
import time
import datetime
import drive
## Set up the serial connection
drive.setup("/dev/cu.usbmodem1411",9600) # (port numbe... | true |
24993e35410c32f7cd7a1f81fe8a17a6fa3ae658 | 2003sl500/counter | /server.py | UTF-8 | 845 | 2.625 | 3 | [] | no_license | from flask import Flask, render_template, redirect, session
app = Flask(__name__)
app.secret_key = "1234567890"
@app.route("/")
def index():
if 'count' in session:
print('key exists')
session['count'] += int(1)
result = session['count']
else:
print("key 'counter' does NOT exist"... | true |
a863576112628bb9de1094aaedf57c9a8f1945b1 | Zai-Lucas/Work | /HangMan.py | UTF-8 | 841 | 3.59375 | 4 | [] | no_license | myWord = "panda"
myList = list("_____")
Miss = ("b""c""e""f""g""h""i""j""k""l""m""n""o""q""r""s""t""u""v""w""x""y""z")
MissList = list("-----------------------")
while True:
choice = input("Type a word: ")
if choice == myWord:
print("That is the correct Word")
print("Congrats, You Win!")
break
el... | true |
9909a3353ec93fcf9fab8e2abe79cd00de5d3fa8 | DJHyun/Algorithm | /BOJ/Python/2447_별찍기-10.py | UTF-8 | 496 | 2.96875 | 3 | [] | no_license | # baekjoon source = "https://www.acmicpc.net/problem/2447"
import sys
N = int(sys.stdin.readline())
result = [[' '] * N for _ in range(N)]
for i in range(N):
for j in range(N):
if i % 3 == 1 and j % 3 == 1:
continue
result[i][j] = '*'
a,b = i,j
while a > 0 and b > 0:
... | true |
3bbf5fc5bdebbc1c74836fea114661b0ce9a4446 | Tech-Helper503/alone-in-space | /aloneinspace/main.py | UTF-8 | 1,029 | 2.703125 | 3 | [] | no_license | from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
window.title = 'My Game'
window.borderless = False
window.fullscreen = False
window.exit_button.visible = False
window.fps_counter.enabled = True
app = Ursi... | true |
8b427c5b7c359d59b4f3ce9be5d1a25fa16df916 | zayan2009/2020-Domain-Adaptation-Volume-Estimation | /Code/feature_engineering.py | UTF-8 | 6,875 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Libs
# In[ ]:
import os
import time
import glob
import json
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold, train_test_split
from sklearn.preprocessing import OneHotEncoder
import lightgb... | true |
1377aa04c8114d5e5ab42200b28566f8aa932514 | alexdabe/WIFI-vehicule-remote-control | /loco_alfa.py | UTF-8 | 2,606 | 3.234375 | 3 | [] | no_license | # Définition d'un client réseau gérant en parallèle l'émission
# et la réception des messages (utilisation de 2 THREADS).
import socket
import sys
import threading
host = "192.168.0.20"
port = 40000
a = ["defaut", "omega", "0", "m", "'"]
loco_id = "alfa"
message_recu = ' '
def marche():
global a
... | true |
892bfdb9788628497a811cdd0e58a2e576113934 | karbekk/Python_Data_Structures | /Interview/Python_Excercises/Oops/Design_Patterns/Structural/Adapter/Adapter.py | UTF-8 | 1,068 | 3.71875 | 4 | [] | no_license | '''
If interface is not compatible between a client and a server, adapter provides a
alternative conversion by providing a alternative interface
so note that here our specific methods have speak method where as
clint just calls the speak method in generaln
'''
class Korean(object):
def __init__(self):
s... | true |
15d577a81501601617569cca7f397b1fca407bda | stckwok/JetsonTx2 | /benchmarking/parboil/measure_power.py | UTF-8 | 7,638 | 2.515625 | 3 | [
"MIT"
] | permissive | """
Module: measure_power.py
This module perform the actual power measurement for the selected bechmark by user
# external power measurement
#sudo ./wattsup ttyUSB0 watts volts amps > spmv_large_30_345600_ext.csv
# internal power measurement (preferred method)
# sudo ./pwr -h
# Reads the power information from the IN... | true |
59f99a8ab235ae1ac5e4af2241652c551824b2df | taesu-park/PycharmProjects | /A형/숨바꼭질.py | UTF-8 | 746 | 3 | 3 | [] | no_license | # import sys
# from collections import deque
#
# N, K = map(int,sys.stdin.readline().split())
#
# def BFS(n):
# Q = deque()
# Q.append(n)
# while Q:
# v = Q.popleft()
#
from collections import deque
N, K = map(int, input().split())
visit = [False] * 100001
Q = deque()
Q.append((N, 0))
visit[N] = Tr... | true |
584a5289d8f6e630d35ec5d1366a6e5d8e4736c8 | AaronJny/leetcode | /1-50/50.py | UTF-8 | 400 | 2.953125 | 3 | [] | no_license | class Solution:
def myPow(self, x: float, n: int) -> float:
if n == 0:
return 1.0
if x == 0:
return x
res = 1.0
flag = 1 if n > 0 else -1
n = abs(n)
while n > 0:
if n & 1:
res *= x
x = x * x
n... | true |
50d3d7503f2d5c79947bc8364b48f8192c1c17f8 | mdurrer/cgd | /pypython/PyMan/PyMan.py | UTF-8 | 6,799 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python
import os, sys
import pygame
import level001
import basicSprite
from pygame.locals import *
from helpers import *
from snakeSprite import *
from basicMonster import Monster
if not pygame.font: print 'Warning, fonts disabled'
if not pygame.mixer: print 'Warning, sound disabled'
BLOCK_SIZE = 24
... | true |
22ae7e3c08127bb9dade8c419ad26ad80d6dce58 | 323117/Mission-Planning-using-ga | /plot_errorbars.py | UTF-8 | 777 | 3.125 | 3 | [] | no_license | # script that reads results file and plot error bars
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
fields = ['Approach', 'Mean', 'Std']
df = pd.read_csv("compare.csv", skipinitialspace=True, usecols=fields)
experiments = df.Approach
x_pos = np.arange(len(experiments))
means = df.Mean
sds = df... | true |
affc2154dcb19cdb413885b52e806ad5fa018c04 | rishabmehrotra/learn_python | /Input/ex12.py | UTF-8 | 192 | 3.71875 | 4 | [] | no_license | age = input("How are you? ")
height = input("How tall are you? ")
weight = input("What is your weight ")
print(f'Ok you are {age} years old and height is {height} and your weight is {weight}') | true |
fd56af1c1b392011254d89351aaa74750d51e0f8 | pawarm/rasptetris | /menu.py | UTF-8 | 2,577 | 2.6875 | 3 | [] | no_license | from tetris import Tetris
import keyboard
import os
import time
import threading
from segment_display import LED_Module
from MAX7219 import MAX7219
from config import text_display
class Menu():
def __init__(self):
self.game = Tetris()
self.led_display = LED_Module()
self.led = MAX7219()
self.to_show_led = ... | true |
6becce7c6f6a1139ce7bae42c35f38ac50a63301 | CurryMentos/algorithm | /exercise/数学题/2.7.py | UTF-8 | 410 | 3.3125 | 3 | [] | no_license | # !/usr/bin/env python
# -*-coding:utf-8 -*-
"""
# File : 2.7.py
# Time :2021/7/16 10:22
# Author :zyz
# version :python 3.7
"""
"""
计算公式 13 + 23 + 33 + 43 + …….+ n3
实现要求:
输入 : n = 5
输出 : 165
对应的公式 : 13 + 23 + 33 + 43 + 53 = 225
"""
def fun():
n = 5
sum = 0
for i in range(1, n + 1):
... | true |
bd4655296102c331758aca9018c359cdfc28e2f9 | DavidFruehbuss/notes | /homework4/homework4_solutions.py | UTF-8 | 1,313 | 3.546875 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
'''
# code used to generate the data:
t = np.arange(0, 100, 0.1)
x = np.random.normal(loc=5, scale=0.5, size=1000)
y = np.random.normal(loc=3, scale=0.25, size=1000)
np.savez('homework4.npz', t=t, x=x, y=y)
'''
# homework4 solution:
def absdiff(a, b):
"""Return ... | true |