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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bd8fd6632856d6fb1266c480a483a8c49b9fc4fa | Python | shen-huang/selfteaching-python-camp | /19100102/jynbest6066/d5_exercise_string.py | UTF-8 | 1,499 | 3.734375 | 4 | [] | no_license | text = ''' The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although pr... | true |
11569fb75791c63e92d7629c229b633bb205f43e | Python | tyang1/enfo_api | /src/models/enfoModel.py | UTF-8 | 2,161 | 2.765625 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from marshmallow import fields, Schema
from flask_sqlalchemy import SQLAlchemy
from . import db
# initialize our db
# db = SQLAlchemy(... | true |
31c9908b7fd6627f8290f92857eb9af8051c8ec0 | Python | ravi4all/PythonRegJanMorning | /GameDevelopment/03-DrawingObjects.py | UTF-8 | 491 | 3.15625 | 3 | [] | no_license | import pygame
pygame.init()
size = width,height = 800,500
# width = 800
# height = 500
black = 0,0,0
white = 255,255,255
red = 255,0,0
screen = pygame.display.set_mode((width,height))
x = 5
while True:
for event in pygame.event.get():
# print(event)
if event.type == pygame... | true |
8da8864c5a1d5d90afc674f4d8a237a0ade87a05 | Python | Sungurlu/GlobalAIHubPythonCourse | /Homeworks/HW-3.py | UTF-8 | 1,651 | 3.453125 | 3 | [] | no_license |
S1=input("Student-1 Name:")
print("------",S1,"------")
i1=int(input("Student-1, please enter your Midterm: "))
j1=int(input("Student-1, please enter your Project: "))
k1=int(input("Student-1, please enter your Final: "))
S2=input("Student-2 Name:")
print("------",S2,"------")
i2=int(input("Student-2, plea... | true |
a47769def87c6226de6e6cdd70061b17d59265f5 | Python | shankar7791/MI-11-DevOps | /Personel/abhikr/assignment_2/check_vowel_consonent.py | UTF-8 | 371 | 4.125 | 4 | [] | no_license |
#prog 2.5.Write a program to input any alphabets and check it is vowel or consonent
vowel=['a','e','i','o','u','A','E','I','O','U']
#consonent=['b','c','d','f','g','h','j','k','l''m','n','p','q','r','s','t','v','w''x','y','z']
alphabets=input(" Enter the alphabets: ")
if alphabets in vowel:
print("Alphabet is v... | true |
e331f28402c0faaf28e85179d6cd12b8e3e370e8 | Python | Pepeciruela/poster_api | /probatina.py | UTF-8 | 316 | 2.96875 | 3 | [] | no_license | import requests
direccion = "http://www.omdbapi.com/?apikey=e35ce937&i=tt3896198"
#HACER PETICIÓN HTTP
respuesta = requests.get(direccion)
if respuesta.status_code == 200:
print (respuesta.text)
datos = respuesta.json()
print(datos)
else:
print ("Se ha producido un error", respuesta.status_code) | true |
2d05e79e5a04d0d9278d496f6d2e68180a3810e1 | Python | jufey/piDir | /python/Sunfounder_SuperKit_Python_code_for_RaspberryPi-master/02_btnAndLed_1.py | UTF-8 | 1,279 | 3.515625 | 4 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep # this lets us have a time delay (see line 12)
GPIO.setmode(GPIO.BCM) # set up BCM GPIO numbering
GPIO.setup(18, GPIO.IN) # set GPIO25 as input (button)
GPIO.setup(17, GPIO.OUT) # Set LedPin's mode is output
GPIO.output(17, GPIO.HIGH) # Set LedPin high(+3.3V)... | true |
5e60b7896e6b3398b661d3238c7047766747ef3e | Python | Liamdoult/aoc-2020 | /01/solution.py | UTF-8 | 437 | 3.15625 | 3 | [] | no_license | with open("input.txt", "r") as f:
f = f.read().splitlines()
f = map(int, f)
f = sorted(f)
print(f[:10])
for i in range(len(f)):
for j in range(i, len(f)):
for k in range(j, len(f)):
if f[i] + f[j] + f[k] == 2020:
print(f[i], f[j], f[k])
print(f[i]*f[j]*f[k]... | true |
c704d98f17dcf70367b7a07d45748c8eed3ea667 | Python | hector-han/leetcode | /dp/prob0452.py | UTF-8 | 1,457 | 3.953125 | 4 | [] | no_license | """
用最少数量的箭引爆气球
medium
在二维空间中有许多球形的气球。对于每个气球,提供的输入是水平方向上,气球直径的开始和结束坐标。由于它是水平的,所以y坐标并不重要,因此只要知道开始和结束的x坐标就足够了。开始坐标总是小于结束坐标。平面内最多存在104个气球。
一支弓箭可以沿着x轴从不同点完全垂直地射出。在坐标x处射出一支箭,若有一个气球的直径的开始和结束坐标为 xstart,xend, 且满足 xstart ≤ x ≤ xend,则该气球会被引爆。可以射出的弓箭的数量没有限制。 弓箭一旦被射出之后,可以无限地前进。我们想找到使得所有气球全部被引爆,所需的弓箭的最小数量。
和435一样,就是把起止点相同... | true |
cc1420b42312e586d8b05dbdf6061477939ed181 | Python | abhinavmathur96/Codeforces | /Palindromic Cut.py | UTF-8 | 1,554 | 2.765625 | 3 | [] | no_license | from collections import *
n = input()
s = raw_input()
c = Counter(s)
odd = []
even = []
for k in c.keys():
if c[k]&1:
odd.append(k)
else:
even.append(k)
if len(odd)==0:
ans = []
ans_s = ''
for k in c.keys():
ans_s = k*(c[k]/2)+ans_s+k*(c[k]/2)
ans.append(ans_s)
elif len(o... | true |
53d6d058c4e179dcb0f83aa6fe36b10e3b436263 | Python | Scott-Bunting/opti | /subsystem_cost/model_optimiser_TNC_cost.py | UTF-8 | 1,579 | 3.4375 | 3 | [] | no_license | import numpy as np
from classes.model_parameters import MP
from classes.room import Room
from scipy.optimize import minimize
from functions.cost import cost_obj_fun
from classes.test_distribution_plotter import PlotTestDistribution
class Model:
"""
Class for optimization of the cost
"""
def __init__(... | true |
d5913672045f2d0f45e0448c3e8ec39e7bfae0f4 | Python | wintangt/MyPortofolio | /SimplePy2.py | UTF-8 | 1,307 | 3.8125 | 4 | [] | no_license | #Soal Nomor 1
print("="*50)
print("Soal Nomor Satu")
for a in range(1,6): #1,2,3,4,5
for b in range(1, a+1):
print((a), end=" ")
print()
#Soal Nomor 2
print("="*50)
print("Soal Nomor Dua")
for c in range(1,6):
for d in range(1, c+1):
print(d, end=" ")
print()
#Soal Nomor 3
print("="*5... | true |
fd89434edb95c8367623cbb16cd241770c524ff0 | Python | rawat-shashank/geektrust | /Set2Problem1/__main__.py | UTF-8 | 371 | 2.953125 | 3 | [] | no_license | from takeInput import take_input
import sys
def main():
""" Main function to start program, runs the input function with
counter set to 3.
"""
if sys.version_info[0] > 2 and sys.version_info[1] > 5:
take_input(2)
else:
raise Exception("Python 3.6 or a more recent version is re... | true |
caca14a7495d671e456a8e1d4571dfd9ec6e8438 | Python | thehandsomepanther/breadcrumb | /breadcrumb.py | UTF-8 | 2,372 | 2.828125 | 3 | [] | no_license | import sys
import json
import csv
datafile = sys.argv[1]
enrollmentsfile = 'enrollments.json'
popularfile = 'popular.json'
def calc_average_enrollment(enrollment_list):
total = 0
for key in enrollment_list:
total += float(enrollment_list[key])
return total / len(enrollment_list.keys())
with open(datafile, 'rb')... | true |
1d573c99d9e42664287cbb0830dea32572a82f0c | Python | jeremyrans/aoc2017 | /day13/part1.py | UTF-8 | 439 | 2.78125 | 3 | [] | no_license | input = [l.strip('\n') for l in open('input.txt').readlines()]
print input
layers = {}
scanners = {}
scanner_loc = 0
severity = 0
for l in input:
parts = l.split()
layers[int(parts[0].strip(':'))] = int(parts[1])
scanners[int(parts[0].strip(':'))] = 0
for pos in xrange(max(layers.keys()) + 1):
range... | true |
51c832f195aa9cde0dfcc5010d06a07dfb43669d | Python | Covax84/CodeWars | /unique_in_order.py | UTF-8 | 409 | 3.984375 | 4 | [] | no_license | def unique_in_order(iterable: any) -> list:
"""
:param: any iterable
:return: list of items without any elements with the same value next to each other
and preserving the original order of elements
"""
output_arr = [iterable[0]] if iterable else []
for i in iterable:
if i !=... | true |
4e4091ce743a8f35bd642b0b69f8a6984e897629 | Python | zhexxian/SUTD-The-Digital-World | /Homework/coding_week4/Q3.py | UTF-8 | 425 | 3.5 | 4 | [] | no_license | ####### Your function should return a tuple containing a list of average #####
####### and the overall average, e.g., ([3.5,6.0,1.4], 3.625) ################
def findAverage(listOfLists):
a = []
b = c = 0
for i in listOfLists:
b += sum(i)
c += len(i)
if i == []:
a.appe... | true |
4e7f09c395860e352d1a72efa5906611d21305ea | Python | zhlei99/more_and_more_learning | /kerasLearning/dog_vs_cat_improment.py | UTF-8 | 4,687 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 22 16:11:37 2019
dog Vs cat improvement
相比最早的技术,添加dropout技术,图像变换进行数据集变大技术
效果提升:提升到82%,提升了15%
进一步提升方案:regularization techniques , tuning the network's parameters(such
as the numbers of filters per convolution layer, or the number of layers in the netw... | true |
4840c6df86825d1bae2683b66093b1a1a0904108 | Python | ycanerol/pymer | /generalizedmodels/gen_quad_model_multidimensional.py | UTF-8 | 9,624 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import matplotlib.pyplot as plt
import numpy as np
from scipy.linalg import eigh
from scipy.optimize import minimize
import analysis_scripts as asc
from genlinmod import conv
filter_length = None
stimdim = None
def set_stimdim(stimdim_toset):
global stimdi... | true |
bcab507ed6594002169ec19204752a07ed547fef | Python | WithPrecedent/amicus | /amicus/simplify/analyst/reduce.py | UTF-8 | 4,868 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
analyst.steps
Corey Rayburn Yung <coreyrayburnyung@gmail.com>
Copyright 2021, Corey Rayburn Yung
License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
Contents:
"""
import dataclasses
from typing import (Any, Callable, ClassVar, Dict, Hashable, Iterable, List,
Mapping, MutableMapping, MutableSeq... | true |
428b19ee0f24ed922ab2bdcc384f9ba3707e4bf4 | Python | Pinyk/Numpy-Pandas | /Matplotlib/legend图例/Demo.py | UTF-8 | 802 | 3.6875 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-3,3,50)
y1 = 2*x + 1
y2 = x**2
plt.xlim((-1,2))
plt.ylim((-2,3))
plt.xlabel('I am X')
plt.ylabel('I am Y')
new_ticks = np.linspace(-1,2,5)
print(new_ticks)
plt.xticks(new_ticks)
plt.yticks([-2,-1.5,-1,1.22,3],[r'$really\ bad$',r'$bad$',r'$normal$',r'$... | true |
1ccb0f1cf4225609c9b49a602a25e37d7ecd0517 | Python | hheavyduty/speech_recognition_deep_learning | /TUT_Sounds_Task3/activity_detection.py | UTF-8 | 1,751 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 6 11:25:48 2018
@author: USER
"""
'''
SUMMARY: Event detection using threshold, return list of <bgn, fin>
AUTHOR: Qiuqiang Kong
Created: 2016.06.15
Modified: -
--------------------------------------
'''
import numpy as np
'''
find pairs of <bgn, fi... | true |
da984c4c8006a08ab71eb95b60c3ea7f79e1fd1f | Python | evnewlund9/repo-evnewlund | /PythonCode/FarmCenter.py | UTF-8 | 2,139 | 3.171875 | 3 | [] | no_license | from turtle import *
import tkinter.messagebox
import tkinter
def one(points):
points += 1
turtle.clearscreen()
def two(points):
points += 2
turtle.clearscreen()
def three(points):
points += 3
turtle.clearscreen()
def four(points):
points += 4
turtle.clearscreen()
def five(points):
... | true |
e18dc280780eea1224278972901ebe0c24780021 | Python | aamirabbasi89/hackinscience | /exercises/210/solution.py | UTF-8 | 201 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 13:07:51 2015
@author: Aamir Abbasi
"""
import mathtools
sum = 0
for i in range(0, 1000):
if mathtools.is_prime(i) is True:
sum += i
print(sum)
| true |
6b65827fbbcaa48bb816df8585c94dc338b2c229 | Python | brucenielson/Python-Machine-Learning | /Quizes.py | UTF-8 | 11,287 | 3.765625 | 4 | [] | no_license | # 01-01: Quiz Read CSV
import pandas as pd
def test_run():
"""Function called by Test Run."""
df = pd.read_csv("data/AAPL.csv")
# TODO: Print last 5 rows of the data frame
print df.tail()
if __name__ == "__main__":
test_run()
# 01-01: Quiz Compute mean volume
"""Compute mean volume"""
import p... | true |
fa55dfcea5c70c565cee8b94e9e968fb36902371 | Python | pngsavvy/sudoku-solver | /Gui.py | UTF-8 | 10,893 | 3.578125 | 4 | [] | no_license | import pygame
import time
class Gui:
screen_width = 400
screen_height = 400
info_screen_height = 50 # for little section under the board
blocks = [] # holds the current value for each block
solution_board = [] # holds solution which is obtained from the backtracking algorithm
... | true |
acb06e292dc796785da816295e71171440d2a475 | Python | ethansudman/pythonexamples | /Neuron.py | UTF-8 | 826 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
import random
import math
class Neuron:
def __init__(self, num_inputs):
self.weights = []
for i in range(0, num_inputs):
self.weights.append(random.uniform(-2.4/num_inputs, 2.4/num_inputs))
self.threshold = random.uniform(-2.4/num_inputs, 2.4/num_inputs)
self.output ... | true |
d37422133ef8c608d69c2ec513569406b4606b26 | Python | genuinemerit/erep_messenger | /emsg_functions.py | UTF-8 | 9,302 | 2.765625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
#!/usr/bin/python3
"""
:module: emsg_functions
:class: EmsgFunctions
Global constants and generic helper functions.
:author: PQ <pq_rfw @ pm.me>
"""
import arrow
import hashlib
import json
import subprocess as shl
import time
import traceback
from collections import namedtuple
from os import... | true |
d1c5dc40b317851282c804474f5793e6d01c7761 | Python | niu-haiyang/PythonAdvance | /learning_0402_core_grammar/decorator.py | UTF-8 | 1,037 | 4.0625 | 4 | [] | no_license | """
权限装饰器: 当执行一项业务时, 判断是否具有权限
"""
def check_access(fun):
def check(*args, **kwargs):
secret = input('请输入暗号: ')
if secret == 'outime':
return fun(*args, **kwargs)
else:
print('你没有权限执行......')
return check
def log(fun):
def wrapper(*args, **kwargs):
... | true |
26ca648e6410ea8da717a3546b55d826dfc36683 | Python | Pradeep-Sulam/ProjectEuler | /3_prime_factor.py | UTF-8 | 222 | 3.703125 | 4 | [] | no_license | n = int(input("Enter the number to know the prime factor's : "))
i = 1
prime_factors = []
while n > 1:
if n % i == 0:
#print(i)
prime_factors.append(i)
n = n / i
i = i+1
print(prime_factors) | true |
5b2c52abe7ce6191a14a0f8e570c4a18d7e0a610 | Python | JessicaFavin/RFID_UHF_Gen2_Simulator | /usrp.py | UTF-8 | 739 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
from emitter import Emitter
from receiver import Receiver
from computer import Computer
import logging
class USRP:
def __init__(self, f):
self.logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
self.emitter = Emitter(f)
self.logger.info("Emitter is set")
self... | true |
d0a68d1de26c25d3ba35cd5d6a79b6860320b0e0 | Python | eelmaooo/studyzen | /search-queue/stackqueue.py | UTF-8 | 551 | 3.921875 | 4 | [] | no_license | # stack using list
stack = ["Amar", "Akbar", "Anthony"]
stack.append("Ram")
stack.append("Iqbal")
print(stack)
# Removes the last item
print(stack.pop())
print(stack)
# Removes the last item
print(stack.pop())
print(stack)
# -------------------------------------------------------------------------
# Queue... | true |
8fb3ee648f06b7caec0c8455c8a5c7b72997547c | Python | sauramel/Animal-Rescue-Game | /client_networking.py | UTF-8 | 5,119 | 2.765625 | 3 | [] | no_license | from game_functions import restrictive_input, encode_DP, decode_DP
from game_classes import DataPacket
import socket
import pickle
import zlib
import re
def query_host_port(default=(None,None)):
HOST = restrictive_input(
"Enter host IP: ",
lambda x: x,
lambda x: re.match("([0-9]{1,3}\.){3}... | true |
d5c2880b7657417e25d1831283f1c3cba4f95dfa | Python | funktor/stokastik | /LeetCode/UniquePaths.py | UTF-8 | 1,786 | 3.03125 | 3 | [] | no_license | import numpy as np
class Solution(object):
def can_visit(self, grid, x, y, visited):
return 0 <= x < len(grid) and 0 <= y < len(grid[0]) and grid[x][y] != -1 and (x, y) not in visited
def sum_paths(self, grid, x, y, visited, num_zeros):
visited.add((x, y))
a = self... | true |
3dd1cfb1a9cf4231574327a5d7fd9ab9c7929005 | Python | BCLab-UNM/SC2 | /src/navigation/src/bug_nav.py | UTF-8 | 30,942 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Matthew Fricke, 2020, based on an implementation by Isabelle and Ethan Miller distibuted under the MIT license.
#The three bug algorithms differ only in how they decide to leave the wall and return to the path through free space to the goal. To implement this, a single Bug class was created t... | true |
3c069a46a84eda67e6157452e81d11112e11e6d2 | Python | dyeap-zz/CS_Practice | /Set/Set.py | UTF-8 | 130 | 3.734375 | 4 | [] | no_license | s = set()
s.add(2)
# how to access the 2.
print(next(iter(s)))
print(s)
print(s.pop()) # gives the 2 but also removes it
print(s) | true |
d11d6977e6510d892f90efa1be09f29e949beab3 | Python | shaunfg/Complexity-Networks | /complexity/tests/efficiency_test.py | UTF-8 | 4,715 | 2.859375 | 3 | [] | no_license | import numpy as np
import random
import matplotlib.pyplot as plt
def plot_bar(z,title = "Oslo Model"):
heights = np.cumsum(z[::-1])[::-1] #indexing to reverse list
plt.figure(figsize= (8,5))
plt.bar(np.arange(1,len(z)+1,1),heights)
plt.title(title)
plt.ylabel("Heights")
plt.xlabel("sites")
de... | true |
4910a49978e76471e24b10da37b1b681fbb93689 | Python | EstherJin/Cartographer | /cartographer.py | UTF-8 | 33,411 | 2.734375 | 3 | [] | no_license | import argparse
import csv
import ast
import os
import os.path
import tkinter as tk
from tkinter import messagebox
from tkinter import filedialog
from collections import deque
from PIL import Image, ImageTk
def replace_gui(file_name, dire):
global root, gui
with open(file_name, encoding='utf-8-sig') as csv_fil... | true |
b5699d6c03cdbe562d7de1930535dfee9b920c8a | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/allergies/88b2ba9ca1914d12867195d8a2157d1b.py | UTF-8 | 527 | 4.03125 | 4 | [] | no_license | # Allergies Python Exercism, 1st iteration
class Allergies(object):
allergens = ["eggs","peanuts","shellfish","strawberries","tomatoes","chocolate","pollen","cats"]
def __init__(self,score):
self.score = score
# A food is in the allergy list if 2 ** (index of food) & score is non-zero, since a... | true |
2c3567bf692ee07cde0f7fc535f997f60d8c5dc5 | Python | BRhoads1155/web-scraping-challenge | /Missions_to_Mars/scrape_mars.py | UTF-8 | 2,908 | 3.09375 | 3 | [] | no_license | #Dependencies
from splinter import Browser
from bs4 import BeautifulSoup
import pandas as pd
import time
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {'executable_path': 'chromedriver.exe'}
return Browser('chrome', **executable_path, headless=Fal... | true |
eb368a5df2dab84cf2f18fef959b299ca2306b5d | Python | yjthay/Project-Euler | /ProjectEuler Q064.py | UTF-8 | 691 | 2.859375 | 3 | [] | no_license | # referred to algo from https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Continued_fraction_expansion
periodlist=[]
for S in xrange(1,10001):
if (S**0.5).is_integer():
next
else:
a0=int(S**0.5)
a=int(S**0.5)
m=0
d=1
answerlist=[]
count=0... | true |
6aef807b0545762daca66aede84f78bb754cf370 | Python | jpolitron/kattis-problems | /j/ss.py | UTF-8 | 378 | 3.15625 | 3 | [] | no_license | my_info = 'The capital of france is Paris'
top_weekend_movies = ['Black panther', 'Peter Rabbit', 'Fifty Shades Freed', 'Jumanji: welcome ot the jungle', 'The 15:17 to Pari ']
movie_name = my_info[-6:-1] + ' blues'
if movie_name in top_weekend_movies:
print(f'{movie_name} made it into the top movies!')
else:
pr... | true |
5d572332a7a5b4d3bf0907ae922044d8a160517b | Python | cwalker4/youtube-recommendations | /youtube_follower/utils.py | UTF-8 | 7,565 | 2.6875 | 3 | [] | no_license | import os
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
KEY_LOC = os.path.join(os.path.dirname(__file__), '../credentials/api_key.txt')
with open(KEY_LOC, 'r') as f:
DEVELOPER_KEY = f.read()
YOUTUBE_API_SERVICE_NAME = 'youtube'
YOUTUBE_API_VERSION = 'v3'
youtube = build(... | true |
ddcd7dfb4e5dbb69bc659cf6c3d7cf1fe732f753 | Python | viniciushedler/prog1 | /mercado.py | UTF-8 | 1,491 | 3.625 | 4 | [] | no_license | import datetime
class Produto():
'''Produto(nome,preco)'''
def __init__(self, nome, preco):
self.nome = CharField
self.preco = preco
class Item():
'''Item(produto,qtd)'''
def __init__(self, produto, qtd):
self.produto = produto
self.qtd = qtd
def get_preco(self):
... | true |
981aeda14a51110562829de09903af4b870c76aa | Python | atm1992/LFM | /util/read.py | UTF-8 | 4,181 | 3.15625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import os
import csv
def get_item_info(input_file):
"""获取每个电影的标题以及分类"""
if not os.path.exists(input_file):
return {}
item_info = {}
with open(input_file, newline='') as f:
data = csv.reader(f)
header = next(data)
for item in data:
if... | true |
21a3384c6fe431da597b5faffa4faf6f1f90b376 | Python | moey920/Data-Analysis | /[실습] 프로젝트(2) Tip 데이터 분석하기.py | UTF-8 | 14,265 | 3.890625 | 4 | [] | no_license |
# coding: utf-8
# # [실습] 프로젝트 (2) : Tip 데이터 분석하기
# ### Tip 데이터셋에서 가장 높은 Tip을 받기 위한 전략 짜기
# ### 학습 목표
# - 각 테이블 별로 전체 금액, 팁 금액, 성별 등의 정보가 담겨있는 Tip 데이터셋을 자세히 살펴본다.
# - 데이터를 pandas, numpy, matplotlib 등의 패키지로 다루는 데에 익숙해진다.
# - 각 Column별로 Tip이 높아지는 경향성을 찾아보며 어떤 특징의 테이블에 언제 가야 더 많이 받을 수 있는지 분석해본다.
# ---
# ## Contents
... | true |
d7213d371513e09c11837cc200839248a4d5196c | Python | aseembrahma/projeuler | /prob50.py | UTF-8 | 2,229 | 3.171875 | 3 | [] | no_license | import sys
from time import time
prime_list = []
def build_primes(n):
global prime_list
bit_list = [True for x in range(2, n+1)]
for i in range(len(bit_list)):
if bit_list[i]==False: continue
x = i+2
prime_list.append(x)
temp = x+x
while temp <= n:
... | true |
27a1de721ec1b7715cc478594309144f00f366fa | Python | Kyrk/Google-Fruit-Store-Project | /health_check.py | UTF-8 | 2,711 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
'''Script to run in background monitoring system statistics: CPU usage, disk
space, available memory, and name resolution.
Sends email if there are problems, such as:
- Report error if CPU usage is over 80%
- Report error if available disk space is lower than 20%
- Report error if ava... | true |
f1e5ce4744e0411df1d22b26fc101264e64a779b | Python | justin-xing/ics3u-wave1 | /area.py | UTF-8 | 227 | 4.25 | 4 | [] | no_license | length = float(input("Input the length of the field in feet."))
width = float(input("Input the width of the field in feet."))
area0 = length * width
area = str(area0 / 43560)
print("The area of the field is " + area + " acres") | true |
7fc4ae7d6005275d311f335e1379ee05df9e0faa | Python | immanuelw/PyMegaman | /py_megaman.py | UTF-8 | 5,000 | 2.703125 | 3 | [] | no_license | #Testing the entire Environment
import random
import pygame
import sys
from pygame.locals import *
from character import Character
from geom import Geometry
from bg import Background
from env import Environment
from entity import *
from config import *
from levels import *
from weapons import *
pygame.init()
clk = p... | true |
f669d96d8083ea74cbe4e27da8a9d1e11183d847 | Python | ardmhacha24/garageautomation | /prototypes/sensortesting_script2.py | UTF-8 | 1,179 | 2.96875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
import sys
GPIO.setmode(GPIO.BCM)
# This is the GPIO pin number we have one of the door sensor
# wires attached to, the other should be attached to a ground
# Bottom of door Sensor
DOOR_SENSOR_PIN_BOTTOM = 18
DOOR_SENSOR_PIN_TOP = 24
# Initially we don't know if the door sensor is... | true |
2d2bd6a0a5a8e02d18edde0c2f9c10b3a6369252 | Python | AleksandrTitov63/sphere_bda_spring_2021 | /01.pyhton_intro/hw/E.py | UTF-8 | 436 | 3.765625 | 4 | [] | no_license | def build_char_counter(word):
counter = dict()
for letter in word:
counter[letter] = counter.get(letter, 0) + 1
return counter
size = int(input())
counter_to_words = dict()
for _ in range(size):
new_word = input()
counter = frozenset(build_char_counter(new_word).items())
counter_to_wor... | true |
6d2888f4ff063de8fe84f0984c329efe5b0ee766 | Python | zanbeel/my_previous_learnings | /String2.py | UTF-8 | 1,405 | 3.90625 | 4 | [] | no_license | # how to use sbstr
parrot = "Norwegian Blue"
print(parrot)
print(parrot[-11])
print(parrot[-10])
print(parrot[-5])
print(parrot[-11])
print(parrot[-8])
print(parrot[-6])
print()
print(parrot[3])
print(parrot[4])
print(parrot[9])
print(parrot[3])
print(parrot[6])
print(parrot[8])
print()
print(parrot[3 - 14])
pr... | true |
47ea197589bb0538072f2385ac62cab9bad64fc6 | Python | dpcalpa/flask-server | /app/tests/test.py | UTF-8 | 506 | 2.578125 | 3 | [] | no_license | import unittest
# some_file.py
import sys
# insert at 1, 0 is the script path (or '' in REPL)
sys.path.insert(1, '../prueba-k8/app')
from app import *
class MyTests(unittest.TestCase):
##Unit test for index()
def test_index(self):
self.assertEqual(index(), """
<h1>Python Flask in K8s!</h1>
"""... | true |
eb20d282dee8b24a20eaeb164682cba10b99042a | Python | JacopoSilvestrin/rosneuro-GUI | /bciloop_utilities/proc_fisher2.py | UTF-8 | 1,592 | 2.90625 | 3 | [] | no_license | import numpy as np
# Input:
# - P data matrix []
# - Pk label vector (Only two classes allowed[samplesx1])
# - NSTD Outliers removal. Number of standard deviation to
# consider a sample as outlier [default: empty list]
# - do_balance Balancing classes [defa... | true |
0acadc79127f5cc53cb616bac3e31c2ef120822f | Python | shahzadhaider7/python-basics | /17 ranges.py | UTF-8 | 926 | 4.625 | 5 | [] | no_license | # Ranges - range()
range1 = range(10) # a range from 0 to 10, but not including 10
type(range1) # type = range
range1 # this will only print starting and last element of range
print(range1) # this will also print same, starting and last element
list(range1) # this will list the whole range from... | true |
9ac47d063b5a74965ecdb08285929cc172a94774 | Python | mjlavin80/aps-elastic-scripts | /insert_25k.py | UTF-8 | 2,130 | 2.546875 | 3 | [] | no_license | def insert_25_elastic(folder, myindex):
import glob, json
from elasticsearch import Elasticsearch
#print("reading json")
try:
with open("%s.json" % folder) as c:
myjson = c.readlines()
except:
print("No bulk file found for %s" % folder)
myfiles = glob.glob("/aps... | true |
61df8d717f3bbfc0bad2522c7d334f5d1d3e1c3e | Python | YoyinZyc/Leetcode_Python | /Array/Pro42_Trapping_Rain_Water.py | UTF-8 | 1,024 | 3.015625 | 3 | [] | no_license | '''
Array_Hard
9.14 11:04pm
'''
from collections import deque
class Solution(object):
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
heightIndex = deque()
area = 0
for i, h in enumerate(height):
if not heightIndex:
... | true |
6fd2b2ad22fb42889d960b942d13d24ab3d6d4b2 | Python | shukhrat17/Python-Modbus | /PythonModbus/Debug.py | UTF-8 | 518 | 2.640625 | 3 | [] | no_license | ##################################################
# Yuldashev Shuhrat #
# Mikroelektronika plyus 2020, 12.01 #
# For printig Debug messages #
##################################################
import sys
class Debug:
def __init__(sel... | true |
86483ffded970770240b3c917772fa03d7a4cbf4 | Python | Reathe/Qubic | /src/networking/client.py | UTF-8 | 4,096 | 2.953125 | 3 | [
"MIT"
] | permissive | import socket
from typing import Dict, Any, List
import jsonpickle
from model.qubic import Qubic
from networking.rooms import Room
class Client:
HOST, PORT = "qubicgame.ddns.net", 9999
# HOST, PORT = "localhost", 9999
def __init__(self, name, id=None, *args, **kwargs):
super().__init__(*args, **kwargs)
self... | true |
d31f76733cbec5f5fc063df4aba072424064148c | Python | risd/steam | /map/management/commands/delete_map_data.py | UTF-8 | 2,696 | 2.546875 | 3 | [] | no_license | """
This should take command line options
for deleting different sets of data.
For now, commenting out the bits that
are not relavent, and mentioning printing
that to the console, as a reminder for
future use.
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models impo... | true |
64e8bb650c9765ebb2dd314f6b42cb7f0ce3c54c | Python | chris-wood/ccn-pbe | /src/overhead.py | UTF-8 | 6,741 | 2.609375 | 3 | [] | no_license | # general stuff
import sys
import os
import random
import time
# matplot lib stuff
import matplotlib.lines as mlines
import matplotlib as mpl
import matplotlib.pyplot as plt
import math
import numpy as np
# crypto stuff
import hashlib
from Crypto.Cipher import AES
# experiment settings
fileName = sys.argv[1]
minPayl... | true |
2e60b9e796388641ea0aed8c3fd46ecfb8c00763 | Python | HalcyonBrendan/LinePrediction | /OddsPrediction/HalcyonNHLdb.py | UTF-8 | 972 | 2.9375 | 3 | [] | no_license | import MySQLdb
from config import CONFIG as config
class HalcyonNHLdb(object):
def __init__(self):
self.db = MySQLdb.connect(passwd=config["mysql"]["pw"],host="localhost",user="root",db="halcyonnhl")
self.cursor = self.db.cursor()
def execute_command(self, command_string):
self.cursor.execute(command_string)... | true |
a7a719b42b92083989ecb7f02f0cd0c5bf3b171c | Python | TejaYenduri/Python | /Banking App/DpAccHolders.py | UTF-8 | 227 | 2.734375 | 3 | [] | no_license | import os
def displayAccHolders():
names=[]
for file in os.listdir(os.getcwd()):
if file.endswith(".txt"):
with open(file,'r') as fileobj:
data=fileobj.readlines()
names.append(data[1].split(':')[1])
return names | true |
8d4b5e5955a82d87557cb33ea0227eabd28d406e | Python | razasaddiqi/Python-Game | /game.py | UTF-8 | 1,795 | 3 | 3 | [] | no_license | import pygame
pygame.init()
s_width = 500
s_hight = 500
pygame.display.set_caption('Brick Break-Game')
screen = pygame.display.set_mode((s_width,s_hight))
slider_colr = (0,0,255)
slider_x = s_width/2
slider_y = 490
slider_width = 150
slider_hit = 15
ball_x = 235
ball_y = 472
ball_r = 7
ball_w = 7
x_vel ... | true |
32733998a739bd53f635695df3a6f58d1e9e67e2 | Python | Xeoul/projects | /Python/A2 Vincent Lam PYTHON 328#7.py | UTF-8 | 2,771 | 4.40625 | 4 | [] | no_license | print("#--------------------------------------------------------")
print("# Name: Vincent Lam ")
print("# Date: June 18,2020 ")
print("# Problem: Page 328, #7 ")
print("# Title: Test Average and Grade ... | true |
f5ad0cf954d4bed1cebacb4f63b97fd08aa490d8 | Python | sdss/observesim | /bin/gen_weather | UTF-8 | 4,976 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import argparse
import os
import sys
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
from observesim.weather import Weather2
def generate_weather(model_fname, mjd0, mjd1, n_realizations, n_burnin=24*14, seed=None):
"""
Generates a set of realizations of clo... | true |
e94c9637fcc2c4e558dda88ad86fd730589fcdc2 | Python | choplet/homework | /planner/_planner/__init__.py | UTF-8 | 2,468 | 3.390625 | 3 | [] | no_license | import sys
from datetime import date
import sys
from _planner import storage
get_connection = lambda: storage.connect('planner.sqlite')
def action_show_menu():
'''Отображает меню'''
print('''
1. Добавить задачу
2. Найти задачу
3. Вывести все задачи
4. Удалить задачу
5. Показать все задачи в категории
m. Показать ме... | true |
76cd00fac9a38322fc3d1e45dbad938ec5a31a9b | Python | dustinboswell/daily-coding-problem | /prob16.py | UTF-8 | 1,389 | 4.09375 | 4 | [] | no_license | '''
You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accomplish this, with the following API:
record(order_id): adds the order_id to the log
get_last(i): gets the ith last element from the log. i is guaranteed to be smaller than or equal to N.
You should be ... | true |
f454e36f403650251fdc9ffeb31376eb993fdc1f | Python | f-chapuis19/Projet_Iot | /Server_controller/db_control.py | UTF-8 | 1,451 | 3.3125 | 3 | [] | no_license | import sqlite3
import json
from datetime import datetime
DB_PATH = 'db/server_data.db'
def Db_connect():
connection = None
try:
connection = sqlite3.connect(DB_PATH)
except sqlite3.Error as e:
print("An error occurred:", e.args[0])
return connection
def Db_close():
sqlite3.conne... | true |
c67f48250c27bec5c2531f0e4502e6db875f123c | Python | zingkg/common-python | /Key.py | UTF-8 | 461 | 3.03125 | 3 | [] | no_license | from PrivateKey import PrivateKey
from PublicKey import PublicKey
__author__ = 'zingkg'
class Key(object):
def __init__(self, modulus, coprime, multiplicative_inverse):
self.public_key = PublicKey(modulus, multiplicative_inverse)
self.private_key = PrivateKey(modulus, coprime)
def encrypt(sel... | true |
879f968d00aa90f2d2c7f04d78579376d36bfab0 | Python | hardhatdigital/laser-drift | /test/processes/race.py | UTF-8 | 2,953 | 2.703125 | 3 | [
"MIT"
] | permissive | import unittest
import laserdrift.processes.race as r
from unittest.mock import MagicMock, Mock, call, patch
from multiprocessing import Queue, Pipe
class TestRace(unittest.TestCase):
def mock_queue(self, items):
self.queue = items.copy()
q = MagicMock()
q.get = Mock()
q.get.side_ef... | true |
19987b550898f8638bf44c95a6d5dfb6159eb50c | Python | artemmarkaryan/ugly_algorithms | /20.02/longest_increasing_sequence.py | UTF-8 | 338 | 2.78125 | 3 | [] | no_license | n = list(
map(
int,
input().split()
)
)
foo = [1 for _ in range(len(n))]
flag_increasing = True
sequence = 1
max_i = 0
for i in range(1, len(n)):
max_j = 0
for j in range(0, i):
if n[j] < n[i]:
max_j = max(max_j, foo[j])
foo[i] += max_j
max_i = max(max_i, foo... | true |
97bee6a64167c7d718e6fedd34fb39eacde8e5ae | Python | jfrank1120/EZ_Garage | /garageData.py | UTF-8 | 4,658 | 2.578125 | 3 | [] | no_license | #ARC
import spaceData
from google.cloud import datastore
from garage import Garage
from space import Space
_GARAGE_ENTITY = 'Garage'
def log(msg):
"""Log a simple message."""
print('GarageData: %s' % msg)
def getClient():
client = None
try: # When we run 'gcloud app deploy' this will work and it w... | true |
234cd8029a025239ec5d08fa37080e2b7ed66252 | Python | edujtm/diversify | /diversify/session.py | UTF-8 | 13,792 | 2.9375 | 3 | [
"MIT"
] | permissive | """
This module makes the connection to the spotify WEB API to get information
on the user music preferences. It is able to write csv files for playlists
to be analyzed with future modules.
The goal with this module is to make the spotify data available in a simple
way for local analysis and inter... | true |
6d41396cfd64c4da27540ee836622296513809fb | Python | Muskan-sh/Contact-Manager | /contact_manager/search.py | UTF-8 | 2,316 | 2.671875 | 3 | [] | no_license | import tkinter.messagebox as messagebox
from tkinter import *
from contact_manager.conn import myconnection
name_s = None
num1_s = None
num2_s = None
email_s = None
def search_fu(right_display: Frame):
label1 = Label(right_display, text='Name : ', width=20, bg='azure2', font='hadriel 14')
label... | true |
70d10502c3b16b0c7aa26f16a94108070d5f3a3e | Python | balshetzer/advent-of-code-wim | /aoc_wim/aoc2020/q01.py | UTF-8 | 795 | 3.71875 | 4 | [
"WTFPL"
] | permissive | """
--- Day 1: Report Repair ---
https://adventofcode.com/2020/day/1
"""
from collections import Counter
from aocd import data
def find_pair(counter, target=2020):
# find a pair of numbers from the multiset (counter) which sums to target
for number in counter:
diff = target - number
if diff in... | true |
ff8f331732bb416377ebf23f4f5b5abd3130fbe2 | Python | Alex2034/Meteor-Project | /Nitka.py | UTF-8 | 5,145 | 3.1875 | 3 | [] | no_license | from tkinter import *
import math
import time
root = Tk()
canv = Canvas(root, width=1000, height=800, bg='white')
canv.pack(fill=BOTH, expand=1)
class Ball:
def __init__(self): # создание шарика
self.x = 0
self.y = 0
self.Vx = 0
self.Vy = 0
se... | true |
9e4a3da8f581bc1dc110464808bb1d773952e660 | Python | Shirly100/myLibrary- | /books_status.py | UTF-8 | 716 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 18:25:41 2019
@author: Shirly
"""
import sqlite3
import datetime
from collections import deque
def connect_db():
return sqlite3.connect('myLibrary.db')
from enum import Enum
class Status(Enum):
available = "available"
borrowed= "borrowed"
... | true |
6f92ea2e25a894f906d82798869c59075966e0b9 | Python | koking0/Algorithm | /LeetCode/Problems/207. Course Schedule/code.py | UTF-8 | 1,045 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-H -*-
# @Time : 2020/H/4 9:13
# @File : code.py
# ----------------------------------------------
# ☆ ☆ ☆ ☆ ☆ ☆ ☆
# >>> Author : Alex 007
# >>> QQ : 2426671397
# >>> WeChat : Alex-Paddle
# >>> Mail : alex18812649207@gmail.com
# >>> Github : https://gi... | true |
245428a83df31de597b3ce3d40969d5a970d1e89 | Python | nishantyaji/ProjectEuler | /Problem102.py | UTF-8 | 1,434 | 3.765625 | 4 | [] | no_license | import requests
import numpy
def readTo2DArray():
url = 'https://projecteuler.net/project/resources/p102_triangles.txt'
response = requests.get(url)
data = response.text
lines = data.split('\n')
lines = lines[:len(lines)-1] #Last line is empty
array2d = numpy.zeros((len(lines),6))
index =... | true |
eca3b7e0a697e3f15c90bbc7ebab1087d2d2708e | Python | jamgochiana/evMDP | /sim/python/src/energyGMM.py | UTF-8 | 7,121 | 3.421875 | 3 | [] | no_license | import numpy as np
from scipy import stats
class energyGMM(object):
"""
Saves relevant information from scikit-learn GaussianMixtureModel class.
Also can perform exact inference, mean finding, etc
Attributes:
weights_
means_
covariances_
time_range
obs... | true |
72b2ac45637dce85313eaece3b4b3a1ea34bd2e4 | Python | Sky-zzt/lintcodePractice | /pythonAlgorithm/tree/defTree.py | UTF-8 | 393 | 3.265625 | 3 | [
"MIT"
] | permissive | class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
tree = TreeNode(1)
tree1 = TreeNode(2)
tree2 = TreeNode(5)
tree3 = TreeNode(3)
tree4 = TreeNode(4)
tree5 = TreeNode(6)
# tree6=TreeNode(7)
tree.right = tree3
tree.left = tree1
# tree1.right = tree4
tree1.le... | true |
f5c6ac79ef723cce16d309ff658ca40fffa490e3 | Python | Lewis-blip/python | /test2.py | UTF-8 | 1,899 | 4.15625 | 4 | [] | no_license | #boolean
is_available = True
is_active = False
print(type(is_available))
full_name = "Frank John"
get_by_index = full_name[0]
print(get_by_index)
get_by_index = full_name[1:3]
print(get_by_index.upper()) #upper case method
print(len(get_by_index)) # length fuction
#Data Structure
#list
#first method of creating a... | true |
be82d78d76754c5d5e5ae2d8f858d8bbebbeb507 | Python | JinkelaCrops/nn-segment | /label/labelizer.py | UTF-8 | 2,138 | 2.90625 | 3 | [] | no_license | import re
import random
class Labelizer(object):
def __init__(self, label_file_path, line_break="\n\n"):
self.f = open(label_file_path, "r", encoding="utf8")
self.line_break = line_break
self.data = []
self.data_reshape = []
def process(self):
with self.f:
... | true |
5853f168993b7179cc9791c521e9cb316ba634d1 | Python | rheehot/Algorithm_problem | /Hash_bestalbum.py | UTF-8 | 1,116 | 3.25 | 3 | [] | no_license | #장르별 가장 많이 재생된 노래를 2개씩 모아 베스트앨범 만듬
#총 재생횟수가 가장 많은 장르부터 수락함(가장 횟수가 많은 곡 부터, 횟수 같으면 고유번호 작은것 부터 수락)
from collections import defaultdict
def solution(genres, plays):
answer = []
#genre_dict = {장르: [(재생횟수, 노래고유번호),..] }
genre_dict = defaultdict(list)
for i, genre, play_n in zip(range(len(genres)), g... | true |
b3ba20bedb1a1c4540b3de8ccf2d9c359fcdc846 | Python | stdiorion/competitive-programming | /contests_atcoder/abc193/abc193_b.py | UTF-8 | 185 | 3.03125 | 3 | [
"BSD-2-Clause"
] | permissive | INF = float("inf")
n = int(input())
ans = INF
for _ in range(n):
a, p, x = map(int, input().split())
if a < x:
ans = min(ans, p)
if ans == INF:
ans = -1
print(ans) | true |
9dca3e5812ee1ef89e83b91cf6878132362c335a | Python | ChenliangLi205/LeetCode | /Q56MergeIntervals.py | UTF-8 | 705 | 3.359375 | 3 | [
"MIT"
] | permissive | # Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
if len(intervals) <= 1:
... | true |
c691fbadd920110a94bdcb64c7f1acc484ff684d | Python | msabramo/Doula | /doula/log.py | UTF-8 | 518 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import BashLexer
import os
def get_log(job_id):
"""
Grabs a log file for a job and highlights the text with Pygments
for display to the user
"""
log = ''
log_name = os.path.join('/var/log/doula', ... | true |
29bb0bf36d66c6e8457f1b27ea247226928c72fd | Python | cbogithub/AutoLock | /faceRecognition.py | UTF-8 | 1,137 | 3.046875 | 3 | [] | no_license | import cv2
import numpy as np
# Create window for image display
CASCADE_FN = "haarcascade_frontalface_default.xml"
# The scale used for face recognition.
# It is important as the face recognition algorithm works better on small images
# Also helps with removing faces that are too far away
RESIZE_SCALE = 3
RECTANGE_CO... | true |
97018d2e289d069d8fe1ada21fed9c7e8cce9a75 | Python | jafophx/ms-identity-python-flask-webapp-authentication | /authenticate_users_in_my_tenant.py | UTF-8 | 2,690 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | from flask import Flask, Blueprint, session, redirect, url_for
from flask_session import Session
from pathlib import Path
import config as dev_config
import os, logging
"""
Instructions for running the app:
LINUX/OSX - in a terminal window, type the following:
=======================================================
... | true |
90378e30692aae7e4a1daec6d06b794d9b7028a6 | Python | wwang184/BoyStory | /testtime.py | UTF-8 | 112 | 2.734375 | 3 | [] | no_license |
from HtmlParser import time_parser
import re
A = [1,2,3]
for i in range(len(A)):
A[i]= A[i] + 1
print(A) | true |
e36ad34a0318deab02d0720c7649ddeebeaec50f | Python | lautarocastillo/weather-station | /dht22.py | UTF-8 | 359 | 2.6875 | 3 | [] | no_license | import Adafruit_DHT
import board
import busio
class Dht22:
def __init__(self, pin):
self.pin = pin
self.sensor = Adafruit_DHT.DHT22
def read(self):
humidity, temperature = Adafruit_DHT.read_retry(self.sensor, self.pin)
return {
"humidity": humidity,
... | true |
4849bf8f6c36be1dd6c5cceccc88a54e732c84bf | Python | arrdem/calf | /tests/test_parser.py | UTF-8 | 5,386 | 3.484375 | 3 | [
"MIT"
] | permissive | """
Tests of calf.parser
"""
import calf.parser as cp
from conftest import parametrize
import pytest
@parametrize("text", [
'"',
'"foo bar',
'"""foo bar',
'"""foo bar"',
])
def test_bad_strings_raise(text):
"""Tests asserting we won't let obviously bad strings fly."""
# FIXME (arrdem 2021-03... | true |
c32cf32c8552e4df1ffccea02c45eb0907a6a807 | Python | kmalhan/state_space_vehicle_trailer | /state_space_vehicle_trailer/core.py | UTF-8 | 4,570 | 3.234375 | 3 | [
"MIT"
] | permissive | import datetime
import json
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib import animation
"""
Class implementation of state space model for vehicle and trailer
"""
class StateSpaceModel:
def __init__(self):
self.log('Start State Space Modeling..... | true |
3c38959fc4dd02415889c0b62d3dd001d4d851ab | Python | paulosmolski/exercism | /python/isbn-verifier/isbn_verifier.py | UTF-8 | 382 | 3.265625 | 3 | [] | no_license | def is_valid(isbn):
isbn = [x for x in isbn if x in "X0123456789"]
L = []
for x in isbn:
if x.isdigit():
L.append(int(x))
elif x == 'X' and isbn.index(x) == len(isbn)-1:
L.append(10)
if len(L) != 10: return False
sum = 0
for value, item in enumerate(L):
... | true |
25a238627f7c8fb6baedee7f0c2603d2224ad476 | Python | TiwariPradyumn/Math-Formulae | /mathFormula.py | UTF-8 | 814 | 4.375 | 4 | [] | no_license | import math
class MathFormula:
import math
def __init__(self):
pass
def areaOfcircle(self,radius):
a=math.pi*radius*radius
return f" Area of this circle is {a} "
def perimeterOfcircle(self,radius):
perimeter=2*math.pi*radius
return f"Perimeter of... | true |
5ed51ec88adc3580ad5f14d80a1994bbfef3dcc8 | Python | gorpo/Bases-python | /redimensiona_marcadagua_base.py | UTF-8 | 774 | 2.765625 | 3 | [] | no_license | from PIL import Image
import os, sys
imagem = 'teste.jpg'
#imagem de entrada e marca dagua
imagem_entrada = Image.open(imagem)
watermark = Image.open('watermark.png')
# redimensiona imagem de entrada para 250px
imagem_entrada = imagem_entrada.resize((250, 250), Image.ANTIALIAS)
#pega as medidas da i... | true |
5265fb2b00391c375cba4f82067925795c80e474 | Python | KunyiLiu/algorithm_problems | /kunyi/data_structure/linked_list/convert-binary-search-tree-to-sorted-doubly-linked-list.py | UTF-8 | 1,375 | 3.8125 | 4 | [] | no_license | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: root of a tree
@return: head node of a doubly linked list
"""
def treeToDoublyList(self, root):
# inorder traverse ... | true |
031aa16f3a25c8ae06cd9e39413b443f236c9001 | Python | kushal177/hobbyProjects | /AffineTransformationMatrixCalc/calcAffineTrans.py | UTF-8 | 1,805 | 2.734375 | 3 | [] | no_license | import numpy as np
#from affineMatFromPoints import affine_matrix_from_points
from loadPts import load_points
from matplotlib import pyplot as plt
# read the points
pts_file1 = 'MatchedPointsAll_1'
Hl_1 = 'Hl_1'
pts = load_points(pts_file1)
#print('pts: \n', pts)
x1_y1 = pts[:,[0,1]]
#print('(X1,Y1) pts: \n', x1_y1)
... | true |