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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c7f076188e4b0bf375e1d2c4de0b4a29a5ed31b2 | Python | Guadaler/Theano | /test_np.py | UTF-8 | 430 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
# -------------------------------------------
# 功能:
# Author: zx
# Software: PyCharm Community Edition
# File: test_np.py
# Time: 17-1-3 上午10:27
# -------------------------------------------
import numpy as np
a = np.random.randn(3, 3)
print a.ndim
print a.__len__()
print a.sh... | true |
2b53a2f1e928c9d8a3ac603a643973f203ad9ded | Python | WangFan1007/flasklearn | /unittest_demo.py | UTF-8 | 1,515 | 2.65625 | 3 | [] | no_license | import unittest
from login import app
import json
class LoginDemo(unittest.TestCase):
def setUp(self):
app.testing = True
self.client = app.test_client()
def test_empty_all(self):
resp = self.client.post('/login', data={})
ret = json.loads(resp.data)
self.assertIn('c... | true |
0074f35794d9bf326480c33e19af47d014863f80 | Python | ctbeiser/Evolution_full | /2/take5/dealer.py | UTF-8 | 6,486 | 3.796875 | 4 | [] | no_license | """
This file contains the implementation of the Dealer component. The dealer is
responsible for managing the game, especially the rounds and turns.
The Dealer is given a list of Player objects and simulates a complete game.
A game ends when one of the players reaches a specified number of bull points at
the end of a ... | true |
ed4cc2aa4e16a9609e9cbd9f695574fd544dab3b | Python | mudragada/groundclutter | /PyProblems/HackerRank/Interview Preparation Kit/Warmup Challenges/repeatedstring.py | UTF-8 | 1,270 | 3.640625 | 4 | [] | no_license | """
https://www.hackerrank.com/challenges/repeated-string/problem
"""
import time
class Solution:
def repeatedString(self, s,n):
strlen = len(s)
numvowels = 0
for char in s:
if(char == 'a'):
numvowels += 1
remainder = n%strlen
if(remainder > 0):
... | true |
4edc5095e146608b74bd9cad88206c2fe5b17503 | Python | miamaric12/HAPPy | /HAPPY/plot_functions.py | UTF-8 | 3,335 | 3.359375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from matplotlib_scalebar.scalebar import ScaleBar
from matplotlib import pyplot as plt
def addScaleBar(ax, scale, location='upper right'):
"""Add a scale bar to an axes.
Parameters
----------
ax : matplotlib.axes.Axes
Matplotlib axis on which to plot.
"""
if scale:... | true |
0006f3b23e097ff3c0e23bc89fc9948d1dd413ed | Python | Dragonxero/dotfiles | /bin/tex2md.py | UTF-8 | 406 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
# purpose:
# enclose $math$ environments within `backticks`
import re
import os
import sys
if len(sys.argv) != 2 or not os.path.isfile(sys.argv[1]):
print 'bad filename argument'
sys.exit(1)
s = open(sys.argv[1]).read()
s = re.sub('\$\$(?P<id>[^\$]+)\$\$', '`$$\g<id>$$`', s)
s = re.sub('(?... | true |
86b9ca54381214e09d8452e8009fbec374840870 | Python | jpowelliv/Object-Oriented-Programming | /basketballer.py | UTF-8 | 809 | 3.765625 | 4 | [] | no_license | #Joseph E. Powell IV
#CIS 225-01
#Basketball Game
#9th November 2018
class Game:
#Info
def __init__(self, squad, city, state):
self.squad = squad
self.city = city
self.state = state
def getSquad(self):
return self.squad
def getCity(self):
return self.city
def getState(self):
... | true |
3f0a80d123865e0fefb6d34af9e59e34927fbfcc | Python | Zimmermann25/InterviewBit | /Math/Python/ReverseInteger.py | UTF-8 | 1,027 | 3.546875 | 4 | [] | no_license | class Solution:
# @param A : integer
# @return an integer
def reverse(self, A):
base = 10
newNumber = 0
Acopy = abs(A)
digits = 0
# znalezienie długości(ilosci cyfr)
signBit = False
if A < 0:signBit=True
while Acopy >= 1:
digi... | true |
aaad0b268b79c4775594cc3879bbd51a5cd322c1 | Python | FuckBrains/autoTube | /twitch_api.py | UTF-8 | 3,625 | 2.53125 | 3 | [] | no_license | import urllib.request
import requests
import sys
import logging
import settings
import time
from moviepy.editor import *
from settings import CLIENTID
base_clip_path = 'https://clips-media-assets2.twitch.tv/'
headers = {
'Accept': 'application/vnd.twitchtv.v5+json',
'Client-ID': CLIENTID,
'User-Agent': 'Mo... | true |
83630f4dd4e70a8b2a40c88ba073d42546b49526 | Python | Andrew-Finn/DCU | /Year1/ca117/Lab01.2/password_012.py | UTF-8 | 712 | 3.234375 | 3 | [] | no_license | import string
import sys
def contnumber(password):
for i in password:
if i in string.digits:
return 1
return 0
def contupper(password):
for i in password:
if i in string.ascii_uppercase:
return 1
return 0
def contlower(password):
for i in password:
... | true |
1b95d9352e64b7257576a317720a8e0caa826ae3 | Python | jreinert/csis582_predicting_fantasy_football_scores_qb_reinert | /aiprojectlinearregression.py | UTF-8 | 7,660 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 21:54:48 2020
@author: reine
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split, KFold, cross_val_score
from sklearn.linear_model import LinearRegression, ElasticNet, Lasso, Rid... | true |
9b60363e909cd9d91c2f0f0b68186afc1d05e53d | Python | toskatlt/Space-Attack-Py | /main.py | UTF-8 | 5,529 | 3.109375 | 3 | [] | no_license | import pygame
import random
import math
from pygame import mixer
pygame.display.set_caption("Space Attack")
pygame.init()
WIDTH_GAME = 1150
HEIGHT_GAME = 1150
win = pygame.display.set_mode((WIDTH_GAME, HEIGHT_GAME))
clock = pygame.time.Clock()
FRAME = 25
player_img_array = ['PNG/playerShip1_blue.png', 'PNG/player... | true |
13766336fbd97a5ca3f74347472eb11eac43c8af | Python | ngiangre/HMMicro | /hmm_scripts/sim_hmm.py | UTF-8 | 2,015 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# USAGE:
# ./sim_hmm.py $PWD
#
#
# A quick script to simulate a sequence from a 2-state Markov Model
# with known parameters
# Import libraries
#from multiprocessing.dummy import Pool as ThreadPool
from pandas import DataFrame, read_csv
import pandas as pd
import numpy as np
import sys, os
### ... | true |
2a1165df204f4313c0991013df193f10ed252537 | Python | nummer30/walloftext | /webserver/app.py | UTF-8 | 780 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SubmitField
app = Flask(__name__)
app.config['SECRET_KEY'] = 'filesystem'
class UpdateForm(FlaskForm):
brightness = IntegerField('Brightness')
content = StringField('... | true |
06ec707c3fafe5dc7ceb67c2a15e0cb281ed5d23 | Python | Ozdemir-B/heroku-restapi-1 | /seg_tflite.py | UTF-8 | 5,163 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 16:23:16 2020
@author: hp
"""
import numpy as np
import tflite_runtime.interpreter as tflite
import cv2
import visualization_utils as vis_util
class seg:
def __init__(self):
self.img_path_adasdas = ""
def create_category_index(self,label_path='coco... | true |
bde829fa2b4738cd6d4533895048f57157503b9c | Python | Lemonstars/algorithm | /test3/2.整除查询/solution.py | UTF-8 | 1,392 | 3.625 | 4 | [] | no_license | # Description
# Given an array of positive integers and many queries for divisibility.
# In every query Q[i], we are given an integer K ,
# we need to count all elements in the array which are perfectly divisible by K.
# Constraints:1<=T<=1001<=N,M<=1051<=A[i],Q[i]<=105
#
# Input
# The first line of input contains an i... | true |
f7e23fbaaf6ca7d3fc5aa9f91fa9e71a9d98afe2 | Python | sh1n0ks/konatsu | /konatsu/index.py | UTF-8 | 601 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
import chromedriver_binary
import time
for auto_click in range(1000):
page_url = "https://soty.staff-start.com/staffs/320"
driver = webdriver.Chrome(executable_path='chromedriver')
# ページを開く
driver.get(page_url)
#待機時間
time.sleep(3)
# ボタンの情報取得
yell_button... | true |
b974d34cb8b6e3a60ab7a1c6fdeed614450c745c | Python | Bruception/advent-of-code-2020 | /day20/part2.py | UTF-8 | 5,771 | 2.703125 | 3 | [] | no_license | import re
import sys
import math
def getBorders(image):
return [
image[0],
''.join([row[-1] for row in image]),
image[-1],
''.join([row[0] for row in image]),
]
def getFlips(image):
return [
image,
image[::-1],
[row[::-1] for row in image],
[... | true |
280b332aba878045cf472c3ce78fb2ea85e61df1 | Python | Coec0/MachineStock | /node-box/file_input.py | UTF-8 | 1,192 | 2.984375 | 3 | [] | no_license | import math
import time
import numpy
from input_handler import InputHandler
from threading import Thread
class FileInput:
def __init__(self, file, input_handler: InputHandler, input_size, reads_per_second=1, benchmark=False):
self.reads_per_second = reads_per_second
self.file = file
sel... | true |
e32496cd9f19faa010a5a5397d4f4599acbd92bd | Python | San2shgupta/San2shgupta | /dailyroutine.py | UTF-8 | 932 | 3.484375 | 3 | [] | no_license | import datetime
def now():
return datetime.datetime.now()
def san():
c = int(input("Enter 1 for Exersise 2 for show\n"))
if (c==1):
value = input("Type Here\n")
with open("santosh-exer.txt", "a") as fl:
fl.write(str([(now())]) + ":" + value + "\n")
print(... | true |
9dde332c05f486de78c548d6722c206eace6c7c7 | Python | gapplef/mpi4py-examples | /03-scatter-gather.py | UTF-8 | 1,701 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
from mpi4py import MPI
import scipy.integrate as inte
comm = MPI.COMM_WORLD
if comm.rank == 0:
print("-"*20)
print(" Running on {:d} cores".format(comm.size))
print("-"*20)
n_data = comm.size*4
if comm.rank == 0:
A = np.arange(n_data, dtype=np.float64) # rank... | true |
fe2ef3b8122c4e0f6f774bfc5c90b70bdca1e46f | Python | Desnord/lab-mc102 | /lab16/lab16_main.py | UTF-8 | 1,480 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import sys
import os
sys.path.insert(0, os.getcwd())
import lab16 as lab
# Le string a ser procurada
busca = input()
buscaOriginal = busca[:]
aux = input()
token = aux.split()
palavrasIgnorar = token
# le numero de paginas
numeroPaginas = int(input())
palavrasPagina = []
# Le palavras em ... | true |
75d9ec39a1f25d188116340b0d30350a597f80c5 | Python | varunaluri18/Roman-Urdu-Project-using-NLP | /urdu1.py | UTF-8 | 3,295 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
#making corpus or words from comments
import re
from nltk.stem.porter import PorterStemmer
import nltk
from sklearn.featur... | true |
46f428ef37ebff93452a865e7ed3e4b10af8dd7b | Python | gopularam/developer | /Python/Modules-Packages/mygame/game.py | UTF-8 | 222 | 2.765625 | 3 | [] | no_license | import draw
def play_game():
print("inside play game.")
return "play_game"
def main():
result = play_game()
draw.draw_game(result)
#Modules are imported as singletons
if __name__ == '__main__':
main() | true |
314f6ea61d29aaf9f28aa6c4a8d7f8fbcc6b0b5a | Python | baewonje/iot_bigdata_- | /python_workspace/01_jump_to_python/4_input_output/3_file_io/q6.py | UTF-8 | 227 | 3.234375 | 3 | [] | no_license | user_input = input("저장할 내용을 입력하세요: ")
f = open('test.txt','a',encoding='UTF-8')
f.write(user_input)
f.write("\n")
f.close()
f2 = open("test.txt", 'r',encoding='UTF-8')
print (f2.read(),end='')
f2.close() | true |
8b45949abb929c76af40cec291d94534d66cc545 | Python | maggio-a/dl-sigproc | /utils/mask.py | UTF-8 | 4,430 | 2.78125 | 3 | [] | no_license | # The code for the random mask generation was adapted from Mathias Gruber's implementation at
# https://github.com/MathiasGruber/PConv-Keras/blob/master/libs/util.py
import PIL.Image as Image
import PIL.ImageDraw as ImageDraw
import PIL.ImageFilter as ImageFilter
import random
import math
import torch
import torch.nn.... | true |
3ee0667815e8b60bb8351402672555bdbc019aab | Python | bornamir/WordCount | /WordCont/views.py | UTF-8 | 2,234 | 2.984375 | 3 | [] | no_license |
from django.http import HttpResponse
from django.shortcuts import render
def temp(Re):
return render(Re,"home.html",{"Req":str(Re)})
def cont(Re):
orgwords=Re.GET["fulltext"]
words=orgwords.lower()
num=int()
wordlist=words.split()
num=len(wordlist)
numword=dict()
for w in wordli... | true |
04961b8a9edc3188b474c7c5a2bee55ba1532ce2 | Python | samsamuelson/HPM573S18_SAMUELSON_HW4 | /1.py | UTF-8 | 607 | 3.625 | 4 | [] | no_license | import random
#1 - represents Heads
#2 - represents Tails
class Game:
def Simulate(self):
reward = -250
twoBack = 0
oneBack = 0
for i in range(1,21):
outcome = random.randint(1,2)
if twoBack == 2 and oneBack == 2 and outcome == 1:
reward =... | true |
b67b96b449596171a9b45455b31aada931e57441 | Python | parkjinhong03/Backend-for-Recycle | /Server/Application/User/Signup/Email/method.py | UTF-8 | 1,935 | 2.796875 | 3 | [] | no_license | import RequestParser
import smtplib
from email.mime.text import MIMEText
from db_connect import connect
import random
def post2():
'''
이메일 인증 완료를 위한 POST Method
:return: status code
410 - email에 공백이 포함됨
411 - number에 공백이 포함되거나 정수형이 아님
403 - 인증 실패 (인증 번호가 다름)
200 - 인증 성공
'''
db, cur... | true |
78166246ce1d6af4f871b39ad06c9d23b609629e | Python | ebby-s/Python | /Computer science/insertion sort.py | UTF-8 | 1,032 | 3.234375 | 3 | [] | no_license | import datetime,random
def sort(array):
for i,CurrentValue in enumerate(array[1:]):
for pos,elem in enumerate(array):
if elem >= CurrentValue:
del(array[i+1])
array.insert(pos,CurrentValue)
break
return array
def checked_sort(array):
for ... | true |
5e9498df8be08989a6f04b6bb31210c5b05d45b7 | Python | rionehome/submit_poker | /ygkn/card.py | UTF-8 | 246 | 3.171875 | 3 | [
"MIT"
] | permissive | from suit import Suit
from rank import Rank
class Card:
def __init__(self, suit_number, rank_number):
self.suit = Suit(suit_number)
self.rank = Rank(rank_number)
def __str__(self):
return str(self.suit) + "-" + str(self.rank)
| true |
b7943575335190d2ed1d64562b7e4035806b5bcb | Python | carlydonner/Lab1 | /lab1pygame.py | UTF-8 | 655 | 2.921875 | 3 | [] | no_license | import pygame, sys
import serial
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((800, 600)) #window size
pygame.display.set_caption('Hello World!') #header of window
s = serial.Serial("/dev/ttyACM0")
while True: #main game loop
l = s.readline()
x = l.rstrip().split(",")
i... | true |
d3370023de699f4c7e64ef9c06cac9086a542cca | Python | WeDias/RespCEV | /Exercicios-Mundo1/ex011.py | UTF-8 | 276 | 3.859375 | 4 | [
"MIT"
] | permissive | largura = float(input('Digite a Largura da Parede: '))
altura = float(input('Digite a Altura da Parede: '))
area = float(largura * altura)
tintanec = area / 2
print('Em uma parede de {:.2f} Metros quadrados, é necessario {:.2f} Litros de Tinta!'.format(area, tintanec))
| true |
bb0db598aeb745050e0548785ddedce2e623d044 | Python | ChrisIsMyName/reddit_upvoter | /RedditUpvoter.py | UTF-8 | 2,993 | 2.640625 | 3 | [] | no_license | import urllib.request
import urllib.parse
import json
import time
import datetime
import argparse
import sys
def getJSON(url, args : dict, header):
binaryArgs = None
if args != None:
binaryArgs = bytes(urllib.parse.urlencode(args), "UTF8")
req = urllib.request.Request(url, binaryArgs, header)
r... | true |
e36ce8421d94d3c8a7ced1193f3b82baf336d16b | Python | trupa7/Flask-App | /app.py | UTF-8 | 1,366 | 3.203125 | 3 | [] | no_license | """"
==========================================
Title: A basic “Hello World” API using Flask
Author: Trupal Patel
Date: 6th July 2020
==========================================
"""
from flask import Flask, request, jsonify
from werkzeug.exceptions import BadRequest
import logging
app = Flask(__name__)
log = logg... | true |
ff7202eb1fa4e33fc2263cbd0ff03c55db292c1c | Python | Aasthaengg/IBMdataset | /Python_codes/p03108/s973006563.py | UTF-8 | 625 | 2.5625 | 3 | [] | no_license | N,M=map(int,input().split())
bridge=[]
size=[1]*(N+1)
tree=list(range(N+1))
def find(a):
x=tree[a]
if a==x:
return a
x=find(x)
tree[a]=x
return x
for i in range(M):
A,B=map(int,input().split())
bridge.append((A,B))
Ans=N*(N-1)//2
ans=[]
for a,b in bridge[::-1]:
aroot=find(a)
... | true |
a6b96090759ce1c90e71f87b23cdbe9eb2440cb0 | Python | Free-Geter/Driver_Action_Monitor | /model/test.py | UTF-8 | 3,784 | 2.703125 | 3 | [] | no_license | import cv2
from keras.models import load_model
from keras.preprocessing import image
from PIL import Image
import numpy as np
import Classifier
model = load_model('model/self_trained/Overfitting-20-1.00.hdf5')
def path_to_tensor(img_path):
# loads RGB image as PIL.Image.Image type
img = image.load_img(img_path... | true |
1136af23cda1ee030050c579ade853b73692a354 | Python | wangweiwg/python | /02-Python基础/04-list和tuple.py | UTF-8 | 1,540 | 4.5625 | 5 | [] | no_license | # list:列表
# list是Python内置的一种数据类型,list是一种有序的集合,可以随时添加和删除其中的元素
classmates = ['后裔', '典韦', '孙悟空', '黄忠'];
# 计算列表元素的个数
len(classmates);
# 可以使用索引访问列表中的元素
classmates[0];
# 如果要取最后一个元素可以使用-1
classmates[-1];
# 可以把元素插入到指定的位置
classmates.insert(1, '兰陵王');
# 要删除list末尾的元素,使用pop()方法, 返回的是删除的元素
classmates.pop();
# 要删除指定位置的元素,用pop(i)方法,... | true |
bc180c44221d61792ee2673f9ffaf52689c98712 | Python | yangy30685/allinone | /python/app_re/re_1.py | UTF-8 | 1,530 | 3.328125 | 3 | [] | no_license | import re
s = '<html><body><h1>hello world<h1></body></html>'
start_index = s.find('<h1>')
for i in range(start_index, len(s)):
print(s[i], end='')
print()
print()
key_1 = r'<html><body><h1>hello world<h1></body></html>'
p_1 = r'(?<=<h1>).+?(?=<h1>)'
pattern_1 = re.compile(p_1)
match_1 = re.search(pattern_1, key_... | true |
d48e52e6305b2d16b83bb3be62f257d1df6107d9 | Python | shibukawa/oktavia.py | /oktavia/sais.py | UTF-8 | 5,985 | 2.875 | 3 | [] | no_license | '''
Original source code:
* G. Nong, S. Zhang and W. H. Chan, Two Efficient Algorithms for Linear Time Suffix Array Construction, IEEE Transactions on Computers, To Appear
* http:#www.cs.sysu.edu.cn/nong/index.files/Two%20Efficient%20Algorithms%20for%20Linear%20Suffix%20Array%20Construction.pdf
'''
import sys
from . ... | true |
78ec9d75118b14f07b98762176a4407697218cd4 | Python | cduck/hyperbolic | /hyperbolic/tiles/tile_gen.py | UTF-8 | 2,386 | 2.734375 | 3 | [
"MIT"
] | permissive | from ..poincare import Transform
from . import Tile
class TileGen:
def __init__(self, center_tile, corner_tile):
self.center_tile = center_tile
self.corner_tile = corner_tile
@staticmethod
def from_center_tile(center_tile):
trans_to_origin = Transform.shift_origin(
... | true |
2d8668694d86a184d15f795df9cae937b73091d1 | Python | krystiankowalski95/Wolf_And_Sheep | /Animal.py | UTF-8 | 196 | 2.875 | 3 | [] | no_license | from abc import abstractmethod
import uuid
class Animal:
def __init__(self, x, y):
self.x_position = x
self.y_position = y
@abstractmethod
def move(self):
... | true |
895124fefd39bed30955a7bbbc10d99be1153316 | Python | rkumar2-20/inventorylogin | /inventorylogin.py | UTF-8 | 8,969 | 2.65625 | 3 | [] | no_license |
from tkinter import *
from tkinter import ttk , messagebox
from PIL import Image, ImageTk
import pymysql
from playsound import playsound
from validate_email import validate_email
class Register:
def __init__(self, root):
self.root = root
self.root.title(" ... | true |
f1cbf39302dbb7447a4608165539e2feaed28b89 | Python | shivamjadhav2000/MLSOFTWARE | /new_brain/clustering/KMeans.py | UTF-8 | 3,165 | 2.75 | 3 | [] | no_license | import numpy as np
class KMeans:
def __init__(self, K=3, trials=3, max_iters=250):
self.K = K
self.trials = trials
self.iters = max_iters
self.X = None
self.cost = None
self.centroids = None
self.clusters = None
self.distances = None
self.M =... | true |
32845c00fe347f7f268b96177bcaaf46f1d0b0f6 | Python | ndearaujo/python-functions | /Program_4-2.py | UTF-8 | 404 | 4 | 4 | [] | no_license | max_temp = 102.5
temperature = float(input("Enter the substance's Celsius temperature: "))
while temperature > max_temp:
print('The temperature is too high.')
print('Turn the thermostat down and wait')
print('5 minutes. Then the temperature')
print('again and enter it.')
temperature = float(input(... | true |
cc5eb8c1bc032ef3f4ece99da09e49e257dee869 | Python | rushout09/ProblemSolving | /spoj/spCANDY3.py | UTF-8 | 202 | 3.375 | 3 | [] | no_license | t = int(input())
for i in range(0,t):
input()
sum=0
n = int(input())
for _ in range(0,n):
sum=sum+int(input())
if sum%n==0:
print("YES")
else:
print('NO') | true |
21d50c3d0a0a9dbbf8ac4e5abd3db13826a11f48 | Python | PatrykDluzynski/Projects | /CatsAndDogsML/CatsAndDogsModelTrainer.py | UTF-8 | 2,863 | 3.203125 | 3 | [] | no_license | import numpy as np
import keras
from keras.models import Sequential, load_model, save_model
from keras.layers import Conv2D, Activation, Flatten, Dense, Dropout, MaxPooling2D
from keras.callbacks import TensorBoard
import time
MODEL_NAME = 'cats_and_dogs_convnet_64x4-64_b30_7e_V2_{}'.format(int(time.time()))
tensorbo... | true |
7f41516d32dc213e43e77a37f93e0182857d562a | Python | leebinjun/arithmetic-lamp | /arithmetic-lamp/vision/classify_num/predo.py | UTF-8 | 620 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import cv2
path = "./data/num"
files = os.listdir(path)
# print(files)
for f in files:
print(f)
cnt = 0
data_list = os.listdir(path+'/'+f)
# print(data_list[:4])
for data in data_list:
data_file_path = path+'/'+f+'/'+data
# img = cv2.imread(data_file_path)
... | true |
47c3e827ac088e20e10423e8a8fd305a7d243d2a | Python | povilasv/nonlinear-analysis-toolkit | /nat/lyapunov/lyap_r.py | UTF-8 | 2,107 | 3.109375 | 3 | [] | no_license |
from utils import *
from .defaults import default_delay
def lle_rosenstein(x, m=2, d=None, s=100, t=0, should_plot=False, plot_title=None):
"""
Uses tisean library to compute largest lyapunov exponent using Rosenstein et al. algorithm.
More info:
http://www.mpipks-dresden.mpg.de/~tisean... | true |
1d5c29061b513e2f0bdb3ea3b9509cb0efe376cc | Python | rjjjava/PycharmProjects | /deep-rl-master/ddpg/neural_network_share_weight.py | UTF-8 | 6,588 | 3.125 | 3 | [
"MIT"
] | permissive | """
Define neural network structures of the actor and critic method
The actor and critic networks share the layers: State ==> FC ==> ReLU ==> Feature
The algorithm is tested on the Pendulum-v0 OpenAI gym task
Author: Shusen Wang
"""
import tensorflow as tf
import numpy as np
class NeuralNetworks:
'''
Sta... | true |
93a8257ee9b9a65e0505de339e77977a73b70d8e | Python | thehungrysmurf/ex02 | /calculator.py | UTF-8 | 2,109 | 3.953125 | 4 | [] | no_license | import arithmetic
# greet user
# tell user to insert operator followed by number(s) to process
# read input
# tokenize input
# if the first token is 'q', quit
# if input is not according to format, alert user
# call the math function on the input
# print output
def turn_to_int(list):
list2 = list[1: len(list)]
... | true |
3e1c4d37fa2aadb748dc331ef24593c001140358 | Python | ukyo-su/callable-enum | /test.py | UTF-8 | 832 | 3.578125 | 4 | [
"MIT"
] | permissive | from callable_enum import CallableEnum, member_with_value, member
def test_call():
class Test(CallableEnum):
@member
def A(self):
return "A"
@member
def B(self):
return "B"
assert Test.A() == "A"
assert Test.B() == "B"
def test_call_arg():
cl... | true |
12aef07f4d6b7615d854ff4ea1a6f221e9f237e3 | Python | oms1994/Cloud-Computing | /Generate_gauss.py | UTF-8 | 2,403 | 2.96875 | 3 | [] | no_license | from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
# setting fixed seed value
np.random.seed(147)
def calc_dist(a, b, ax=1):
return np.linalg.norm(a - b, axis=ax)
def get_gauss_dist(m, dim, mean, stdev):
covar_matrix = [[stdev**2, 0], [0, stdev**2]]
x, y = np.random.multiva... | true |
071dfccfaac3a2a91c3f72f1b338f56d15c49231 | Python | Peng-Zhanjie/The-CP1404-Project | /Week3/convert_temps.py | UTF-8 | 740 | 3.578125 | 4 | [] | no_license | def C_to_F(var):
F=var*1.8+32
return(F)
def F_to_C(var):
C=(var-32)/1.8
return(C)
def main():
loop=True
line=0
File=open('temps_input.txt','r')
File2=open('temps_output.txt','w')
while loop!=False:
C_OR_F="F"
if (C_OR_F=="C"):
try:
number=float(F... | true |
db22198ea49e28cbef41f536af298fedb3b7c9df | Python | roca12/gpccodes | /Codigos estudiantes por lenguaje/PY/Bryann Valderrama/BitWise/operacionesBasicasBitWise.py | UTF-8 | 3,463 | 3.203125 | 3 | [] | no_license | from sys import stdout, stdin
rl = stdin.readline
wr = stdout.write
def par_o_Impar(n):
wr('---------------------------------------------\n')
if n & 1:
wr(f'{n} es Impar\n')
else:
wr(f'{n} es Par\n')
wr('---------------------------------------------\n')
def verificar_K_esimo_Bit_Ence... | true |
39276b1441fef6ab58a452fbadab3d825e117e65 | Python | kbats183/pysport | /sportorg/modules/teamwork/server.py | UTF-8 | 6,317 | 2.578125 | 3 | [] | permissive | import socket
from queue import Queue, Empty
from threading import Thread, Event, main_thread
import json
class Command:
def __init__(self, data=None, addr=None):
self.data = data
self.addr = addr
self.addr_exclude = []
def exclude(self, addr):
self.addr_exclude.append(addr)
... | true |
66f1adabd39ccc4fabd833f3a78c3502bdf18f95 | Python | alexseb/learnpython | /inheritance/class.py | UTF-8 | 277 | 3.125 | 3 | [] | no_license |
class A(object):
def __init__(self):
self.name = 'A'
def show(self):
print self.name
class B(A):
def __init__(self):
super(B, self).__init__()
self.bname = 'B'
def show(self):
A.show(self)
print self.bname
obj = B()
obj.show()
| true |
792759acedfd841454932cc57ea313021eb247e4 | Python | famaf/Modelos_Simulacion_2016 | /Practico_07/ejercicio01.py | UTF-8 | 3,466 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import random
from distribuciones import *
# T = sumatoria(1, k, (fo - fe)^2/fe)
# fo = Ni
# fe = n*pi
def estadisticoT(k, n, N, p):
"""
Calcula el estadistico T.
k = particiones (intervalos).
n = tamaño de la muestra.
N = vector de valores (Frecuencia Observad... | true |
ad83a8b50710fa8031d36c3e732c33e9d6cb8951 | Python | kmisiunas/paiss | /demo.py | UTF-8 | 2,179 | 2.546875 | 3 | [
"MIT"
] | permissive | ##############################################################################
# PAISS 2018: Understanding image retrieval representations #
# NLE practical session 02/07/2018 #
# DEMO #
####... | true |
7d0c9b0ef3d02f62771e0f49bf1c447392543e52 | Python | climatom/BAMS | /Code/SEB/Sandbox/explore_LW.py | UTF-8 | 3,866 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Here we test how easily LW down can be modelled from other params
"""
import numpy as np, pandas as pd, statsmodels.api as sm, GeneralFunctions as GF
import matplotlib.pyplot as plt
""" Below are functions to compute potential (ToA) solar radiation. These
functions ar... | true |
449e7f3582aa996fb21b69f61f6e3352bf2c5097 | Python | FernandoBuenoLima/advent-of-code-2020 | /day08/part2/main.py | UTF-8 | 531 | 3.171875 | 3 | [] | no_license | from console import Console
input = [line.strip() for line in open("input.txt").readlines()]
for i in range(len(input)):
program = input.copy()
instruction = program[i]
code = instruction[:3]
if code == "nop":
program[i] = "jmp" + instruction[3:]
elif code == "jmp":
program[i] = "n... | true |
7ed25ad4b2b93af43094867621faeaecaf3c824d | Python | maruthu007/maruthu | /positive.py | UTF-8 | 107 | 3.359375 | 3 | [] | no_license | m = int(input())
if(m == 0):
print('one')
elif(m>0):
print('Positive')
else:
print('Negative')
| true |
7229396a8baae3730293764e3f94e6b0fb58ca2c | Python | Trietptm-on-Security/code | /Learn Python the Hard Way/fahrenheit2celcius.py | UTF-8 | 299 | 3.984375 | 4 | [] | no_license | # Simple example of a temperature conversation
# Prints the following sentence with the result of the calculation
# Needed to add a floating point number for the division
print "15 Fahrenheit equals", (15 - 32) * (5.0 / 9) , "Celsius"
print "200 Celsius equals", 200 * (9.0 / 5) + 32 , "Fahrenheit" | true |
ffc7e86856425431123735f1422096c01fc571b4 | Python | kivy/plyer | /plyer/facades/processors.py | UTF-8 | 934 | 3.015625 | 3 | [
"MIT"
] | permissive | '''
Number of Processors
=======
The :class:`Processors` provides a information on the number of
processors in a system
.. note::
Deprecated in favor of `cpu`
Simple Example
---------------
To get processors status::
>>> from plyer import processors
>>> processors.status
{'Number_of_Processors': '4'}
S... | true |
471d25ec4e02ff73135e3634a9aa13df46f93bf7 | Python | PhilippKaz/GrabberForAsos | /controllers/currency.py | UTF-8 | 595 | 3.03125 | 3 | [] | no_license | import requests
import re
from bs4 import BeautifulSoup
#Получение курса валюты
def Exchange_Currency(currency_from, currency_to):
try:
html = requests.get("https://www.calc.ru/kurs-%s-%s.html" % (currency_from, currency_to))
except Exception as ex:
print("Возникла ошибка при получении курса в... | true |
8397bab57093ecfc144a5a26e282687e2d83e815 | Python | sibork13/Depth-Map | /Clasificacion Basado en colores/Funciones.py | UTF-8 | 3,371 | 3.03125 | 3 | [] | no_license | #Help Suorce
#https://intelrealsense.github.io/librealsense/python_docs/_generated/pyrealsense2.html
#https://medium.com/@gastonace1/detecci%C3%B3n-de-objetos-por-colores-en-im%C3%A1genes-con-python-y-opencv-c8d9b6768ff
#http://docs.ros.org/kinetic/api/librealsense/html/namespacers.html
import pyrealsense2 as rs
impor... | true |
5c4ab5948f50580545b943e2b57863ac403dfb4b | Python | nkyllonen/GWC-SIP-2019 | /week3/survey/survey.py | UTF-8 | 1,884 | 4.40625 | 4 | [] | no_license | '''
This program expands the previous program by looping continuously over the
questions in the survey until the user says they are done collecting responses.
Each individual response is a dictionary, and the set of all responses is saved
as a list of dictionaries.
For students who finish this part of the program quic... | true |
ffe668a75a1e9d9a4cf23dcf04410078545242c1 | Python | nathanawmk/fidesops | /tests/graph/test_traversal_node.py | UTF-8 | 2,084 | 2.53125 | 3 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | from fidesops.graph.traversal import *
from .test_graph_traversal import generate_node
def test_add_child() -> None:
def field_tuples(tn: TraversalNode, da: CollectionAddress):
return {(t[1], t[2]) for t in tn.children[da]}
tn = TraversalNode(generate_node("a", "b", "c", "c2"))
child_1 = Traversa... | true |
8e6f561ccc0bb96db1049f9d915d962a5ac67efa | Python | lhuang-pvamu/FWI | /fwiTut.py | UTF-8 | 13,596 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | # PySIT Tutorial exercises
import sys
import math
import numpy as np
import matplotlib.pyplot as plt
from models import basic_model
config = dict()
##############################################################################
# Problem 1.1
def ricker(t, config):
nu0 = config['nu0']
si... | true |
74f8276a47597b539701998369c0d2b599ec8257 | Python | mbtnv/TestTask_MOC_IKT | /main.py | UTF-8 | 5,071 | 2.546875 | 3 | [] | no_license | import datetime
import logging
import os
import telebot
from telebot import apihelper
from telebot import types
BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
PROXY_IP = os.getenv("TELEGRAM_PROXY_IP")
PROXY_PORT = os.getenv("TELEGRAM_PROXY_PORT")
PAGINATION = os.getenv("PAGINATION")
logger = telebot.logger
telebot.lo... | true |
eeecd68333392e106407d6c54d6047d6683c9421 | Python | haowen-xu/tfsnippet | /tests/layers/convolutional/test_pooling.py | UTF-8 | 7,009 | 2.546875 | 3 | [
"MIT"
] | permissive | import functools
import numpy as np
import tensorflow as tf
from mock import mock
from tfsnippet.layers import *
from tfsnippet.ops import flatten_to_ndims, unflatten_from_ndims
from tfsnippet.utils import is_integer
def patched_pool(pool_fn, value, ksize, strides, padding, data_format):
"""A patched version of... | true |
8c05360856c273b6ccd91397e5c73de5fcdd2244 | Python | raysaarma/Raysa-Arma-Mutiarani_I0320084_Wildan_Tugas5 | /I0320084_soal1_tugas5.py | UTF-8 | 339 | 3.703125 | 4 | [] | no_license | nama = str(input('Ketik nama anda : '))
jk = str(input('wanita/pria : '))
while True:
if jk == 'wanita':
print('Selamat datang, Ibu', str(nama) )
elif jk == 'pria':\
print('Selamat datang, Bapak', str(nama) )
else :
print('Data yang anda masukkan salah, mohon periksa kembali')
br... | true |
72a708db65af377f711c875696f33f644a98267c | Python | gabrielNetto94/sistemas-multimida | /ProjetoOpenCV/exemplosPython/exemplo02 - Manipulação de Pixeis.py | UTF-8 | 460 | 2.828125 | 3 | [] | no_license | from cv2 import cv2
import numpy
src = cv2.imread("WindowsLogo.jpg")
if src is None:
print("Erro ao abrir imagem 1")
else:
rows = numpy.size(src, 0)
cols = numpy.size(src, 1)
for i in range(rows):
for j in range(cols):
bgrPixel = src[i,j]
bgrPixel[0] = 255
bg... | true |
b987f9b8d539090ed1915bd5461571dfb95b37dd | Python | mattias-westerberg/eenx15_19_21_gan | /GAN/networks/models/temp/Nvidia_altered_functions.py | UTF-8 | 6,980 | 2.890625 | 3 | [] | no_license | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | true |
147e36adb55696215c5bae973aa8ea73a80d84b4 | Python | TecnologiaVideojuegos/proyectovideojuego-equipo-h | /src/mapGeneration/Room.py | UTF-8 | 3,233 | 3.6875 | 4 | [] | no_license | import arcade
from random import randrange
class Room:
def __init__(self, x, y):
"""Creates a collection of sprites positioned respect to the point (x, y) in the bottom left of the room"""
self.room_x = x
self.room_y = y
self.wall_list = arcade.SpriteList()
self.floor_list ... | true |
45ed06b8f75bcdaf2f732a47fe297ba8dcaabcbd | Python | joebos/pylinesvr | /tests/test_LineFile.py | UTF-8 | 3,348 | 3.140625 | 3 | [] | no_license | import threading
import random
import datetime
import multiprocessing
import json
import os
from server.models import LineFile
# One of tests is to find the performance of getting a line when multiple clients are requesting at the same time.as
# The test uses multiple processes to call get_line method.
class Concurre... | true |
f9758ada9e9bfd337c1d46e45ba36f8efb1d53b6 | Python | Sapphire0912/Embedded | /HW Med/count02.py | UTF-8 | 2,780 | 2.625 | 3 | [] | no_license | import cv2
import numpy as np
def nothing(x):
pass
path = './count/DJI_0002.JPG'
ori = cv2.imread(path)
# print(ori.shape) # (2160, 3840, 3)
re_ori = cv2.resize(ori, (1280, 720), interpolation=cv2.INTER_AREA)
# cv2.imwrite("./count/DJI_0002_resize.jpg", re_ori)
# cv2.imshow("re_ori", re_ori)
# 顏色區分
# 用原圖的 BG... | true |
4e58992206fa16c503bc335ae45ebde9302374bc | Python | chenyuan0922/python-practice | /file.py | UTF-8 | 700 | 3.453125 | 3 | [] | no_license | #儲存檔案
# file=open("data.txt",mode="w",encoding="utf-8")
# file.write("""helloworld
# 123
# abc
# 中文成功""")
# file.close()
# with open("data.txt",mode="w",encoding="utf-8") as file:
# file.write("5\n3")
#讀取檔案
# sum=0
# with open("data.txt",mode="r",encoding="utf-8") as file:
# data=file.read()
# for line in ... | true |
aef5c4276fb847e72180decc8390eb00c0c684c2 | Python | marcuscastelo-university-assignments/db-turismo | /main.py | UTF-8 | 11,894 | 3.28125 | 3 | [] | no_license | # ==================================================================
# Grupo 4:
# - Gabriel Vitor de Jesus Lima
# - Marcus Vinicius Castelo Branco Martins
# - Pedro Guerra Lourenço
# ==================================================================
# Funções criadas para teste do banco de dados em aplicação:
# - ... | true |
1c8bb338905a09421c8799ada36f64380e536496 | Python | franz-bender-spreewunder/Quirinius | /aaaaa/learning.py | UTF-8 | 4,553 | 2.765625 | 3 | [] | no_license | import glob
import os
import random
from time import time
import cv2
import keras
import numpy as np
from keras import Input, Model
from keras.callbacks import TensorBoard, ModelCheckpoint, Callback
from keras.layers import Dense, Flatten, ConvLSTM2D, BatchNormalization, MaxPooling3D, TimeDistributed
from keras.optimi... | true |
d44ae9989c3fe80afe1f2179c5839f9d74c115b6 | Python | Sambou-kinteh/Pythonmodules | /cgi-first.2.py | UTF-8 | 1,448 | 2.71875 | 3 | [] | no_license | '''import cgi
import HTMLParser
top = HTMLParser.HTMLParser
def test():
print "content-type:text/html\r\n\r\n"
print'<html>'
print'<head>'
print'<title> hello,world - first cgi program<title>'
print'</head>'
print'<boby>'
print'<h2>Hello world! - first cgi program'
print'</body>'
print'</html>'
te... | true |
eaec97b005800b4678bb7ee81a1b2645792091c7 | Python | xiaohaoxing/nlp-book | /ch06/rnn_gradient_graph.py | UTF-8 | 539 | 2.796875 | 3 | [] | no_license | # coding: utf-8
import sys
sys.path.append('..')
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rc("font", family='Mi Lanting')
# mini-batch 大小
N = 2
# 隐藏向量的维度
H = 3
# 时序数据的长度
T = 20
dh = np.ones((N, H))
np.random.seed(3)
Wh = np.random.randn(H, H) * 0.5
norm_list = []
for t in ra... | true |
2a55529e95203d9f6edbd7dcdfb92a6e4e3f7e9a | Python | ogabrielnadai/bot-discord | /main.py | UTF-8 | 5,173 | 2.90625 | 3 | [
"MIT"
] | permissive | '''
Importações da Biblioteca Python
Bibliotecas para, bem ... Dicord.
Data e hora ... eu realmente preciso explicar?
Ruamel.Yaml para permitir que os comentários permaneçam nos arquivos YAML ao lê-los / gravá-los.
Sistema operacional para sistema de arquivos e coisas variáveis de ambiente.
Resources.Data para gerenc... | true |
0ebee4791f61eae3201bf43cb2576a5384e6489e | Python | dyc3/discord-pokemon-battles | /battleapi.py | UTF-8 | 3,909 | 2.609375 | 3 | [] | no_license | from typing import Generator, Iterable, Sequence, Union, Optional, Any
from pkmntypes import *
import aiohttp
import jsonpickle
from pkmntypes import *
from turns import *
import os
import config
import logging, coloredlogs
log = logging.getLogger(__name__)
coloredlogs.install(level='DEBUG', logger=log)
BASE_URL = co... | true |
f07d747979d4b47db7a046a335b6e84e0b05808c | Python | gugarosa/opytimizer | /tests/opytimizer/optimizers/social/test_bso.py | UTF-8 | 2,909 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from opytimizer.optimizers.social import bso
from opytimizer.spaces import search
def test_bso_params():
params = {
"m": 5,
"p_replacement_cluster": 0.2,
"p_single_cluster": 0.8,
"p_single_best": 0.4,
"p_double_best": 0.5,
"k": 20,
}
new... | true |
0faa098133b1c73103f22b97849e8c77b1a9814e | Python | MarianPogor/Python_Exercices | /01_print.py | UTF-8 | 1,166 | 3.703125 | 4 | [] | no_license | print("Hello there human!")
print("do you know you can put any text into a print()?")
print("like stars *******, numbers: 1,2,42,999")
# exercise 1: Use print() to display "Hello world" in the console
# Do one exercise at a time.
print("Hello World")
# exercise 2: Use print() to display some asterisks (this... | true |
cb39071bfde9f0ee91e6226ee7858fb4a43d2b4d | Python | Brucehanyf/python_tutorial | /base/day04.py | UTF-8 | 962 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive | # if 语句
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
car = 'bmw'
print (car == 'bmw')
if car != 'bmww':
print (car.lower())
# 检查多个条件
age_0 = 22
age_1 = 18
print (age_0 >=21 and age_1 >=21)
# 使用or检查多个条件
print(age_0 >=... | true |
5445f3a7d5e5129f857f248e4c3a72e61cf1a7b4 | Python | likangwei/leetcode | /py/064_minimum_path_sum.py | UTF-8 | 1,356 | 3.03125 | 3 | [] | no_license | #/bin/python
__author__ = 'likangwei'
class Solution(object):
def minPathSum(self, grid, d=None, x=0, y=0):
"""
:type grid: List[List[int]]
:rtype: int
"""
if d is None:
d = {}
m, n = len(grid), len(grid[0])
k = x, y
if k in d:
... | true |
ef491844cf80beff4ea228454a9ad9ed6c28a17f | Python | zuohd/python-excise | /tkinter/Frame.py | UTF-8 | 600 | 3.078125 | 3 | [] | no_license | import tkinter
# from tkinter import ttk
win = tkinter.Tk()
win.title("menu using")
win.geometry("400x400+200+200")
#container control
frm=tkinter.Frame(win)
frm.pack()
#left
frm_1=tkinter.Frame(frm)
tkinter.Label(frm_1,text="left top",bg="pink").pack(side=tkinter.TOP)
tkinter.Label(frm_1,text="left bottom",bg="blue"... | true |
dffe1cb9088ed52bcebfcdef5bb51c12a6493e92 | Python | madebypixel02/numerical_methods | /root_finding/newtonMethod.py | UTF-8 | 993 | 3.890625 | 4 | [] | no_license | import numpy as np
def newtonMethod(x0, f, tolerance):
"""
This function applies the newtons method for root finding
The derivative of f is approximated trought the definition of limit with h = 0.0000001
More info: https://en.wikipedia.org/wiki/Newton%27s_method
Args:
---------------
x0: ... | true |
2bfe906bc28454f711bbb85b28c66b116e458d2c | Python | vkolehmainen/PyMusicGen | /core/logic.py | UTF-8 | 3,920 | 2.984375 | 3 | [] | no_license | from core.profilemanager import ProfileManager
from core.midi import Midi
from core.databasemanager import DatabaseManager
from core.chord_generator import ChordGenerator
from PyQt4 import QtCore
class Logic():
def __init__(self, BPM, bar_division):
"""Keeps the program running and delegates ... | true |
51a2d912ee7ef645eb49f3d10a2203c0264858b3 | Python | raulssilva/Kanji_Cardgame | /settingsMenu.py | UTF-8 | 9,939 | 2.828125 | 3 | [] | no_license | import pygame
import time
class Settings:
def __init__(self, screen):
self.screen = screen
self.surface = pygame.Surface((795, 411))
self.soundBar = unichr(0x25AE) + unichr(0x25AE) + unichr(0x25AE) + unichr(0x25AE) + unichr(0x25AE) + unichr(0x25AF) + unichr(0x25AF) + unichr(0x25AF) + unichr(0x25AF) + unichr(0x... | true |
8ec6e10319991e7e749937773b5d582c7943fcc8 | Python | KhHTran/Drowsy_Inattentive_Check | /get_head_pose.py | UTF-8 | 5,351 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
from imutils import face_utils
import cv2
import numpy as np
import dlib
def get_6_main_keypoints(key_points):
# nose 31
# chin 9
# left eye left corner 37
# right eye right corner 46
# Left Mouth corner 49
# Right mouth corner 55
return key_points[[30,8,36,45,48,54]]
... | true |
c0a9faa6454561851f7d4c01d626ed44814bbd6a | Python | kavaliou/MZI | /lab7/eleptic.py | UTF-8 | 1,781 | 3.140625 | 3 | [] | no_license | def mod(x, p):
while x < 0:
return p - (-x) % p
return x % p
def _extended_gcd(a, b):
if a == 0:
return b, 0, 1
d, x1, y1 = _extended_gcd(b % a, a)
x = y1 - (b // a) * x1
y = x1
return d, x, y
def mod_inv(x, p):
d, x, y = _extended_gcd(x, p)
return x
def _legend... | true |
0e197e741847ce395adc16c61def2553780b3ec4 | Python | mitshubh/EE-219 | /Project_1 - Copy/src/ans4a.py | UTF-8 | 1,656 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 23 14:14:54 2017
@author: swati.arora
"""
# RMSE after 10 fold cross validation: 3.888
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model as lm
from sklearn import cross_validation
housing = pd.read_csv("housing_da... | true |
d486137aa551fa9a577aef680e014144cadad3c3 | Python | everjoey/pygraph | /topological_sort.py | UTF-8 | 1,718 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
from .graph import Node
from .graph import Edge
from .graph import Graph
def topological_sort(graph):
time = 0
for node in graph.nodes.values():
node.is_visited = False
node.predecessor = None
def dfs(node):
nonlocal time
time += 1
node.d = time
node.is_visited = True
for node... | true |
d44ee818f49cb25ef15bc04b44254ff87b238727 | Python | octoberry/eco-py | /ecogame/model/social_helper.py | UTF-8 | 808 | 3.046875 | 3 | [] | no_license | import random
def random_moscow_cords():
"""Случайные координаты в Москве"""
lng = random.uniform(37.364073, 37.841978)
lat = random.uniform(55.569028, 55.909194)
return dict(lng=round(lng, 6), lat=round(lat, 6))
def fill_zombie_from_vk(zombie, vk_data: dict):
"""Создает пользователя из данных v... | true |
d70467666e42bef1805c4d451cd57a3823504f65 | Python | MarceloBritoWD/URI-online-judge-responses | /Matemática/1555.py | UTF-8 | 1,039 | 3.75 | 4 | [] | no_license | def funcaoRafael(x, y):
a = (3*x)*(3*x)
b = y*y
return a + b
def funcaoBeto(x, y):
a = 2*(x*x)
b = (5*y)*(5*y)
return a + b
def funcaoCarlos(x, y):
a = (100*-1)*x
b = y*y*y
return a + b
def pegarMaior(x, y, z):
maior = 0
# acumula o maior
if x > maior:
maior = x
if y > maior:
maior = y
if... | true |
5277ee420331dd027430bfd3ab3f099b8e71787f | Python | kotoroshinoto/Coursera_Python_Bioinformatics | /Course2/Week1/strspellgenomepath.py | UTF-8 | 413 | 2.953125 | 3 | [] | no_license | import sys
def quickverify(left, right):
return left[1:] == right[:-1]
genome = ""
patterns = sys.stdin.readlines()
lseq = patterns[0].rstrip()
genome += lseq
for i in range(1, len(patterns)):
rseq = patterns[i].rstrip()
if rseq == "":
break
if not quickverify(lseq, rseq):
raise RuntimeError("Invalid Genome P... | true |
25d59fc7f450a4dd0384d312f09a4e8a5c312061 | Python | anshuln/ITSP-2018 | /Testing_contous.py | UTF-8 | 5,629 | 3.203125 | 3 | [] | no_license | import cv2
import numpy as np
from math import atan,degrees
'''
This script basically breaks down a large image into smaller images according to object contours, and returns the smaller images to
the sliding windows script
'''
def min_max(array):
'''
Returns bounding box of a contour
'''
xmin=9999
xm... | true |