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 |
|---|---|---|---|---|---|---|---|---|---|---|
30b09b68189f254485f576275fe69cd20e1db243 | himewel/airport_streaming | /airflow/dags/spark/mock_dim_dates.py | UTF-8 | 2,932 | 2.90625 | 3 | [] | no_license | # This script has the objective of generate a table with dates and some info
# related to the dates as halfyear name, quarter year name, etc.
#
# Expected arguments:
# - storage_filepath: filepath in storage to fill the output
# - start_date: start of the range of dates to be generated
# - end_date: end of the ra... | true |
c7bfb7606c681c41c47abf69a287c65f8046302c | malithsen/Euler-solutions | /level22.py | UTF-8 | 823 | 3.296875 | 3 | [] | no_license | values = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7,
'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14,
'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21,
'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26, 'A': 1, 'B': 2,
'C': 3, 'D': 4, 'E': 5, 'F': ... | true |
7d39d55046187a81402bfd84bfafb45c40bbfa7a | mrGoncharuk/liver_disease_recognizer | /notebooks/blahblahblah (2).py | UTF-8 | 10,220 | 3.015625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from random import sample
import copy
from scipy.stats import kendalltau
# Мутация
def mutation(population_number, m, k):
index_list = []
for i in range(population_number):
chromosome = sample(range... | true |
9ce2e7082642285c0c5c3a52d7bbd45ddd5d0097 | dekelmeirom/qiskit-ignis | /qiskit/ignis/verification/randomized_benchmarking/clifford_utils.py | UTF-8 | 17,648 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | true |
c7ca6ec8d5a31bcba2b1294b77b0e0688be2641f | 909socal/Movie_Website_Project | /entertainment_center.py | UTF-8 | 1,641 | 3.03125 | 3 | [] | no_license | import media
import fresh_tomatoes
#These are my (instance variables) that are used by the class Movie in the Media.py file
toy_story = media.Movie("Toy Story",
"A story of a boy and his toys who come to life",
"http://www.gstatic.com/tv/thumb/movieposters/17420/p1742... | true |
a11d72010c99f5a808bcf8d097af80d107efc3e0 | timmyhadwen/mm-pymodule | /micromelon/leds/_leds.py | UTF-8 | 2,737 | 2.90625 | 3 | [
"MIT"
] | permissive | from .._robot_comms import RoverController, MicromelonType as OPTYPE
from ..colour._colour import _parseColourArg
_rc = RoverController()
__all__ = [
"write",
"writeAll",
"off",
]
def write(id, c):
"""
Sets the colour of a specific LED
Args:
id (int): The LED to set - must be 1, 2, 3,... | true |
a61602672aa3588f18176662a637a04d2da611d5 | swarnanjali/pythonproject | /yvh.py | UTF-8 | 215 | 2.640625 | 3 | [] | no_license | n=int(input())
a=str(n)
c=0
for i in range(len(a)):
c=c+int(a[i])
j=3
while j>0:
c=(c*10)+9
h=str(c)
s=0
for i in range(len(h)):
s=s+int(h[i])
if s==n:
print(c)
break
| true |
4186a8dfa629d4cf12194f30e925f940df4dd3d8 | Samorinho/mnist_digits | /train_mnist_model.py | UTF-8 | 523 | 2.625 | 3 | [] | no_license | import tensorflow as tf
from load_mnist_digits import x_train, y_train, x_test, y_test
# Creating the Sequential model (one input tensor and one output tensor)
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers... | true |
ffacd00fa0f05913af226269c043bf4e29b79dd8 | Tompkins/Learn-Python | /oop_py3/mylist.py | UTF-8 | 631 | 3.296875 | 3 | [] | no_license | class Mylist:
times = 0
def __init__(self, wrapped):
self.wrapped = []
for i in wrapped:
self.wrapped.append(i)
def __getitem__(self, index):
return self.wrapped[index]
def __add__(self, other):
return Mylist(self.wrapped + other)
def __iter__(self):
... | true |
bbb22ccf77a76454dae35588b70e6ff41e4de416 | alexandermedv/Prof_python4 | /main.py | UTF-8 | 1,786 | 3.40625 | 3 | [] | no_license | """Задание на итераторы и генераторы"""
import wikipedia
import hashlib
import json
class MyRange:
def __init__(self, countries):
self.countries = countries
self.start = 0
self.link = None
self.cursor = 0
def __iter__(self):
return self
def __next__(self):
... | true |
c0ea25a3844d4e3b5320275b24f7ce6b0979e170 | Cazamal/socket | /serv.py | UTF-8 | 417 | 2.859375 | 3 | [] | no_license |
import socket
host = 'localhost'
port = 50000
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((host,port))
s.listen()
print("Aguardando conexão do cliente...")
conn ,ender = s.accept()
print("Conectado em ", ender)
while True:
data = conn.recv(1024)
if not data:
print("fecha... | true |
0ba054f38746426a0a3ac4295cefa25ed2c91d71 | xuluchuan/python_prac | /day009/code/add_computer.py | UTF-8 | 966 | 4.21875 | 4 | [] | no_license | # 实现一个整数加法计算器
# 如:content = input(‘请输入内容:’)
# 如用户输入:5+8+7....(最少输入两个数相加),
# 然后进行分割再进行计算,将最后的计算结果添加到此字典中(替换None):
# dic={‘最终计算结果’:None}。
def is_int(number):
for n in number:
if not 48 <= ord(n) <= 57:
return False
else:
return True
def add_int(content):
result = 0
if conte... | true |
559e633f77a4babb9439a03fb733cfaef06e8eee | shbaek/HackerRank.Python | /Domain/ITERTOOLS/itertools_permutations.py | UTF-8 | 135 | 3.25 | 3 | [] | no_license | from itertools import permutations
list = input().split(' ')
for x in sorted(permutations(list[0],int(list[1]))):
print(''.join(x)) | true |
b3d2c8743ee8b99b844c88eb58b64328d010a7e0 | R-Wright-1/PET-Plastisphere | /2_community_succession/i_community_metabolomics/nmds.py | UTF-8 | 4,940 | 2.515625 | 3 | [] | no_license | import csv
import numpy
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.decomposition import PCA
from matplotlib.patches import Ellipse
from matplotlib.patches import Ellipse
from sklearn import manifold
import matplotlib as mpl
from scipy.spatial import distance
import matplotlib.pa... | true |
c556a038affda8f9c6590090478b2d5a927a2234 | Kubuxu/agh-assigments | /python/exercises/17_json.py | UTF-8 | 1,819 | 3.765625 | 4 | [] | no_license | import json
class Task:
def __init__(self, task, due, priority, difficulty):
self.task = task
self.due = due
self.priority = priority
self.difficulty = difficulty
def __str__(self):
return f"{self.task}\t{self.due}\t{self.priority}\t{self.difficulty}"
def __repr__(s... | true |
c6e0e9be8a8906bedcafaf050903540a058e3c75 | Durburz/eMonitor | /emonitor/modules/messages/messageutils.py | UTF-8 | 3,850 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | from datetime import datetime, timedelta
import pytz
from tzlocal import get_localzone
from apscheduler.triggers.base import BaseTrigger
from apscheduler.util import timedelta_seconds, astimezone
def calcNextStateChange(timestamp, params):
"""
Calculate next state change for given parameters
:param times... | true |
85ac6bc741dca2a378dc4f4346410a46a68d07a5 | mashagua/recommendation_system | /matrixCF/code/model.py | UTF-8 | 3,804 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os
class Singleton(type):
_instance = {}
def __call__(cls, *args, **kwargs):
if cls not in Singleton._instance:
Singleton._instance[cls] = type.__call__(cls, *args, **kwargs)
return Singleton._instance[cls]
class PS... | true |
4d623634a3b003825d6c6ecffb5b66c6ebcd1a55 | obit91/logger | /logger/keyPress.py | UTF-8 | 896 | 2.734375 | 3 | [] | no_license | ####################################################
# FILE : keyPress.py
# WRITER : Ohad_Beltzer , oBit91
# DESCRIPTION : Listens to buttons keyboard presses.
####################################################
from pynput.keyboard import Listener
import sendKey
def on_press(key):
# formats key pressed
k... | true |
1b35d16043c4ecf605a647683eb9bf6c24846b90 | scottdef/esmond | /esmond/api/client/timeseries.py | UTF-8 | 17,529 | 2.75 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | """
Handle GET and POST transactions with the esmond timeseries REST namespace.
------
Classes to handle posting data to esmond rest interface.
Example use:
ts = int(time.time()) * 1000
payload = [
{ 'ts': ts-90000, 'val': 1000 },
{ 'ts': ts-60000, 'val': 2000 },
{ 'ts': ts-30000, '... | true |
dc80890eb9ca23c89a6bc9b31cdcf2f63998aff3 | bensengupta/modelisation | /modelisation/main.py | UTF-8 | 9,862 | 3.5 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
from sys import version_info
from scipy.optimize import curve_fit
from .gen_func import Function
precision = 100
graphs, error = [], False
libraries = ["np"]
def import_libraries(*libs):
"""
Importe une... | true |
230dadf5e68fc44f5e63fdc3e076ab90b029e492 | TeoRojas/Curso_Aprende_Python_con_DBZ | /Control_de_flujo/CF_enumerate_01.py | UTF-8 | 342 | 3.40625 | 3 | [] | no_license | #Cambiar 'Vegeta' por 'Trunks' en la lista
saiyajins = ['Kakarotto', 'Vegeta', 'Bardock', 'Nappa', 'Raditz']
print('Lista de saiyajins original:')
print(saiyajins)
for n_posicion, saiyajin in enumerate(saiyajins):
if saiyajin == 'Vegeta':
saiyajins[n_posicion] = 'Trunks'
print('Lista de saiyajins modifica... | true |
1fd7fc7c46f052b75f247a96f82cea7ccc7d4262 | wangerde/codewars | /tests/python2/kyu_6/test_your_order.py | UTF-8 | 260 | 2.796875 | 3 | [] | no_license | # pylint: disable=missing-docstring
""""Your order, please"""
from python2.kyu_6.your_order import order
def test_return_correct_result():
assert order('is2 Thi1s T4est 3a') == 'Thi1s is2 3a T4est'
def test_empty_string():
assert order('') == ''
| true |
92b66089985de154422de5d04428fc07ca325d5a | osnaldy/Python-StartingOut | /chapter13/recursive_line.py | UTF-8 | 121 | 3.421875 | 3 | [] | no_license | def main():
recur_line(10)
def recur_line(n):
if n > 0:
recur_line(n - 1)
print '*' * n
main() | true |
0c9fe19bb4ec095dd592d9463748e94f667efaeb | mkulariya1/tefla | /tests/test_metrics_tf.py | UTF-8 | 5,283 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Tests for Metrics.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
from tefla.core.metrics import BleuMetricSpec, RougeMetricSpec, moses_mult... | true |
191b212183a2a343da0061f6bff19bd501601779 | rafaelperazzo/programacao-web | /moodledata/vpl_data/14/usersdata/104/5691/submittedfiles/tomadas.py | UTF-8 | 388 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
import math
#ENTRADA
t1=int(input('Digite as tomadas da primeira régua:'))
t2=int(input('Digite as tomadas da segunda régua:'))
t3=int(input('Digite as de tomadas da terceira régua:'))
t4=int(input('Digite as de tomadas da quarta régua:'))
#PROCESSAMENTO
tomad... | true |
2c054266e11f0821f5f2e22751d233bda65fdc24 | abergie5b/mtg_treasure_cruise | /src/gathering/mtgstocks.py | UTF-8 | 5,528 | 2.6875 | 3 | [] | no_license | import datetime as dt
from aiohttp import ClientSession
from sqlalchemy.orm import Session
from database import (
MTGStocksCard,
LowPrice,
HighPrice,
FoilPrice,
AvgPrice,
MarketPrice,
MarketFoilPrice
)
from gatherer import Gatherer
from logger import get_logger
class MTGStocks(Gathere... | true |
e6c7679d89837216fcb89c30ee12c14e4f6e98ac | c4software/thermal-hue | /main.py | UTF-8 | 1,247 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import argparse
from tools.bridge import init_bridge, get_temp,find_bridge
import json
import logging
from settings import BRIDGE_IP
parser = argparse.ArgumentParser()
parser.add_argument("--debug", action="store_true", help="Display debug info (lastupdated information).")
parser.add_argument("--bridge", default=0, he... | true |
2c157e95264a495c2fc51187ef195ede94d864ee | aaronhma/mathly | /mathly/linalg/matrix.py | UTF-8 | 1,617 | 2.9375 | 3 | [
"MIT"
] | permissive | from .error import MatrixError, MathlyAssertError
__all__ = []
class Matrix:
"""
Implementation of matrices.
"""
def __init__(self, matrix):
super().__init__()
# self.matrix = [[1, 2, 3], [4, 5, 6]]
self.matrix = matrix
self.used = []
# self.shape = self.get_sha... | true |
8f0d7ac9b1b567528abbe6b9ea15a93f2cbf66a1 | JohnnyVip/PythonTest | /smtp_demo/smtp_test2.py | UTF-8 | 1,597 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#SMTP电子邮件发送
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.header import Header
from email.utils import parseaddr,formataddr
#先定义署名格式化函数
def _format_addr(s):
name, add... | true |
5ec0e92b0f4e74b417a4ce485abbdc21880281ec | Kajal2000/logical_question_python | /challenge7.py | UTF-8 | 153 | 3 | 3 | [] | no_license | i = 1
q = 0
sum = 0
while i <= 10:
user = input("enter your number")
if user == q:
break
sum = sum + int(user)
ava = sum / i
i = i + 1
print ava
| true |
574bcd31627577e364f49c801461f078b3766fad | nikhilbommu/DS-PS-Algorithms | /Leetcode/LeetCode Problems/ArrangingCoins.py | UTF-8 | 288 | 3.046875 | 3 | [] | no_license | class Solution:
def arrangeCoins(self, n: int) -> int:
step = 1
count = 0
while n>0:
n -= step
step += 1
count += 1
if n>=0:
return count
return count - 1
s = Solution()
print(s.arrangeCoins(10)) | true |
37df102ac4b52798e36b2707c40dc9dddae80abc | Fingernight1/Spacenet-Building-Detection | /Preprocess Data/Split_Data.py | UTF-8 | 7,463 | 3.078125 | 3 | [] | no_license | import os
from pathlib import Path
from random import shuffle
from shutil import copyfile
def Split_Training_Data_To_Pathfiles(training_folder, dst_folder, train_ratio, val_ratio, test_ratio):
ratios_sum = (train_ratio + val_ratio + test_ratio)
if ratios_sum != 1:
train_ratio = train_ratio / ratios_su... | true |
b75f4238a24ce461e0400eb48306c360d766d8cb | RoyelBee/31BranchOutstanding | /KPIs/html_section.py | UTF-8 | 2,896 | 2.609375 | 3 | [] | no_license | import Functions.helper_functions as func
import xlrd
def get_html_table():
xl = xlrd.open_workbook('./Data/ClosedToMaturedTable.xlsx')
sh = xl.sheet_by_name('Sheet1')
th = ""
td = ""
for i in range(0, 1):
th = th + "<tr>\n"
th = th + "<th class=\"unit\">ID</th>"
for j in ... | true |
dbbf05642f767acc95838ddf76a9444452a6c1f5 | geethakamath18/Leetcode | /414.py | UTF-8 | 239 | 2.859375 | 3 | [
"MIT"
] | permissive | #LeetCode problem 414: Third Maximum Number
class Solution:
def thirdMax(self, nums: List[int]) -> int:
nums=list(set(nums))
if len(nums)>=3:
return sorted(nums)[::-1][2]
return sorted(nums)[::-1][0] | true |
c718ebf5bea98fca2b8f6dcfde1b5209a52756a9 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_77/133.py | UTF-8 | 1,290 | 3.140625 | 3 | [] | no_license | # pre-calculation part
# Let Xn be the expectation value that needed to sort array of length n
# Note that the array I mentioned above is in disjoint group(See the source for details)
#
# Then, Xn = 1 + Sigma_{i=0}^n (nCi * f(i) * Xi / n! ), n >= 3
# X0 = 0
# X1 = 0
# X2 = 2
# where f(0... | true |
8970841bb4e6b93277f5173e0411171d3f554a14 | justinvyu/deep-rl | /courses/deeprlcourse/hw1/dagger.py | UTF-8 | 5,131 | 2.609375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import pickle
from sklearn.model_selection import train_test_split
from tensorflow import keras
import gym
import load_policy
import os
import matplotlib.pyplot as plt
import tf_util
from run_trained_policy import run_policy
def main(env_name, train=True):
"""
DAgger:... | true |
8b38def125070f805e6807b772320b8bb0398039 | Joelma-Avelino/curso-em-video-python | /desafio/desafio04.py | UTF-8 | 42 | 2.9375 | 3 | [] | no_license | n = input('Digite algo: ')
print(type(n))
| true |
39439de40b3db3389e6ce87451a88a897ec806c3 | qmnguyenw/python_py4e | /geeksforgeeks/python/easy/9_16.py | UTF-8 | 4,063 | 4.125 | 4 | [] | no_license | for loop – Django Template Tags
A Django template is a text document or a Python string marked-up using the
Django template language. Django being a powerful Batteries included framework
provides convenience to rendering data in a template. Django templates not
only allow paassing data from view to template, ... | true |
0f4ecea8ea65c90f6b473e0d614e9d65d3e88ae0 | iamsabhoho/PythonProgramming | /Q1-3/csvFinalProj/csvFinalProj.py | UTF-8 | 2,079 | 3.15625 | 3 | [] | no_license | import csv
gcCount = 0
#dictionary of student id
stdid = {'Chang, Stephanie' : 20140800050, 'Chen, Cici' : 20120700011,
'Chiang, Darren': 20070200002, 'Ho, Sabrina': 20141000057,
'Huang, Daniel': 20140900054, 'Tai, Alex': 20120800023}
powerschool = {'Teacher Name:':'', 'Section:':'Python', 'Ass... | true |
2e5ea9d7eac022ce6c7b3e6def25bd0f7bf034a7 | yuyang0/falcon-plugins | /lain/600_node_monitor.py | UTF-8 | 2,232 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
import time
import json
import socket
class NodeMonitorPlugin(object):
_timeout = 5
_endpoint = "lain"
_host = socket.gethostname()
_step = 600
def __init__(self):
self._result = []
def run(self):
self._result = []
self.read_d... | true |
2c0d66e6663205d93f56ee498badeb07d1628e60 | amirkamran/smt-playground | /scripts/lmscore.py | UTF-8 | 596 | 2.546875 | 3 | [] | no_license | #!/home/akamran1/local/bin/python3.4
import kenlm, sys, getopt, gzip
def main(argv):
lmfile = ""
inputfile = ""
try:
opts, args = getopt.getopt(argv, "l:i:")
except getopt.GetoptError:
print("lmscore.py -l <lmfile> -i <inputfile")
for opt, arg in opts:
if opt == "-l":
lmfile = arg
eli... | true |
214b285a029bffc330054f6bab43b60e386fcc6e | gbezyuk/graphql-sandbox | /backend/starwars.py | UTF-8 | 726 | 3.21875 | 3 | [] | no_license | import graphene
class Episode(graphene.Enum):
NEWHOPE = 4
EMPIRE = 5
JEDI = 6
@property
def description(self):
if self == Episode.NEWHOPE:
return 'New Hope Episode'
return 'Other episode'
# Alternative syntax is as follows:
# Episode = graphene.Enum('Episode', [('NEWHO... | true |
d952c9e2c8f6502f110c606e23e8509624456bad | CambridgeProgrammerStudyGroup/machine-learning | /07-Decision-Trees/dtree.py | UTF-8 | 2,893 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
import csv
from math import log
from itertools import groupby
from pprint import pprint
with open("titanic3.clean.reordered.csv") as datafile:
reader = csv.reader(datafile)
all_passengers = list(reader)[1:]
def log2(n):
return log(n, 2)
def entropy_of_survival(passengers):
survivors = len... | true |
2394b1d78e535d940a90599c7a1dcdafdc1ea432 | Juulps/catt | /projects/twitbot/src/bot.py | UTF-8 | 3,151 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import tweepy
#from our keys module (keys.py), import the keys dictionary
from keys import keys
from pprint import pprint
import time
import random
CONSUMER_KEY = keys['consumer_key']
CONSUMER_SECRET = keys['consumer_secret']
ACCESS_TOKEN = keys['access_token']
ACCESS_TOKEN_SECRET = keys['access_... | true |
6b8fcdcbe35dd5e6167a8b73c5c6b51ab7fbd8e4 | Ananthu/think-python-solutions | /18.2.py | UTF-8 | 436 | 3.0625 | 3 | [] | no_license | class Duck :
l_suit=["clubs","diamonds","hearts","Spades"]
l_rank=[None,"Ace",2,3,4,5,6,7,8,9,10,"jack","Queen","king"]
duck=[]
def __init__(self):
for i in range(4) :
for j in range(1,14) :
self.rank=j
self.suit=i
Duck.duck.append(self)
#print "%s of %s created" %(Duck... | true |
3e04330ff62f8d9489d1c497f95bfbeb69cb386b | amstocker/Learntris | /learntris.py | UTF-8 | 10,967 | 3.015625 | 3 | [] | no_license | '''
::AUTHOR::
Andrew Stocker
::DESCRIPTION::
My implementation of Learntris for use with the Learntris test suite developed by the
#LearnProgramming community.
::LAST MODIFIED::
July 21, 2014
::NOTES::
'''
import sys
from copy import deepcopy
from random import randint
######################... | true |
2e482c2273f31e6c3d8793f1f2c3ba0aac9a9dde | joernalraun/calliope-mini-stubs | /calliope_mini/spi.py | UTF-8 | 3,799 | 3.359375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # source/microbit/microbitspi.cpp
from typing import Union
from .pin import MicroBitDigitalPin
from .pin_instances import pin13, pin14, pin15
class MicroBitSPI:
"""The ``spi`` module lets you talk to a device connected to your board
using a serial peripheral interface (SPI) bus. SPI uses a so-called
ma... | true |
b52499c5c9838a4eff103ea2a7362a9e3ea23ead | Aasthaengg/IBMdataset | /Python_codes/p02948/s811953177.py | UTF-8 | 732 | 2.609375 | 3 | [] | no_license | import sys,queue,math,copy,itertools,bisect,collections
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
N,M = LI()
data = [LI() for _ in range(N)]
dp = [0] * (M+1)
data.sort(key=lambda x:x[1], reverse=True)
N0 = 2 ** M.bit_length()
seg = [0] * (2*N0)
def seg_set(i,x):
i = i + N0- 1
seg[i] = x
... | true |
57d24949992c5a9e70cbf9994aa2b8b0fc2c8235 | zyz913614263/bookreader | /Server_9sbook/nc/app/crawl/crawler_1.py | UTF-8 | 7,737 | 2.671875 | 3 | [] | no_license | #coding:utf8
'''
Copyright (c) 2014 http://9miao.com All rights reserved.
'''
from pyquery import PyQuery as pq
import urllib,sys
class Crawler_1:
"""
代码中涉及到的地址仅开发测试案例使用,请下载后立即更换
http://www.huaixiu.net/modules/article/search.php?searchkey=%BE%F8%CA%C0%CC%C6%C3%C5&searchtype=articlename&searchbuttom=%CB%D1+%CB%F7... | true |
bf9ad410bae66cd81b5f3956ee54c56d76d0cd9a | MarineLis/DBIS3 | /Forms/PlaceFormEdit.py | UTF-8 | 624 | 2.640625 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, DateField, HiddenField, IntegerField
from wtforms import validators
class PlaceFormEdit(FlaskForm):
place_name = StringField("Name: ", [validators.Length(3, 20, "Name should be from 3 to 20 symbols")])
place_adress = StringField("Pl... | true |
c0074e3e852f8350f334566ba362e0d8835a4a80 | sylph520/geosolver | /geosolver/diagram/computational_geometry.py | UTF-8 | 7,543 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from geosolver.ontology.instantiator_definitions import instantiators
__author__ = 'minjoon'
def distance_between_points(p0, p1):
return np.linalg.norm(dimension_wise_distance_between_points(p0, p1))
def distance_between_points_squared(p0, p1):
return (p0.x-p1.x)**2 + (p0.y-p1.y)**2
def... | true |
5bb76347f235f0aec320ec3386d629374650de53 | ethanmatthews/KCC-Intro-Mon-Night | /aaron.py | UTF-8 | 952 | 3.828125 | 4 | [] | no_license | primary=input("Enter primary color:").lower()
secondary=input("Enter primary color:").lower()
if(primary=="red"):
if(secondary=="yellow"):
print("When you mix red and yellow, you get orange.")
elif(secondary=="blue"):
print("When you mix red and blue, you get purple.")
else:
print("Y... | true |
e51dfc3f7fb5e71985dff6c2fa7baf117d981b3f | xkumiyu/plot-cli | /plot_cli/options.py | UTF-8 | 3,148 | 2.65625 | 3 | [
"MIT"
] | permissive | from typing import Any, Callable, Optional
import click
import matplotlib.pyplot as plt
from .config import config
def _columns_callback(ctx, param, value):
if value is None:
return None
else:
return value.split(",")
def _validate_use_cols(ctx, param, value):
if value is None:
... | true |
0e5ae60ab7233ccfc0d3eb83afcff6577f1074a0 | gpython/python_project | /python_base/oop/base_1/desc_03.py | UTF-8 | 708 | 3.53125 | 4 | [] | no_license | from functools import partial
class StaticMethod:
def __init__(self, fn):
self.fn = fn
def __get__(self, instance, owner):
print("StaticMethod: ", self, instance, owner)
return self.fn
class ClassMethod:
def __init__(self, fn):
self.fn = fn
def __get__(self, instance, cls):
print("Clas... | true |
4681af7cfa5a0cc722a0d5767e4bcd0dc8d4c315 | eduardopds/Programming-Lab1 | /busca/busca.py | UTF-8 | 268 | 3.421875 | 3 | [] | no_license | # coding: utf-8
# Aluno: Eduardo Pereira
# Matricula: 117210342
# Atividade: Busca Linear
seq = [8, 9, 2, 3, 6, 10, 7, 9]
def busca(seq,valor):
e = 0
for i in range(len(seq)):
if seq[i] == valor:
return i
break
else:
e += 1
if e == len(seq):
return -1
| true |
dff0806c3353c657dcdad2aabc761cbc00be4905 | dankoga/URIOnlineJudge--Python-3.9 | /URI_2787.py | UTF-8 | 92 | 3.09375 | 3 | [] | no_license | rows_qty = int(input())
cols_qty = int(input())
print(1 - (rows_qty & 1) ^ (cols_qty & 1) )
| true |
0470a4ea71b065618b576f55ab119ae856a12c44 | jiankangliu/baseOfPython | /PycharmProjects/函数/reduce.py | UTF-8 | 337 | 3.171875 | 3 | [
"MIT"
] | permissive | import functools
list1 = [1, 2, 3, 4, 5]
def fun(a, b):
return a*b
reslut = functools.reduce(fun, list1)
a = reslut
print(a)
print(reslut)
print(id(a))
print(id(reslut))
a = 8
print(id(a))
list2 = [2, 44, 6567, 89]
def fun1(a, b):
return a if a > b else b
print(functools.reduc... | true |
7f60fce84598341ef28f20643c7f3aacd34e1d63 | Palamariuk/JPG-to-excel-cell-matrix | /code.py | UTF-8 | 833 | 3 | 3 | [] | no_license | import xlsxwriter
from PIL import Image
from webcolors import *
path = "" #Enter your path
fileName = input()
scale = int(input())
img_path1 = path + fileName + ".jpg"
xlsx_path = path + fileName + ".xlsx"
workbook = xlsxwriter.Workbook(xlsx_path)
worksheet1 = workbook.add_worksheet()
workshee... | true |
0e80bc8a788b81c123c65d415590b2a9afc098e8 | Irsutoro/sesame | /src/server/sesame.py | UTF-8 | 2,890 | 2.609375 | 3 | [
"MIT"
] | permissive | from server import Server
from models import BaseModel, User, EncryptingAlgorithm, Password
import peewee as pw
PBKDF2_ITERATIONS = 100000
PBKDF2_ALGORITHM = 'sha512'
SALT_LENGTH = 32
#TODO sprawdzanie duplikatów haseł i ograniczeń w bazie
class Sesame(Server):
def __init__(self, database: pw.Database):
su... | true |
53afb8cd48fc9a108f877e6a85e935cce1d87ac5 | KoSangWon/NKLCB_Algorithm | /day10/Programmers12900.py | UTF-8 | 347 | 3.203125 | 3 | [] | no_license | # 풀이 1
# def solution(n):
# DIV = 1000000007
# dp = [0] * (n+1)
# dp[1] = 1
# dp[2] = 2
# for i in range(3, n + 1):
# dp[i] = (dp[i-1] + dp[i-2]) % DIV
# return dp[n]
# 풀이 2
def solution(n):
DIV = 1000000007
a, b = 1, 1
for i in range(n):
a, b = b, a + b
return a... | true |
89a2e90cf045393cdfefba6595324ca072a1862b | metalglove/IronPython-WPF | /BBTan/Helpers/Command.py | UTF-8 | 436 | 2.609375 | 3 | [] | no_license | from System.Windows.Input import ICommand
class Command(ICommand):
"""Command class; for executing commands"""
def __init__(self, execute):
self.execute = execute
def Execute(self, parameter):
self.execute()
def add_CanExecuteChanged(self, handler):
pass
d... | true |
c5094382eae41efc9458d82afd9e206c7fe8b20c | swipswaps/SauceDemo-Automation | /pages/OverviewPage.py | UTF-8 | 1,483 | 2.96875 | 3 | [
"MIT"
] | permissive | """ POM for the checkout Overview page. """
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from pages.Page import Page
class OverviewPage(Page):
""" Overview page class. """
def __init__(self... | true |
2b9621238903aaa83e258b73a3926e0d642261cd | thenavdeeprathore/LearnPython3 | /10_oops/17_Has_A_Relationship.py | UTF-8 | 2,950 | 4.21875 | 4 | [] | no_license | """
Using Members of One Class inside Another Class:
------------------------------------------------
We can use members of one class inside another class by using the following ways
1) By Composition (Has-A Relationship)
2) By Inheritance (IS-A Relationship)
1) By Composition (Has-A Relationship):
------------------... | true |
ca353c9a272a69ef2bb8e9b31ff3eb8b51978724 | TheBigGinge/Analytics | /RyanBot/BogusProfiles/run_bogus.py | UTF-8 | 11,573 | 2.671875 | 3 | [] | no_license | # coding: utf-8
import os
import csv
import datetime
import time
import xlrd
#Paths
Log_Files_Path = '\\\\psfiler01\\data\\SurveyReports\\'
Bogus_Profile_Path = '\\\\filer01\\public\\BogusProfiles\\Processed Log Files\\'
Disabled_Path = '\\\\filer01\\public\\BogusProfiles\\Profiles Disabled\\'
Dashboard_Path = '\\\\f... | true |
003ae911b8bea6175c7614346940661e2ef063b4 | SSL-Roots/CON-SAI | /sai_visualizer/src/sai_visualizer/geometry.py | UTF-8 | 1,694 | 2.578125 | 3 | [
"MIT"
] | permissive |
class Geometry(object):
def __init__(self):
# Qt objects uses width & height
# SSL-Vision uses length & width :(
self.FIELD_WIDTH = 9.0
self.FIELD_HEIGHT = 6.0
# We hope the vision will send these parameters
self.DIST_TO_WALL = 0.3
self.D... | true |
8a5307ba1472a91d8a3d710af8ec0d6ffc580f41 | aak1247/HumanDetectionSystem | /server/models/transfer.py | UTF-8 | 767 | 2.78125 | 3 | [] | no_license | class BaseRtn():
def __init__(self, code = 0, message = "OK"):
self.code = code
self.message = message
def __dict__(self):
return {
"code": self.code,
"message": self.message
}
def __str__(self):
return str(self.__dict__())
class Rtn(BaseRt... | true |
b0d73ff01848b395a476ea0475c2a8811086ea74 | Kavint9/DP-1 | /Coin Change.py | UTF-8 | 690 | 2.765625 | 3 | [] | no_license | # Time Complexity : O(n*m)
# Space Complexity : O(n*m)
# Did this code successfully run on Leetcode : Yes
# Any problem you faced while coding this : No
class Solution:
def coinChange(self, coins: List[int], amount: int) -> int:
dp = [[(sys.maxsize-1) for i in range((amount + 1))] for i in range((len(co... | true |
fa260beeba6b2ca0c6ad46c80ca7840f6b1d3aff | lxxxxl/gpx2avi | /gps2avi_osm_static.py | UTF-8 | 2,871 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import os.path
import sys
import shutil
import urllib.request
import subprocess
import time
import base64
import gpxpy
if len(sys.argv) != 2:
print('Usage: {0} PATH_TO_TRACKFILE.gpx'.format(__file__))
exit(0)
gpx_filename = sys.argv[1]
tempdir = '{}_tmp'.format(gpx_filename)
... | true |
889d421c108e88ea95811ba887379798e2a08873 | aminesabor/Hogeschool-Utrecht | /Opdrachten/les5/5_3.py | UTF-8 | 551 | 3.578125 | 4 | [] | no_license | def test(bestandnaam):
file = open(bestandnaam)
infile = file.readlines()
file.close()
return infile
kaartnummers = test('kaartnummers.txt')
print('Deze file heeft ' + str(len(kaartnummers)))
hoogstenummer = 0
for huidigeregel in kaartnummers:
woorden = huidigeregel.split(', ')
if int(woorden... | true |
ea679b258dbd858f31afc58787029f25268ea45f | RaniaAssab/Tasks | /disease_gene_int_profile_v2.py | UTF-8 | 3,169 | 3.515625 | 4 | [] | no_license | # Use the data provided in the attached file for addressing the following questions
# Part 1: Central genes of the network
# Part 2: Identify top five diseases with similar disease-gene interaction profile
###############################################################################################
###############... | true |
17ba50ee4995ccbd6fd11168528eee0a3db82265 | CPMcshane/bourgeoisie-birds | /sprites/bird.py | UTF-8 | 925 | 3.046875 | 3 | [] | no_license | import arcade
from constants import BIRD_SCALING, BIRD_ANIMATION_FPS
from utils import file_utils
class Bird(arcade.Sprite):
""" Bird player animated sprite """
def __init__(self, folder_name: str, scale: float = BIRD_SCALING):
super().__init__(scale=scale)
# settings
self.animation... | true |
0b75db20fb0f1f5dfcf3340b7cf7fd1652d20d43 | Wuuzzaa/xmas_2017 | /nr_18.py | UTF-8 | 8,142 | 2.875 | 3 | [] | no_license | # Nicht in .py gelöst. Lösung siehe 18.jpg 1+2
#
#
# Stapel init
global nordpol
global rovaniemi
global fulda
global s1
global zuege
nordpol = [3, 2, 1]
rovaniemi = []
fulda = []
s1 = 1 # kleinste Scheibe
zuege = []
def bewege_s1():
global nordpol
global rovaniemi
global fulda
global s1
global ... | true |
d20e31b8ede110cf50fa137ac08b826f9dd4b317 | eraseunavez/wandoo | /crawling_old/old_crawler.py | UTF-8 | 352 | 2.765625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def spider(max_pages):
page = 1
while page < max_pages:
url = 'http://finance.naver.com/sise/sise_market_sum.nhn?sosok=0&page=' + str(page)
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text, 'lxml')
print soup.select(... | true |
c3569b8fd98e087f96fcbbc16db19111197a5711 | redbzi/NM-Crank-Nicolson | /cn.py | UTF-8 | 6,496 | 2.59375 | 3 | [] | no_license | import numpy as np
import sys
from datetime import datetime # speed of the algorithm
from math import asinh, sinh, exp
from scipy.sparse import spdiags, csc_matrix, lil_matrix
from scipy.sparse.linalg import inv
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
#################### ... | true |
ff117afadfca9010ad661ca5c6ca180a7d376de4 | reihan35/1RE01_PRIMALITY_TEST_MINI_PROJECT | /programme-4.py | UTF-8 | 2,157 | 3.859375 | 4 | [] | no_license | def fonc2(a,n):
"""int->int
calcul a^(n-1)% n sans calculer a^(n-1) """
k=1
i=0
while i<n-1:
k=(k*a)%n
i=i+1
return k
def fonc3(a,n,p):
"""int->int
calcul a^(n-1)% n sans calculer a^((n-1)/p)%n"""
k=1
i=0
while (i<(n-1)//p):
k=... | true |
b9bc71766bbf867126806a924513747e9a1c2901 | TwitterDataMining/DataCollection | /social_network_collection/update_user_ids.py | UTF-8 | 1,957 | 2.5625 | 3 | [] | no_license | # Python 3 program
import argparse
import datetime
import logging
import time
from pymongo import MongoClient
# Global variable
TVSHOWS = ["Powerless", "24Legacy","LegionFX"]
# Time range is last 48 hours
TWO_DAY_IN_MILLISECONDS = 2 * 24 * 60 * 60 * 1000
# Document status
PENDING = "pending"
# Input arguments
PROGR... | true |
62f877130174d0f4436aae530f37fb1d8c53d027 | vivek28111992/DailyCoding | /problem_#61_16042019.py | UTF-8 | 1,122 | 4.03125 | 4 | [
"MIT"
] | permissive | """
Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
Implement integer exponentiation. That is, implement the pow(x, y) function, where x and y are integers and returns x^y.
Do this faster than the naive method of repeated multiplication.
For example, pow(2, 10) should... | true |
e8036838e092eac65ef0a4ca6d39151a1007c48e | PostDiplomeTypographieLangageESADAmiens/fbWorkshop2016November | /roboFont/margins.py | UTF-8 | 94 | 2.671875 | 3 | [
"MIT"
] | permissive | font = CurrentFont()
for glyph in font:
glyph.leftMargin += 5
glyph.rightMargin += 5
| true |
0f4d10d039e4462c6b41e13282286b6a91704cdd | lizhenQAZ/code_manage | /Python3.5/Native/E4_MultipleProcess.py | UTF-8 | 439 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from multiprocessing import Process
import time
def func1():
for i in range(5):
time.sleep(2)
print('study' + str(i))
def func2():
for i in range(5):
time.sleep(2)
print('sleep' + str(i))
if __name__ == '__main__':
p1 = Process(target=func1)
p2... | true |
bea83feb67e3a6c4dc3db3d8d912c26665d0f886 | neko-suki/CarND-Behavioral-Cloning-P3 | /old/model_augment.py | UTF-8 | 1,950 | 2.8125 | 3 | [
"MIT"
] | permissive | import csv
import cv2
import numpy as np
def read_csv():
lines = []
with open("data/driving_log.csv", "r") as f:
reader = csv.reader(f)
for line in reader:
lines.append(line)
return lines
def read_images(lines):
images = []
measurements = []
for i in range(1, len(l... | true |
9fa372b8d558a8a10461059d2592269b49aba2d0 | siddarthjha/Python-Programs | /Tkinter/tk_9.py | UTF-8 | 305 | 2.8125 | 3 | [] | no_license | import tkinter as tk
import tkinter.messagebox as m
t = tk.Tk()
t.geometry('100x100')
s = tk.Message(t)
m.showinfo('Mr.Jha', 'I am message box created by Mr.Jha')
def fun():
t1 = tk.Toplevel(t)
t1.mainloop()
b = tk.Button(t, text='Open', command=fun)
b.pack()
t.mainloop()
| true |
607729bb03d4f87b7e365d2790b6566afe65c567 | balazsprog/pyt.ed.datafileprocessing | /xml/xmletree.py | UTF-8 | 409 | 2.75 | 3 | [] | no_license | import xml.etree.ElementTree as ET
filename = 'example_files/plants.xml'
catalog = []
tree = ET.parse(filename)
plants = tree.getroot()
for idx, plant in enumerate(plants):
print()
print("---[%d.]-------------------"%idx)
catalogitem = dict()
for item in plant:
print(item.tag+':', item.text)
catalogitem[... | true |
b41c26ef77a9bc13be4945ac6ae667020ae4adf7 | GeorgeProjects/InformationEmbedding | /CapabilityTest/optimize_test.py | UTF-8 | 3,396 | 2.59375 | 3 | [] | no_license | import math
import json
f = open("qrcodeObj.json", "r")
qrcodeObjStr = f.read()
qrcodeObj = json.loads(qrcodeObjStr)
def computeMaxErrorBits(qrcodeModule, error, qrcodeCellNum):
errorPercentageObj = {
'1': 0.07,
'2': 0.15,
'3': 0.25,
'4': 0.30
}
qrCodeCells = qrcodeCellNum * qrcodeCellNum
if (qrCodeCell... | true |
bb4bcd47f1aaae21a47250b39a7fbb7cdd61c9c5 | qixianQin/PythonLearn | /qiushibaike.py | UTF-8 | 1,994 | 2.90625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
### 爬取糗事百科 热门段子
import requests
from bs4 import BeautifulSoup
base_url = 'https://www.qiushibaike.com/8hr/page/'
def get_page(index):
url = base_url + str(index)
response = requests.get(base_url)
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'lxml')
# print("s... | true |
7d71fbe7d753d39899c574f474037d4f531cbc03 | ClifHouck/desperado | /desperado/inventory.py | UTF-8 | 4,174 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import requests
from desperado import market
INVENTORY_API = {
'application_inventory' : {
'url' : "https://steamcommunity.com/profiles/{profile_id}/inventory/json/{app_id}/{context_id}/",
'url_args' : {
'profile_id' : 'The ID of the user\'s profile in question.',
... | true |
c830a779106d35ea60e4ffe414800aea9a799e01 | guochuanxz/py_2 | /0604/list.py | UTF-8 | 718 | 3.953125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# Author:Damon Guo
# 什么是列表(数组)、下标(索引)
wizard_list = [
'snake','lion','duck'
]
print(wizard_list[0],wizard_list[1],wizard_list[2])
# 如何向列表中追加元素
# wizard_list.append('chicken')
# wizard_list.append('dog')
# wizard_list.append('cat')
print(wizard_list)
# 删除数组中的元素
del wizard_list[0]
# 数组可以做乘法运算,元... | true |
5ff8a94afdbee9ee9e2ce9af2388376dc72ca908 | PriyankaGawali/Python | /Basic/Dictionary/implement_fromkeys_method.py | UTF-8 | 985 | 3.984375 | 4 | [] | no_license | ''' Implement fromKeys() method
x = {1:2, 2:3, 3:4}
possibility 1:[9] then assign 9 to all keys
possibility 2:[1,2,3] then 1 to 1 correspondence
possibility 3:[7,8] then 1:7, 2:8, 3:None
possibility 4:[7,8,9,10] then 1:7, 2:8 , 3:9 and 10 is skipped
'''
def assign_values(input_dict, values):
result_dict = {... | true |
2bd2c11c99cc9d1b1f8d61834e5d215db2e035ba | Taro000/algorythm_note | /MIT_python/chapter_3/root_pwr.py | UTF-8 | 350 | 3.859375 | 4 | [] | no_license | x = int(input())
root = 1
while root ** 2 < x: # 減少関数1つ目
root += 1
pwr = 100
while pwr > 0: # 減少関数2つ目
# MIT教科書ではここに1つ目の減少関数を置いてたけど外出せるよね
# root = 1
while root ** 2 < x:
root += 1
if root**pwr == x:
print(root, pwr)
pwr -= 1
| true |
ec758d30dbf5f4258c52a950bbf0c6b63ccf80f5 | ksboy/finance_negative_entity | /scripts/ensemble.py | UTF-8 | 492 | 2.5625 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
"""
@author: banifeng
@contact: banifeng@126.com
@version: 1.0
@file: ensemble.py
@time: 2019-08-26 20:56
这一行开始写关于本文件的说明与解释
"""
from typing import List, Union
from collections import Counter
def cls_entity_ensemble(cls_tags: List[str]):
if len(cls_tags) == 0:
return None
tag, coun... | true |
2d1bebca1266df2c4d76b0b6193675591d68e615 | TuhinChandra/PythonLearning | /Basics/Shaswata/test16_video28_continue.py | UTF-8 | 429 | 3.875 | 4 | [] | no_license | print('continue keyword examples are here...')
str1 = input('Enter a string :')
for i in str1:
if i == ' ':
continue
print(i, end=' |')
print()
print('for loop execution completed')
# another example taken from Shibaji paul video
n = int(input('Enter a number: '))
i = 1
while i <= n:
if i % 2 == 0:
... | true |
b58c9c9ec3b3088315c20de5fb18e0d69c3e0dc0 | peternara/remote-sensing-label | /CaffeProject/crowd_sourcing/feature_extraction.py | UTF-8 | 2,209 | 2.5625 | 3 | [] | no_license | # coding=utf-8
# 图像特征提取
from CaffeProject.util.image_set import *
from CaffeProject.util.socialmedia_image import *
from numpy import *
import numpy
# import caffe
def extract(image_set, **options):
"""
对于一个图片数据集中所有图片输出一个特征
:param image_set: 图片数据集
:param options: 可选控制项
:return:
"""
for (k, v... | true |
22a4b5e70480591cce4923f56c67832c7b8bf297 | TheGreymanShow/House.Viz | /Scripts/Priorities.py | UTF-8 | 551 | 3.328125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
from time import sleep
print("Enter your preferred mode of travel")
print("1. Bus")
print("2. Subway")
print("3. Train")
a,b,c = map(int,input().split())
x,y,z = 9.52,5.0,5.0
x1 = x*a
y1 = y*b
z1 = z*c
trans_score = (x1+y1+z1)/6 ... | true |
52ac04f33d5f7cd970df6fac3cdac2c35d3db464 | binc75/pythonfun | /coincounter.py | UTF-8 | 1,337 | 4.25 | 4 | [] | no_license | #!/usr/bin/env python3
#
# Money change calculator
#
# Available coins list
coins = [5, 2, 1, 0.5, 0.2, 0.1, 0.05]
def coins_count(amount):
'''Given an amount of money it divide it by the available coins change and give back a dictonary'''
# Check if the amount is at least more that the smallest coin
if... | true |
48603df6337413dd7268c49c125eec546db8605f | joseab10/PanopticSlam | /src/panoptic_slam/kitti/data_loaders/kitti_timestamps.py | UTF-8 | 4,154 | 2.78125 | 3 | [] | no_license | from enum import Enum
from datetime import datetime
import numpy as np
import genpy
import rospy
import panoptic_slam.ros.utils as ru
class TimeMatching(Enum):
Exact = 0
Minimum = 1
Previous = 2
Next = 3
@classmethod
def __contains__(cls, item):
try:
cls(item)
e... | true |
4928fa8557ec639d44d04e5a929baa1bf43ebcc9 | maxymkuz/cs_first_semester | /lection5/labka.py | UTF-8 | 519 | 3.859375 | 4 | [] | no_license | def factorial(n):
if n == 0:
return 1
result = n
for smaller_integer in range(1, n):
result *= smaller_integer
return result
#print(factorial(5))
def repeated(n):
remaining_digits = abs(n)
while remaining_digits/10 > 1:
last_digit = remaining_digits % 10
previ... | true |
be2ea24ca911d95fe0c04c5b3d6de88fbaaceea7 | simonvidal/Python | /deporte.py | UTF-8 | 198 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Autor: Enmanuel Cubillan
# Programa que nos permite usar el bucle for-in
# Bucle For In
for deporte in ['Beisbol','Baloncesto','Futbol']:
print 'Me gusta jugar ' + str(deporte)
| true |
6d6e9d8ddb371d6509f056a6a47445a1e39949ba | rahulmajjage/Learning | /exercisescripts/hanging_game.py | UTF-8 | 3,206 | 4.21875 | 4 | [] | no_license | # Hangman program
# Guess the word randomly chosen by computer. If you exceed maximum tries you will be hanged.
import random
# Constant
HANGMAN = (
"""
------
| |
|
|
|
|
|
|
|
----------""",
"""
... | true |
35320b9239aca26412feac1779a752741d64f80c | tabishkhan96/Product-Matching-using-Deep-Learning | /web app/app/app/download_data.py | UTF-8 | 1,126 | 2.546875 | 3 | [] | no_license | import os
from tqdm import tqdm
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="service-account-file-harsh-gupta.json"
from google.cloud import storage
def download_blob(bucket_name, source_blob_name, destination_file_name):
"""Downloads a blob."""
storage_client = storage.Client()
bucket = storage_cli... | true |
6beeb2baba03274e9eefdab72856d74cc492a3a1 | g1910/Capstone_ClassPath | /supervisor/sup_module.py | UTF-8 | 1,153 | 2.515625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
import ipdb
# LeNet Type Supervisor Model
class SupervisorModule(nn.Module):
def __init__(self, path_dim):
super(SupervisorModule, self).__init__()
self.class_features = nn.Sequential(
nn.Linear(10, 128),
nn... | true |
3821d7571e3d87e88b666ecf70189cb51c527077 | apddup/python_toolbox | /source_py2/test_python_toolbox/test_cute_iter_tools/test_enumerate.py | UTF-8 | 574 | 2.765625 | 3 | [
"MIT"
] | permissive | # Copyright 2009-2013 Ram Rachum.
# This program is distributed under the MIT license.
'''Testing module for `cute_iter_tools.enumerate`.'''
from python_toolbox import cute_iter_tools
def test():
'''Test the basic workings of `cute_iter_tools.enumerate`.'''
for i, j in cute_iter_tools.enumerate(range(5... | true |