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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dae560eba2f35221dc84a50e7e0069b8415b1451 | Python | Devalekhaa/deva | /play30.py | UTF-8 | 185 | 3.296875 | 3 | [] | no_license | d1,d2,e=input().split()
d1=str(d1)
d2=str(d2)
e=int(e)
count=0
for i in range(0,len(d1)):
if(d1[i]!=d2[i]):
count+=1
else:
continue
if(count==e):
print("yes")
else:
print("no")
| true |
b947d74169b18557e40acb4ff120ae96ddd87819 | Python | erik-hasse/pidrive | /pidrive/hardware/TB6612.py | UTF-8 | 1,112 | 3.375 | 3 | [] | no_license | """TB6612 Motor Controller"""
from pidrive.abstract import DriveMotor
from pidrive.types import Direction
class TB6612Motor(DriveMotor):
"""A motor controlled by the TB6612 board.
Args:
direction_pin (gpiozero.DigitalOutputPin): The GPIO pin connected to
the direction control on the board... | true |
259bccd653b6dc041558fd95c594017a1bfbc547 | Python | isabellafaccone/aquabytePersonal | /alok/biomass_estimation/hungarian_matcher_evaluation/hungarian_matcher.py | UTF-8 | 1,466 | 3.078125 | 3 | [] | no_license | import logging
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import cdist
def hungarian_matcher(left_ids, left_bottom_top_edge_locations, right_ids, right_bottom_top_edge_locations):
"""
TBD
Returns
a list of left and right id pair. If either id is None, it is an un... | true |
0e7774cd5955ac6c1130e62b221be5fc6a3296e5 | Python | wlmgithub/awesome | /phone_generator.py | UTF-8 | 1,834 | 3.671875 | 4 | [] | no_license |
book = {
2: ['a','b','c'],
3: ['d','e','f'],
4: ['g','h','i'],
5: ['j','k','l'],
6: ['m','n','o'],
7: ['p','q','r', 's'],
8: ['t','u','v'],
9: ['w','x','y', 'z'],
}
print(book)
def gen_numbers():
g = (
'%d%d%d%d%d%d%d%d%d%d' % (
n1,
n2,
... | true |
7953d618887badea0ea62e089f51031383da00db | Python | tangziwei/petobj | /imreconstr.py | UTF-8 | 5,942 | 2.890625 | 3 | [] | no_license | import numpy as np
from scipy.interpolate import interp1d
def imgnomal(img):
"""很多情况下得到的灰度点并不在0~255之间
调用此函数江最大值映射为255,最小值映射为0以实现正常显示"""
maxp = img.max()
minp = img.min()
px = 255 * (img - minp) / (maxp - minp)
return np.uint8(px)
def radon(img):
'''输入参数为一副图像 numpy array类型 返回函数的 radon变换阵,以... | true |
5b6e4b1890a0cce99f1ef8eb58b2ab98294d165e | Python | Saurabhdimri06/HackerRank_Solutions | /Python/Runner_UP.py | UTF-8 | 538 | 3.234375 | 3 | [] | no_license | #TASK
#Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores.
#Store them in a list and find the score of the runner-up.
#======================================================================================================
#SOLUTION... | true |
e54561c206a84729ae26d74f63b092fb28333937 | Python | filipov73/python_fundamentals_september_2019 | /16.Lists Advanced - Exercise/02. Big Numbers Lover.py | UTF-8 | 91 | 3 | 3 | [] | no_license | numbers = input().split(" ")
numbers.sort(reverse=True)
print("".join(map(str, numbers)))
| true |
b504f29bb466c87bfa3e643653214aee756bb624 | Python | acarapetis/advent-of-code-2019 | /test_intcode.py | UTF-8 | 1,781 | 2.796875 | 3 | [] | no_license | import pytest
import asyncio
import intcode
from intcode import IntProc, AsyncIntCode, buffered, grouped
intcode.DEBUG = True
cat_code = [
3,20, # INPUT @20
1006,20,10, # JUMP $10 IF @20 == 0
4,20, # OUTPUT @20
1005,0,0, # JUMP $0 IF @20 != 0
# @10
99 # TERM
]
int_seq = [1,2,3,4,-4,12431249283]... | true |
74eaf7a54d5cc567e2cf4500d01e4f7e56edcdf0 | Python | mickey0524/leetcode | /433.Minimum-Genetic-Mutation.py | UTF-8 | 1,333 | 3.109375 | 3 | [
"MIT"
] | permissive | # https://leetcode.com/problems/minimum-genetic-mutation/description/
#
# algorithms
# Medium (36.58%)
# Total Accepted: 17.1k
# Total Submissions: 47.3k
from collections import deque
class Solution(object):
def minMutation(self, start, end, bank):
"""
:type start: str
:type end: str
... | true |
41f7dccbb9e6f47a40d1d82628f46defe8baa604 | Python | sangyh/discrete-event-simulation | /main.py | UTF-8 | 775 | 3.09375 | 3 | [] | no_license | """
Created on 2/05/2018
Author:Sangy Hanumasagar
GT ID: 902825462
"""
import operator
'''Define Data Structure for event list and event processor
Event: Tuple of (ID,timestamp)
Event List: List of events to be executed
'''
EventList=[]
def addEvent (event,time):
EventList.append((event,time))
... | true |
2ce00dba4e436fd122a447fc05a76f0859755bba | Python | Elishva/find-paths | /paths/view.py | UTF-8 | 1,746 | 2.90625 | 3 | [] | no_license | import paths.controller as c
class View:
def __init__(self):
pass
def load(self, filename, imname):
print("yes i can!\n")
# self.file_name = input("Please enter the file name")
# self.im_name = input("Please enter the image name or enter to use default image")
self.fil... | true |
845aa5d3199ac6cfc3364548977c28b2b25f756a | Python | raj-pat/CrackingTheCodingInterview | /Chapter 4/5.py | UTF-8 | 1,027 | 4 | 4 | [] | no_license | # check if the tree is BST
class node:
def __init__(self, val):
self.k = val
self.left = None
self.right = None
elems = [58, 4, 5, 7, 2, 8, 9, 1, 0]
def insert(root, nod): # doesn't allow duplicates
if nod.k < root.k:
if root.left != None:
insert(root.left, nod)... | true |
23a674dbe32eb23ea10f56c2038e8941c81a5337 | Python | shcqupc/Alg_study | /AIE23/20191124_linear_regression/9_regression_implement/logist_regression.py | UTF-8 | 1,690 | 3.34375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
#功能: 使用tensorflow实现一个简单的逻辑回归
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
#创建占位符
X=tf.placeholder(tf.float32)
Y=tf.placeholder(tf.float32)
#创建变量
#tf.random_normal([1])返回一个符合正态分布的随机数
w=tf.Variable(tf.random_normal([1],name='weight'))
b=tf.V... | true |
6144fefc93a21b6d989030dc5fc3d5fd9b236607 | Python | SciEcon-GameTheory/Case-64-Repeated_game | /64.py | UTF-8 | 2,698 | 3.140625 | 3 | [] | no_license | import numpy as np
class player:
def __init__(self, identity, pay_off_matrix, utility):
self.rep = 0
self.j = identity
self.pay_off_matrix = pay_off_matrix
self.utility = utility
pass
def generate_long_term_utility(self, a, b):
# a=0 is honest, a=1 is dishonest
... | true |
faf25332d41765a25c08709f587e6a2d621ef4bf | Python | sanjeev1779/codechef | /search.py | UTF-8 | 147 | 3.296875 | 3 | [] | no_license | t=int(input())
for k in range(0,t):
a,b=input().split()
x=a.find(b)
if(x==-1):
print('0')
else:
print('1')
| true |
b311dd62ec7f97f0c7b190261bd98ab1f9bb778e | Python | Anubhavsr54/Big_Mart_Sales_Prediction_Project | /Sales_module/dataframe_features.py | UTF-8 | 3,355 | 2.8125 | 3 | [] | no_license |
import pandas as pd
from Sales_module.logger import log_class
import os
from Sales_module.loading_raw_data import Loading_raw
class Features:
def __init__(self):
self.folder = './Log_file/'
self.filename = 'features_logs.txt'
self.df_object = Loading_raw()
if not os.path.i... | true |
2300a40a5a044a3d06daa033801acf954c7c3984 | Python | jonasbergmn/pQuotes | /Question.py | UTF-8 | 1,170 | 3.609375 | 4 | [] | no_license | import random
class Question:
def __init__(self, question:str, answer:str, category:str):
self.question = question
self.category = category
self.answer = answer
def setChoices(self, choices):
self.choices = choices
def giveChoices(self):
final_answers = self.choic... | true |
9c87edf970cbbc8b9f26c55c4d1a911cecda1ee5 | Python | ma-githup/rankingList | /rankList/rank_list/rank_app/views.py | UTF-8 | 1,663 | 2.78125 | 3 | [] | no_license | from django.shortcuts import render
from django.views import View
from django_redis import get_redis_connection
# Create your views here.
# 连接redis,实现有序集合
conn = get_redis_connection('default')
# 添加服务器
class AddServer(View):
def get(self,request):
return render(request,'Add.html')
def post(self,reque... | true |
530dc48217e612bee95c2f104190812e8db98ff0 | Python | bperard/PDX-Code-Guild | /python/lab28-socks.py | UTF-8 | 994 | 3.828125 | 4 | [] | no_license | '''
lab 28 socks
'''
import random # used for randint
# lists for color and type, pile list, drawer dict
sock_colors = ['black', 'white', 'blue']
sock_types = ['ankle', 'crew', 'calf', 'thigh']
sock_pile = []
sock_drawer = {}
# generate random sock pile list with tuple (color, type)
while len(sock_pile) < 100:
... | true |
ec324ee59bc676ca3df0d713c81ba9ba45801338 | Python | RedSkiesIO/catalyst-network-simulation | /python/sim/simlib/simple_storage.py | UTF-8 | 793 | 2.828125 | 3 | [] | no_license | import scipy.io
import os
class store:
def __init__(self, home_directory: str):
self.home_directory = home_directory
def save_variable(self, directory: str, variable_name: str, obj):
full_directory = os.path.normpath(self.home_directory + '/' + directory + '/')
if not os.path.exists(full_directory):
os.mak... | true |
8b6dfb435ac64b7108f66b7304c40c70565000f0 | Python | alexarmstrongvi/MyAnalysis | /scripts/make_yield_table.py | UTF-8 | 4,890 | 2.53125 | 3 | [] | no_license | """
Program: make_yield_table.py
Author: Alex Armstrong <alarmstr@cern.ch>
Copyright: (C) Dec 8th, 2017; University of California, Irvine
"""
from argparse import ArgumentParser
from collections import namedtuple
import ROOT
import global_variables as G
# Configure
data_sample_name = 'data_all'
signal_sample_name = '... | true |
e69541fafd708ae146bdbd5cd4d472789f015d5a | Python | bobcaoge/my-code | /python/leetcode/143_Reorder_List.py | UTF-8 | 812 | 3.21875 | 3 | [] | no_license | # /usr/bin/python3.6
# -*- coding:utf-8 -*-
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def reorderList(self, head):
"""
:type head: ListNode
:rtype: None Do not return anything, modify head in-place instead.
... | true |
01009a4ca41f676080961c1f471fa73addb2ee97 | Python | FreddieMercy/leetcode | /Python/_2017/July2017/July02nd2017/_62UniquePaths.py | UTF-8 | 361 | 2.625 | 3 | [] | no_license | class Solution(object):
def uniquePaths(self, m, n):
mem = []
for row in range(m):
mem.append([])
for col in range(n):
if not row or not col:
mem[row].append(1)
else:
mem[row].append(mem[row-1][col]+mem[r... | true |
f4763100f6e91c6af4093a73d461b30d387a87f7 | Python | RoseSJose/Flask-Tutorial | /Shows/app.py | UTF-8 | 527 | 2.53125 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
import crawler
import psycopg2
app = Flask(__name__)
dbconn = psycopg2.connect(dbname="show")
@app.route("/")
def index():
crawler.create_table()
crawler.insert()
return render_template("index.html")
@app.route("/search")
def search():
cursor... | true |
ce05d4c236582299e97a41f1c7b062163ca05164 | Python | Aasthaengg/IBMdataset | /Python_codes/p03449/s798630793.py | UTF-8 | 287 | 2.546875 | 3 | [] | no_license | def resolve():
n = int(input())
a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
total = 0
for i in range(n):
line_1 = sum(a_1[:i+1])
line_2 = sum(a_2[i:])
total = max(total, line_1+line_2)
print(total)
resolve() | true |
144ead408633d71736f9c2701557b1ceb11ca993 | Python | hunara/Unsorted-projects | /Class_tutorial.py | UTF-8 | 926 | 3.375 | 3 | [] | no_license |
import math
class Attributes:
def abilitymod(self, abilityscore):
self.modifier = math.trunc((abilityscore / 2) - 5)
return self.modifier
toon = Attributes()
testabilities = {
'Strength': 15,
'Dexterity': 11,
'Constitution': 12,
'Intelligence': 13,
'Wisdom': 14,
'Charis... | true |
3bd27176f4a276129f50e48619258840635d39fa | Python | lzdh/vital_sqi | /tests/sqi/test_dtw_sqi.py | UTF-8 | 711 | 2.78125 | 3 | [
"MIT"
] | permissive | import pytest
from vital_sqi.sqi.dtw_sqi import dtw_sqi
class TestDtwSqi(object):
x = [0, 1, 2, 3]
def test_on_invalid_template_type(self):
template_types = [2.1, 4]
for i in template_types:
with pytest.raises(ValueError) as exc_info:
dtw_sqi(self.x, i)
... | true |
ce0452e69e14e8e2a1b864e8d0122da29d15c24b | Python | Fed4Brilliance/DP-SFed | /_utils/fast_svd.py | UTF-8 | 732 | 2.796875 | 3 | [] | no_license | import numpy as np
import time
from scipy.linalg import eigh as largest_eigh
from scipy.sparse.linalg.eigen.arpack import eigsh as largest_eigsh
np.set_printoptions(suppress=True)
np.random.seed(0)
N=50
k=1
X = np.random.random((N,N)) - 0.5
X = np.dot(X, X.T) #create a symmetric matrix
# Benchmark the dense routine
s... | true |
4cec7fec81a7b63e3703e8f7a03d7b578890cb4b | Python | abhishek-paliwal/Bash-Scripts-To-Make-Life-Easier | /mggk_bash_scripts/600-mggk-artificial-intelligence-nlp-programs/601-mggk-using-ai-nlp-to-find-keywords-from-list-of-top-google-urls/601-mggk-using-ai-nlp-to-find-keywords-from-list-of-top-google-urls.py | UTF-8 | 34,728 | 2.859375 | 3 | [] | no_license | ##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## USAGE FOR PYTHON
## Print this help as >> this_script_name --help
## CREATING SCRIPT USAGE FUNCION AND CALLING IT VIA '--help'
import sys
####
def usage():
print('## USAGE: ' + sys.argv[0])
HELP_TEXT = """
##################... | true |
ee19e5419a74ce154deaa62b15123308074069f9 | Python | daniel-reich/ubiquitous-fiesta | /iA5aeTFGLcxx94Wjh_0.py | UTF-8 | 139 | 3.3125 | 3 | [] | no_license |
def delete_occurrences(lst, num):
new_lst = []
for i in lst:
if new_lst.count(i) < num:
new_lst.append(i)
return new_lst
| true |
811e6cc0185503a10f0553e0b6a1431900e9b770 | Python | borbota/redflags_stuff | /redflags_organization_list_to_csv.py | UTF-8 | 494 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import csv
import os
# define path to files
mypath = ""
for file in os.listdir(mypath):
if file.endswith(".json"):
json_data = open(file).read()
data = json.loads(json_data)
data2 = data["result"]
with open('organizations_2017.csv','a'... | true |
5ccf07e727e2099a08a2a7d27235578e42b04b19 | Python | Bobspadger/royal_mail_rest_api | /royal_mail_rest_api/shipping.py | UTF-8 | 6,803 | 2.6875 | 3 | [
"MIT"
] | permissive | import requests
import datetime
from royal_mail_rest_api.api import RoyalMailBaseClass
from royal_mail_rest_api.errors import RoyalMailError
class ShippingApi(RoyalMailBaseClass):
"""
Royal Mail Shipping Class, used to communicate with the Royal Mail Rest API to create labels
"""
token_url = '/shippin... | true |
924f8bacf1fb8c83cf556332c2e55e1f217311bf | Python | ZHANG-EH/EECS475-Project | /substr_enc/substr_enc/utils/suffix_tree_helper.py | UTF-8 | 1,215 | 3.53125 | 4 | [] | no_license | """
Helper functions for suffix tree.
Jiangchen Zhu <zjcsjtu@umich.edu>
"""
def get_path_helper(node):
"""Compute the path label of a node recursively."""
if node.parent == None:
# if this is a root node
return ''
else:
return get_path_helper(node.parent) + node.edge_label
def g... | true |
38578db26c3a95c401488b911b7ef4f8ca607fb3 | Python | muvendiran/3.py | /21.PY | UTF-8 | 115 | 2.890625 | 3 | [] | no_license | a11,a21,a31=input().split()
a11=int(a11)
a21=int(a21)
a31=int(a31)
sum=(a11/2)*(2*a21+(a11-1)*a31)
print(int(sum))
| true |
c8d139772524755f1ca848cbd5989864f32ad2e9 | Python | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | /week3_course_python_III/day2_python_VIII/exercises/imports/a/x.py | UTF-8 | 242 | 2.9375 | 3 | [
"MIT"
] | permissive | def f1x():
print("hola")
def f2x():
f2z()
x=2
y=1
print(f1x())
from b.c.z import f2z # si importo todo las funciones llamadas en la otra pagina se van a mostrar tambien porque importas todo, tendrias que importar solo la funcion
f2x() | true |
dc536af6e1199542f8c309f32d17311965bf62d9 | Python | jurgisp/rl-sandbox | /Agent.py | UTF-8 | 1,925 | 2.578125 | 3 | [] | no_license |
import time
import random
from collections import deque
import numpy as np
import os
import gym
from gym import envs
class Agent:
def __init__(self,
env,
brain,
train_nsteps=1,
max_epsilon=1.0,
min_epsilon=0.1,
... | true |
f9ab2a97d613e1d50f19dc9157deb0de6a1c67bc | Python | thelukemccarthy/water-sensor | /ec_sensor.py | UTF-8 | 3,145 | 2.828125 | 3 | [] | no_license | import smbus
from sensor_dto import *
import pickle
import os.path
class EcSensorSettings:
def __init__(self):
# default settings
self.write_check = 1
self.low_ec_calibration = 200
self.high_ec_calibration = 1380
self.ec_step = 60
def save(self):
with open('ec_s... | true |
098d5853c0e120fab8d360b2b4679f5d6afd2cac | Python | goppy510/atcoder | /BeginnerSelection/ABC026_A.py | UTF-8 | 101 | 3.59375 | 4 | [] | no_license | a = int(input())
t = 0
for x in range(a):
y = a - x
_t = x*y
if _t > t:
t = _t
print(t)
| true |
ecdd259a6dc2eaed7c499788d13d7b3c398852f2 | Python | TomKan0909/terminal-spotify | /spotify_track.py | UTF-8 | 387 | 2.765625 | 3 | [] | no_license | from typing import List
from spotify_abstract import SpotifyAbstract
""""
Represents a spotify album
"""
class SpotifyTrack(SpotifyAbstract):
def __init__(self, name, id, track_number):
self.track_number = track_number
super().__init__(name, id)
def __str__(self):
... | true |
0ccdd02d71243c60c458399bd5b3e308182359d0 | Python | AnumHassan/ASG | /Q_5.py | UTF-8 | 408 | 3.5 | 4 | [] | no_license | import datetime
year_1 = int(input('Enter a year '))
month_1 = int(input('Enter a month '))
day_1 = int(input('Enter a day '))
date1 = datetime.date(year_1, month_1, day_1)
year_2 = int(input('Enter a year '))
month_2 = int(input('Enter a month '))
day_2 = int(input('Enter a day '))
date2 = datetime.date(year_2, month_... | true |
67259c108ba59d078b58534baa54724e663bff00 | Python | gaurang1703/algorithm-practice-python | /python/coding-dojang/test_source_code_file/code2.py | UTF-8 | 1,673 | 3.1875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
# 웹 페이지를 가져온 뒤 BeautifulSoup 객체로 만듦
url = "http://www.weather.go.kr/weather/observation/currentweather.jsp"
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
table = soup.find("table", {"class" : "table_develop3"})
data = []
for tr in tab... | true |
f9b5464c8f6f3c018e527e8579fc9bfe3f3f64fd | Python | pkusp/kaggle-quora-classification-2018 | /working/bi-lstm_baseline.py | UTF-8 | 4,935 | 2.875 | 3 | [] | no_license | # encoding: utf-8
"""
@author: pkusp
@contact: pkusp@outlook.com
@version: 1.0
@file: bi-lstm_baseline.py
@time: 2018/11/20 下午4:43
LSTM is all you need
"""
# 2000 seconds
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
import time
from datetime import datetime
imp... | true |
e2b72d9594b82060a84fb990f3a61a59a95102ef | Python | LinYuFengXiao/GBN-Client-Server | /GBN_Server.py | UTF-8 | 4,982 | 2.671875 | 3 | [] | no_license | import select
import socket
import sys
from random import random
from GBN.Data import Data
class GBNServer:
def __init__(self):
self.nextseqnum = 1
self.addr = ('127.0.0.1', 31500)
self.client_addr = ('127.0.0.1', 12345)
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM... | true |
59a95e98906c95139c6c95879b62edf8fe8917b9 | Python | hortegab/backup_pruebas_gnuradio | /programacionconcodigo/program_objetos/parte1/leccion1.py | UTF-8 | 204 | 3.0625 | 3 | [] | no_license | class B_add_ff:
def __init__(self):
print('se creo un b_add_ff')
def function(self):
print('soy una funcion')
misumador=B_add_ff()
misumador.function()
print ('he terminado')
| true |
5ecafa092ef323d11c2c667e26c59dd0c7e0b961 | Python | lofie21/HARK | /HARK/tests/test_ConsIndShockInit.py | UTF-8 | 897 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | """
This file tests whether ConsIndShockModel's are initialized correctly.
"""
# Bring in modules we need
import unittest
import numpy as np
import HARK.ConsumptionSaving.ConsumerParameters as Params
from HARK.ConsumptionSaving.ConsIndShockModel import IndShockConsumerType
from HARK.utilities import plotFuncsDer, plo... | true |
a1cf753c4604565cc8395cd1fe950ef331ed800d | Python | TPouplin/Projet-coding-week | /sudoku/Reconnaissance/Reconnaissance_image.py | UTF-8 | 9,527 | 3.0625 | 3 | [] | no_license | import cv2
import operator
import numpy as np
from matplotlib import pyplot as plt
def affiche_image(image):
"""Affiche une image donnée jusqu'à ce qu'une touche soit entrée"""
cv2.imshow('image', image) #Affiche l'image
cv2.waitKey(0) #Attend qu'une touche soit appuyée (l'image est encore visible)
cv2... | true |
1cf13f5ea59db6abfc02915058b066595f6fa1ce | Python | michaelmcmillan/michaelmcmillan.github.io | /src/rss_feed.py | UTF-8 | 457 | 2.59375 | 3 | [] | no_license | from blog import Blog
from template import Template
class RSSFeed(Blog):
def compile(self, header, body, footer):
header, body, footer = (Template(header), Template(body), Template(footer))
compiled = ''
for post in self.posts:
compiled += body.compile({
'title'... | true |
c93db15e11c3fc7fc1fe24797dea98525138757e | Python | zuxfoucault/ConvNet-OOP | /data_loader/stl10_loader.py | UTF-8 | 4,394 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Implements the Stl10Loader class by inheriting the DataLoader base class.
STL-10 dataset is loaded from an external path (i.e., in dataset folder) and preprocessed.
Created on Sun Apr 22 20:54:32 2018
@author: Santosh Pattar
@author: Veerabadrappa
@version: 1.0
"""
from base.data_loader_b... | true |
6e302853ba193562be2d56d9d65c9b1a0a28f060 | Python | ych09041/supercool | /hotSwapTest.py | UTF-8 | 4,891 | 3.296875 | 3 | [] | no_license | import smbus
import time
bus = smbus.SMBus(1)
##slaveAddress = 0x05
class ArmObj:
"""Object for representing 1 mechanical arm. Using OOP just for data management.
"""
def __init__(self, busLine, i2cMinRange=3, i2cMaxRange=10):
"""Constructor for ArmObj. Needs a busline that it operates on and the... | true |
0fb721c1c078bb424aadc7cec1ac858601f634d2 | Python | samueljefferson/A-Star-Pathfinding | /sidewinder.py | UTF-8 | 3,691 | 2.96875 | 3 | [] | no_license | # adapted from
# http://weblog.jamisbuck.org/2011/2/3/maze-generation-sidewinder-algorithm
import numpy as np
import forward_astar as fa
def go_east(east_percent):
if np.random.random() < east_percent:
return True
else:
return False
def get_paths_up(left, right, row, env):
up_chance = 0.4... | true |
5695e470f5e7c248b208826e9f9a52484b8a232a | Python | liuluyang/miller | /education/10-10/循环.py | UTF-8 | 126 | 3.015625 | 3 | [] | no_license |
# n = 0
# sum_num = 0
# while n < 100:
# n += 1
# sum_num = sum_num + n
# print(sum_num)
#
# print("""""'aa'""""")
| true |
736bf6b1a95adcc18533a78c18c9fccfc1ae0136 | Python | niteshrawat1995/cowin_tracker | /notifiers/twilio.py | UTF-8 | 1,252 | 2.546875 | 3 | [] | no_license | import os
from .base import Notifier
from twilio.rest import Client
from dotenv import load_dotenv
load_dotenv()
class Twilio(Notifier):
TWILIO_ACCOUNT_SID = os.environ.get("ACCOUNT_SID")
TWILIO_AUTH_TOKEN = os.environ.get("AUTH_TOKEN")
FROM_WHATSAPP_NUMBER = os.environ.get("FROM_WHATSAPP_NUMBER")
FR... | true |
4bec851799fcbffdcb963b30187a8daeff7e559a | Python | thyagomaia/projetocpu20211 | /strings/kleberbarros/1234.py | UTF-8 | 759 | 3.921875 | 4 | [] | no_license | while(True):
try:
cont = 0 #contador
strg = "" #string final
entrada = input() #string auxiliar (linha)
entrada = entrada.lower() #mudando para minusculo
for i in range(len(entrada)):
if(entrada[i] == ' '):
strg += entrada[i] #concatenan... | true |
8c1f8826eedfd51ef1adf30387e01532f2f872c2 | Python | MKoi/spaceSW | /textbox.py | UTF-8 | 5,642 | 2.703125 | 3 | [] | no_license | #from __future__ import print_function
#import textwrap
def biggerThan(a,b):
return a[1] > b[1] or (a[1] == b[1] and a[0] > b[0])
class Textbox(object):
def __init__(self, rows, columns):
self.chars = [['' for x in range(columns)] for y in range(rows)]
self.bak = [['' for x in range(columns)] for y in r... | true |
11bea96d90a83799b0c3368f39f82d8d3fda208d | Python | bodom0015/platform | /nest_py/omix/data_types/cohort_phylo_tree_nodes.py | UTF-8 | 4,186 | 2.546875 | 3 | [
"MIT"
] | permissive | """
The attributes of the nodes of a phylogenetic tree (taxonomy) for a single
cohort. This is the primary place analytics results for a cohort's
taxonomy are kept.
"""
from nest_py.core.data_types.tablelike_schema import TablelikeSchema
#FIXME this needs to go somewhere more generic
NUM_QUANTILES = 20
COLLECTION_NA... | true |
4c2687b61b93682b7dc56ca1aa1dc6a7c1d24172 | Python | shen-huang/selfteaching-python-camp | /exercises/1901040051/d08/mymodule/stats_word.py | UTF-8 | 1,132 | 3.578125 | 4 | [] | no_license | text = 12
# text = []
import collections
import re
def stats_text_en(string_en):
if type(string_en)!= str:
raise ValueError('文本为非字符串')
result = re.sub("[^A-Za-z]", " ", string_en.strip())
newList = result.split( )
print('英文单词词频统计结果: ',collections.Counter(newList),'\n')
def stats_text... | true |
51a0db3cb6a4bda1eb4c49725877264c22347629 | Python | ErangaHeshan/HackerRank | /HackerlandRadioTransmitters.py | UTF-8 | 700 | 3.171875 | 3 | [] | no_license | #!/bin/python3
n, k = input().strip().split(' ')
n, k = [int(n), int(k)]
x = [int(x_temp) for x_temp in input().strip().split(' ')]
x.sort()
t_count = 0
prev_t = 0
distance = 0
for i in range(n - 1):
if prev_t != 0:
if x[i] > prev_t + k:
distance += x[i + 1] - x[i]
if d... | true |
f10e2b7e880e12a647de38453ae3d456ee9a4371 | Python | JannikGDev/AdventOfCode2019 | /Task11/IntCode.py | UTF-8 | 3,830 | 2.625 | 3 | [] | no_license | from typing import List
class IntCode:
def __init__(self, code, instruction_pointer: int = 0, rel_base: int = 0):
self.code: List = code
self.rel_base = rel_base
self.i = instruction_pointer
self.outputs = []
self.inputs = []
self.stopped = False
def get(self... | true |
8d83eef0d3dbe76e957766bc7efa31e756e096b6 | Python | m-piechatzek/phishing_url_detector | /src/naive_bayes.py | UTF-8 | 2,353 | 3.40625 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import confusion_matrix, accuracy_score
# Bar Chart
import numpy as np
import matplotlib.pyplot as plt
class NaiveBayesMain:
def __init__(self, phishing_csv_path, legitimate_c... | true |
302a06c3da118ad6b118fcff910ab507a49bcef8 | Python | thipham-200467699/BDAT1007.Assignment1 | /brand.py | UTF-8 | 1,180 | 2.796875 | 3 | [] | no_license | from db_utilities import DbUtiltity
class Brand:
def __init__(self, p_brand_name='', p_models=[]):
self.name = p_brand_name
self.models = p_models
def serialize(self):
return {
'name': self.name,
'models': self.models
}
def get_all_brands():
_br... | true |
e60ab2b13b69b2a5d4f2cd699afb47d29576f421 | Python | Nur3400/practise | /nur.py | UTF-8 | 82 | 3.203125 | 3 | [] | no_license | name="amar sonar bangla ami tomai valobashi"
print(name)
a=10
b=20
c=a+b
d=b-a
e=a*b
print(c)
print(d)
print(e)
| true |
60ca004eec7001b8828b3f27a92ef9b1d2c09506 | Python | git-gagan/greyatom-python-for-data-science | /my-first-python-project/code.py | UTF-8 | 1,058 | 3.75 | 4 | [
"MIT"
] | permissive | # --------------
# Code starts here
class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2=['Hilary Mason','Carla Gentry','Corinna Cortes']
new_class=class_1+class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
# Code e... | true |
307cea060e6abf46dd92314ddc0c1e6bfaa0d3d7 | Python | TaeYeon-kim-ai/keras | /keras53_pandas4_np.py | UTF-8 | 345 | 2.625 | 3 | [] | no_license | import numpy as np
import pandas as pd
df = pd.read_csv('../data/csv/iris_sklearn.csv', index_col=0, header=0)
print(df.info())
aaa = df.to_numpy()
print(aaa)
print(type(aaa))
# bbb = df.Values
# print(bbb)
# print(type(bbb))
np.save('../data/npy/iris_sklearn.npy', arr=aaa)
#과제
#pandas의 loc iloc... | true |
f7ebcf178940a5db2884522aa0b987b30ccf2a1f | Python | Createitv/BeatyPython | /05-PythonAlgorithm/BasicDataStructure/array/second_largest_num.py | UTF-8 | 1,616 | 3.578125 | 4 | [] | no_license | #!/Users/tnt/Documents/虚拟环境/Py4E/bin/python3
# -*- encoding: utf-8 -*-
# Time : 2021/07/25 22:41:43
# Theme : 寻找数组中第二个最大元素
def find_second_maximum_1(lst):
first_max = float('-inf')
second_max = float('-inf')
# find first max
for item in lst:
if item > first_max:
first_max = item
... | true |
7420af260c04088c28b39da8a89ea74607bbb822 | Python | xdhuxc/xflask | /app/devops/bfd.py | UTF-8 | 4,834 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 除法总是会返回真实的商,不管操作数是整形还是浮点型。执行from future import division 指令就可以做到这一点。
from __future__ import division # 需要放到文件最开头
import os
import sys
import getopt
# https://blog.csdn.net/beautygao/article/details/79231571
'''
http://andylin02.iteye.com/blog/1071448
http://www.runoob.c... | true |
9a4747efdd7ee224255a7d5f9010d0e73f90f54f | Python | Avstrian/SoftUni-Python-Advanced | /Functions_Advanced/2-Sort.py | UTF-8 | 154 | 3.515625 | 4 | [] | no_license | def sort(list_of_nums):
sorted_nums = sorted(list_of_nums)
print(sorted_nums)
numbers = list(map(int, input().split(" ")))
sort(numbers)
| true |
f51279611e9ab474abc0402436fd597b6525177a | Python | Estorva/MDPSim | /visualizer/chessknight.py | UTF-8 | 1,518 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
def aToCoord(a):
if a == 'nne':
return (1, 2)
if a == 'ene':
return (2, 1)
if a == 'ese':
return (2, -1)
if a == 'sse':
return (1, -2)
if a == 'ssw':
return (-1, -... | true |
b4e63bc7c6a95c6c5c77664d6bd4fb467146227e | Python | IotaSpencer/shell-scripts | /unrealgen.py | UTF-8 | 17,514 | 2.625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# -*- coding: utf-8 -*-
import argcomplete
from argparse import *
from termcolor import colored
import requests
import sys
admin_block = []
hosts = []
#Config
v = "unrealgen 0.5"
#Classes
class CustomError(Exception):
def __init__(self, value):
self.parameter ... | true |
dbb2f4474dd08924438d836ae28cbd3a7d07917a | Python | hedayet13/practiceCoding | /hackerRank83_twoString.py | UTF-8 | 212 | 3.125 | 3 | [] | no_license | n=int(input())
for iter in range(n):
a=input()
# a='hello'
a=set(list(a))
b=input()
# b='World'
b=set(list(b))
if a.intersection(b):
print('YES')
else:
print('NO') | true |
a3c04e95780e08c036ccbcd3fa08bd92692efd5a | Python | Tygo-bear/CSCBE-2021 | /StrangeSounds.py | UTF-8 | 1,052 | 2.953125 | 3 | [] | no_license | import wave
import numpy
# Read file to get buffer
ifile = wave.open('StrangeSounds.wav')
samples = ifile.getnframes()
audio = ifile.readframes(samples)
# Convert buffer to float32 using NumPy
audio_as_np_int16 = numpy.frombuffer(audio, dtype=numpy.int16)
audio_as_np_float32 = audio_as_np_int16.astype(numpy.float32)
... | true |
f8eda84cfda33f9d4fc3bb199f57e9d228d73762 | Python | siddharthgaud/python_basic_code | /python basics/updated w3school/functionss.py | UTF-8 | 266 | 3.546875 | 4 | [] | no_license | def func(): # creating a function
print("a function is created and then called")
func() # calling a function to print above statement
def funct(fname):
print(fname + " Gaud ")
funct("siddharth")
funct("Daksha") | true |
004e63557a7b70c85876d37cd4833defc1498a09 | Python | Yradio/phishbuckets | /pbos.py | UTF-8 | 12,608 | 2.796875 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | #
# pbos.py - functions calling the Linux OS, and utilities
#
def get_at_tasks():
"""Show the queued tasks."""
import subprocess
# Calls standard 'atq'
bash = "atq"
atlist = subprocess.check_output([bash], shell=True)
# Comes back as bytes, hence the decode bit...
alljobs = atlist.d... | true |
3f1cffe274170d8d8564973a8645198d1a0eb34a | Python | kunimune0893/test | /test.py | UTF-8 | 1,200 | 2.5625 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
get_ipython().magic('load_ext autoreload')
get_ipython().magic('autoreload 2')
get_ipython().magic('matplotlib inline')
import sys, os, math, re
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns # グラフスタイル
#np.set_printoptions?
#np.set... | true |
77ac9ae0b0727b575b77a7d35f63345d29a558cc | Python | AndersHqst/datamining | /project/scanners/page_rank_scanner.py | UTF-8 | 538 | 2.625 | 3 | [] | no_license | import sys
from utils.bin_helper import bin_numeric
from scanner_attribute import ScannerAttribute
def page_rank_scanner(website):
"""Scan website for its PageRank.
This number is actually set on the website object,
and we add it to the proprocessing by providing a
scanner
:param website: websit... | true |
148c14a8295db476035fec39c203e9c4b6661efb | Python | gdao-research/A2C | /runner.py | UTF-8 | 2,679 | 2.53125 | 3 | [] | no_license | import numpy as np
class Runner(object):
def __init__(self, env, policy, nb_rollout=5, gamma=0.99):
self.env = env
self.policy = policy
self.obs = self.env.reset()
self.nb_rollout = nb_rollout
self.gamma = gamma
def rollout(self):
# Roll
N, H, W, C = sel... | true |
3900b79e9cc60e5ae216562240c528a40d267234 | Python | zix99/sshsysmon | /sshsysmon/lib/util/dictlib.py | UTF-8 | 1,722 | 3.109375 | 3 | [
"MIT"
] | permissive | from .timespan import TimeSpan
from .size import ByteSize
from datetime import datetime
from dateutil.parser import parse
# Merge b into a. path is for logging
def merge(a, b, path=[], overwrite=False):
o = dict(a) # Clone
for key in b:
if key in o:
if isinstance(o[key], dict) and isinstance(b[key], dict):
... | true |
cee09da2bcfe7ffa6e24cc6772176a53036169df | Python | wilsonrivero/E-commerce-python-flask | /app/controllers/routes.py | UTF-8 | 4,423 | 2.78125 | 3 | [] | no_license | from flask import render_template, request, flash, redirect, url_for
from app import app, db
from app.models.tables import Products
import matplotlib.pyplot as plt
import os
@app.route('/')
def home():
try:
product = Products.query.all()
total = 0
for p in product:
total += p.price
... | true |
1abcd31fa3d48cf83d9da5e90c8d43f7d939d40a | Python | AdamPurnomo/C3-Robot-Arm-Control | /Source Code/Debugging Code/Jacobian/Jac.py | UTF-8 | 2,231 | 3.359375 | 3 | [] | no_license | import sympy
a = sympy.Symbol('a')
b = sympy.Symbol('b')
c = sympy.Symbol('c')
d = sympy.Symbol('d')
e = sympy.Symbol('e')
f = sympy.Symbol('f')
g = sympy.Symbol('g')
def cos(m):
res = sympy.cos(m)
return res
def sin(n):
res = sympy.sin(n)
return res
x = -65*(((-sin(a)*sin(c) + cos(a)*cos(b)*cos(c))... | true |
a7db0e55c16a7ab22d6686065b6b33e6d2fbcda8 | Python | learnMyHobby/list_HW | /listStudents.py | UTF-8 | 378 | 4.09375 | 4 | [] | no_license | # Make a list of ten students in your class.
# Print the name of each student whose name starts with ‘B’.
# making the list of ten students in my class
list_of_students = ['hari','shyam','Bibek',
'Bishal','anup','aditya',
'safal','abhaya','arun','sita']
for i in list(list_of_s... | true |
d6b6bbbf84c4bae923bfab3ba70c26673ff63d12 | Python | ingridyfan/sorting_project | /sorting3.py | UTF-8 | 4,587 | 3.4375 | 3 | [] | no_license | import csv
import sys
import pandas as pd
import numpy as np
import time
import timeit
import datetime
#CONSTS
NUMCOMP = "Numerical"
DATECOMP = "Date"
TEXTCOMP = "Text"
'''
Call the function get_filtered_dataframe
Input:
filename of the CSV
List of Tuples with the format...
(Category Name, Comparison Type, Ope... | true |
7fcc5be0184aab7fb0720d25514d0ad24408ffc1 | Python | mjedmonds/OpenLockLearner-AAAI20 | /openlockagents/OpenLockLearner/quit.py | UTF-8 | 753 | 2.8125 | 3 | [] | no_license | import zmq
import zlib
import pickle
def send_zipped_pickle(socket, obj, flags=0, protocol=-1):
"""pickle an object, and zip the pickle before sending it"""
p = pickle.dumps(obj, protocol)
z = zlib.compress(p)
return socket.send(z, flags=flags)
def recv_zipped_pickle(socket, flags=0, protocol=-1):
... | true |
f2616ceea65eb46eba5bc8a700534c64bffb4ec8 | Python | Matthew94/reshef_battle_sys | /card_class.py | UTF-8 | 1,430 | 3.640625 | 4 | [] | no_license | class Card(object):
def __init__(self, title = "Dark Magician", type = "Monster"):
"""Contains the attributes of the card."""
self.title = title
self.short_title = self.create_short_title(title)
self.attack = 2500
self.defence = 2100
self.type = type
self.desc... | true |
289dd40647872985a394b961441c147fe595b1c4 | Python | 23lnlx/datasci-sys-and-algos | /a3/pr6.py | UTF-8 | 1,181 | 3.09375 | 3 | [] | no_license | import MapReduce
import sys
"""
Word Count Example in the Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
matrix = record[0]
row = record[1]
... | true |
d679b979b867993f0bd5aa49257651427a15a329 | Python | jrreed83/linear_regression | /model/linear_regression.py | UTF-8 | 324 | 2.71875 | 3 | [] | no_license | import torch.nn as nn
class LinearRegression(nn.Module):
def __init__(self, din):
super().__init__()
self.layer = nn.Linear(din,1)
def forward(self, inputs):
outputs = self.layer(inputs)
# This makes the outputs a 1D tensor
outputs = outputs.view(-1)
return out... | true |
d98380ed1d8d725477ddc2530aef9639aac81319 | Python | fsaldivar/python | /Master/Ej_4_02.py | UTF-8 | 308 | 4.3125 | 4 | [] | no_license | '''
Ejercicio 2
Algoritmo que pida un número y diga si es positivo, negativo o 0.
'''
n1=int(input("Intruduce un numero: "))
if n1>0:
print("El numero {} es POSITIVO".format(n1))
if n1<0:
print("El numero {} es NEGATIVO".format(n1))
if n1==0:
print("El numero {} es CERO".format(n1))
| true |
ed8595e9debbbe44258c0e52acc87ce007f485b3 | Python | lva123/python101-sinh-vien | /Code buoi hoc/Buoi 2/bt4.py | UTF-8 | 642 | 3.28125 | 3 | [] | no_license | #pt bac hai
import math
a = float(input("nhap he so a "))
b = float(input("nhap he so b "))
c = float(input("nhap he so c "))
if a == 0:
if b == 0:
print("vo nghiem")
else:
y = -c/b
else: # a khac 0
delta = (b*b) - 4*a*c
print("delta:",delta)
if (delta < 0):
print("vo nghiem... | true |
fdf7c50f33d68295e758dddbd61ad212646d932a | Python | cdargham/pwp-capstones | /TomeRater/TomeRater.py | UTF-8 | 7,419 | 3.421875 | 3 | [] | no_license | class User():
def __init__(self, name, email):
self.name = name
self.email = email
self.books = {}
def get_email(self):
return self.email
def change_email(self, address):
self.email = address
print("E-mail address updated.")
def read_book(s... | true |
ead9b44348ee957e1b0a06070bcfb575fcafb46f | Python | Heavy9428/Spatial-DS-Trebing | /Assignments/Program_5/query1.py | UTF-8 | 7,759 | 3.171875 | 3 | [] | no_license | import os
import sys
import math
from pymongo import MongoClient
import pygame
import json
from math import radians, cos, sin, asin, sqrt
class mongoHelper(object):
def __init__(self):
self.client = MongoClient()
def get_doc_by_keyword(self, collection, field_name, search_key, like=True):
"""
... | true |
6b42b6e8706120860a70ba45206fc2e722a5e43e | Python | andrewskripnik/mypy | /wFiles_csv.py | UTF-8 | 752 | 2.640625 | 3 | [] | no_license | import os
import csv
from sys import argv
ad_file = r'D:\python\mypy\addr_book.csv'
serialize = __import__('csv')
def updateDB(i1):
u_dict = i1
with open(ad_file, 'w') as csv_db:
writer = csv.writer(csv_db)
for key, val in u_dict.items():
writer.writerow([key, val])
def getDB():
with open(ad_file... | true |
62a6b23fdc7f5363772f5595eb6c4eaced1ca447 | Python | testpass1982/Python_lessons_basic | /lesson02/home_work/hw02_easy.py | UTF-8 | 2,024 | 4.15625 | 4 | [] | no_license | # Задача-1:
# Дан список фруктов.
# Напишите программу, выводящую фрукты в виде нумерованного списка,
# выровненного по правой стороне.
# Пример:
# Дано: ["яблоко", "банан", "киви", "арбуз"]
# Вывод:
# 1. яблоко
# 2. банан
# 3. киви
# 4. арбуз
# Подсказка: воспользоваться методом .format()
fruits = ["яблоко", "б... | true |
21ed169d1ab9db95ee48df1660bc2b1f391c7bdb | Python | NikFilip/ChessAI | /Chess/GameTree.py | UTF-8 | 6,312 | 3.359375 | 3 | [] | no_license | from Board import Board
from MoveNode import MoveNode
from Input import Input
import copy
import random
from multiprocessing import Pool
WHITE = True
BLACK = False
class AI:
depth = 1
board = None
side = None
movesAnalyzed = 0
def __init__(self, board, side, depth):
self.board = board
... | true |
79b4e084a647d3426b25faa0e27a8aa73d88f871 | Python | razmiqayelyan/homework | /homework9.py | UTF-8 | 1,595 | 3.875 | 4 | [] | no_license | '''1.Create 5 file (.txt) and write messages in them.'''
with open('file1.txt', 'w') as file1:
login = input('Login: ')
file1.write(login)
with open('file2.txt', 'w') as file2:
login = input('Password: ')
file2.write(login)
with open('file3.txt', 'w') as file3:
login = input('email: ')
file3.write(login)
with ope... | true |
9278ecff736bd39ac9135b7312ea216efa427d76 | Python | SwamyDev/udacity-deep-rl-navigation | /udacity_rl/memory.py | UTF-8 | 1,621 | 2.796875 | 3 | [] | no_license | import logging
import random
from collections import deque
import numpy as np
logger = logging.getLogger(__name__)
class Memory:
def __init__(self, batch_size, record_size, seed=None):
self._record = deque(maxlen=record_size)
self._batch_size = batch_size
self._keys = None
if see... | true |
0cd0d04219e5e01e2221b5c7da133c10e98b6ed9 | Python | emilkaminski/OOR | /organizer/oclasses/organize.py | UTF-8 | 1,425 | 3.59375 | 4 | [] | no_license | #definition of organized class
from oclasses.items import note
class organizer (object):
def __init__ (self, name, size, pages):
self.name = name
self.size = size
self.pages = pages
self.actions_que = {
'1':self.new_note,
'2':self.new_vcard,
'... | true |
66c29565b48b4c34d8c7373c045d96507f35ba1c | Python | NikiDimov/SoftUni-Python-Basics | /conditional_statements_advanced/ski_trip.py | UTF-8 | 1,201 | 3.34375 | 3 | [] | no_license | days = int(input())
room = input()
assessment = input()
def negative_ot_positive(assessment, total_price):
if assessment == "negative":
print(f"{total_price - total_price * 0.1:.2f}")
else:
print(f"{total_price * 1.25:.2f}")
def room_for_one_person(days, assessment):
total_price = (days ... | true |
f836e9b2812574e86e72631bc6ec1cdcaf7c82ab | Python | hackwithcameron/Rat-in-a-Maze | /rat.py | UTF-8 | 2,331 | 3.78125 | 4 | [] | no_license | from maze import print_maze, create_blank, \
test, example
def rat(maze):
"""
Main function called to find path through maze.
:param maze: Maze for path to be found
:return: Solution to maze or "No solution"
"""
start_pos = (0, 0)
solution = create_blank(maze) # Creates blank maze sa... | true |
cb1d7560f436a754807857b79177372e75031342 | Python | mapiccc/ML-DL-RL-AutoML-1 | /RL/ac_game.py | UTF-8 | 2,281 | 2.859375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import gym
import sys
sys.path.append('./')
from actor_critic import Actor, Critic
# pylint: disable=protected-access
np.random.seed(2)
tf.set_random_seed(2)
MAX_EPISODE = 3000
MAX_EP_STEPS = 1000
DISPLAY_REWARD_THRESHOLD = 1000
LR_A = 0.001
LR_C = 0.01
class Game(object... | true |
5af83ceda2bd029b8631ca421d4d9cc5548d3ad0 | Python | bssrdf/pyleet | /N/N-Queens.py | UTF-8 | 2,477 | 4.125 | 4 | [] | no_license | '''
-Hard-
*Backtracking*
The n-queens puzzle is the problem of placing n queens on an n×n
chessboard such that no two queens attack each other.
Each solution contains a distinct board configuration of the n-queens' placement,
where 'Q' and '.' both indicate a queen and an empty space, respectively.
Example 1:
... | true |
b75b3fcc8f61c453a1cfbc4a6c4e7bcf6108b38a | Python | ybz21/aiot | /car/app.py | UTF-8 | 2,110 | 2.859375 | 3 | [] | no_license | import cv2
import time
import threading
from flask import Response, Flask
import nanocamera as nano
# Image frame sent to the Flask object
global video_frame
video_frame = None
# Use locks for thread-safe viewing of frames in multiple browsers
global thread_lock
thread_lock = threading.Lock()
# Create the Flask obj... | true |
20036d46d1bba287e7585673f52808f3e1b77f31 | Python | dMedinaO/peptidesPredictor | /scripts/aligments/processMatrixAligment.py | UTF-8 | 2,522 | 2.90625 | 3 | [] | no_license | '''
script que permite procesar la data de la matriz obtenida desde el alineamiento,
procesa la data por la posicion y obtiene la frecuencia por cada elemento, genera un archivo resumen con
respecto a las posiciones y un resumen con respecto a la mayor tendencia por cada elemento
'''
import pandas as pd
import sys
mat... | true |