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 |
|---|---|---|---|---|---|---|---|---|---|---|
348102beaa90c1ab2edaf16781ca9a9b7fbdc305 | Najarin321/Python-codes | /Python-codes/Mundo 1 e mundo2/exercicio43curso.py | UTF-8 | 721 | 4.3125 | 4 | [] | no_license | print("""Desenvolva uma lógica que leia o peso e a altura
de uma pessoa, calcule seu IMC e mostre seu status, de acordo
com a tabela abaixo:
- Abaixo de 18.5: Abaixo do peso
- Entre 18.5 e 25: Peso ideal
- 25 até 30: Sobrepeso
- 30 até 40: Obesidade
- Acima de 40: Obesidade mórbida
""")
peso = int(input("inf... | true |
00ef19b1fb222bc31ef84f1b9d0838c256c9e5f6 | AitorPo/python_learning | /10-Sets-Diccionarios/sets.py | UTF-8 | 267 | 3.546875 | 4 | [] | no_license | # Los sets son colecciones de datos sin ningún orden predefinido. Cada vez sacará los elementos en un orden distinto
personas = {
'Aitor',
'Pepe',
'Luís'
}
print(personas);
personas.add('Toñi');
personas.remove('Pepe');
print(personas); | true |
65e71e7760bd74bacf0b1349e83e7d50a23ae080 | Aasthaengg/IBMdataset | /Python_codes/p02398/s222211516.py | UTF-8 | 126 | 3.140625 | 3 | [] | no_license | a, b, c = map(int, raw_input().split(" "))
cnt = 0
for i in range(a, b + 1) :
if (c % i == 0) :
cnt += 1
print cnt | true |
370b4bf3700ed686305dfc19ace8efa6ce182140 | andersonjacob/RSParser | /parseRSTextFile.py | UTF-8 | 5,904 | 2.984375 | 3 | [] | no_license | import re
class person(object):
def __init__(self):
self.first_name = ''
self.last_name = ''
self.address_1 = ''
self.address_2 = ''
self.city = ''
self.state = ''
self.zip = ''
self.phone = ''
self.email = ''
self.birthday = None
... | true |
d997841d8388318f9f83329e6af0653486fc97d2 | kmzn128/CCI_Python | /CCI_1/CCI_1/1_6.py | UTF-8 | 400 | 3.171875 | 3 | [] | no_license | str_in = "aabcccccaaa"
buf = []
out = []
for c in str_in:
if (len(buf) == 0):
buf.append(c)
else:
prev = buf[len(buf)-1]
if(prev == c):
buf.append(c)
else:
out.append(prev)
out.append(str(len(buf)))
buf.clear()
buf.appen... | true |
582fcfc7ad14254a12ec6497079e6ba307578329 | charx7/MachineLearning | /Preprocess/filter_english_tweets.py | UTF-8 | 2,342 | 3.21875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import time
import regex as re
from nltk.corpus import words
from nltk.corpus import stopwords
from nltk.tokenize import TweetTokenizer
from nltk.stem.snowball import SnowballStemmer
from multiprocessing import Pool
def detect_language(text, wordlist):
# check NaN cases
if pd.isnull(text):
... | true |
bd1df6499da3b635043369518af581cc1b780038 | jianhongwu/Kaggle-Quora-Insincere-Questions-Classification | /models/train_model.py | UTF-8 | 2,307 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 30 17:09:26 2019
@author: WJH
"""
#%%
import time
import numpy as np
from sklearn import metrics
from sklearn.model_selection import StratifiedKFold
def elapsed(sec):
"""
时间计算
"""
if sec<60:
return str(sec)+"sec"
elif sec<(60*60):
retu... | true |
2d586090a3b5bd7db8b3b72f85e10b6c6ee8eb4e | syurskyi/Python_Topics | /050_iterations_comprehension_generations/003_generators/examples/Python-from-Zero-to-Hero/10-Generators.py | UTF-8 | 2,898 | 3.875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
# Напишем функцию, генерирующую случайные числа в установленном диапазоне.
# In[ ]:
import random
# In[ ]:
def randoms(min, max, n):
return [random.randint(min, max) for _ in range(n)]
# In[ ]:
# сразу же материализует результаты вызова функции randoms
f... | true |
e3288af7cd7b6e3f12623db7415941e5ab502585 | aforizs80/py-trening-upload | /teszt.py | UTF-8 | 250 | 3.40625 | 3 | [] | no_license | # #name = input("add meg a neved")
# #age = 60
# print("szia" + name)
# print (name, age)
# print (name + "" + str(age))
szam1 = input("add meg az elso szamot")
szam2 = input("add meg a masodik szamot")
osszeg = int(szam1) + int(szam2)
print(osszeg)
| true |
c851510b0662749878a40135b0f08c1e2252b3dc | edgetch/devnetcert | /program.py | UTF-8 | 98 | 2.9375 | 3 | [] | no_license | import operations
a=100
b=200
c=operations.add(100,200)
print (operations.add(2,3))
print (c)
| true |
03317e6ab31f0821ececa4b0d41189df166162ee | RyanGoh83/flask-blog | /sql.py | UTF-8 | 710 | 3.59375 | 4 | [] | no_license | # sql.py- Script to create db and populate with data
import sqlite3
#creates a new db if it doesn't already exist
with sqlite3.connect("blog.db") as connection:
#get a cursor obj used to execute SQL commands
c = connection.cursor()
#create the table
c.execute("""CREATE TABLE posts (title TEXT, post... | true |
a45f4da16846e1d573ee42661e29299a3e0a1788 | zedpro/bind9LogAnalysis | /logprocessor.py | UTF-8 | 561 | 2.515625 | 3 | [] | no_license |
from config import *
class LogProcessor:
def __init__(self, logFilename):
self.logFilename = logFilename
def analysis(self):
"""
Analizza il file di log
:return:
"""
#test rt
#
# Componiamo path del file di log
#
logPath =... | true |
5b6caf56b2c165e49e6a3c3b729afc958606c7d5 | ynu-python-course/2016-autumn | /team-1/src/game.py | UTF-8 | 9,091 | 2.953125 | 3 | [] | no_license | import pygame,sys,random,time
#初始化
pygame.init()
pygame.mixer.init()
#时间控制
clock=pygame.time.Clock()
#重复按键设置
pygame.key.set_repeat(100,15)
#取得历史最高分
highest=open('highest.txt', 'r')
line = highest.readline()
h_result=int(line)
highest.close()
ding_splat = pygame.mixer.Sound("ding.wav")
#动画精灵
class ImgClass (pygame... | true |
b0f506d8996e5caad137db26ca155bc42f3356e7 | joshkimmel16/CS117-Quizzly | /Bluetooth/BluetoothClient.py | UTF-8 | 2,965 | 3.046875 | 3 | [] | no_license | '''
Provides an interface and implementation for communicating via Bluetooth on the client side
'''
#imports
import bluetooth
from threading import Thread
import select
#object representing the configuration parameters for a Bluetooth client
class BluetoothClientConfig:
#constructor
def __init__(self, server_... | true |
5a24d22804abff195faeb158538eda9c4b655f7d | prasannakumar2495/QA-Master | /pythonPractice/samplePractice/MultipleChoice/Questions.py | UTF-8 | 597 | 3.46875 | 3 | [] | no_license | '''
Created on 11-Feb-2019
@author: prasannakumar
'''
from MultipleChoice import QuestionClass
from builtins import str
questions=[
"what is my name?\n (a)prasdfw \n (b)prasannakumar \n\n",
"what is my last name? \n (a)jhgvj \n (b)kumar \n\n"
]
question = [QuestionClass(questions[0],"b"),
Quest... | true |
74ab97edf0211fd448f7c51c28a384c5d5237999 | Ruben103/AI1 | /Final/nqueens_stats.py | UTF-8 | 1,641 | 3.921875 | 4 | [] | no_license | def main():
"""
Replace original main function by this function to perform the program a
desired amount of times. The program will return a success rate range from
0 to 1, where 0 indicates a succes rate of 0%, and 1 indicates a succes rate of 100%.
"""
try:
if len(sys.argv) is not 2:
... | true |
66fbe84f74b08fa2e4b4426c8dffdbb139fce843 | qiniu/python-sdk | /qiniu/services/pili/rtc_server_manager.py | UTF-8 | 2,044 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from qiniu import http, Auth
import json
class RtcServer(object):
"""
直播连麦管理类
主要涉及了直播连麦管理及操作接口的实现,具体的接口规格可以参考官方文档 https://developer.qiniu.com
Attributes:
auth: 账号管理密钥对,Auth对象
"""
def __init__(self, auth):
self.auth = auth
self.host = 'http://rt... | true |
70eeb299128dc55079c6cb3d9f42ceaa68684c6b | giobber/cardboard-handles | /models/system/models.py | UTF-8 | 2,274 | 3.25 | 3 | [] | no_license | import math
import solid
import solid.utils
from solid import OpenSCADObject
from .utils import extrude, degree_to_radians
def pill(width: float, height: float, **kwargs) -> OpenSCADObject:
"""A pill-shaped object.
Params:
width (float): total width in mm
height (float): total heigh... | true |
8a4c5e4e1bafbe8ce79ba319ccd4efafe7fb51e5 | Federic04/Unidad4POOEventos | /ubicacionGrilla.py | UTF-8 | 566 | 3.34375 | 3 | [] | no_license | from tkinter import *
class Ventana(object):
__ventana=None
def __init__(self):
self.__ventana=Tk()
self.__ventana.title('Geometría de Celdas en Ventana')
for r in range(0, 5):
for c in range(0, 5):
cell = Entry(self.__ventana, width=10)
... | true |
b8fc28f0a9f0409eab4a36d28d65ac099891cf09 | ankit-logan/adhocsummerspython2018 | /p1.py | UTF-8 | 111 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python2
import time
x=raw_input("please enter something:")
print type(x)
time.sleep(2)
print x
| true |
ee3d77050a1c66643f6c2e88bb598257ee10b546 | HongboQiao/Orc_Band | /orcband/ml_model/code/polynomial_regression_model.py | UTF-8 | 1,592 | 3.015625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from evaluation import r2_score
def Polyno... | true |
b74b25e97b9dbb5a8db146c75bea2a53d6a87a28 | komnastya/lpthw | /ex24.py | UTF-8 | 1,649 | 4.5625 | 5 | [] | no_license | # ex24
print("Let's practice everything.")
print("You'd need to know 'bout escape with \\ that do: ")
print("\n newlines and \t tabs.")
poem = """
\t THe lovely world
with logic so firmly planted
cannot discern \n the needs of love
no comprehend passion from intuition
and requiers an explonation
\n\t\twhere there is ... | true |
06754938ec7f244f12998345ba47e85afe4cfc93 | tommylees112/esowc_notes | /example_scripts/preprocess/test_ndvi.py | UTF-8 | 5,147 | 2.671875 | 3 | [] | no_license | import xarray as xr
import numpy as np
from datetime import datetime
from src.preprocess import NDVIPreprocessor
from src.utils import get_kenya, get_ethiopia
from ..utils import _make_dataset
class TestNDVIPreprocessor:
@staticmethod
def test_make_filename():
test_file = "19860702_testy-test.nc"
... | true |
a98592c90b0844803ef340af034164015f22b50c | biyam/Becoming-a-Friend-with-Programming | /코로나 기간 지하철 이용객 비교해보기.py | UTF-8 | 1,430 | 3.1875 | 3 | [] | no_license | import csv
f = open('201903subway.csv')
data = csv.reader(f)
next(data);next(data) #두 줄 띄우기(값이 두 줄 아래에 있음)
s_in = [0]*24; s_out=[0]*24 #리스트를 24개 만들어줌(24시간)
for row in data:
row[4:]=map(int,row[4:]) #시간대별 값 추출
for i in range(24): #24번 반복하기
s_in[i]+=row[4+i*2]
#(4열까지 값X, 승차는 짝수마다 있음)
s_out[i]+=ro... | true |
f2126c08a91d4bffc85bf39c53dc775d77c174d7 | JWock82/PyNite | /PyNite/Quad3D.py | UTF-8 | 32,554 | 3.40625 | 3 | [
"MIT"
] | permissive | # References used to derive this element:
# 1. "Finite Element Procedures, 2nd Edition", Klaus-Jurgen Bathe
# 2. "A First Course in the Finite Element Method, 4th Edition", Daryl L. Logan
# 3. "Finite Element Analysis Fundamentals", Richard H. Gallagher
from numpy import array, arccos, dot, cross, matmul, add, zeros
f... | true |
c45e73b050813f73ea0c2c1aecf5085eb998b2c6 | PeterZhangxing/codewars | /sort_algorithm/merge_sort.py | UTF-8 | 1,134 | 3.40625 | 3 | [] | no_license | import random
import time
def cal_time(func):
def wrapper(*args, **kwargs):
t1 = time.time()
result = func(*args, **kwargs)
t2 = time.time()
print("%s running time: %s secs." % (func.__name__, t2 - t1))
return result
return wrapper
def merge_once(data,left,mid,right):
... | true |
16ca97599facf0eb51f16bf8a302ab78b06af062 | dmorady1/2020-adventofcode | /9/solve.py | UTF-8 | 1,069 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
with open("input.txt") as f:
data = f.read()
# data = """35
# 20
# 15
# 25
# 47
# 40
# 62
# 55
# 65
# 95
# 102
# 117
# 150
# 182
# 127
# 219
# 299
# 277
# 309
# 576
# """
data = data.splitlines()
data = list(map(int, data))
# print(data)
splitter = 25
def solve(data, splitter=25):
... | true |
fb749c468598f8ec84735c857a0e86b4616e2fd0 | tzdwekat/Dorans-Lab | /comebackchamp.py | UTF-8 | 5,005 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 5 18:12:56 2020
@author: tariq
"""
import pandas as pd
import numpy as np
import math
from sqlalchemy import create_engine
## PROGRAM PARAMETERS ##
wk_dir = 'C:/Users/tariq/DLAB'
datapath = wk_dir + '/DATA/COMEBACK_DATA/comebackchamp.csv'
#CREATE THE D... | true |
3affc2d0f169c3751ba0fdb83adf18fc2d001ee2 | Logehwari/logi_codekata | /plus_1.py | UTF-8 | 44 | 2.765625 | 3 | [] | no_license | Num = int(input())
Cnt = Num + 1
print(Cnt)
| true |
bbcb624bbc1ce4587990bcf9d04f18b6b56afc55 | andrecastillo/pi_foyer | /read_gpio_inputs.py | UTF-8 | 675 | 3.234375 | 3 | [] | no_license | # Import required Python libraries
import RPi.GPIO as GPIO
import time
# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
# Define GPIO to use on Pi for motion sensor
GPIO_PIR = 4
# Set pin as input
GPIO.setup(GPIO_PIR,GPIO.IN)
# lets watch it get ready
print "Waiting for the PIR to ... | true |
405d064c7eb7c60a02ef38ff863141b97c1bfcfb | atirpetkar/streamlit_expt | /streamlit_app_copy.py | UTF-8 | 776 | 2.609375 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import numpy as np
from os import listdir
from os.path import isfile, join
import re
import json
from ast import literal_eval
st.markdown("# Ground Truth Portal")
st.markdown("------")
filenames = ["file1", "file2", "file3"]
length = len(filenames)
index = [1,2,3]
dic = d... | true |
a9c38b77edf03aa339cd4aebb449c009171cdb73 | JoseCcari/Silabo | /Model/Flask.py | UTF-8 | 377 | 2.640625 | 3 | [] | no_license |
from flask import Flask
from flask import request
app= Flask (__name__) #mi objeto
@app.route('/') #grap o decorador
def index(): #funcion
return 'Hola Mundo'
@app.route('/method1')
def method1():
param =request.args.get('param1', 'without data')
return 'the param is: ' + str (param)
... | true |
2e71c7d9844fffa851ef6c34f3afd00e05bf875c | aderbique/cs5665 | /assn6/problem6/split_year_6.py | UTF-8 | 1,024 | 2.53125 | 3 | [] | no_license | import os, sys, csv, re
def run(fn):
file = open(fn)
if 'lazy' == 'lazy':
for line in file:
m = re.search('(\d\d\d\d).*',line)
line = m.group(0) + m.group(1)
print(line)
if m.group(0) == '2014':
append_file('2014.csv',line)
elif m.group(0) == '2014':
append_file('2015.csv',line)
elif m.gr... | true |
e5f109be0246e2d1629f7f765daa0f0e7c8ffcd4 | abihi/Advent-of-Code-2020 | /day19/day19.py | UTF-8 | 1,138 | 2.921875 | 3 | [] | no_license | def consume(x, rule_number, rules_map):
rule = rules_map[rule_number]
if rule[0] == '"':
rule = rule.strip('"')
if x.startswith(rule):
return [len(rule)]
else:
return []
acc_chains = []
for opt in rule.split(" | "):
acc_chain = [0]
for... | true |
bedc3f0e630abe66ba6dfd11756e705f71e2ac88 | KingsleyDeng/PythonTraining | /Chapter_11/MySQL执行DML语句.py | UTF-8 | 680 | 3.046875 | 3 | [] | no_license | # 导入访问MySQL的模块
import mysql.connector
# 第一步:连接数据库
conn = mysql.connector.connect(
user='root',
password='DawnDeng1993',
host='localhost',
port='3306',
database='python',
use_unicode=True)
# 第二步:获取游标
c = conn.cursor()
# 第三步:调用execute()执行insert语句插入数据
c.execute('insert into user_tb values(null, %s... | true |
4acd8ef5ed3209af25da93cdf871ebf536d8b962 | celiawaggoner/hb-coding-challenges | /stack_class.py | UTF-8 | 494 | 4.375 | 4 | [] | no_license | class Stack(object):
"""Create a stack class using a list"""
def __init__(self):
self._stack = []
def push(self, item):
"""Add an item to the top"""
self._stack.append(item)
def pop(self):
"""Remove the top item"""
self._stack.pop()
def peek(self):
... | true |
3bc08fbc0fb55ca113390bdc8414b277123bc066 | renatoreli/Rjecnici-i-setovi | /salabahter.py | UTF-8 | 1,580 | 3.953125 | 4 | [] | no_license |
d2 = {} # inicijalizacija praznog rjecnika
d2 = dict({}) # takodjer inicijalizacija praznog rjecnika pomocu funkcije dict
d1 = {"key1": "value1", "key2": 123, "key3": True} # inicijalizacija rjecnika nekim pocetnim vrijednostima
print("d1: ", d1)
print("keys():", d1.keys()) # vraca listu kljuceva (keys... | true |
5f4b6223d3fa8dd3640bc34cbddf4beb8042f41a | KevinHorning/CS2302-IntermediatePython | /HW4/3.py | UTF-8 | 202 | 3.046875 | 3 | [] | no_license | #10.23
def recursive(indent, num):
if num > 0:
recursive(indent, num//2);
print(" " * indent + "*" * num);
recursive(indent + num // 2, num//2);
| true |
8c1591fb9e0f604aef3b731895ae187bab925771 | jercheng/js_video_scrapy | /crawl/new/maoyan_com/new/parse_page/get_clear_url.py | UTF-8 | 775 | 2.84375 | 3 | [] | no_license | import json
import sys
def main():
with open("man_yan_url","r",encoding="utf-8") as file_r,open("clear_url","w",encoding="utf-8") as file_w:
clear_movie = []
index = 1
for item in file_r.readlines():
json_item = json.loads(item.strip())
is_not_in = True
f... | true |
34ae7abe8b7291881037f375502317a533fd7938 | Hongyin-bug/Phys-cs-15B-Electronics-lab | /liu_3418183_hw1/p5_hw1.py | UTF-8 | 320 | 3.671875 | 4 | [] | no_license | import numpy as np
#(a)summing in a for loop
sum1 = 0
for i in range(0, 10000):
if i % 2 == 1:
sum1+= i
print(sum1)
#(b)summing in a while loop
sum2 = 0
x = 1
while (x<10000):
sum2 += x
x += 2
print(sum2)
#(c)summing in numpy array
r = np.arange(1, 10000, 2)
sum3 = np.sum( a = r)
print(sum3)
| true |
613dd8d76f97cfe36c977fda285df84f22fb0ed2 | williamejelias/DNA-String-Matching | /Recursive.py | UTF-8 | 4,167 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python
import time
import sys
# 1. Creating list of alignments
# 2. Score an alignment
"""PART1"""
alignments_list = []
def all_alignments(n, m, seq1, seq2):
if len(seq1) == 0 or len(seq2) == 0: # if seq1 or seq2 are empty then fill up the remaining
if len(seq1) == 0: # bits ... | true |
7e55913698d157500646943a7c947632d01a7815 | sairamprogramming/python_book1 | /chapter7/algorithm_workbench/exercise2.py | UTF-8 | 166 | 4.03125 | 4 | [] | no_license | # Program to display all the items in the list names.
def main():
names = ['sai', 'ram', 'girish', 'naveen']
for item in names:
print(item)
main()
| true |
a73465f057b8d1440cc7fc2e532e26724dbc8b9a | painprovider/fishyboteso | /fishy/engine/semifisher/fishing_event.py | UTF-8 | 4,004 | 2.53125 | 3 | [
"MIT"
] | permissive | """
fishing_event.py
Defines different fishing modes (states) which acts as state for state machine
also implements callbacks which is called when states are changed
"""
import logging
import time
from fishy.engine.semifisher import fishing_mode
from playsound import playsound
from fishy import web
from fishy.engine.... | true |
86d485f3c49365d29cde169463e2755ea51119c5 | craymichael/ArgValidation | /req_test.py | UTF-8 | 3,345 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # ======================================================================================================================
# Copyright 2016 Zachariah Carmichael
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy ... | true |
1d1fc863007797335acee39fe857d7236923fc20 | eglrp/BeginnerAI | /lib/keras/retinanet/utils.py | UTF-8 | 36,765 | 2.75 | 3 | [] | no_license | import numpy as np
import keras
import tensorflow as tf
import PIL
import cv2
import six
class AnchorParameters:
""" The parameteres that define how anchors are generated.
Args
sizes : List of sizes to use. Each size corresponds to one feature level.
strides : List of strides to use. Each st... | true |
b9cc94930c267699c9715cdeedd90710e2eb4b41 | arunpa0206/mltrainingv1 | /tensorflow/nlp/sentiment/imdb-explore.py | UTF-8 | 1,595 | 2.71875 | 3 | [] | no_license | import pandas as pd
dataset_path_movies = '/movies.list.gz'
dataset_path_keywords = '/keywords.list.gz'
dataset_path_genres = '/genres.list.gz'
dataset_path_ratings = '/ratings.list.gz'
print("Opening Keyword File.")
cols_keywords = ['movie', 'keyword']
skip_keywords = 89713
df_keywords = pd.read_csv(dataset_path_ke... | true |
3f378ba07d3c9410f4f3dd35fa5675a27a569d57 | imkarin/eyetracking-dash | /index.py | UTF-8 | 5,610 | 2.6875 | 3 | [] | no_license | """
For more details on building multi-page Dash applications, check out the Dash
documentation: https://dash.plot.ly/urls
"""
import pandas as pd
import plotly.express as px
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies... | true |
679700dc989a40c9f41f266bfbdf4ca4cc0babc8 | kaephas/FtoDweeBot | /weather.py | UTF-8 | 1,128 | 3.109375 | 3 | [
"MIT"
] | permissive | import requests, json
# Enter your API key here
# base_url variable to store url
def getCityWeather(city, api):
city_name = city
api_key = api
base_url = "https://api.openweathermap.org/data/2.5/weather?q="
# complete url address
complete_url = base_url + city_name + "&appid=" + api_key
# g... | true |
c984b5ca63eeb080627a80cb6bce625bbdc8bcf4 | ashok1230/perfect_number | /perfect_number.py | UTF-8 | 299 | 3.171875 | 3 | [] | no_license | class perfect:
def __init__(self):
self.number=int(raw_input("enter number:"))
sum=0
for i in range(1,self.number/2+1):
if self.number%i==0:
sum+=i
if sum==self.number:
print self.number,' is perfect number'
else:
print self.number,'is not perfect number'
a=perfect()
| true |
6cfad72cce199ae9570df9083e060c42a46479eb | abdulla-m/Python | /matrix2.py | UTF-8 | 454 | 2.9375 | 3 | [] | no_license | import math
import os
import random
import re
import sys
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
for _ in range(n):
matrix_item = input()
matrix.append(matrix_item)
result=[]
for m in range(m):
for n in range(n):
... | true |
7acbcb8e22c0ff1ed649b005e9beb6637631c34d | markgordon/Sand-Table | /tests/motor_test.py | UTF-8 | 1,550 | 2.5625 | 3 | [] | no_license | import RPi.GPIO as GPIO
from utils.DRV8825 import DRV8825
import threading
from time import sleep
M_Rot = DRV8825(dir_pin=13, step_pin=19, enable_pin=12, mode_pins=(16, 17, 20))
M_Lin = DRV8825(dir_pin=24, step_pin=18, enable_pin=4, mode_pins=(21, 22, 27))
def run_MRot():
for delay in delays:
print("\nDel... | true |
de6f2aaa4981ae4cba81fa388a4c8a5e2de871ad | davidtnly/DeepLearning | /08-opencv-online-course/02-intro-videos.py | UTF-8 | 630 | 3.03125 | 3 | [] | no_license | import cv2
import sys
# Print versions
print('=' * 50)
print(f"OpenCV Version: {cv2.__version__}")
print(f"Python {sys.version}")
# Create a video capture object and read in the input file to check to see that it can open the file
cap = cv2.VideoCapture('videos/vtest.avi')
while True:
# Read
ret, frame = cap... | true |
13b8f868f5191867c595d794c7d8b2bb841bc47b | heyMP/spacy-course | /exercises/ja/solution_03_09_01.py | UTF-8 | 525 | 3.1875 | 3 | [
"CC-BY-NC-4.0",
"MIT"
] | permissive | from spacy.lang.en import English
from spacy.tokens import Token
nlp = English()
# デフォルト値がFalseである拡張属性「is_country」をトークンに追加
Token.set_extension("is_country", default=False)
# テキストを処理し、「Spain」のトークンについてis_country属性をTrueにする
doc = nlp("I live in Spain.")
doc[3]._.is_country = True
# すべてのトークンについて、文字列とis_country属性をプリント
pr... | true |
eea0f51c7d8c01095ec7d963cd2be78e782d7126 | j0hnk1m/leetcode | /medium/39.py | UTF-8 | 385 | 3.140625 | 3 | [] | no_license | candidates = [2,3,6,7]
target = 7
# recursive/backtracking - o(t^n) runtime, o(t) space
def cs(candidates, target, path):
if target == 0:
res.append(path)
return
for i in range(len(candidates)):
if target >= i:
cs(candidates[i:], target-candidates[i], path+[candidates[i]])
... | true |
9b25611e6805057e43d2ea1b1d071de5553dacf6 | gabriellaec/desoft-analise-exercicios | /backup/user_158/ch3_2020_03_30_19_48_55_096814.py | UTF-8 | 129 | 2.5625 | 3 | [] | no_license | import math
def calcula_gaussiana(x,mi,sig):
f=(1/sig*math.sqrt(2*math.pi))*math.e**(-0.5((x-mi)/sig)**2)
return float(f) | true |
5b2f7dd3d4ba92e0e4aa822432afe1cf3ac8bf6f | Lijin111/LeetCode-in-Python | /WordBreakII.py | UTF-8 | 355 | 2.578125 | 3 | [] | no_license | class Solution(object):
def wordBreak(self, s, words):
dp, n = {}, len(s)
def dfs(i):
if i==n:
return ['']
if i not in dp:
dp[i] = [ ' '+ s[i:j+1] + w for j in xrange(i,n) if s[i:j+1] in words for w in dfs(j+1)]
return dp[i]
... | true |
8102e5f459879b99719460a4402672fc0a50b4d5 | Rohnin-Barrette/ICS3U-Unit4-03-for_loops-py | /forloops.py | UTF-8 | 973 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by: Rohnin Barrette
# Created on: Sep 2021
# This program shows the user all of the numbers squared
# leading up to and including the inputted number
def main():
# This program shows the user all of the numbers squared
# leading up to and including the inputted number
... | true |
211929df2f5591732c535b02c1906031ef2a1827 | EmaPrn/Terminal_GUI | /blessed_app.py | UTF-8 | 4,587 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# allows the definition of interfaces
from abc import abstractmethod
from typing import Tuple
from blessed import Terminal
from _window_manager import IWindow, WindowManager
from gui_elements import TextStyles
from math import log2
class _BlessedWindow(IWindow):
"""... | true |
1d73843456cfe49d617f12d4ebc7d763a59af5ce | jiangzidong/BriVL-BUA-applications | /main.py | UTF-8 | 1,267 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
'''
@File : BriVL_pipline.py
@Time : 2021/08/26 12:49:25
@Author : Chuhao Jin
@Email : jinchuhao@ruc.edu.cn
'''
# here put the import lib
import os
import numpy as np
from BriVL.text_feat_extractor import TextFeatureExtractor
from BriVL.img_feat_extractor import ImgFeatureEx... | true |
dba92289473a97f691fcbbc56d23d1be0e74549a | tchristofferson/Emissions-and-Temp-Analysis | /analyzer.py | UTF-8 | 793 | 3.203125 | 3 | [] | no_license | import csv
emissions = {}
temp_changes = {}
with open("emissions.csv", newline="") as csv_file:
reader = csv.reader(csv_file)
for row in reader:
if row[1] == "Year":
continue
emissions[int(row[1])] = int(row[2])
with open("temperatureChanges.csv", newline="") as csv_file:
read... | true |
1a62727322b9da71fab66e1a8cfd15c8d72d390b | rahulmohan67/demo-repo2 | /coins.py | UTF-8 | 290 | 3.65625 | 4 | [] | no_license | # implemented Greedy Algorithm to find minimum number of coins
denom=[1,2,5,10,20,50,100,200,500]
denom.reverse()
amt=117
out=[]
n=len(denom)
i=0
while(i<n):
while(amt>=denom[i]):
amt-=denom[i]
out.append(denom[i])
i+=1
for i in range(len(out)):
print(out[i])
| true |
a772035a05eacf2bd5540443095f7a175b4f8ebc | MaxIakovliev/algorithms | /old/Session002/TopInterviewQuestions/Repetition/SetMismatch.py | UTF-8 | 431 | 2.78125 | 3 | [] | no_license | class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res=[]
u=set()
for n in nums:
if n in u:
res.append(n)
else:
u.add(n)
for i in range(1, len(n... | true |
7fa973d42b0e1556e3b47d060d157e2ff604374e | robertbernardbrown/Pizza | /test.py | UTF-8 | 2,228 | 2.5625 | 3 | [] | no_license | from app import app
import unittest
from flask.ext.login import current_user
from flask import request
class FlaskTestCase(unittest.TestCase):
# Ensure that flask was set up correctly
def test_index(self):
tester = app.test_client(self)
response = tester.get('/', content_type='html/text')
... | true |
7f86011dceef8a8a5ebb22c52bed0067df1ab12e | pabogdan/nengo_spinnaker | /tests/builder/test_model.py | UTF-8 | 15,392 | 2.875 | 3 | [
"MIT"
] | permissive | import collections
import mock
from rig.bitfield import BitField
from nengo_spinnaker.builder import model
class TestSignalParameters(object):
"""SignalParameters should support __eq__.
"""
def test_eq(self):
# Create several SignalParameters and ensure that they only
# report equal when ... | true |
2d4b8fcb06c740e3dfb615e4db12dade7804ec5a | 7starsea/programming-code-memory | /python/gzip_test.py | UTF-8 | 1,543 | 2.84375 | 3 | [
"MIT"
] | permissive | import gzip
import shutil
from io import StringIO
import pandas as pd
import time
import os.path
import binascii
def write_gz_file(raw_filename, gz_filename):
df = pd.read_csv(raw_filename, index_col=False)
df.to_csv(gz_filename, index=False, compression='gzip')
write_gz_file('test.csv', 'test2.csv.gz')
de... | true |
f63a696b85997684283dd58cffeb2af6bf30dc9d | PrashantJalan/NLP | /Hindi/Word analysis/Functions/ignore.py | UTF-8 | 189 | 3.140625 | 3 | [] | no_license | # Deletes the strings having the mentioned frequency
def ignore_freq(db_word, freq):
i = len(db_word)-1
while i>=0:
if db_word[i][1]==freq:
db_word.pop(i)
i = i-1
return db_word
| true |
7284cd58dc5fdf377d553f842792071f3e1e5232 | kelvinwilliam/TantanganPencarianInformasiMediaOnline | /No 4.py | UTF-8 | 2,860 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import nltk
from bs4 import BeautifulSoup
import re
import os
import codecs
from sklearn import feature_extraction
# In[2]:
df = pd.read_csv (r'D:\03. university\MEDIA ONLINE\question_philoit.csv', usecols=['content'])
print (d... | true |
897196378ab8d14dc7a8bdcfac2675b56949b60a | SonHOuse1993/ML_DL_RL | /sklearn_Example/python_Classification_Model/LR_Model_Example.py | UTF-8 | 332 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
X, y = load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0, solver='lbfgs', multi_class='multinomial').fit(X, y)
print(clf.predict(X[:2, :]))
print(clf.predict_proba(X[:2, :]))
print(clf.s... | true |
f7e4d7d87b17efedb9a6c4881a8f8a7609f19e38 | ItaloPerez2019/mongoSample101 | /starter_code_snake_bnb/src/services/data_service.py | UTF-8 | 297 | 2.84375 | 3 | [] | no_license | from data.owners import Owner
def create_account(name:str,email:str) -> Owner:
owner = Owner()
owner.name= name
owner.email = email
owner.save()
return owner
def find_account_by_email(email: str) -> Owner:
owner = Owner.objects().filter(email=email)
return owner | true |
e83ae4ba245b9f69bb3bd17afc419c62bc2bd1b7 | cocagolau/NEXT_13-01_Programming-Practice | /Week11/test1.py | UTF-8 | 156 | 2.796875 | 3 | [] | no_license |
class TestClass :
def __init__ (self, name) :
self.name = name
def getName (self) :
return self.name
def setName (self, name) :
self.name = name | true |
1fd177f9c76e38158227e4bd3fc6389c0a4e9cf3 | kazimirovic/oversimplified_dht | /oversimplified_dht/node_id.py | UTF-8 | 1,421 | 3.34375 | 3 | [] | no_license | class NodeId:
"""
>>> bytes(NodeId.from_int(1))
b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01'
>>> int(NodeId.from_bytes(
... b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01'))
1
... | true |
034c02eb7d1afcf6779db9c00b4fba1bfabfeae1 | JCharlieDev/Python | /Python Programs/DAITOVTEST/Scripts/Secuencia.py | UTF-8 | 17,330 | 2.578125 | 3 | [
"MIT"
] | permissive | from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
root = Tk()
root.title("Secuencia Tests")
root.geometry("500x300")
def intentos():
intento = Toplevel()
intento.title("Intento")
intento.geometry("500x300")
intento.focus_force()
intento.grab_set()
botonA... | true |
f2150dd015bb62fb5e63b6e5375777a407c922df | mcmullinboy15/6620_Solar_Energy_Project | /helps/combine_data.py | UTF-8 | 1,458 | 3.03125 | 3 | [] | no_license | import pandas as pd
from datetime import datetime
def combine():
date_parser = lambda x: datetime.strptime(x, "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d %H:%M:00")
solar_data = pd.read_csv("../solar_data.csv", index_col=0, usecols=[1, 2, 3], parse_dates=["TIME"], date_parser=date_parser)
weather_data = pd.re... | true |
cdb12e07fdc7160f081dfbd6b947ec25c1e48658 | jksarathy/cs591 | /Hw1/two.py | UTF-8 | 4,856 | 3.296875 | 3 | [] | no_license | from common import hamming_dist
from common import frac_correct
import matplotlib.pyplot as plt
import numpy as np
import sys
import random
# Running counter attack a (without extra information).
def attack_a(a, n):
# Set default guesses.
x_hat = [0] * n
# Based on a[i], set x[i] to the most likely value... | true |
5e687549335eb2753df1f788b8dc9c0769046e85 | shihang1/python | /day3/生成器-并行.py | UTF-8 | 498 | 3.15625 | 3 | [] | no_license | # Auth: ShiHang
import time
def custom(name):
print("%s is coming!" %name)
while True:
who = yield
print("球星【%s】来了!,%s找他签名" %(who,name))
# c =custom("shihang")
# c.__next__()
# c.send("haha")
# c.__next__()__next__
# c.send('hehe')
def prducer():
a=custom("shihang")
b=custom("fangming")
... | true |
acea971cbdc0803d8f707c0a8fb98563497c577e | yamaguchi-milkcocholate/milkcocholate | /BitBank/bitbank/gp/aggregate.py | UTF-8 | 1,799 | 2.5625 | 3 | [] | no_license | from bitbank.gp.gp import GeneticNetwork
class Aggregate:
def __init__(self, gp_num, mutation, cross, elite_num, new_num, population, fitness_function, keep, depth, steps):
self.gp_num = gp_num
self.mutation = mutation
self.cross = cross
self.elite_num = elite_num
self.new... | true |
58e31bd493468b163878534d07848741bab5ef96 | benquick123/code-profiling | /code/batch-2/dn6 - spet tviti/M-17036-2160.py | UTF-8 | 10,010 | 3.15625 | 3 | [] | no_license | from collections import defaultdict
def se_zacne_z(tvit, znak):
hestag = []
text = tvit.split()
for i in range(len(text)):
if znak in text[i]:
od_znak = text[i]
beseda = ""
for a in range(len(od_znak)):
if od_znak[a].isalnum():
... | true |
756228a074cc400f6eebc1873f3ecbf4bc4faa8f | blinkdr/sudoku | /backtrack_soduku.py | UTF-8 | 2,351 | 3.765625 | 4 | [] | no_license | import time
class Suku(object):
def __init__(self, data):
self.data = data # 9*9的一个二维数组
def solve(self):
x, y = self.get_next()
# 二维数组中全部都不为零时结束
if x == -1 and y == -1:
return True
# 尝试用1-9去填为0的位置
for num in range(1,10):
# 条件满足
... | true |
a26062cdb14e02015fb3abdf219c1a23aa7d3333 | stcorp/visan | /visan/examples/GOSAT_CAI_L2_CLD.py | UTF-8 | 1,231 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | # This is an example VISAN script for the GOSAT CAI L2 CLD product
# Make sure to set the 'products-file directory' option in the VISAN Preferences panel to
# a directory containing GOSAT CAI L2 CLD products.
# This example will then take the first product it finds in this directory and
# for that product plot the cl... | true |
f577f79591157d7d0cba030852f34c253b04fe92 | klq26/house-data | /logger.py | UTF-8 | 2,045 | 3.09375 | 3 | [] | no_license | import logging
from logging import handlers
class logger(object):
# 日志级别关系映射
level_relations = {
'debug': logging.DEBUG,
'info': logging.INFO,
'warning': logging.WARNING,
'error': logging.ERROR,
'crit': logging.CRITICAL
}
# logger 初始化
def __init__(self, f... | true |
4680a00ed330027774f53f4a196a0346e4923c4e | ochsnerd/Hamiltonian_Extrapolation | /matrix_extrapolation/matrices.py | UTF-8 | 4,089 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from typing import Union, List
from random import random
from itertools import combinations
from mpmath import (matrix, zeros, eye, eigh,
sqrt,
mnorm, norm,
conj)
Matrix = matrix
def allclose_mpmath(a: Union[Matrix, np.ndarray],
... | true |
048473ff359fde82a72666470f2a89e77719332d | fact-project/muons | /muons/analysis_utensils/simulation_analysis/scoop_acceptance_vs_openingAngle.py | UTF-8 | 2,151 | 2.546875 | 3 | [] | no_license | """
Analyze effective area vs opening angle
Call with 'python -m scoop --hostfile scoop_hosts.txt'
Usage: scoop_simulate_muon_rings.py --simulation_dir=DIR --scoop_hosts=PTH --preferencesFile=PTH --steps=INT --output_dir=DIR
Options:
--simulation_dir=DIR Directory of the simulations
--scoop_hosts=PTH ... | true |
02dda45ea0a43f664d85f5daa2f0eb94a0c88061 | w0jtech/selenium_course | /pytest_project/test_pytest.py | UTF-8 | 1,112 | 4 | 4 | [] | no_license | import pytest
"""
Nazwa pliku z testami musi zawierać słowo test w nazwie - na pocz. lub na koncu.
Metody w pliku testowym muszą zaczynać się od słowa test, aby zostały uruchomione.
Asercje sprawdzają czy zakładany warunek jest true
W naszym przykładzie sprawdzamy czy wynik dodawania jest True, a jeżeli nie to wyświ... | true |
3d252a47f8eef3e2a1ef9c35e173a71382f10083 | pacifikus/2021-1-MAILRU-SDET-Python | /hw_1/code/tests/base.py | UTF-8 | 1,519 | 2.5625 | 3 | [] | no_license | import pytest
import basic_locators
from creds import LOGIN, PASS
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
class BaseCase:
driver = None
config = None
def fi... | true |
c0059f84bbd1e5828c22fc5e6ea9510a0324964e | Anirudh-Kakarlapudi/einstein | /einstein/dataset.py | UTF-8 | 6,130 | 3.0625 | 3 | [] | no_license | """
This script defines :class: `Loader` and :class: `_Fetcher`. The `Loader`
class loads the CSV file stored in the Google Storage Bucket, and processes
it by dropping non-target columns. The `_Fetcher` class can not be sub-classed
by importing the module, and was used by the developers to fetch the data from
the 'Ins... | true |
3e1316e53a5995a1542e4541e119d6b8c96456ed | alexvasiu/FP-Labs | /Evenimente/Repository/DatabaseRepo.py | UTF-8 | 9,829 | 3.125 | 3 | [] | no_license | """
Modulul pentru repository cu baza de date
"""
import sqlite3
from Domain.Events import Event
from Domain.Exceptions import DatabaseException
from Domain.Persons import Person
class RepoDB:
"""
Clasa RepoDB(cu baza de date) :
+ AllPersons
+ AllEvents
- loadData... | true |
ca19f03fe1f848787c1e7b16fbeda7c7a60c4df8 | VaneezaAhmad/Text-Prediction | /data.py | UTF-8 | 1,162 | 3.578125 | 4 | [] | no_license | import glob
def read_first_line(file):
"""Gets the first line from a file.
Returns
-------
str
the first line text of the input file
"""
with open(file, 'rt') as fd:
first_line = fd.readline()
return first_line
def merge_per_folder(folder_path, output_filename):
"""Mer... | true |
aa26a882881a7c2efac5ad5f21ad2c8937436b0d | juanjosegdoj/Ejercicios-b-sicos-en-Python | /54oscmd.py | UTF-8 | 2,426 | 3.65625 | 4 | [] | no_license | import os
def link_informacion(): #si desea saber más acerca de los siguientes operadores;
os.system("start http://pythonya.appspot.com/detalleconcepto?deta=Creaci%C3%B3n,%20carga%20y%20lectura%20de%20archivos%20de%20texto")
def enlace_python():
os.system("start http://pythonya.appspot.com/" )
... | true |
6a8335c318c37b8ba68090b8aab9bdfe1bbaab44 | haukeD/Maschinlerning-sheet4 | /python/exercise3c.py | UTF-8 | 2,944 | 3.125 | 3 | [] | no_license | """
============================
A demo of K-Means clustering
============================
"""
print __doc__
from time import time
import numpy as np
import pylab as pl
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
np.random.seed(42) # an integer (... | true |
8281d960febcc8798d0ce7802925bfb07f231220 | btoll/howto-algorithm | /python/75-leetcode-questions/matrix/word_search.py | UTF-8 | 879 | 3.421875 | 3 | [] | no_license | import ipdb
def word_search(board, word):
ROWS, COLS = len(board), len(board[0])
path = set()
def dfs(r, c, i):
if i == len(word):
return True
if (r < 0 or c < 0 or
r >= ROWS or c >= COLS or
word[i] != board[r][c] or
(r, c) in path):
... | true |
4acf328c320df670c5cbfe58b6659af4d191410c | VJ-P/30-Days-Of-Leetcode-November-2020 | /lengthOfLongestSubstringTwoDistinct.py | UTF-8 | 819 | 2.96875 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int:
if len(s) == 0:
return 0
longest = 0
i = 0
j = 0
ld = 0
check = set()
while j < len(s):
if len(check) < 1:
check.add(s[i])
... | true |
13a0ef3d06f95a076cceec8ebdb4daf63fcfdc44 | anantkaushik/Competitive_Programming | /Python/hackerearth/string-sum.py | UTF-8 | 989 | 4.3125 | 4 | [] | no_license | """
Consider All lowercase Alphabets of the English language. Here we consider each alphabet from
a to z to have a certain weight. The weight of the alphabet a is considered to be 1, b to be 2,
c to be 3 and so on until z has a weight of 26. In short, the weight of the alphabet a is 1, and
the weight of all other al... | true |
0b797da31d5080d7a351a7d2ff3ba92985b7ec35 | JINO-ROHIT/PyTorch-Codes | /forward_method.py | UTF-8 | 1,545 | 2.78125 | 3 | [] | no_license | import torch
import torchvision
import torch.nn.functional as F
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from torch import optim
from torch import nn
from torch.utils.data import DataLoader
class Network(nn.Module):
def __init__(self):
super().__init_... | true |
dfecd022cf778b2c3983b6a40ed1f65dba337b4f | Aasthaengg/IBMdataset | /Python_codes/p03400/s168483791.py | UTF-8 | 130 | 2.9375 | 3 | [] | no_license | N = int(input())
D,X = input().split()
x = 0
for n in range(N):
An = int(input())
x += 1+(int(D)-1)//An
c = x+int(X)
print(c)
| true |
e32ca3435915207b050a7212b7017517452dc433 | dalbamm/DB-PJT2 | /dataType.py | UTF-8 | 618 | 2.609375 | 3 | [] | no_license | class Theater:
name=''
location=''
capacity=0
def __init__(self, a, b, c):
self.name=a
self.location=b
self.capacity=c
def set(self, a, b, c):
self.name=a
self.location=b
self.capacity=c
class Play:
name=''
genre=''
price=0
def __init__(self, a, b, c):
self.name=a
sel... | true |
309bfebf0e8a4b12be703dd87c03d064730968a3 | wuliebucha/pytorch-baidu-ctc | /torch_baidu_ctc/test.py | UTF-8 | 4,853 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import division
import unittest
import itertools
import numpy as np
import torch
from torch.nn.functional import log_softmax
import torch_baidu_ctc
class CTCLossTest(unittest.TestCase):
@staticmethod
def _create_test_data(dtype, device, average_frames, reduction):
# Size: T x N x 3
... | true |
399f5ed2421931be835c27d9337c424108300e18 | XueqiYang/incrementally-active-learning_SWID | /src/cleaning.py | UTF-8 | 6,178 | 2.984375 | 3 | [] | no_license | import numpy as np
import glob
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn import preprocessing
from sklearn.preprocessing import LabelBinarizer
def open(path):
testFiles = path + "/test_set/totalFeatures5.csv"
trainingFiles = glob.glob(path + "/training_set/*.csv")
lis... | true |
e297404d1f4519d55d6d6763a9dae0133ab70237 | chelseashin/AlgorithmStudy2021 | /chelseashin/SamsungProblems/swea/5658_보물상자비밀번호.py | UTF-8 | 639 | 2.859375 | 3 | [] | no_license | # 18m
# 많이 풀어본 문제라 금방 품
# 특별한 알고리즘 X, 리스트 슬라이싱을 이용해 회전, 값에 16진수 처리를 하면서 중복없이 리스트에 담아줌
import sys
sys.stdin = open("5658_input.txt")
T = int(input())
for tc in range(T):
N, K = map(int, input().split())
A = list(input())
turn = N//4
result = 0
L = []
for _ in range(turn):
for i in range... | true |
e76300afdf0c7f09f211f0c423f102209945cb98 | Grey2k/yandex.praktikum-alghoritms | /tasks/sprint-5/F - Maximum Depth/my_solution.py | UTF-8 | 281 | 3.1875 | 3 | [] | no_license | def solution(root) -> int:
return tree_depth(root)
def tree_depth(root) -> int:
if root is None:
return 0
left_depth = tree_depth(root.left)
right_depth = tree_depth(root.right)
return left_depth + 1 if left_depth > right_depth else right_depth + 1
| true |
8bffe82cf69a18f7899f622498eb96085b0fba2e | vaderkvarn/aoc19 | /5/comp.py | UTF-8 | 3,793 | 2.671875 | 3 | [] | no_license | from __future__ import annotations
from dataclasses import dataclass
from typing import List, Callable, Any
@dataclass
class Ins:
modes: List[int]
args: List[int]
comp: Comp
def next(self):
return len(self.args) + self.comp.i + 1
def get_arg(self, i):
if self.modes[i] == 0:
... | true |