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 |
|---|---|---|---|---|---|---|---|---|---|---|
2ea3abff67b204a63a77a047c363e85b1ba530eb | CHC278Cao/ML | /HW3/KNN.py | UTF-8 | 914 | 2.984375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
X = np.array([[2.2, 3.4], [3.9, 2.9], [3.7, 3.6], [4, 4], [2.8, 3.5], [3.5, 1], [3.8, 4], [3.1, 2.5]])
y = np.array([45, 55, 91, 142, 88, 2600, 163, 67])
X1 = np.array([[3.5, 3.6]])
k = 3
clf... | true |
e9306f16055cc010cfb8c9d3fb113eb1ff670362 | karghar/Cracking | /chapter1/task6.py | UTF-8 | 293 | 3.40625 | 3 | [] | no_license | #matrix rotation
class Solution(object):
def matrixNinetyDegree(self, matrix):
result = []
matrixLen = len(matrix)
for x in range(0, matrixLen):
innerRow = []
for y in range(matrixLen - 1, -1, -1):
innerRow.append(matrix[x][y])
result.append(innerRow)
return result
| true |
00b73d3c8f78d34713d30cab2af0208b729aa0c4 | elifo/damaged_fault | /py-example/modules/houches_fb.py | UTF-8 | 3,689 | 3.203125 | 3 | [] | no_license | # Script that has subroutines to compute FFT, smooth, etc
import numpy as np
# import ipdb as db
import sys
# Tapering with a Hanning window
def taper(x,p):
if p <= 0.0:
return x
else:
f0 = 0.5
f1 = 0.5
n = len(x)
if (p*n) < 1 : return x
nw = int(p*n)
ow = np.pi/float... | true |
06ed2b5185e94785f67c5e88ab452f82e2dda6e6 | stevenhgn/IN1000-Gruppe1 | /uke10/fag.py | UTF-8 | 469 | 3.6875 | 4 | [] | no_license | class Fag:
def __init__(self, navn):
self._navn = navn
self._studentListe = []
def leggTilStudent(self, student):
self._studentListe.append(student)
def hentAntallStudent(self):
return len(self._studentListe)
def hentFagNavn(self):
return self._navn
def h... | true |
ddb4ccd35b04db63292ae266c486c90d06fc661c | aLagoG/kygerand | /ger/TTP/SV2/2789.py | UTF-8 | 84 | 3.078125 | 3 | [
"MIT"
] | permissive | numbers = [i for i in raw_input().split("+")]
numbers.sort()
print "+".join(numbers) | true |
1ef634619954834a69b31bf1d57e9116e108a4db | prediction2020/Labeled-TOF-MRA-with-DP | /utils/evaluate_segmentation_functions.py | UTF-8 | 8,313 | 2.6875 | 3 | [
"MIT"
] | permissive | """
This file contains helper functions for evaluate_segmentation.py script.
"""
import os
import csv
import xml.etree.cElementTree as ET
import numpy as np
import config
from utils import get_paths
# compare segmentations based on the EvaluateSegmentation software of Taha
def segment_comparison(
goldstandard_... | true |
3400a57250f3e1cd855f871d54cddde2a33656e1 | arvindb95/Computational_physics_codes | /Homework_3/diff_eqn_solver.py | UTF-8 | 6,350 | 3.5625 | 4 | [] | no_license | import numpy as np
from astropy.table import Table
from astropy.io import ascii
## Comparing different algorithms to solve dy/dx = f(x,y)
def euler_method(function,x0,y0,x,stepsize):
"""
function = dy/dx; x0,y0 are initial conditions; x is the point where y needs to be calculated.
"""
x_array = np.ara... | true |
128edcb4bba2fd999319c094f61e16ad2fbb6716 | NikitaShymberg/minesweeper | /game/tile.py | UTF-8 | 703 | 3.265625 | 3 | [] | no_license | from game.constants import BOMB
class Tile:
def __init__(self, value, row, col):
self.explored = False
self.marked = False
self.value = value
self.remainingValue = value
self.row = row
self.col = col
def mark(self):
self.marked = not self.marked
... | true |
6c50297099ab81eeb87af19b7bf07ef87098dd23 | kimdg1105/Algorithm_Solving | /BOJ/1766.py | UTF-8 | 783 | 3.421875 | 3 | [] | no_license | # 위상정렬
import heapq
N,M = map(int,input().split())
adj_list = [[] for _ in range(N+1)]
for _ in range(M):
a, b = map(int,input().split())
adj_list[a].append(b)
def topological_sort(adj):
ans = []
q = []
indegree = [0 for _ in range(N+1)]
for i in range(1,N+1):
for j in adj[i]:
... | true |
519b6d5c66875f0eaaab82b9a31b087409c6fd70 | MahnazAkbariKasten/Algorithms_And_DataStructur_Challenges | /Code Interview/Backtracking/N_queens.py | UTF-8 | 2,661 | 4.15625 | 4 | [] | no_license | __author__ = 'pretty moon'
'''
https://www.hackerearth.com/practice/basic-programming/recursion/recursion-and-backtracking/tutorial/
We start from far left column and place a queen in first row and try to solve the problem for rest of columns.
If there is no answer, then we backtrack and move the queen in first column... | true |
e19e32fd19eee2e8cd9ccf84967c26a155c8a8d6 | scikit-hammertime/endfront | /scikit_hammertime/util.py | UTF-8 | 930 | 2.921875 | 3 | [] | no_license | """
Script: util.py
===============
Description:
------------
utilities for dealing with data
Usage:
------
python preprocess.py -i $DATA_DIR -o data.df
##################
Jay Hack
jhack@stanford.edu
Fall 2014
##################
"""
import os
import pickle as pkl
import pandas as pd
def load_data(num_... | true |
2b33ef42f6c4b511a1d170f19bb3ba6faecdda9e | JohnLapis/py-studies | /problems/amicable_numbers.py | UTF-8 | 396 | 3.46875 | 3 | [] | no_license | from Factorize import factorize
from Divisors import find_divisors
def d(x):
return sum(find_divisors(factorize(x))[:-1])
def sum_amicable(limit):
amicables = []
for n in range(2,limit+1):
m = d(n)
if m != n and d(m) == n:
amicables.append(n)
print(amicables)
return... | true |
38cf8c5a61e6a6a272781cf0e078b79adcc94477 | Geunbaek/python_algorithm_interview | /7장 배열/238_product_of_array_except_self.py | UTF-8 | 439 | 3.21875 | 3 | [] | no_license | class Solution:
def productExceptSelf(self, nums: list[int]) -> list[int]:
out = []
p = 1
for i in range(len(nums)):
out.append(p)
p *= nums[i]
p = 1
for i in range(len(nums)-1, -1, -1):
out[i] = out[i] * p
p = p * nums[i]
... | true |
f61f804e0d92a9324bb9f22bfa67f92c43efdabe | tomvand/research-template | /code/processing/preprocessing/mnist_to_numpy.py | UTF-8 | 1,333 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import argparse
import os
def main():
parser = argparse.ArgumentParser(description='Process raw MNIST files into numpy files.')
parser.add_argument('--input_directory', action='store', required=True)
parser.add_argument('--data', action='append', default=[])
p... | true |
f6b9909251acd0c6d1f7bc69a5043946c36e2db3 | f-squared/Flashcards | /flashcard_engine.py | UTF-8 | 666 | 4.09375 | 4 | [] | no_license | import random
def flashcard_engine(cards):
"""
Initiates a simple text-based flashcard game.
Flashcard content is stored in cards, a dict object.
"""
print "Welcome to a very simple text-based flashcard game."
print "Press CTRL-C to exit at any time."
print "-" * 60
while True:
... | true |
d72259e31bfb0af3ad7c25a648d62c6f8f30200b | tingleshao/image_toolbox_grail | /math_morphology.py | UTF-8 | 1,766 | 2.53125 | 3 | [] | no_license | import sys
import getopt
from scipy import misc
from scipy import ndimage
import numpy as np
import matplotlib.pyplot as plt
__doc__ = "this is doc for math_morphology.py!"
def process(arg):
# el = ndimage.generate_binary_structure(2,1)
# eli = astype(np.int)
im = np.zeros((64,64))
np.random.seed(2)
... | true |
6553ed9bd10072bd4a2221a96fb6779af53d22ed | HoeYeon/Algorithm | /Python_Algorithm/Baek/9251.py | UTF-8 | 489 | 3.296875 | 3 | [] | no_license | A = input()
B = input()
arr = [[0 for i in range(len(A)+1)] for j in range(len(B)+1)]
print(arr)
for i in range(len(B)):
for j in range(len(A)):
if B[i] == A[j]:
# 2개가 같다면 좌 대각선 + 1
arr[i+1][j+1] = arr[i+1-1][j+1-1]+1
else:
# 2개가 다르다면 좌측 or 상단중에 큰 값을 가져온다.
... | true |
8289c3f3b69dc9092e3e6f74828754bf8b755848 | fadedmusic/lihang-book-impl | /chapter7@svm/svm.py | UTF-8 | 5,035 | 2.703125 | 3 | [] | no_license | """
@author chenjianfeng
@date 2018.01
"""
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from smo import SMO
from sparseVector import SparseVector
from kernel import Kernel
class SVM(object):
def __init__(self, dataset, labe... | true |
8c87eeb9e31c016fc7086bd92ad1e67f698c0f06 | Brucewanghahei/QMD_Old_Programs | /02 Keithley SourceMeter 2450/Triple Linear Resistance Measurement/v1.0 Triple Linear Resistance Measurement/Wrapper.py | UTF-8 | 61,354 | 2.59375 | 3 | [] | no_license | """Written by Bruce Wang.
Inspired and helped by Johnathon Vannucci.
Contact wdmzcjwq@gmail.com if you have any questions"""
"""To compile the .ui file into .py file, it is very simple. Do the following stpes:
1. Open Command Proment (Terminal if you are using mac), using 'cd' to get the directory that... | true |
c5ce468f8903b70895886d8853f966ffc4f3342a | HelenaOliveira1/ProjetoPOO2 | /Questao2/Funcionario.py | UTF-8 | 352 | 2.703125 | 3 | [] | no_license | from Questao2.Pessoa import Pessoa
class Funcionario(Pessoa):
def __init__(self, salario, matricula, nome, idade, genero):
super(Funcionario, self).__init__(nome, idade, genero)
self.salario = salario
self.matricula = matricula
def calcularINSS(self, salario):
self.inss = salari... | true |
4361d8f7900ad3603693c47d7c3eb6983768caae | Aasthaengg/IBMdataset | /Python_codes/p02779/s717099996.py | UTF-8 | 183 | 3.015625 | 3 | [] | no_license | n = int(input())
a = sorted(list(map(int, input().split())))
b = [-1] + a
l = []
for i in range(n):
l.append(a[i] - b[i])
if l.count(0) == 0:
print('YES')
else:
print('NO') | true |
d6268ab6defa86b6f786ac59265bb37d9f22af99 | ptarling/DeepLearningFishCounting | /lossfunctions_metrics.py | UTF-8 | 675 | 2.59375 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
def hinge_loss(y_true, y_pred):
yhat_diff = y_pred[:,0]
return tf.reduce_sum(tf.math.maximum(y_true, yhat_diff))
def au_absolute_loss(y_true, y_pred):
y_hat = tf.reduce_sum((y_pred[:,:,:,0]), [1,2])
y = tf.reduce_sum((y_true[:,:,:,0]), [1,2])
log_var = tf.reduce_sum(y_pr... | true |
ee063d79865e3cc872fe1a3389335a9ec083a0ed | JoshuaAcosta/TTP-FS | /app/auth/routes.py | UTF-8 | 2,969 | 2.875 | 3 | [] | no_license | """ Authorization routes """
from flask import render_template, url_for, redirect, request, flash
from flask_login import login_user, logout_user, login_required
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
from app.models import User, Balance
from .forms import RegisterF... | true |
b1a479fb069e396b67739d35c74edca48a7cf532 | DimonYin/Coursera_Courses_Dimon_Yin | /Python 3 Programming Specialization/Python Classes and Inheritance/Week1/course_4_assessment_1.py | UTF-8 | 778 | 4.0625 | 4 | [] | no_license | # Q1
class Bike:
def __init__(self, initX, initY):
self.color = initX
self.price = initY
testOne = Bike("blue", 89.99)
testTwo = Bike("purple", 25.0)
# Q2
class AppleBasket:
def __init__(self, initX, initY):
self.apple_color = initX
self.apple_quantity = initY
def increa... | true |
40c0eb27bc6341fd13a4957e3f9603ada4d87ed5 | spotify-research/collabclass | /scripts/parse-stackexchange.py | UTF-8 | 3,288 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import argparse
import html
import numpy as np
import pickle
from lxml import etree
def process_questions(path, workspace, min_score=5):
qs = dict()
edges = list()
cnt = 0
# Get the root.
context = iter(etree.iterparse(path, events=("start", "end")))
event, root = next(... | true |
7372b6be770a66cfe083637fa9fc20a279807a86 | jamesshapiro/project-euler | /042.py | UTF-8 | 437 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3 -tt
triangle_numbers = {x*(x+1)/2 for x in range(1, 72)}
def is_triangle_word(word):
total = sum(map(lambda x: ord(x) - ord('A') + 1, word))
return total in triangle_numbers
with open('/Users/jamesshapiro/Desktop/p042_words.txt', 'r') as f:
lines = f.readlines()
line = lines[0]
lin... | true |
ab1eb4f5b79e616b7b0a5f1c5badcdf30ef2ba5e | igor-si/shared | /recipies/python/hpaste/hpastewebplugins/clbin.py | UTF-8 | 1,717 | 2.515625 | 3 | [] | no_license | import urllib2
import re
from ..webclipboardbase import WebClipBoardBase
class Clbin(WebClipBoardBase):
def __init__(self):
self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23... | true |
9d6647b454009578316701abe0b2dfd36ccc6f0d | mex3semmen/video-game-behavioural-cloning | /play_vizdoom.py | UTF-8 | 6,699 | 2.75 | 3 | [
"MIT"
] | permissive | import os
from argparse import ArgumentParser
from multiprocessing import Process, Queue, set_start_method
from random import randint
from functools import reduce
parser = ArgumentParser("Play and evaluate vizdoom games with a trained network.")
parser.add_argument("models", type=str, nargs="+",
he... | true |
259c8de2062a79e29376c5f50efbbfa1b7d2fc95 | nathanschepers/tyk-python-ldap-auth | /middleware.py | UTF-8 | 3,444 | 2.6875 | 3 | [] | no_license | import base64
import hashlib
from tyk.decorators import *
from gateway import TykGateway as tyk
import ldap
# address of the ldap server
ldap_server = "172.17.0.2"
@Hook
def LDAPAuthMiddleware(request, session, metadata, spec):
"""
Function to handle Authentication via LDAP.
Please review the tutorial ... | true |
0ac8cb90fd335a74799ddacabfee99af72f63812 | ZhaoxiangSimonCai/UsydInnovation2019 | /script/train_orcnn.py | UTF-8 | 7,993 | 2.53125 | 3 | [] | no_license | import numpy as np # linear algebra
import torch
import torchvision
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import pandas as pd
import os
import sys
import torchvision.transforms as transforms
from PIL import Image
import matplotlib.pyplot as plt
from sklearn.model_selection import trai... | true |
ca2d0c39ec5529e4bea60c63b3988506aa21ebe4 | meteoadriatic/MeteoAdriaticARW | /meteoadriatic/lib/strc.py | UTF-8 | 2,673 | 2.59375 | 3 | [] | no_license | from datetime import timedelta
import urllib.request
import os
import shutil
# Build list of LBC's time stamps
def lbc_hours(wrf_init_time, wrf_end_time, lbc_frequency):
strc_time = wrf_init_time
mylist = []
while strc_time <= wrf_end_time:
mylist.append(strc_time)
strc_time = strc_time + ... | true |
ccb849e1786661ae2fd094a4021adff949a3fda8 | joseriveracastro/Aprende-a-Programar-con-Python-3 | /41_adivina_num_2.py | UTF-8 | 818 | 4.375 | 4 | [] | no_license | # VERSIÓN 2.0 DE ADIVINAS EL NÚMERO
import random
# Variables para modificar el juego
posibilidades = 5
limite = 10
print("Hola, Cómo te llamas?")
nombre = input()
print("Muy bien " + nombre + " estoy pensando un número entre 1 y " + str(limite) +", intenta adivinarlo")
print("A proposito, solo tienes " + str(posib... | true |
5bafcc3e0d8bed1cdf38d3344eca2df13ab7b541 | Allan-Sky/python-init | /tipos/directory.py | UTF-8 | 101 | 2.734375 | 3 | [] | no_license | aluno = {
'name': 'sky',
'nota': 9.2,
'ativo': True
}
aluno['idade'] = 45
print(aluno)
| true |
0cb114b0793ca60cc6b3401bfcaada91e6d4d097 | goerz/pyala | /modules/HtmlVBarTable.py | UTF-8 | 11,014 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from TemplateProcessor import *
def warn(msg):
""" print a warning message to stderr """
sys.stderr.write(str(msg))
sys.stderr.write("\n")
class HtmlVBarTable(object):
""" A html barchart creator that uses tables
To use, just set the attributes, and then print the obj... | true |
b948e6d6e0dd7bd1b41cb057303817ac916dd7da | htakemoto/tensorflow-flask | /server/hello.py | UTF-8 | 359 | 2.640625 | 3 | [] | no_license | from flask import Flask
import tensorflow as tf
app = Flask(__name__)
@app.route('/')
def hello_world():
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
return str(sess.run(a+b))
if __name__ == '__main__':
app.run... | true |
240c278a09867b4866758ea08129606d99200bdf | pankita11/python-scripts | /anagram_check.py | UTF-8 | 825 | 4.34375 | 4 | [] | no_license | # Check if 2 strings have the same alphabets
# dog <==> o dg
def anagram(str1, str2):
str1 = str1.replace(" ", "").lower()
str2 = str2.replace(" ", "").lower()
#Edge case check
if len(str1) != len(str2):
return False
# Create empty dictionary
count1 = {}
for letter in str1:
... | true |
45fb466b4767be25218068b09c32e2451bb81bd0 | harmonytrevena/python_101 | /hello_you.py | UTF-8 | 498 | 5.1875 | 5 | [] | no_license | # Small Exercise 1. Hello You
# Prompt the user for his name using the input function.
name = input("What is your name? ")
# Upon receiving their name, you will say hello to them.
print("Hello " + name)
# Small Exercise 2. HELLO YOU
# Repeat the above exercise but this time print the user's name in ALL CAPS, and a... | true |
b2442689b04745f88f57d3380fd9d55b4d4c491a | yaliqin/socket | /socket_server.py | UTF-8 | 631 | 2.9375 | 3 | [] | no_license | def socket_server():
import socket
import time
HOST = '192.168.1.35'
PORT = 8001
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(5)
print('Server start at: %s:%s' %(HOST, PORT))
print('wait for connection...')
while True:
conn, addr... | true |
5e15798c2c3a91aca5dc571100411b404ac24cb9 | akhirgar/2021_hacktoberfest | /Python/map.py | UTF-8 | 336 | 4.0625 | 4 | [] | no_license | numbers = [2, 4, 6, 8, 10]
# returns square of a number
def square(number):
return number * number
# apply square() function to each item of the numbers list
squared_numbers_iterator = map(square, numbers)
# converting to list
squared_numbers = list(squared_numbers_iterator)
print(squared_numbers)
# Output: [4, 1... | true |
1705b36f246708ab23428e916f3f64b3ad164dc0 | pcs003/Pokemon | /qplserver.py | UTF-8 | 3,760 | 2.59375 | 3 | [] | no_license | from flask import Flask, request, jsonify
import json
import base64
import re
import string
from sqlite3 import connect
app = Flask(__name__)
class File:
filedata = ''
fileid = ''
alreadyparsed = False
dropped = False
print("Starting Pokemon Server!")
# Listen for post requests
@app.route('/', methods=['GET', 'PO... | true |
5a9860460a1019970e114358c26f54188f7221ef | alcharkov/pomodoro-calculator | /main.py | UTF-8 | 1,067 | 3.5 | 4 | [
"MIT"
] | permissive | import sys
pomodoro_count = 4
pomodoro_length = 25
short_break_length = 5
long_break_length = 15
def main():
minutes = sys.argv[1]
total = int(minutes)
session_cnt = pomodoro_count
pomodoros = 0
short_breaks = 0
long_breaks = 0
while total >= 0:
if session_cnt == 0:
se... | true |
8ba384e0e521133818356b3a1cd79df77dd2db05 | HineWAN/test-and-eval-of-multi-agent-system | /simulation_ws/src/pie/script/image_read.py | UTF-8 | 532 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 17 12:33:22 2018
@author: intel1
"""
import cv2
import numpy as np
image = cv2.imread("image.png")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("gray",gray)
print(gray.shape)
for i in range(gray.shape[0]):
for j in range(gray.shape[1]):
if gray[i][j] <... | true |
1cab74bbd0448113b94d13d43d53e91ab8cb3292 | jg258/Programs | /Protein_Sequencer.py | UTF-8 | 3,558 | 2.984375 | 3 | [] | no_license | __author__ = 'Jason'
#Version: 3.35
#For Courtney and her Project
class ProteinSequencer:
def __init__(self):
pass
proteinReference = {'Lysine': ['AAA', 'AAG'], 'Aspartic_Acid': ['GAT', 'GAC'], 'Tryptophan': ['TGG'],
'Alanine': ['GCT', 'GCC', 'GCA', 'GCG'], 'Glycine': ['GGT', ... | true |
e36f74de836c72414bf230285da713a07d001abe | noah-menikefs/DPCSYear11-PythonNM | /CreditCard.py | UTF-8 | 646 | 3.15625 | 3 | [] | no_license | cardstring = "49927398716"
card = int(cardstring)
length = len(card)
def findSum(cardstring):
s = 0;
while (card > 0):
x = card%10
card = card//10
s = s + x
return (s)
def cardSum(cardstring):
ctr = 0
sum = 0
for i in range(length-1, -1, -1):
if (ctr % 2 == 1):
temp = int(cardstring[i])
temp... | true |
a00bebd511da3a884eb760b90f97573b983283c4 | finnbar/markov-music-gen | /main.py | UTF-8 | 10,683 | 2.8125 | 3 | [] | no_license | # EPQ: Generative Music
# Written in Python 2.7
# musicbot3000!
KEY = "C" # The key of our output music
MELODY_ORDER = 2 # The order of the Markov Chain/Process for MELODY
RYTHMN_ORDER = 4 # The order of the Markov Chain/Process for RYTHMN
OUTPUT_LENGTH = 8 # Number of bars of output
TIME_SIGNATURE = 4.0 # Beats in a ... | true |
87d3d5bbf23e4ea4e2c5aa030bf331cd6aaf5051 | nullhoge/pyworks | /kame.py | UTF-8 | 373 | 3.125 | 3 | [] | no_license | # coding: utf-8
import turtle
import random
kame = turtle.Turtle()
kame.shape('turtle')
kame.shapesize(2, 2, 3)
kame.home()
kame.clear()
kame.penup()
kame.fd(150)
kame.left(90)
kame.pendown()
kame.circle(200)
kame.penup()
kame.home()
kame.pendown()
while True:
kame.left(random.randint(1, 360))
kame.fd(15)
... | true |
235079c6f5994b668b1d8f6ba37e4f5261a06696 | ZihengZZH/bimodal-speech-recognition | /src/utility.py | UTF-8 | 18,883 | 2.53125 | 3 | [] | no_license | import os
import json
import numpy as np
import pandas as pd
import skimage.io as io
import matplotlib.pyplot as plt
from scipy.io import loadmat
from scipy.signal import spectrogram
from sklearn.decomposition import PCA
data_config = json.load(open('./config/config.json', 'r'))
# load the CUAVE dataset
def load_cu... | true |
74bf13690bc057c2cfacfa8105edf092da98879a | cyansoul/kaggle-leaderboard-scraper | /main.py | UTF-8 | 2,274 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 19 14:37:47 2019
@author: Cyan
"""
import pandas as pd
import urllib3 # pip install -i https://pypi.anaconda.org/pypi/simple urllib3
import json
import sys
import warnings
warnings.filterwarnings('ignore')
def data_scraper(competition, type):
... | true |
d2208e7e3525d50b9e6f655c9af2bc74a6e6413a | arssher/pgtpch | /aggregate.py | UTF-8 | 4,380 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import os
import csv
import argparse
import scipy.stats
import numpy as np
import math
from agg_setup import group_tests, get_paired, preprocess_samples
def percent_speedup_ref_denom(test_res, ref_res):
return '%.2f' % ((ref_res - test_res) / (1.0 * ref_res) * 100)
def percent_spe... | true |
b388eac875cd7d7961c98a6483db8b2e818b53e7 | violetefu/AllState_Kaggle | /xgb_mb.py | UTF-8 | 6,831 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import xgboost as xgb
from datetime import datetime
from sklearn.metrics import mean_absolute_error
from sklearn.cross_validation import KFold
from scipy.stats import skew, boxcox
from sklearn import preprocessing
from sklearn.preprocessing import StandardScaler
import itertools
... | true |
92a3b5e5ef3a06820086b956ab93412cd8ab67ff | Javi-Python/Projecto-Shark-Attack-Data-Cleaning | /SRC/funciones.py | UTF-8 | 1,579 | 3.796875 | 4 | [] | no_license | def replace_regex(dataframe, list_regex, list_to_change, new_column, old_column):
'''this function takes as input:
dataframe = the name of the dataframe we are working on
list_regex = a list of regex patterns we want to replace
list_to_change = a list of strings we want to replace certain re... | true |
e00b531744af0f58e4d8d8bf3cbfc506e634b315 | Mikkel-14/JuegosModelamiento2020A | /src/usuario.py | UTF-8 | 343 | 2.75 | 3 | [] | no_license | class Usuario:
def __init__(self, nombreUsuario, password):
self.nombreUsuario: nombreUsuario
self.password: password
def registrar(self):
pass
def ingresar(self):
pass
def getNombreUsuario(self):
return self.nombreUsuario
def getContraseña(self):
... | true |
742f4c98b2a0c0f4c18d0f3433d19d859cc6a062 | guerintheo/pacmouse_pkg | /pacmouse_pkg/src/estimation_control/estimation.py | UTF-8 | 2,470 | 2.640625 | 3 | [] | no_license | import numpy as np
from copy import deepcopy
import pacmouse_pkg.src.params as p
from pacmouse_pkg.src.estimation_control.dynamics import motion_model
from pacmouse_pkg.src.estimation_control.particle_filter import ParticleFilter
from pacmouse_pkg.src.estimation_control.observation_functions import *
class Estimator:
... | true |
2187f539e91ab295aebcbf1d31f0794e0201d4a5 | gladiopeace/csc-manager-ui | /app_tools/qr/keyboard_scanner.py | UTF-8 | 2,270 | 3 | 3 | [] | no_license | from pynput import keyboard
from pynput.keyboard import Key
import logging
WORD_SEPARATOR_ENTER='enter'
WORD_SEPARATOR_TAB='tab'
class KeyboardScanner:
def __init__(self, word_separator=WORD_SEPARATOR_ENTER):
self.logger = logging.getLogger(f'{self.__class__.__name__}', )
self.__chars_list = []
... | true |
2208e22dec1ba00594448a86df4858f014280fd7 | mattjhussey/pemjh | /src/pemjh/challenge119/main.py | UTF-8 | 721 | 3.6875 | 4 | [] | no_license | """ Challenge119 """
# pylint: disable=missing-docstring
def sum_digits(num):
remaining = num
total = 0
while remaining:
remaining, digit = divmod(remaining, 10)
total += digit
return total
def main(target):
""" challenge119 """
# Loop through numbers and power... | true |
c781d83a69845892921706f2363d8a4c1895ca6b | lolsheep/SheepSuite | /util.py | UTF-8 | 625 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import random
from datetime import datetime, date
# def progress_bar(index, total, file):
# print('\n')
# total = total - 1
# bar_length = 60
# bar_filled = int(round(bar_length * index / float(total)))
# percent = round(100.0 * index / float(total),2)
# p_bar ... | true |
a13d811c5066c94dee4622fe850490afd7f83604 | Distributed-SLSH/Distributed-SLSH | /distributed_SLSH/middleware/reducer.py | UTF-8 | 3,415 | 2.875 | 3 | [] | no_license | """
The code responsible for the collection of each query's outputs and of its reduction to the final result.
"""
from middleware.utils.networking import *
from worker_node.SLSH.selectors import NearestPoints
from worker_node.SLSH.lsh import L1
import numpy as np
from time import time
from middleware.forwarder imp... | true |
f82b6cc6db64771314dbe17cf459b9f60951d80a | philliplab/lml | /NLP_with_PyTorch/Chap1_Intro/ex1.2_implement_and_plot_basic_freq_based_encoding.py | UTF-8 | 441 | 2.65625 | 3 | [] | no_license | from sklearn.feature_extraction.text import TfidfVectorizer
import seaborn as sns
import IPython
ipython = IPython.get_ipython()
ipython.magic('matplotlib')
corpus = ['Time flies like an arrow', 'Fruit flies like a banana']
tfidf_vectorizer = TfidfVectorizer()
tfidf = tfidf_vectorizer.fit_transform(corpus).toarray()
... | true |
f65ed0fc743b96ed11f1862627cee3e840675526 | sambhav228/image-processing | /dataset_crawler.py | UTF-8 | 976 | 2.71875 | 3 | [
"MIT"
] | permissive | # make sure to install all the dependencies prior running the script. happy hacking xD
'''
author @DravitLochan
'''
from urllib.request import urlopen
from bs4 import BeautifulSoup
url = "http://www.numberplates.com/pr-number-plate-gallery.asp?page="
urlSite = "www.numberplates.com/"
def main():
f = open("dat... | true |
b4c37dd75d16f285d470b837715a4b68a170f18d | benreynwar/communityshare | /community_share/picture_utils.py | UTF-8 | 757 | 2.546875 | 3 | [] | no_license | import hashlib
import imghdr
from community_share.s3_connection import save_file_to_s3
def get_image_type(image_data):
return imghdr.what('ignored', h=image_data)
def image_to_user_filename(image_data, user_id):
image_type = get_image_type(image_data)
return 'user_{0:d}_{1}.{2}'.format(
user_i... | true |
e188bfa29dc1e382eccc6472af9e0194c8659a3f | x2wing/Python | /study/1.py | UTF-8 | 327 | 2.953125 | 3 | [] | no_license | import string, fractions
#for i in xrange(12000):
# print repr(i).rjust(2), repr(i**2).rjust(3)
a='6.786564'
b='4294967295+2'
c='ff'
str='param'
i=0
strr=''
if (i==0):
str=list(strr+'bad')
#print list(str)
for i in str:
print i
print dir("")
#print '{0}, eggs, and {1}' .format('spam', 'SPAM!')
... | true |
db18605adbf968f00e5a12dac791ac9d26f6fe13 | Arwa-Ibrahim/Hakerrank-Problems | /python/pb10.py | UTF-8 | 1,670 | 4.34375 | 4 | [] | no_license | '''
Task: Consider a list (list = []). You can perform the following commands:
- insert i e: Insert integer e at position i.
- print: Print the list.
- remove e: Delete the first occurrence of integer e.
- append e: Insert integer e at the end of the list.
- sort: Sort the list.
- pop: Pop the last element from the lis... | true |
83b2049dd4dd2d4cbbbf801ab658a00c23db0c2d | RePierre/manelator | /src/scrapper.py | UTF-8 | 2,789 | 2.921875 | 3 | [
"MIT"
] | permissive | import requests
from lxml import html
import re
import argparse
import time
from random import randint
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--start-at', required=False, type=int, default=1)
parser.add_argument('--output-file', required=False, default='corpus.txt')
... | true |
5adf9a5f270087de6ad33bfed589056045fbd8a9 | VitorValandro/Vitae | /server/utils/auth.py | UTF-8 | 1,155 | 2.9375 | 3 | [] | no_license | # Esse é um middleware para verificar se o usuário está logado ou não.
# A função é um decorator aplicado à todos os recursos que precisam estar
# protegidos por autenticação.
from functools import wraps
from models.User import User
from flask import request, jsonify, make_response
import jwt
from config import API_T... | true |
aa658851a7d0dfc63c659e53c64035a3942d3511 | CAUN94/tics1002021 | /clase9/sec5/maximo.py | UTF-8 | 253 | 3.390625 | 3 | [] | no_license | matriz = [[1,2,3,4],[4,52,6,4],[7,8,9,4],[7,8,9,4]] # 4x4
max = matriz[0][0]
for i in range(len(matriz)):
for j in range(len(matriz[i])):
if matriz[i][j] > max:
max = matriz[i][j]
print(f"El maximo valor es {max}")
| true |
dc631837546758652a419d74ac6a81b33ec80473 | 634480/smoothie | /13sep/ej1.py | UTF-8 | 198 | 3.6875 | 4 | [] | no_license | #mostrar elementos de la matriz
matriz = [["hola ",5,8], ["mundo ", 12, 9.8] , ["better", 100, 1.15 ]]
for element in matriz:
for inception in element:
print(inception)
| true |
bacaa78b5ec485abd2d50cdc4399dd6abb8e3b91 | stevewmli/RaspberryBand | /test_yaml.py | UTF-8 | 139 | 2.546875 | 3 | [] | no_license | import yaml
with open('./songs/do_re_me.yaml') as f:
notes = yaml.load(f, Loader=yaml.FullLoader)
for n in notes:
print(n) | true |
b43cffd36842a73f4fa871f275627b33329e9d09 | santiago-m/IA2019 | /Ejercicio_1/test_npuzzle_iterativ_deepening_search.py | UTF-8 | 3,520 | 2.609375 | 3 | [] | no_license | import os
import sys
sys.path.append('../aima-python')
sys.path.append('../libs')
from problems import *
from generators import *
from heuristics import *
from generic_heuristics import *
import pytest
import time
import statistics
from datetime import datetime
''' ---------------this variables are used to write the s... | true |
cf2cb5f4b21b98f45a05e52f0e5bcecbf3dd0449 | justinalexchan/doorBellCV | /faceRcognitionTraining/trainModel.py | UTF-8 | 1,542 | 2.515625 | 3 | [] | no_license | import numpy as np
import keras
from keras import backend as K
from keras.models import Sequential
from keras.layers import Activation
from keras.layers.core import Dense, Flatten
from keras.optimizers import Adam
from keras.metrics import categorical_crossentropy
from keras.preprocessing.image import ImageDataGener... | true |
0f1a77e565bfb1ddfa7918777a57794205de0df5 | sirikata/sirikata | /scripts/graph/windowed_queues.py | UTF-8 | 1,052 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
import sys
import server
# Graph windowed queues for all servers from the given data file
def GraphWindowedQueues(filename):
server_avg_queued_graph = server.ServerGraph()
server_avg_weight_graph = server.ServerGraph()
fp = open(filename, 'r')
for line in fp:
[server1, serve... | true |
411d65f4b5085a92de3efec326384b21887df789 | andynormancx/aoc2019 | /day8.py | UTF-8 | 1,671 | 2.8125 | 3 | [] | no_license | #!/usr/local/bin/python3
import InputHelper as IH
import sys
import itertools
verbose = True
def solve1(input):
pixels_per_layer = 25 * 6
layers = [input[index:index + pixels_per_layer] for index in range(0, len(input), pixels_per_layer)]
zeros_layer = min(layers, key=lambda x: x.count('0'))
print(ze... | true |
a4d989ad2d05d56ef19603e73a92675c84edbe4b | Romanafanasyev/daymaker | /network.py | UTF-8 | 2,973 | 3.015625 | 3 | [] | no_license | import random
def relu(x):
if x > 1:
return 1 + 0.01 * (x - 1)
elif x < 0:
return 0.01 * x
else:
return x
def der_relu(x):
if x > 1:
return 0.01
elif x < 0:
return 0.01
else:
return 1
def mse_loss(y_true, y_pred):
dy1 = y_pred[0] - y_true[0]
... | true |
4c730a9007d708d6f73941929d4456177301330f | JGONGSQ/detokeniser_python | /detokeniser.py | UTF-8 | 1,692 | 3.125 | 3 | [] | no_license | import sys
import argparse
import json
import os
def process_token_file(filepath):
tokens = dict()
with open(filepath, 'r+') as f:
lines = f.readlines()
# for each line, get the key value pairs
for line in lines:
key, value = line.rstrip("\n").split(";")
tokens... | true |
f444f7417dc5d7ef6f0d54bc9871892ec5fda50e | clefever/aoc2018 | /day11/day11.py | UTF-8 | 2,426 | 3.4375 | 3 | [
"MIT"
] | permissive | class FuelCell:
def __init__(self, x, y, serial):
self.x = x
self.y = y
self.serial = serial
def get_rackId(self):
return self.x + 10
def get_powerLevel(self):
intermediate = ((self.get_rackId() * self.y) + self.serial) * self.get_rackId()
return -5 if len(s... | true |
bef6cd25c6065e9b0c6e3e2f23be46d58920de03 | cuonghp2112/TKTD | /backend/crawldata/baomoi/baomoi/spiders/vnexpress.py | UTF-8 | 2,980 | 2.59375 | 3 | [] | no_license | import scrapy
import re
class VnExpress(scrapy.Spider):
name = "vnexpress_news"
start_urls = ["https://vnexpress.net/"]
def check_link(self,link):
if link is not None and link[0] == "/":
if not re.match(u"(https).*",link) and len(link) > 1:
link = "https://vnexpress.net... | true |
087c04e78fd00270b5a48b4d3fbd10625eeafdbf | Priya-Chandak/Flask_CRUD | /models.py | UTF-8 | 715 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.secret_key = "Secret Key"
#SqlAlchemy Database Configuration With Mysql
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://priya:root@localhost/crud'
app.config['SQLALCH... | true |
5ac35b4763dd1117f6bfe59270efcb7a3914bbf4 | Kyrgyzbai/itc_python | /Day2/class_works/day24/__pycache__/hakaton.py | UTF-8 | 2,760 | 4.03125 | 4 | [] | no_license | ################################################################################
# Задание 2:
# Создайте input() который принимает от пользователя дату в формате: "2020-10-24 18:30" и возвращает dictionary разделённую по значениям даты:
# date = {
# "year": "2020",
# "month": "10",
# .....
# }
... | true |
525117a1481840badff3bb048c0e8d0ede81a05c | mmahmad/Image-Detector | /python_server.py | UTF-8 | 1,578 | 2.828125 | 3 | [] | no_license | from socket import *
import time
import StringIO
from PIL import Image
import base64
def decode_base64(data):
"""Decode base64, padding being optional.
:param data: Base64 data as an ASCII byte string
:returns: The decoded byte string.
"""
missing_padding = 4 - len(data) % 4
if missing_paddi... | true |
c213f79db1ece45e8c312e5df68ce67f406a52aa | gabriellaec/desoft-analise-exercicios | /backup/user_105/ch27_2019_08_19_14_40_07_161553.py | UTF-8 | 311 | 3.390625 | 3 | [] | no_license | cigarros_por_dia = int(input('quantos cigarros voce fuma por dia?: '))
anos_fumando = int(input('ha quantos anos fuma?: '))
minutos_perdidos = (cigarros_por_dia*10)*(anos_fumando*365)
dias_perdidos = minutos_perdidos / 1440
#print('você perdeu {0:.0f} dias de vida'.format(dias_perdidos))
print(dias_perdidos
| true |
fd24d74f643827ad8cf8c0e2f1c548b401af8400 | 569985011/Work-Space | /python/13652.HTML文本输出.py | UTF-8 | 351 | 3.375 | 3 | [] | no_license | import sys
def remove_tags(raw_html):
temp = ''
Flag = False
for i in range(len(raw_html)):
if Flag :
temp+=raw_html[i]
if i == '>':
Flag = True
elif i == '<':
Flag = False
return temp
txt = ''
for line in sys.stdin:
txt = txt +... | true |
9e99ce68858b4051e2f010263d88ac4018de77b8 | taazi1101/Public | /presetloader.py | UTF-8 | 2,164 | 2.8125 | 3 | [] | no_license | from selenium import webdriver
import ast
import base64
import os
def openpr_ff(url,cookies,private):
options = webdriver.FirefoxOptions()
if private:
options.add_argument("--private")
browser = webdriver.Firefox(options=options)
browser.get(url)
for x in cookies:
brows... | true |
52ec4ce947ac6a9b9a423ed7491e491e1fb5a95b | bhargav-s-271100/Python-Programs | /Sum,Average and Count of positive or neagitive Inetgers.py | UTF-8 | 376 | 3.75 | 4 | [] | no_license | a=int(input("enter the number or enter 999 to exit : "))
pos=0
neg=0
sum=0
i=0
while(a!=999):
if(a>0):
pos+=1
elif(a<0):
neg+=1
sum+=a
i+=1
a = int(input("enter the number or enter 999 to exit : "))
avg=float(sum/i)
print("sum = ",sum," average = ",avg)
print("Positive... | true |
9578e126ed0a6e3701b57764cb4aa33461c7aef5 | JVehaun/Tweeter | /tweeter.py | UTF-8 | 1,241 | 2.6875 | 3 | [] | no_license | from twitter import *
import sys
import indicoio
access_key = "734176927825682433-UPc1vYiJjO0B4Ux6kj3GwRFXgIA22sK"
access_secret = "PpMlpJ412wx87g34msMRdir2yqfaiDTB6P0WqOdrlMxUw"
consumer_key = "jRsDidUota8wzQOin3AmKS312"
consumer_secret = "fRWBT5mK9EXWaZiIJCLdAO9FpbfU71eT4IHuv41OxazTJCeUdC"
indicoio.config.... | true |
b7f25e1c35234838b9fe5eb6d4bbf957f2a0fa74 | best2000/file_search_engine | /t.py | UTF-8 | 3,240 | 2.6875 | 3 | [] | no_license | import os, pickle
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
def read_index():
root_path = en.get()
#get file index from path
file_index = [(path, files) for path, _, files in os.walk(root_path)]
#save files index to file_index.pkl
try:
os.remo... | true |
2511d5fdcaf07302b3cfad217c466ed681c862dc | hrdavidge/georgette_heyer | /questionnaire/who_introduced_reader.py | UTF-8 | 4,481 | 3.46875 | 3 | [] | no_license | import pandas as pd
import argparse
import os
import matplotlib.pyplot as plt
# for colours: https://matplotlib.org/2.0.0/examples/color/named_colors.html
parser = argparse.ArgumentParser("Code to create frequency distribution, pie chart and save percentages showing who introduced reader to Heyer")
parser.add_argumen... | true |
06ff965af874b0ac2a81320b6183bbc9d261ab8e | sunderblade/nud2google | /b_split_csv.py | UTF-8 | 1,816 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
## Rooms ##
# "ASB 210"
# "ASB 220"
# "ASB 304"
# "ASB 504"
# "ASB Foyer"
# "ASB Kitchen"
# "SB 221"
# "SB 222a"
# "SB 306"
import sys,csv,string,os
open("asb_210.csv", 'w').close()
open("asb_220.csv", 'w').close()
open("asb_304.csv", 'w').close()
open("asb_504.csv", 'w').close()
open("as... | true |
75dd8fea721929a680e28ded682f5883dab0ccb7 | Dreaouth/Machine-Learning-inAction | /logistic/logRegres.py | UTF-8 | 7,491 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import random
# 加载数据
def loadDataSet():
dataMat =[] # 存放数据
labelMat = [] # 存放标签
fr = open('testSet.txt','r')
for line in fr.readlines():
lineArr = line.strip().split()
dat... | true |
4b59899a7294acca48bb34e3cfba067be269c469 | k402xxxcenxxx/ColorHarmonization | /color_harmonization.py | UTF-8 | 3,779 | 2.5625 | 3 | [] | no_license | #! python3
import cv2
import sys
import numpy as np
import util
import importlib
importlib.reload(util)
HueTemplates = {
"i" : [( 0.00, 0.05)],
"V" : [( 0.00, 0.26)],
"L" : [( 0.00, 0.05), ( 0.25, 0.22)],
"mirror_L": [( 0.00, 0.05), (-0.25, 0.22)],
"I" : [( 0.00, 0.05), ( ... | true |
d1287e9443cf4a996b1c2727d3818264a2b7c5a4 | seraphD/DataAnalyticsFinalProject | /Ks.py | UTF-8 | 444 | 2.5625 | 3 | [] | no_license | class Ks:
name = ""
category = ""
bigCategory = ""
day = 0
goal = 0
pleged = 0
state = True
def __init__(self, name, category, bigCategory, day, goal, pleged, backers, state):
self.name = name
self.category = category
self.bigCategory = bigCategory
se... | true |
8f4bd1ddecc2cde85ea44b9ea6561fed04d049b7 | brycecaine/habiticorrall | /wsgi/myproject/dashboard/config.py | UTF-8 | 654 | 2.734375 | 3 | [] | no_license | TASK_COLORS = [
{'hex': '#CADAF7', 'name': 'Bright Blue', 'min': 10.0000000001, 'max': 999999999999},
{'hex': '#D1E0E3', 'name': 'Blue Grey', 'min': 5.0000000001, 'max': 10},
{'hex': '#D8EAD3', 'name': 'Green', 'min': 1.0000000001, 'max': 5},
{'hex': '#FFF1CF', 'name': ... | true |
9b720ae37e92b7f61682b97053cd17ada43cd987 | Pbyrne95/interview_qs | /search_algos/dijksrasA.py | UTF-8 | 2,633 | 3.6875 | 4 | [] | no_license | from heapq import heappop, heappush
import math
from math import inf
from manhattan_graph import manhattan_graph, penn_station, grand_central_station
graph = {
'A': [('B', 10), ('C', 3)],
'C': [('D', 2)],
'D': [('E', 10)],
'E': [],
'B': [('C', 3), ('D', 2)]
}
def dijkstras... | true |
b72d60da83af610eb662bd0b4905a957747dc7fc | wucysh/PyCat | /tools/portScan.py | UTF-8 | 993 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import telnetlib
import threading
import queue
def get_ip_status(ip):
server = telnetlib.Telnet()
for port in range(80, 65535):
# for port in [3306, 1521]:
try:
server.open(ip, port, 2)
print('{0} port {1} is open'.format(ip, port))
except Exc... | true |
34eb73ea3d9cc42d704da40fe278b6b078dc14dc | gustavodsf/py_projects | /pier/Parser-py/FaixaEtariaDAO.py | UTF-8 | 452 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import PostgresDB
class FaixaEtariaDAO:
def __init__(self):
self.pg = PostgresDB.PostgresDB()
self.pg.connect()
self.faixaEtariaDict = dict()
def retrieveAll(self):
query = "SELECT * FROM faixa_etaria"
rows = self.pg.executeQuery(query)
for row in rows:
self.faixaEtariaDict[row[2]] = row[0]
def wi... | true |
b538badb8efdf6671f9e8475639a601920027821 | AgrimNautiyal/Problem-solving | /linked_list/stack_using_linked_list.py | UTF-8 | 1,276 | 3.84375 | 4 | [] | no_license | #question url : https://practice.geeksforgeeks.org/problems/implement-stack-using-linked-list/1
# Class to represent a node
class StackNode:
# Constructor to initialize a node
def __init__(self, data):
self.data = data
self.next = None
class Stack:
# The method push to push element into
# the stack
... | true |
160721729d1416597ab1e0bb0e2d8ccc120b4475 | dhohn/root-stuff | /countbins.py | UTF-8 | 821 | 2.75 | 3 | [] | no_license | import ROOT,sys
def main(argv):
if len(argv)-1<1:
raise RuntimeError('usage: python countins.py file.root')
filename = argv[1]
f = ROOT.TFile.Open(filename,'READ')
if not f: raise RuntimeError(filename+' doesnt exist')
nbins_dict = {}
for tkey in f.GetListOfKeys():
if tke... | true |
c00f9f0da31b21be953e79d21e5920084e5c0d11 | DinLei/RecitePoetry | /utils/io_util.py | UTF-8 | 1,490 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/9/13 15:20
# @Author : BigDin
# @Contact : dinglei_1107@outlook.com
import os
import glob
import pickle
from utils.sql_util import SqliteOperation
def save_to_sqlite(data, database, table):
"""
将数据存放到对应的表中,自动添加数值索引
:param data:
:param ... | true |
e8d6e388683fb51e0e17f89c2c9cba3e4ae882ef | liuqi8827/DR-PG | /rl/tools/oracles/meta_oracles.py | UTF-8 | 6,259 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | from abc import ABC, abstractmethod
import numpy as np
from numpy import linalg as la
import copy
from collections import deque
from rl.tools.utils.mvavg import ExpMvAvg
from rl.tools.oracles.oracle import Oracle
from rl.tools.utils import logz
class MetaOracle(Oracle):
"""These Oracles are built on other Oracle ... | true |
b860fb8cec50160416519ab795b32b1ea1451056 | jimbowyer123/Stocks | /Stock Data.py | UTF-8 | 7,483 | 3.59375 | 4 | [] | no_license | # Relevant imports (best not to include any irrelevant ones)
import matplotlib.pyplot as plt
import datetime
from yahoo_finance import Share
from statistics import mean
import matplotlib.dates as dt
import matplotlib.finance as mfinance
import matplotlib.ticker as ticker
# Create a class to contain relevant stock valu... | true |
1b4aeafeee21422f6363e9514c6e8d64fdbecfb7 | Aasthaengg/IBMdataset | /Python_codes/p03821/s682702855.py | UTF-8 | 261 | 2.921875 | 3 | [] | no_license | N = int(input())
A = []
B = []
cnt = 0
for i in range(N):
a,b = map(int,input().split())
A.append(a)
B.append(b)
for i in range(N)[::-1]:
amari = (A[i] + cnt) % B[i]
if amari != 0:
add = B[i] - amari
cnt += add
print(cnt) | true |
4211a3c51c8f124486d6f7016dae2813ab4ff4fd | datormx/PythonExercises | /retos-platzi/Reto1_7_EdadFuturaPasada.py | UTF-8 | 348 | 5 | 5 | [] | no_license | if __name__ == "__main__":
print('Welcome, you will know how old were you last years and how old you are going to be next year.')
name = input('Write your name: ')
age = int(input('Write your age: '))
f_age = age + 1
p_age = age - 1
print(f'{name}, you were {p_age} years old last year and you ... | true |