blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
71132011a1040d91c4a6b2a78ccbd8c6caf989bb | Python | rohanghosh7/Hackerrank_Python_Solution | /Alphabet Rangoli.py | UTF-8 | 826 | 2.921875 | 3 | [] | no_license | def print_rangoli(s):
wid = 4*s - 3
for i in range(1,s+1):
for j in range(1, wid+1):
flag = 0
for k in range(1,s+1):
if (j<=2*s-1 and j is 2*s-2*i+2*k-1) or (j>2*s-1 and j is 2*s+2*i-2*k-1):
print(chr(97+s-k),end='')
flag = ... | true |
0486d17c2555fe3a7756066811bdc4f1b92cb623 | Python | alsignoriello/geometry | /data/3Dmesh/generate_poly.py | UTF-8 | 2,775 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import sys
import numpy as np
from numpy.random import seed
from numpy import pi, sin , cos
from scipy.spatial import Delaunay
import operator
# random seed
seed(1292405)
# number of vertices
# Nv = int(sys.argv[1])
N = 10
# radius of polygon
r = float(sys.argv[1])
# allocate vertices
coords = []... | true |
f9564a68b2731fa04be686856a3a3fe49e0798e1 | Python | amantaya/Image-Processing-Python | /image-processing/04-drawing-bitwise/DrawPractice.py | UTF-8 | 548 | 2.9375 | 3 | [] | no_license | """
* Program to practice with skimage drawing methods.
"""
import random
import numpy as np
import skimage
from skimage.viewer import ImageViewer
# create the black canvas
image = np.zeros(shape=(600, 800, 3), dtype="uint8")
viewer = ImageViewer(image)
viewer.show()
# mask = np.ones(shape=image.shape[0:2], dtype="b... | true |
cea636a57e8c66a4c68dbe7e113a929539e24c3e | Python | javierlopeza/IIC2233-2015-2 | /Tareas/T07/MainWindow.py | UTF-8 | 22,848 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from PyQt4 import QtGui, uic
import dropbox
import dropbox.files
import threading
import os
import time
ventana = uic.loadUiType("main.ui")
class MainWindow(ventana[0], ventana[1]):
def __init__(self, dbx):
super().__init__()
self.setupUi(self)
self.dbx = dbx
... | true |
2f24a9f7016a19ab44f81e29ec2fa2c7293d9204 | Python | Asara/bangbot3 | /bangbot/plugins/cc.py | UTF-8 | 3,259 | 2.59375 | 3 | [
"WTFPL"
] | permissive | # -*- coding: utf-8 -*-
from irc3.plugins.command import command
import irc3
import json
import os
import requests
ccfolder = 'extra/ccfolder/'
if not os.path.exists(ccfolder):
os.makedirs(ccfolder)
@irc3.plugin
class Plugin(object):
def __init__(self, bot):
self.bot = bot
@command(permission=Non... | true |
c91275bd35d62df78618f105ff7c7d27e02a1801 | Python | styinx/ACBIB | /ACBIB.py | UTF-8 | 6,518 | 2.640625 | 3 | [] | no_license | # Assetto Corsa Basic Information Board (ACBIB)
import ac
import math
try:
import app.acbib as acbib
import app.gui as gui
except:
ac.console("error importing gui")
# global settings
APP_WIDTH = 600
APP_HEIGHT = 170
invalid_lap = False
ratio = 1
font_huge = 70
font_big = 40
font_medium = 20
font_small =... | true |
714c28ac76b6d2c8885b8aad7177a9c5fcae19ea | Python | Papiertieger23/HypixelIO | /hypixelio/models/recent_games/recent_game_info.py | UTF-8 | 779 | 2.828125 | 3 | [
"MIT"
] | permissive | from hypixelio.utils.time import unix_time_to_datetime
class RecentGameInfo:
def __init__(self, game: dict) -> None:
"""
Parameters
----------
game: dict
The game's JSON data received from the Hypixel API.
"""
self.DATE = unix_time_to_datetime(game["date... | true |
ac80e6eabaa5a3db1805ce698497f46f1ed2908b | Python | lwillmeth/AnalysisofAlgorithms | /Implementation2/seqAlign.py | UTF-8 | 4,828 | 2.90625 | 3 | [] | no_license | <<<<<<< HEAD
import sys, re, time
=======
#!/usr/bin/python
'''
CS 325 - Implementation 2
Sequence alignment via dynamic programming
Kyle Prouty, Levi Willmeth, Andrew Morrill
Winter 2017
'''
import sys, re
>>>>>>> 0404bc8bdd747e9a9d205a4781cff61271b9bce3
DEBUGGING = False
costFile = 'imp2cost.txt'
seqFile = '... | true |
083882968c34470366c400d8f118a6c21a8810ac | Python | Mastah95/IOIOIO | /tests.py | UTF-8 | 2,514 | 3.296875 | 3 | [
"MIT"
] | permissive | import unittest
from itertools import product
import numpy as np
from main import get_neighbours, get_next_move
class TestGetNeighbours(unittest.TestCase):
def test_finds_neighbourhood(self):
matrix_shape = (10, 20)
position = (5, 7)
ys = (-1, 0, 1)
xs = (-1, 0, 1)
offse... | true |
43b5ca76c86d6c805b253a8e6ff8799a5ac80c8a | Python | DmitriChe/pydev_hw5 | /file_manager.py | UTF-8 | 5,480 | 3.171875 | 3 | [] | no_license | import os
import sys
import shutil
import json
from account import account
from victorina import victorina
def make_directory(folder_name):
if not os.path.exists(folder_name):
os.mkdir(folder_name)
return 'Папка успешно создана'
else:
return 'Папка с таким именем уже существует - при... | true |
108ae3585a1d247f1f13b955c20b302c0bfae751 | Python | shikixyx/AtCoder | /Enterprise/HHKB/2020/2020_C.py | UTF-8 | 383 | 2.875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(input())
P = list(map(int, input().split()))
NUM_LIST = [False] * 200100
ANS = []
idx = 0
for p in P:
NUM_LIST[p] = True
while NUM_LIST[idx]:
i... | true |
75a222c9a7ae088f568e4ab061e9bf180818d850 | Python | mmr12/DeepBlueSea | /models/baseline_model.py | UTF-8 | 2,936 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from base.base_model import BaseModel
import tensorflow as tf
from models.utils_model import *
class BaselineModel(BaseModel):
def __init__(self, config):
super(BaselineModel, self).__init__(config)
self.build_model()
self.init_saver()
def build_model(self):
self.is_training =... | true |
62efcb7778366aee68a870bcf2e69e47e60ecd65 | Python | KunHCS/flaskbank | /flaskbank/backend/model.py | UTF-8 | 1,784 | 2.671875 | 3 | [] | no_license | """
Database initialization
"""
from . import mongo
import pymongo
import random
import luhn
from functools import wraps
jti_blacklist = set()
clients = mongo.db.clients
clients.create_index([('username', pymongo.ASCENDING)], unique=True)
clients.create_index([('accounts.account_number', pymongo.ASCENDING)],
... | true |
34ed287f6298bf26914143ace069d489026c96d4 | Python | InevitableShot/JSP2020 | /lista7/zad3.py | UTF-8 | 755 | 3.8125 | 4 | [] | no_license | import time
from random import randint
t1 = [randint(0, 20) for i in range(0, 100)]
t2 = [randint(0, 20) for i in range(0, 200)]
t3 = [randint(0, 20) for i in range(0, 300)]
def bubble_sort(tab):
n = len(tab)
while n > 1:
for i in range(0, n-1):
if tab[i] > tab[i+1]:
tab[i]... | true |
1388b2361f9d0e2cafd2b7ac5f96c6f1807e213b | Python | nikhilranjan7/open-cv | /video_loading.py | UTF-8 | 507 | 2.515625 | 3 | [] | no_license | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc('m','p','4','v')
out = cv2.VideoWriter('output.m4v', fourcc, 20.0, (640,480))
while True:
ret, frame = cap.read()
frame = cv2.resize(frame, (640,480))
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
... | true |
b0b798837b1e86e672d97e563006ca9ce9533b1d | Python | cam-hart/Thermal-Resistance-of-a-heatsink | /heatsink_thermal_resistance.py | UTF-8 | 4,272 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 15:19:54 2021
@author: camer
"""
import pandas as pd
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
"""
num_fins=N(10,12,14,16,18)
base_thickness=x(10mm)
base_width=w (46.9mm)
gap_thickness=b
fin_thic... | true |
284a3b0b50776c6c309870352a681114f6382025 | Python | kekeFu/Python2020 | /test_2_file/file_advance_2.py | UTF-8 | 1,530 | 3.421875 | 3 | [] | no_license | """
文件或文件夹操作:
1.rename(), 重命名
2.remove(), 删除
文件夹操作:
1.mkdir(),创建文件夹
2.rmdir(),删除文件夹
3.getcwd(),获取当前文件夹路径
4.chdir(目录),改变默认目录, 并定位到指定目录
4.listdir(目录),获取目录列表
总结:批量处理文件命名容易出错,最好不要缺省参数
"""
import os
# os.rename('test1.txt', 't.txt')
# os.remove('test2.txt')
# os.mkdir('a')
# os.rmdir('a')
# pr... | true |
a5505ea2a9af2b80bea582064568a27ed41c11a2 | Python | adrianmikol/2020-11-21-python | /funkcje/zadanie3.py | UTF-8 | 964 | 3.90625 | 4 | [] | no_license | """
Napisać funkcję obliczającą całkowity wstępu grupy osób do kina, wg zasady:
jeden bilet kosztuje 20
przy zakupie co najmniej 10 biletów bilet kosztuje 13
Przy co najmniej 150 osobach koszt jest stały i wynosi 1600.00 za całość.
"""
def koszt_biletow_grupy(liczba_osob, cennik):
return ( cennik['cena_sali'] if ... | true |
3a3cc0e3ad636c0e20f3844b2e8b4ee4ef37ab55 | Python | saileshnankani/QHacks2019 | /Models.py | UTF-8 | 5,200 | 3.3125 | 3 | [] | no_license | import collections
from Events import Event
from _datetime import datetime
EPSILON = 0.005
class Calendar:
def __init__(self):
self.week1 = Week()
self.week2 = Week()
self.week3 = Week()
self.week4 = Week()
self.week5 = Week()
class Week:
def __init_(self):
... | true |
527cf37406555f96733ce06c78131c09831d87f2 | Python | daniyaniazi/OpenCV | /8.Basic_image_operations.py | UTF-8 | 743 | 3 | 3 | [] | no_license | import cv2
img= cv2.imread("images/FACE.jpeg")
print(img.shape)#tuple od no of rows ,cols,channels
print(img.size)#return total no of pixels is accessed
print(img.dtype)#return image datatype
b,g,r=cv2.split(img)
img= cv2.merge((b,g,r))
cv2.imshow("image",img)
# Resizing an image
imgResized=cv2.resize(img,(300,200))
... | true |
2b4ff4889f1031edf20440e85fb72454ab0fcdbb | Python | tokaevaAA/msu_python_spring2021 | /dz/dz3Contest/dz2_F.py | UTF-8 | 480 | 3.671875 | 4 | [] | no_license | def expand_seq(n, openb, closeb, s):
if (openb + closeb < 2 * n):
if openb < n:
Str = s + "("
yield from expand_seq(n, openb + 1, closeb, Str)
if closeb < openb:
Str = s + ")"
yield from expand_seq(n, openb, closeb + 1, Str)
else:
yield s
... | true |
9b7e50f7c72cb17a609f8b5a1399a28de4806265 | Python | pyrusx/learningpython | /dictionarypractice.py | UTF-8 | 306 | 3.21875 | 3 | [] | no_license |
def dicttest():
mydict = {}
mydict['hi'] = 2
mydict['bye'] = 50
'''
mydict hi -> 2
'''
mydict['hi'] = mydict['hi'] + 1
print(mydict)
'''
mydict {
"a" : 3
"b" : 1
}
JavaScript Object Notation
abaaaaaaa
'''
| true |
f40b9cbd28afd5428232fdef810dd402320c9400 | Python | sideroff/python-exercises | /01_basic/exercise_020.py | UTF-8 | 119 | 3.5 | 4 | [
"MIT"
] | permissive | def copies_of_string(string, number_of_copies):
return string * number_of_copies
print(copies_of_string("asd", 6)) | true |
a87b4d7a5656151f0ffb634c56eddd54ec642f5d | Python | kelvin-lu/ballet_ames_sim_lower_threshold | /ballet_ames_sim_lower_threshold/features/contrib/user_06/feature_37.py | UTF-8 | 262 | 2.625 | 3 | [] | no_license | from ballet import Feature
import ballet.eng
def calc_age(ser):
return 2018 - ser
input = "Yr Sold"
transformer = ballet.eng.SimpleFunctionTransformer(calc_age)
name = "Years since sold"
feature = Feature(input=input, transformer=transformer, name=name)
| true |
c93dc563ea1949b6da100813fc21b5da41154c7b | Python | kth496/Algorithm-study | /leetcode/BinaryTreeLevelOrderTraversal2.py | UTF-8 | 514 | 2.9375 | 3 | [] | no_license | class Solution:
def levelOrderBottom(self, root: TreeNode) -> List[List[int]]:
ret = []
q = deque()
q.append((root, 1))
if not root: return ret
while q:
cur, depth = q.popleft()
if not cur: continue
if len(ret) < depth:
lev... | true |
204d8bef02e93c3d3a9902dddfe76d68c570ec8b | Python | tpltnt/tektronix222 | /tests/features/steps.py | UTF-8 | 1,793 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | from lettuce import *
import sys
sys.path.append('../../tektronix222/')
from tek222 import Tek222
@step(u'Given there is a working serial port')
def given_there_is_no_file_named(step):
assert True, 'yay!'
@step(u'When the object is initialized')
def when_the_object_is_initialized(step):
world.scope = Tek222('/dev/t... | true |
fd6a9d8dc73897844d03068ed21e0b87194aa7a1 | Python | yhshin0/python_ruby | /06. Input_Output/python2.py | UTF-8 | 344 | 3.703125 | 4 | [] | no_license | in_str = input("아이디를 입력해주세요.\n")
# input()을 통해 들어오는 값의 형태는 str이므로 11과 일치하지 않음. 대신 "11"을 사용해야 함.
real_egoing = "11"
real_k8805 = "ab"
if real_egoing == in_str:
print("Hello!, egoing")
elif real_k8805 == in_str:
print("Hello!, k8805")
else:
print("Who are you?")
| true |
6ae5a2db7e973957213a2c9b89ca49dfa3633287 | Python | laomu/py_1709 | /1.Django_cursor/days05_总结/mysite/mytemp/views.py | UTF-8 | 995 | 2.59375 | 3 | [] | no_license | from django.shortcuts import render
from . import models
# Create your views here.
def index(request):
# 1. 传递第一种数据:简单的变量赋值
message = "欢迎访问本系统"
# 2. 传递
user = models.User(id=1, name="jerry")
# 3. 传递一个列表
msg_list = ["雪琪", "瓶儿", "小环"]
# 4. 传递一个字典
msg_dict = {"name": "拓跋晔", "age": 120}... | true |
a548148bcff0a64c5f3cb93cffd3ba2a3232e25e | Python | ClaudeHuang/GitLearn | /python/mymodule_demo.py | UTF-8 | 145 | 2.546875 | 3 | [] | no_license | import mymodule
# 导入自制模块
mymodule.say_hi()
# 用.来访问模块中的成员(数据)
print('version', mymodule.__version__) | true |
fb2941c67ad9c917b8baf4acf5358f745d466916 | Python | rishirajsinghjhelumi/Coding-Templates | /SPOJ/7683.py | UTF-8 | 92 | 3.203125 | 3 | [] | no_license | t=input()
while t:
t-=1
x=raw_input().split()
print pow(int(x[0]),int(x[1],3),int(x[2]))
| true |
6c402152f987a8ed44d7a665cf9c39a20609782c | Python | Python-study-f/Algorithm-study_1H | /Algorithm_2021/April_2021/210425/1915_Largest_Square/1915_210422_ohzz.py | UTF-8 | 488 | 3.015625 | 3 | [] | no_license | # 가장 큰 정사각형 1915
n, m = map(int, input().split())
board = [list(map(int, list(input()))) for _ in range(n)]
dp = [[0] * m for _ in range(n)]
maxValue = 0
for i in range(n):
for j in range(m):
if board[i][j] == 1:
tmp = min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1])
dp[i][j] = ... | true |
25001ffe10b19ee5aefd67a95f730973b0461eca | Python | Mropat/Project-MTLS | /all_scripts/python/Sequence/BLOSUM/confusion_seq.py | UTF-8 | 4,117 | 2.5625 | 3 | [] | no_license | import pickle
import numpy as np
from sklearn.model_selection import cross_validate
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import cross_val_predict
from sklearn.metrics import recall_score
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_m... | true |
68d2738f3217743851219bbf79edc759299811c6 | Python | Dhivya-Ra/star | /sectwenty.py | UTF-8 | 215 | 3.1875 | 3 | [] | no_license | s=input("")
for i in s:
if ord(i)>=120 or ord(i)==121 or ord(i)==122:
b=chr(96+3-(122-ord(i)))
elif ord(i)==88 or ord(i)==89 or ord(i)==90:
b=chr(64+3-(90-ord(i)))
else:
b= chr(ord(i) + 3)
print(b,end="")
| true |
35b72b9974befd6347049668a099a9d061f4f1a1 | Python | MichaelSluydts/schnetpack | /custom/triplets/Samplers.py | UTF-8 | 5,220 | 2.84375 | 3 | [
"MIT"
] | permissive | from torch.utils.data.sampler import Sampler, RandomSampler
import itertools
import numpy as np
from torch.utils.data.sampler import BatchSampler
import random
import pdb
class SequentialNRepeatSampler(Sampler):
r"""Samples elements sequentially, always in the same order.
Arguments:
data_source (Data... | true |
175dd4b9f20fd329dcf3429083a362b94d777d51 | Python | zeeke/gitlab-build-hooks | /trello_commit_to_card.py | UTF-8 | 2,933 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python
import gitlab
import configargparse
import re
from trello import TrelloClient
from trello.card import Card
def search_for_card_numbers(message):
return re.findall('#(\d+)', message)
def create_link_message(commit):
return "{} committed {}:\n{}".format(commit.author_name, commit.short... | true |
847ea7dd9a9ee89e34c51f294da25802464358a0 | Python | crvernon/mosartwmpy | /mosartwmpy/utilities/inherit_docs.py | UTF-8 | 646 | 3.140625 | 3 | [
"CC0-1.0"
] | permissive | import types
def inherit_docs(cls: object) -> object:
"""A class decorator to automatically inherit docstrings from parents.
Args:
cls (object): The class that needs docstrings
Returns:
object: The class with docstrings inherited from parents
"""
for name, func in vars(cls).items... | true |
91f3e228e5e580c7f4ce3e7f69de0af84ac95a01 | Python | digitic/CV-Thesis-Celeste | /FinalEdges.py | UTF-8 | 1,170 | 2.71875 | 3 | [] | no_license | import numpy
import cv2
#Determine source video
cap = cv2.VideoCapture("CelesteVideos/Level1.mp4")
frame_width = int(cap.get(3) / 2)
frame_height = int(cap.get(4) / 2)
#Output file creation
out = cv2.VideoWriter('CelesteVideos/edgeDetection.mp4',cv2.VideoWriter_fourcc('M','P','4','V'), 30, (frame_width,frame_height)... | true |
0d4f086384f16c6614d4e9e6bfecbbb4766c1d75 | Python | verovanie/Student-database-management | /backEnd_studentDatabase.py | UTF-8 | 2,594 | 2.859375 | 3 | [] | no_license | import sqlite3
def connection():
try:
conn=sqlite3.connect("student.db")
except:
print("cannot connect to the database")
return conn
def studentData() :
con = connection()
con = sqlite3.connect("student.db")
cur = con.cursor()
cur.execute('''CREATE TABLE IF NOT... | true |
0f3526c8835d7d19bcac3068b5ee805b90f5eaf3 | Python | hao6699/sort_python | /连续子数组最大和.py | UTF-8 | 285 | 3.109375 | 3 | [] | no_license | def FindGreatestSumOfSubArray(self, array):
# write code here
totalsum = array[0]
max_sum = array[0]
for i in range(1,len(array)):
totalsum = max(totalsum+array[i],array[i])
max_sum = max(totalsum,max_sum)
return max_sum
| true |
902747a9848890dafe6270314cf040e7aa4ba21b | Python | namanpujari/microstate_correlation | /utils.py | UTF-8 | 7,517 | 3.4375 | 3 | [] | no_license | """Some utility functions for microstate hydrogen bond analysis.
"""
from __future__ import print_function
# Globals
import sys
import time
from functools import wraps
GROTTHUSS = ["GLU", "ASP", "SER", "THR", "HIS", "TYR", "ASN", "GLN", "HOH", "PAA", "PDD"]
# Cofactors in the heme group
# The function below returns ... | true |
f509c4ebf1553d9e8311ada8c34e1550a5df2ccf | Python | Mkrolick/MachineLearningExploration | /DeepLearningBook/Chapter 1/simple_net.py | UTF-8 | 1,388 | 2.8125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
# Network and training
epochs = 200
batch_size = 128
verbose = 1
nb_classes = 10 # number of outputs = number of digits
n_hidden = 128
validation_split = 0.2 # how much train is reserved for validation
mnist = tf.keras.datasets.mnist
(X_train, Y_train), (X_test, ... | true |
e5d8950624a0a0a57e7ba5783ce7a8f685a8404e | Python | vaishak-github/python-progs | /Employee_record_management_system/search_record.py | UTF-8 | 710 | 3.96875 | 4 | [] | no_license | def search(lst, eid, choice):
if choice == 1:
for i in lst:
if i['emp_id'] == eid:
print("The details for employee with id:",eid, "\n Id:", i['emp_id'], "|| Name:", i['emp_name'],
"|| Email:", i['emp_email'], "|| DOB:", i['emp_dob'])
retur... | true |
ee25317037c1b95554ae59e47a915d46a16fbe42 | Python | ankurdave/graphframes | /python/graphframes/tests.py | UTF-8 | 2,793 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | true |
054759bb301e5177b0dc1956a568413060535a7b | Python | DonaldWhyte/notes-parallel-scientific-computing | /CourseworkWorksheets/coursework2/task3/compute_efficiency.py | UTF-8 | 1,263 | 2.890625 | 3 | [] | no_license | import sys
def efficiency(serialTime, parallelTime, numProcesses):
return serialTime / (numProcesses * parallelTime)
if __name__ == "__main__":
# Parse command line arguments
if len(sys.argv) < 3:
sys.exit("Usage: python {0} <inputRuntimeFile> <outputEfficiencyFile>".format(sys.argv[0]))
i... | true |
b0640c6d477c374d80ad08f032962a0dc052d0cd | Python | fanshi118/NYC_Restaurant_Health_Score_Prediction | /scripts/311_parser.py | UTF-8 | 1,510 | 2.84375 | 3 | [] | no_license | __author__ = 'Shi Fan'
import pandas as pd, numpy as np
if __name__=='__main__':
# dataset can be downloaded from here
# https://data.cityofnewyork.us/Social-Services/311-Service-Requests-from-2010-to-Present/erm2-nwe9
# set filter: "Agency is DOHMH" and "Location Type contains Restaurant"
# click "Export" and "Do... | true |
6bc3f9a86dc87725252ff971d212b76dd6a46e92 | Python | GreatStephen/MyLeetcodeSolutions | /Remove All Adjacent Duplicates In String/stack.py | UTF-8 | 275 | 3.109375 | 3 | [] | no_license | class Solution:
def removeDuplicates(self, S: str) -> str:
# 甚至比2pointer还慢
deq = collections.deque()
for i,v in enumerate(S):
if len(deq)>0 and deq[-1]==v: deq.pop()
else: deq.append(v)
return ''.join(deq) | true |
1979d73a9a323a74e1e6f1fd858cb0738afa9ace | Python | marvjaramillo/ulima-intro210-clases | /s062-grupal/menu.py | UTF-8 | 520 | 3.171875 | 3 | [] | no_license | OPCION_COTIZAR = 1
OPCION_PARTICIPAR = 2
OPCION_DETENER = 3
OPCION_CREDITOS = 4
lista_opciones = [ "Cotizar envio",
"Participar por un premio",
"Detener aplicacion",
"Creditos"
]
def mostrar_menu():
print("*" * 20)
print("*" * 20)
... | true |
0a0e1a2e67497d30a0d7301aa6c98db663feb58a | Python | perrozzi/cmg-cmssw | /FWCore/Services/bin/profilereader.py | UTF-8 | 4,001 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
"""module to read profiling information generated by the SimpleProfiling Service
"""
import os
class FunctionInfo(object):
"""Holds the profiling information about one function
"""
def __init__(self,attrList):
self.address =attrList[0]
self.name =os.popen("c++filt "+a... | true |
bc4f2cb71599ee23c84c3b22602ac30dd62e64f3 | Python | Bandydan/Python_scripts | /factor.py | UTF-8 | 355 | 3.625 | 4 | [] | no_license | #!/usr/bin/python2.7
def factorial(x):
y = 1
n = x
if x > 1:
while x - y > 0:
n = n * (x - y)
y +=1
return n
elif x == 0 or x == 1:
n = 1
return n
def factor(x):
if x == 0 or x == 1:
return 1
result = x
counter = x
while counter > 1:
result *= counter - 1
counter -= 1
return result
prin... | true |
02b4fb21388f7f8ce2f8977f82492dbf00c152cf | Python | mattsains/powermonitor | /GPIOInterface/powermonitor.py | UTF-8 | 3,945 | 2.90625 | 3 | [] | no_license | import spidev
import ctypes
import time
class PowerMonitor:
def __init__(self):
self.spidev = spidev.SpiDev()
self.spidev.open(0, 1)
def _send_data(self, command, receive_bytes, *data):
"""Internal wrapper function used to format the command byte"""
commandbyte = 0b10100010 | (... | true |
ad1dbd21a8cb809c3858cc368a3d333d943f8f21 | Python | eletromagcomp/projeto3 | /projeto3_plus.py | UTF-8 | 9,421 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 20:03:28 2019
@author: hiro
"""
import numpy as np
import matplotlib.pyplot as plt
import time
import math
from celluloid import Camera
from scipy.optimize import newton
from mpl_toolkits.axes_grid1 import make_axes_locatable
#%% HIROCOISAS####... | true |
350cffbe67c00486ab930e46dd42d5a133187fb4 | Python | cchaas-uwaterloo/UW-SDIC_distributed_data_aggregation | /Applications/OCT14_LMS_analysis.py | UTF-8 | 2,809 | 2.546875 | 3 | [] | no_license | from Downloaders import readLMSData
from Operations import calculateRMS
from Util import segmentList
import os
# Get data file path
# Local data files
'''
target_file_path = os.path.dirname(__file__)
dir_index = target_file_path.rfind('/')
target_file_path = target_file_path[:dir_index]
# Config_
target_file_path = t... | true |
d4fccf043ca14933d80d6617a73bab0996f78939 | Python | gemst1/Blog | /TensorBoard/arbitrary_image.py | UTF-8 | 1,245 | 2.671875 | 3 | [] | no_license | from datetime import datetime
import io
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress',... | true |
be8025afb910a1bafed34a3c776d6555d35078d1 | Python | l2radamanthys/TxtMerge | /textmerge.py | UTF-8 | 5,300 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
import ttk
from tkFileDialog import askopenfilenames, asksaveasfilename
import tkMessageBox
import os
import random
from merge import MergeProcess
class MainFrame(tk.Frame):
def __init__(self, master):
tk.Frame.__init__(self, master)
... | true |
b43bc5d49b850d9c3f543212953d45dc1b72f7c8 | Python | jlyang1990/LeetCode | /800. Climbing Stairs II.py | UTF-8 | 912 | 2.96875 | 3 | [] | no_license | # n stairs, exactly k steps, every step: 1, 2 or 3 stairs
# O(nk) time, O(n) space
def climbStairs(n, k):
if n < 3:
count = [1]*n
else:
count = [1]*3+[0]*(n-3)
for i in range(k-1):
for j in range(n-1, -1, -1):
if j == 0:
count[j] = 0
elif j == 1:
count[j] = count[j-1]
elif j == 2:
count[j... | true |
05a1e28e30e02063ce1eff81ae954f4be76a6814 | Python | ArtsenMachin/audithon.task20 | /models/models.py | UTF-8 | 9,956 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import psycopg2
import json
from pydantic import BaseModel, ValidationError
from typing import List, Optional
conn = psycopg2.connect(database="audithon", user="postgres",
password="4432", host="26.173.145.160", port="5434")
cursor = conn.cursor()
class json_serializable(BaseModel):
type ... | true |
16c6139b84bb24b74258b86d80ba17feb98f80b1 | Python | kkujawinski/git-pre-push-hook | /tests/mock_repo/test_file.py | UTF-8 | 108 | 3.46875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | def add(x , y):
return x+ y
def substract(x, y):
return x - 1
def multiply(x, y):
return x*y
| true |
4f2b1dbf80cc66a7119ed201a0bb8392f3d317fe | Python | mluker/azure-dns-to-terraform | /tfdnsgen.py | UTF-8 | 2,850 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import csv
import json
parser = argparse.ArgumentParser(description='Terraform Code Generator')
parser.add_argument('--rg', action="store", dest='rg', required=True, help='resource group name')
parser.add_argument('--zone', action="store", dest='zone', required=True, help='name ... | true |
863404ab835692810310b5bfb9c424c665582ad5 | Python | ashishkashinath/Grad_School_Courses | /CS461_ECE422/MP References/mnwrhsn/CS461_UIUC_FA17-master/mp1/sol_1.1.2.2.py | UTF-8 | 570 | 2.875 | 3 | [] | no_license | import sys
from Crypto.Cipher import AES
ciphertext_file = sys.argv[1]
key_file = sys.argv[2]
iv_file = sys.argv[3]
output_file = sys.argv[4]
with open(ciphertext_file) as f:
ciphertext = f.read().strip().decode('hex')
f.close()
with open(key_file) as f:
key = f.read().strip().decode('hex')
f.close()
... | true |
5d92a5a4edd7ce7c0a0821c0addd6a8fd61e5c28 | Python | martimunicoy/peleffy-benchmarks | /peleffybenchmarktools/dihedrals/dihedralhandler.py | UTF-8 | 5,425 | 2.765625 | 3 | [
"MIT"
] | permissive | """
This module contains classes and functions to handle dihedral benchmarks.
"""
class DihedralBenchmark(object):
"""
It defines a certain dihedral and allows to run several benchmarks
on it.
"""
def __init__(self, dihedral_atom_indexes, molecule):
"""
It initializes a DihedralBe... | true |
135b5828023b8c29aa739f9d2cdc2c69fe5e4b40 | Python | facloud/python-algorithms | /algos/perf/__init__.py | UTF-8 | 719 | 3.25 | 3 | [] | no_license | import time
import matplotlib.pyplot as plt
class PerformanceTestResult(object):
def __init__(self, validation_outcome, duration):
self.validation_outcome = validation_outcome
self.duration = duration
def run_performance_test(p, size):
random_input = p.get_random_input(size)
start_time =... | true |
becb5547281e82c25376cffa803649396e836e4f | Python | Nitta-K-git/pybind_samples | /out/numpy_mod_test.py | UTF-8 | 362 | 3.1875 | 3 | [
"MIT"
] | permissive | import numpy_mod as tes
import numpy as np
a = np.array([1,3,5,6]).reshape(2,2) # 今回の関数は2次元のみ限定
print(a)
tes.print_array(a) # numpyデータをprint
b = tes.modify_array(a,3) # ブロードキャスト処理
print(a)
print(b)
tes.modify_array_inplace(a,4) # ブロードキャスト処理で引数自体を書き換え
print(a)
| true |
633cc0c703b14a13b3eca6fda02826982b684547 | Python | silvermund/keras-study | /keras/keras10_validation2.py | UTF-8 | 959 | 3.34375 | 3 | [] | no_license | from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
import numpy as np
import matplotlib.pyplot as plt
#1. 데이터
x = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13])
y = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13])
## 잘라서 만들어라!!!
x_train = x[:8] # 훈련, 공부하는 거
y_train = y[:8]
x_test = x[8:11]... | true |
ab0867a4a11938628213ad39cda6bdd2f9887572 | Python | badrequest400/qa-management_system | /manager_test.py | UTF-8 | 2,643 | 3 | 3 | [] | no_license | import unittest
from manager import *
from item import *
from subscriber import *
class ManagerTest(unittest.TestCase):
def setUp(self):
self.a = Item('Hundred Years of Solitude', 'Gabriel Marquez', 'BF123')
self.b = Item('The Neuromancer', 'William Gibson', 'BF124')
self.c = Item('Going P... | true |
df51389b142e0c372be452924c05b34814ef3bc2 | Python | liyimpc/pytool | /base/stack.py | UTF-8 | 167 | 3.53125 | 4 | [] | no_license | '''
栈:
先进后出,用数组模拟操作
'''
stack = []
# 压入数据
stack.append("A")
stack.append("B")
stack.append("C")
# 取出数据
stack.pop()
| true |
3c83590019b959559ea8c865826713a107c13966 | Python | marsXyr/ERL | /core/neuro_evolutionary.py | UTF-8 | 8,159 | 2.5625 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
import fastrand, math
# Neuroevolution SSNE
class SSNE:
def __init__(self, args):
self.current_gen = 0
self.args = args
self.population_size = self.args.pop_size
self.num_elitists = int(self.args.elite_fraction * args.pop_size)
if self.num_e... | true |
31506051faff870369638d07d1465e3bc5024c44 | Python | puneet-10/POI-in-Enron-Company | /poi_id.py | UTF-8 | 6,654 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import sys
import matplotlib.pyplot as plt
import pickle
from sklearn import preprocessing
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
sys.path.append("../tools/")
from sklearn.metrics import accuracy_score
from feature_format import featureFormat, targetFeatu... | true |
f24041261a1cb59fdff06f83964282df7464103f | Python | manishita-dey/Image_Color_Palette_Generator | /main.py | UTF-8 | 1,885 | 2.84375 | 3 | [] | no_license | from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
import os
import numpy as np
import matplotlib as plt
from PIL import Image
UPLOAD_FOLDER = 'static/uploads/'
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD... | true |
54d07a77c063fb813934e254a7a2f11f223f048b | Python | DorotaOrzeszek/ProjectEuler | /Euler23.py | UTF-8 | 783 | 3.28125 | 3 | [] | no_license | import math
def divsum(n):
dssum = -n
sq = math.sqrt(n)
if math.floor(sq) == sq:
dssum += sq
end = int(sq)
else:
end = int(sq)+1
for i in range(1,end):
if n % i == 0:
dssum += i
dssum += n/i
return dssum
def nrtype(n):
if n == divsum(n):
return 'p' # n is perfect'
elif n... | true |
8e5a48d144bb93515dad1cf9f7ab5e387a75b77c | Python | deepakag5/Data-Structure-Algorithm-Analysis | /leetcode/puzzle_roman_to_int.py | UTF-8 | 1,213 | 3.953125 | 4 | [] | no_license | # Time complexity : O(1)
# As there is a finite set of roman numerals, the maximum number possible number can be 3999,
# which in roman numerals is MMMCMXCIX. As such the time complexity is O(1)
# If roman numerals had an arbitrary number of symbols, then the time complexity would be proportional
# to the length of t... | true |
ae28dd19e7e0aa414dd9c4f5654fd17bcaf885aa | Python | rahdirs11/CodeForces | /python/translation.py | UTF-8 | 84 | 2.84375 | 3 | [] | no_license | s, t = input(), input()
print('YES' if ''.join(list(reversed(s))) == t else 'NO')
| true |
43c2801153ffeb6cc3259963b10d6df58c40e97a | Python | diop/kebetu | /random_dictionary_words.py | UTF-8 | 578 | 3.546875 | 4 | [
"MIT"
] | permissive | import sys
import random
def get_dictionary_words():
with open('snippet.txt', 'r') as f:
dictionary_words = f.read().split(' ')
return dictionary_words
def create_random_sentence(dictionary, num_words):
for _ in range(num_words):
random_sentence = ' '.join(random.sample(dictionary, num_wor... | true |
761e91951e003ed882a2728ff7ff40c2e15c130d | Python | rhys-newbury/EmbodiedFlowMaps | /data_processing_scripts/process_fac_file.py | UTF-8 | 531 | 2.875 | 3 | [] | no_license | import collections
d = collections.defaultdict(int)
def process_fac(fac):
for index, line in enumerate(open(fac)):
if index == 0:
continue
data = list(map(lambda x : x.strip(), line.split(",")))
time = float(data[4][0] + "." + data[4][1:])
total = time * float(data[... | true |
7e526503c016d36f0041a71e978a34916302c0ac | Python | abbindustrigymnasium/python-kompendium-ABBjaceng | /Kompendium/Kapitel 2 Öviningsuppgifter/2.3.py | UTF-8 | 198 | 3.125 | 3 | [] | no_license | A="Dator>> "
print(A +"Hej!\n" + A +"Vad heter du i förnamn?")
B=str(input("Du>> " ))
print(A + "Vad heter du i efternamn?")
C=str(input("Du>> "))
print(A+ "Trevligt att träffas "+ B +" " + C+"!") | true |
58b1dff1ec407d600e43fb93cd7d833faa0fcf9b | Python | fatihmete/dfviewer | /dfviewer/__init__.py | UTF-8 | 5,794 | 2.703125 | 3 | [
"MIT"
] | permissive | import sys
import numpy as np
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton,\
QLineEdit, QTableWidget, QTableWidgetItem,\
QLabel, QHBoxLayout, QVBoxLayout,\
QHeaderView, QComboBox, QCheckBox, QStatusBar
from PyQt5.QtCor... | true |
58115a78f8519254d110c761bac3d1351a6c09aa | Python | vensder/py_hw_2016 | /hw3_db.py | UTF-8 | 3,238 | 3.90625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# 2016_python.py
#
# Student Dmitry Makarov <vensder@gmail.com>
from time import sleep
'''
2. Сохранить объект в файл можно так:
»> import pickle
»> data = {
... 'a': [1, 2.0, 3, 4+6j],
... 'b': ("character string", b"byte string"),
... 'c': {No... | true |
2889d05a1c970fd5fc5293cc677bbda1a80e17b5 | Python | EduardoSaverin/Sentiment-Analysis | /word_cloud.py | UTF-8 | 496 | 2.984375 | 3 | [] | no_license | from wordcloud import WordCloud
import matplotlib.pyplot as plt
def show_wordcloud(data, title = None):
wordcloud = WordCloud(
background_color = 'white',
max_words = 200,
max_font_size = 40,
scale = 3,
random_state = 42
).generate(str(data))
fig = plt.figure(1, fi... | true |
e21989be0fda30b95836c52df553e30c0c59939d | Python | nipunaw/Lotus | /src/lotusFloating.py | UTF-8 | 8,309 | 2.625 | 3 | [
"MIT"
] | permissive | # CIS 4930
########### Contributors ###########
# Nipuna Weerapperuma
# Hannah Williams
# David Jaworski
# Carlos Morales-Diaz
# Spencer Bass
########### PyQT5 imports ###########
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
class FloatingWidget(QtWidgets.QWidget):
def __init__(self, chi... | true |
e55d4c968193eeacf1ced0e94416b6ae271f7614 | Python | limyer/NetworkTermProject | /참고 예제/RSPClient테스트용.py | UTF-8 | 403 | 2.84375 | 3 | [] | no_license | from socket import *
import threading
ADDR=('192.168.200.172',12000)
clientSocket=socket(AF_INET,SOCK_STREAM)
clientSocket.connect(ADDR)
def clientThread():
print(clientSocket.recv(2048).decode())
t=threading.Thread(target=clientThread)
t.daemon=True
t.start()
sentence='a'
while sentence!='.':
sente... | true |
642a23fb360dab305050ebe5a99272f1726a4c5f | Python | xzhu2/BIA660 | /Team Sports/FinalProject/RestServiceHandler.py | UTF-8 | 5,045 | 2.53125 | 3 | [] | no_license | """
BIA 660
Final Project A sport statistic analysis website
Author: Han Yan
"""
import cherrypy
import simplejson
from MongoDBHandler import *
###
### Classes
###
class RESTResource(object):
"""
Base class for providing a RESTful interface to a resource.
Support http request:
handle_GET
handle_PUT
... | true |
befb0995df41d043ee6118f0ecb2709475a7354f | Python | Arnab-Banerjee-Kolkata/SudokuGame | /Sudoku.py | UTF-8 | 19,228 | 3 | 3 | [] | no_license | from random import randint
from tkinter import *
import tkinter as tk
import matplotlib.pyplot as plt
import numpy as np
import time
import random
numbers = [1,2,3,4,5,6,7,8,9]
n=9
m=3
def search(c=0):
"Recursively search for a solution starting at position c."
i, j = divmod(c, n)
i0, j0 = i - i % m, j - j... | true |
027816e7cdab9736fa6da5219666a5c1b929f94d | Python | hwans21/python | /Day04/module_basic02.py | UTF-8 | 528 | 4.09375 | 4 | [] | no_license | # 모듈 내에 존재하는 변수, 함수, 클래스를 직접 임포트하는 방법
from math import factorial,gcd
print(factorial(6))
print(factorial(5))
print(gcd(12,18))
# 임포트할 모듈을 별칭을 지정해서 사용하기
import statistics as st
li = [34,55,12,33,55,66,99]
print('평균:', st.mean(li))
print('분산:',st.variance(li))
print('표준편차:',st.stdev(li))
# 위에서 알려드린 두 가지 개념을 합쳐서도 사용이 가... | true |
75a0044bd940082fd4ae4a7a3fd6569429039cc4 | Python | adamatan/bin-devils | /scripts/comment/comment.py | UTF-8 | 1,695 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import sys
import argparse
############################### Parse arguments ################################
parser = argparse.ArgumentParser(description='Generates fixed-width comments.')
parser.add_argument('-d', '--debug', help="Debug mode", action='store_true')
languages = parser.add_mutually... | true |
48e9dcc6735115d196b87d25fe9d788124a98900 | Python | copperstick6/alexa-git | /alexa-skill.py | UTF-8 | 1,677 | 2.59375 | 3 | [] | no_license | import logging
from random import randint
from flask import Flask, render_template, request, redirect
from flask_ask import Ask, statement, question, session, request
import urllib2
import json
import gitFeed
import techcrunch
import qod
app = Flask(__name__)
log = logging.getLogger()
ask = Ask(app, "/")
logging.getLo... | true |
482202ce235025c58c315b5748997838ae3777bb | Python | Lagom92/algorithm | /0405/subset.py | UTF-8 | 748 | 2.90625 | 3 | [] | no_license | def f(n, N, K):
global cnt
if n == N:
s = 0
for i in range(N):
if b[i] == 1:
s += a[i]
if s == K:
cnt += 1
for i in range(N):
if b[i] == 1:
print(a[i], end=" ")
print()
return
... | true |
19222eb90c4c9b2f34ed7847a241c49bc76a74ca | Python | VadymLinyvyi/ST_Falcon_Courses | /Lections/Lection 13/services/guest_service.py | UTF-8 | 938 | 3.078125 | 3 | [] | no_license | from colorama import Fore
from models.guests import Guest
from helpers.input_helper import get_string, get_age
from helpers.output_helper import pretty_print
class Guest_service():
def search_guest(self):
name = get_string("Please, enter guest name: ")
guest = Guest.objects().filter(name__icontai... | true |
4bfb9ba5ceb445faa8a9287f2072042b86f00f0d | Python | chancejiang/tiddlyweb | /test/test_tiddlers_fields.py | UTF-8 | 3,492 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | """
Test extended fields on tiddlers.
Some tiddlers have additional fields what we don't
know about ahead of time, but we'd like to handle.
Most straightforward things to do here seems to be
to do what TiddlyWiki does: have a fields field.
"""
import simplejson
from tiddlyweb.config import config
from tiddlyweb.seri... | true |
df97738fd132ecfbdbfea5198b388b517bcacb41 | Python | JamieStarrCompany/yelp_challenge | /Legacy/app/routes.py | UTF-8 | 1,247 | 2.578125 | 3 | [] | no_license | from flask import render_template, flash, redirect, url_for
from app import app
from app.forms import SearchForm
import graph
name = ''
address = ''
rating = 0
review_count = 0
def get_stats(rest_name, rest_address, stars, rest_review_count):
global name
global address
global rating
global review_count
name =... | true |
9fda65ad618f4786fc00a0660fbe62666a941881 | Python | sangkeerthana70/Python-playground | /functionsPython/parmsInFunction.py | UTF-8 | 111 | 2.734375 | 3 | [] | no_license | def my_function(fname):
print(fname + " Smith")
my_function("Earl")
my_function("Toby")
my_function("Linda") | true |
9d66260bfeb09f661977a5b927152b4e49667f6b | Python | zhangyue0503/python | /ex/benbanfaxuepy/py1.py | UTF-8 | 100 | 3.21875 | 3 | [] | no_license | # -*- coding=utf-8 -*-
# %r功能
x = "There are %d types of people." % 10
print "I said: %r." % x
| true |
71e240df20c5cbd09e4daa8380381ca587d3355f | Python | bakerks/Szabos-fractional-wave-eqaution | /2D Code/Szabo2D.py | UTF-8 | 6,673 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# Approximates the solution to Szabos fractional wave equation using schemes with and without correction terms within the approximation of the fractional derivatives, corresponding schemes are seen in Eqs 3.9 and 3.8 respectively. This notebook contains 2 examples, one with a smoo... | true |
b80f582d8e454a067456c63c451100f7b508ccb7 | Python | luftbuefel/microbitFlappyBird | /microbitFlappyBird.py | UTF-8 | 2,754 | 3.609375 | 4 | [
"MIT"
] | permissive | from microbit import *
from random import *
import music
class Wall:
column = -1
hole = -1
birdRow = 2
BIRD_COLUMN = 1
birdCanMove = True
birdBrightness = 9
score = 0
WALL_MOVE_TIMER = 800
WALL_BRIGHTNESS = 3
EMPTY_ROW = "00000"
wallMoveTimer = WALL_MOVE_TIMER
walls = []
wallsUpdated = True
gamePlaying = Tr... | true |
791378dc9bdf5295774f708d03a89eb4f2ddcf23 | Python | zdyxry/LeetCode | /array/1450_number_of_students_doing_homework_at_a_given_time/1450_number_of_students_doing_homework_at_a_given_time.py | UTF-8 | 327 | 3.015625 | 3 | [] | no_license | from typing import List
class Solution:
def busyStudent(self, startTime: List[int], endTime: List[int], queryTime: int) -> int:
return sum(a<=queryTime<=b for a,b in zip(startTime,endTime))
startTime = [1,2,3]
endTime = [3,2,7]
queryTime = 4
res = Solution().busyStudent(startTime, endTime, queryTime)
pri... | true |
1b487f1eaf15f1129f7b6a301066a335e4b06431 | Python | 1noll1/lt2212-v19-a4 | /gendata.py | UTF-8 | 3,831 | 3.0625 | 3 | [] | no_license | import os, sys, glob, argparse, numpy as np, pandas as pd, subprocess, re
from nltk import word_tokenize
from nltk.corpus import stopwords
import numpy as np
from sklearn.model_selection import train_test_split
'''I removed metavars from R and P because I saw no use of them
and they were causing conflict
'''
#Part 1:... | true |
18e78699db3f708744c0c052b27631b8f59a378b | Python | firgaty/jfp-2019 | /main.py | UTF-8 | 3,901 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
import random
# top line is 0
board = [[0] * 7 for _ in range(100)]
base = 0
L = 6
C = 7
# debug
def pboard():
for i in range(L):
for j in range(C):
print(board[base + L - i - 1][j], end=' ')
print()
# clean line if full
def is_tetris():
for e in board[base]:
... | true |
b73ccc7c890f58090810be24b8ab0cad4e7b77d1 | Python | mbromberek/Python_One_Liners | /ch05_regex/08_get_monetary_nbr.py | UTF-8 | 641 | 3.6875 | 4 | [] | no_license | ## dependencies
import re
## Data
report = '''
If you invested $1 in the year 1801, you would have $18087791.41 today.
This is a 7.967% return on investment.
But if you invested only $0.25 in 1801, you would end up with $4521947.8525.
'''
## My try
result = re.findall('(\$[0-9]+(\.[0-9]*)*)', report)
print(result)
... | true |
9f69919ec07ab9df48efb4e4c3d78ab65ad54bd4 | Python | cb285/SeniorProject | /amazon/lambda/home_lambda_handler.py | UTF-8 | 11,199 | 2.71875 | 3 | [] | no_license | from requests import *
import string
from word2number import w2n
USER = "clayton"
PASSWORD = "clayton"
SERVER_URL = "https://" + USER + ":" + PASSWORD + "@192.195.228.50:58000"
VERIFY_SSL = False
SERVER_TIMEOUT = 5
# create translator for removing punctuation
translator=str.maketrans('','',string.punctuation)
def ... | true |
a2fee87eafeea66b849cf090b14756ea98592287 | Python | macalinao/market-maker | /exchange.py | UTF-8 | 2,441 | 3.125 | 3 | [
"MIT"
] | permissive | import uuid
def parse_message(message):
if message['type'] == 'book':
return Book(message)
return message
class Order(object):
def __init__(self, security, direction, quantity, price=None):
self.order_id = str(uuid.uuid4())
self.security = security
self.direction = directi... | true |
b5c009434801ddf2d3aee58febf972b8b5d8432b | Python | repakyky/egoroff_OOP | /venv/oop22_polymorphism.py | UTF-8 | 1,798 | 4.0625 | 4 | [] | no_license |
# Полиморфизм
# Короче это такой принцип написания кода.
# Для трёх разных классов мы написали методы подсчёта площади, которые при этом работают по-разному
# (Для прямоугольника, квадрата и круга)
# При этом названия методов одинаковые - вместо:
# - get_rectangle_area;
# - get_square_area;
# - get_circle_area;
# Везд... | true |
98fe8a5007f5266b2faabd1e778f0416488b5528 | Python | thinker3/py_learn | /codeeval/products_and_order.py | UTF-8 | 445 | 3.125 | 3 | [] | no_license | from sys import argv
import itertools
digits = {
'0': '0',
'1': '1',
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz',
}
def order(one):
one = [digits[i] for i in one]
for p in itertools.product(*one):
yield ''.jo... | true |