blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
343d199c25dcfdf70af929f486a4db7624c39f68 | Python | reading-stiener/For-the-love-of-algos | /Search/search_2D_mat.py | UTF-8 | 864 | 3.828125 | 4 | [] | no_license | class Solution:
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
m = len(matrix)
if m == 0:
return False
n = len(matrix[0])
row = 0
col = n-1
while col >=... | true |
f1616e338a0665c507112f9f209a63f49b1a387b | Python | leowwww/bars-Second-classification | /test.py | UTF-8 | 1,908 | 3.046875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torch.autograd import Variable
import time
n_data = torch.ones(100,2)
x0 = torch.normal(2*n_data,1)
y0 = torch.zeros(100)
#print(x0)
x1 = torch.normal(-2*n_data,1)
y1 = torch.ones(100)
x = torch.cat((x0,x1),0).type... | true |
e878aa557febc081fa31319fde36692f4b1fc11c | Python | atillakz/MyProject | /new/Api_client.py | UTF-8 | 3,710 | 2.515625 | 3 | [] | no_license | import json
import requests
header = {'Content-Type': 'application/json', \
'Accept': 'application/json'}
import pandas as pd
import pandas as pd
from influxdb import DataFrameClient
from sklearn.externals import joblib
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import ... | true |
6fa060446cce03b6b6935355295ed9d4073e050b | Python | pedrovs16/PythonEx | /ex072.py | UTF-8 | 364 | 3.859375 | 4 | [
"MIT"
] | permissive | escolha = 0
contagem = ('um', 'dois', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'quatorze', 'quinze', 'desseseis', 'dessesete', 'dezoito', 'dezenove', 'vinte')
while escolha > 20 or escolha < 1:
escolha = int(input('Digite um nรบmero de 1 atรฉ 20:'))
print(f'{escolha} ... | true |
4d5bb15b7cb21dccc861d009ef657a62277f9c52 | Python | gentle-potato/Python | /01_OT/hello.py | UTF-8 | 2,644 | 4.09375 | 4 | [] | no_license | '''
# ์ฒซ ๋ฒ์งธ ํ๋ก๊ทธ๋จ
print('Kim Hyung Lim')
'''
'''
# ๋ณ์์ ๊ฐ์ ์ ์ฅ(ํ ๋น : assign)
x = 10 ; y = 20 ; z = 30
x = 10
y = 20
z = 30
print(x, y, z)
print(x)
print(y)
print(z)
# ์ฌ๋ฌ ๊ฐ์ ๋ณ์์ ์ฌ๋ฌ ๊ฐ์ ๊ฐ์ ์ ์ฅ
x, y, z = 10, 20, 30
print(x, y, z)
print(x)
print(y)
print(z)
# ์ฌ๋ฌ ๊ฐ์ ๋ณ์์ ๋์ผํ ๊ฐ์ ํ ๋น
a=b=c=100
print(a, b, c)
'''
"""
# ๋ ... | true |
e74a4ea4d67526e55398867c4acb94fd6554e8c5 | Python | 99YuraniPalacios/scientific-computing-hw- | /Lorenz.py | UTF-8 | 696 | 2.921875 | 3 | [] | no_license | import numpy
import matplotlib
import matplotlib.pyplot
#Creado el 3 de Marzo de 2016
#Autora: Yurani Palacios
# Atractor de Lorenz
X0= 0.2
Y0= 1.0
Z0= 1.05
Sigma= 10
Rho= 28
Beta= 2.667
Delta= 0.01
t= range(10001)
X= range(10001)
Y= range(10001)
Z= range(10001)
X[0]= X0
Y[0]= Y0
Z[0]= Z0
for i in range (1, 1000... | true |
6a0812583d1c6242e12e90178b349c274e578e6b | Python | raphamoral/Exercicicios_PythonBrazil_Mackenzie_PYTHONPRO | /Mackenzie/Mackenzie Aula3 Praticando Exercicio3.py | UTF-8 | 718 | 4.375 | 4 | [] | no_license | #EXERCรCIO 3 โ Faรงa um programa em Python que resolva o seguinte problema:
#Um concurso possui um prรชmio no montante de R$ 780.000,00 para dividir entre trรชs ganhadores da seguinte forma:
#- o primeiro ganhador receberรก 46% do prรชmio;
#- o segundo ganhador receberรก 32% do prรชmio;
#- o terceiro ganhador receberรก o r... | true |
030d5731cfd0456db50f698fa36d987278e3c4a7 | Python | GBardis/gamebot-competition | /PythonAPI/player.py | UTF-8 | 625 | 2.96875 | 3 | [] | no_license | from buttons import Buttons
class Player:
def __init__(self, player_dict):
self.dict_to_object(player_dict)
def dict_to_object(self, player_dict):
self.player_id = player_dict['character']
self.health = player_dict['health']
self.x_coord = player_dict['x'... | true |
666362a65059249ef51fcd7fce3f56c4c3ad08e0 | Python | gwylim/physics-project | /metropolis.py | UTF-8 | 2,580 | 2.96875 | 3 | [] | no_license | from random import random, randint
from math import exp, pi, cos, sin, sqrt, log
from sys import argv, stdout, stderr
from collections import defaultdict
q = 10
def delta(i, j):
if i==j: return 1
else: return 0
def adjacent(l, x, y):
for dx in [-1,0,1]:
for dy in [-1,0,1]:
if dx*dy ==... | true |
7cdbf46e87452323482651fe436b86508d9fd724 | Python | julekb/LP2 | /statistics.py | UTF-8 | 1,514 | 3.015625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from functions import strip_punctuation, load
"""
some general statistics and plots
"""
if __name__ == "__main__":
with open('Tweets-airline-sentiment.csv', 'rb') as f:
dataset = pd.read_csv(f)
all_numb = len(dataset)
po... | true |
7276cff4b6d1d25fcec328169fd462561b7c829b | Python | xiaohugogogo/python_study | /python_work/chapter_2/name_cases.py | UTF-8 | 512 | 4.25 | 4 | [] | no_license | name = "Eric"
print("Hello " + name + ", would you like to learn some Python today?")
name = "zHAO yU Hu"
print(name.lower())
print(name.upper())
print(name.title())
sentence = 'Albert Einstein once said, "A person who never made a mistake never tried anything new."'
print(sentence)
famous_person = "Albert Einstein"... | true |
130ff52279d7a5bbd61b6817d1cd1f8415b92dd7 | Python | austinHuff/CookieClicker | /CookieClicker.py | UTF-8 | 12,231 | 3.109375 | 3 | [] | no_license | import pygame
import inputbox
import time
pygame.init()
# get highscores & save into dict
highscores = dict()
try:
with open('highscores.txt','r') as t:
s = t.readlines()
for i in s:
L = i.split(' ')
if L != ["\n"] and L != [""]:
highscores[str(L[0])] = [int(L[1]),int(... | true |
c4781e3cb3179e309d7ecc88e67c4e41c49af2e2 | Python | illacceptanything/illacceptanything | /code/kjk.py | UTF-8 | 2,059 | 3.328125 | 3 | [
"MIT"
] | permissive | import random, math
from itertools import *
def respond(challenge, f, g):
n = len(challenge)
a = [f[challenge[i]] for i in range(0,n)]
b = [0 for i in range(0,n)]
b[0]=int(g[(a[0]+a[-1]) % 10])
for i in range(1,n):
b[i] = int(g[(b[i-1]+a[i]) % 10])
return b
def checkg(g, pairs):
f ... | true |
a843d7922e1af5a9889afa549b9043ca00dac2be | Python | marinlauber/my-numerical-recipes | /MyKeyBoard.py | UTF-8 | 837 | 2.703125 | 3 | [] | no_license | import keyboard
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
x = np.linspace(-1,1,256)
y = np.zeros_like(x)
plt.ion()
fig = plt.figure()
ax = fig.add_subplot(111)
plt.... | true |
cd423087b7ef5bd1beb6b67ef3f3ef38d353493d | Python | rlinguri/pyfwk | /pyfwk/base/dbase.py | UTF-8 | 1,334 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
dbase.py: instance methods for extending database classes
"""
# ----------------------ABSTRACT-BASE-CLASS-DATABASE----------------------#
class DBase:
"""
import sqlite3 module in extended module
Vars curs and conn should be declared in extended class
Values for both... | true |
df45359db68c9fda816c06698fb9690fe1197760 | Python | mattdaviscodes/home-game-poker | /tests/test_models.py | UTF-8 | 34,249 | 2.53125 | 3 | [] | no_license | import pytest
import datetime
import sqlalchemy
from models import *
from exceptions import *
from poker import TexasHoldemHand
from deuces import Card as PokerCard
class TestGroup:
def test_create(self, db, user):
group = Group.create(id=1, creator_id=user.id, name="test_group", active=True,
... | true |
e048cd76b7a5ed99b659b8616da67e8c5feb1e96 | Python | driellevvieira/ProgISD20202 | /Iago/Atividade 6/atividade 6.py | UTF-8 | 4,227 | 3.875 | 4 | [] | no_license | """
Seja o seguinte procedimento cirรบrgico:
1 - Procedimento de anestesia: Pode-se utilizar uma diversidade de fรกrmacos para
anestesia os animais, dentre eles Ketamina e xilazina utilizados em conjunto,
halotano (gasoso). Verificar a dosagem correta de acordo com o peso dos animais.
2 - Depois do anestรฉsico te... | true |
448b43050ab008401a9031ccee4749ea30eb3e17 | Python | wanxu2019/PythonPractice | /knowledge_points/A-star.py | UTF-8 | 10,384 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/6/10 8:51
# @Author : Json Wan
# @Description :
# @File : A-star.py
# @Place : dormitory
'''
้ข็ฎๆ่ฟฐ๏ผ
problem statement
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tou... | true |
aae93af24bffdc62c4f46e8692d6ae5ff037296c | Python | jongky/my_devel | /python/my_chan.py | UTF-8 | 613 | 3.125 | 3 | [] | no_license |
import stackless
import sleep
def sender(chan, value):
print "[## JK-DBG-1] sender: Starting --->"
for x in range(0, 10):
print "[## JK-DBG-1.1] sender: Sending Data : %s" %format(x)
chan.send(x)
sleep(3)
def receiver(chan):
print "[## JK-DBG-2] receiver: Receiving on chan= %s" %format(c... | true |
847bcb8eef1757cbc3bd9ba4ed2ee1bf65d26527 | Python | RinSer/crypto | /rsa_break.py | UTF-8 | 3,923 | 2.828125 | 3 | [] | no_license | # Bad RSA Break
import gmpy2
from extended_euclidean_algorithm import eea
gmpy2.get_context().precision = 1100 # Adjust calculations' precision
class Factorizer:
def __init__(self, N):
self.N = gmpy2.mpz(N)
A = gmpy2.ceil(gmpy2.sqrt(self.N))
x = gmpy2.sqrt(gmpy2.sub(pow(A, 2), self.N))
self.p = gmpy2.mpz(... | true |
c383dd873c52bcf74a8dba9d8d18b966957691e0 | Python | ptyork/au-aist2120-21sp | /A/not_dictionaries_0209.py | UTF-8 | 631 | 3.546875 | 4 | [] | no_license | students = [
'Alice',
'Bob',
'Chuck',
'Dr. Dre'
]
grades = [
85,
70,
60,
100
]
name = input("Enter name: ")
name = name.strip()
name = name.title() # auto capitalize each word
if name in students:
idx = students.index(name) # find name
grade = grades[idx]
print(... | true |
9896f03ee112635384f9e4ff6c2fdd958bc1ee1a | Python | Sheersha-jain/Python_practice | /sum_of_integer.py | UTF-8 | 166 | 3.5625 | 4 | [] | no_license | def sumOfdigits():
count = 0
input_num = input("Enter the number you want to sum : ")
b = [int(var) for var in input_num]
print sum(b)
sumOfdigits()
| true |
07bd20655e66cc1fff87f0c2f72e8f73b00ce9da | Python | smantz/fufezan-lab-advanced_python_2020-21_HD | /Ex4/Ex4_functions.py | UTF-8 | 1,562 | 3.46875 | 3 | [] | no_license | import pandas as pd
import plotly.graph_objects as go
def get_lookup_dict(csv):
"""
Makes a nested dictionary out of a given csv-file
Args:
csv: csv-file
Returns:
nested dictionary containing different amino acid properties and the corresponding values assigned to the
1-letter... | true |
d6150b27171c39c57cde514e867435458c75683c | Python | qiudebo/13learn | /code/matplotlib/lab/test_head_map.py | UTF-8 | 2,102 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'qiudebo'
import numpy as NP
A = NP.array([
[6.55,6.76,7.32,5.6,5.94,],
[0.01,0.01,0.04,0.02,0.11,],
[6.45,6.29,4.34,4.57,7.15,],
[8.73,10.67,6.9,8.25,8.53,],
[0.03,0.01,0.05,0.01,0.07,],
[1.36,1.41,0.8,0.98,1.36,],
[0,0,0,0,0.01,],
[2.09,2.93... | true |
32a7a6d32929869e29a29aa4c3a30ff867fa0b77 | Python | cldf/csvw | /src/csvw/frictionless.py | UTF-8 | 8,234 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | """
Functionality to convert tabular data in Frictionless Data Packages to CSVW.
We translate [table schemas](https://specs.frictionlessdata.io/table-schema/) defined
for [data resources](https://specs.frictionlessdata.io/data-resource/) in a
[data package](https://specs.frictionlessdata.io/data-package/) to a CVSW Ta... | true |
87cccb86958ba8e5b7d09cde63c878b5e41a6a78 | Python | bobcaoge/my-code | /python/leetcode_bak/633_Sum_of_Square_Numbers.py | UTF-8 | 627 | 3.40625 | 3 | [] | no_license | # /usr/bin/python3.6
# -*- coding:utf-8 -*-
import math
class Solution(object):
def judgeSquareSum(self, c):
"""
:type c: int
:rtype: bool
"""
a = 0
while a <= math.sqrt(c/2):
b = math.sqrt(c - a**2)
if b == int(b):
return Tru... | true |
12a1de31738b396c309aa7885d2e646313a7b788 | Python | li551933/Recognition | /mnistimg.py | UTF-8 | 851 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
mnist = read_data_sets('MNIST_data', one_hot=False)
# print(mnist.train.images[0].shape) #(784,)
img0 = mnist.test.images[0].reshape(28,28) # ็ฉ้ต ไบ็ปดๆฐ็ป
img1 = mnist.test.images[1].reshape(28,28)
img2 = mnist... | true |
c30434cca5f67e72343122bca8889edc8b84b106 | Python | HarithJ/Yummy-Recipes-Ch3 | /tests/test_recipes.py | UTF-8 | 12,057 | 3.3125 | 3 | [] | no_license | import json
from .test_base import BaseTestCase
from app.models import Recipe, Ingredient
class RecipeTestCase(BaseTestCase):
"""This class represents the testing for recipes"""
def create_recipe(self, token, context, cat_id=1, title="Recipe Create Test", ingredients=None, directions=None, rec_num=1):
... | true |
4d0250d4aded17cf8f57a64115310acb0585e9e8 | Python | clarisahasya/NagelSchreckenberg | /NagelSchreckenberg.py | UTF-8 | 2,670 | 3.125 | 3 | [] | no_license | import numpy.random as random
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation
from copy import copy
from operator import itemgetter
# inisialisasi
M = 100 #panjang lintasan
p = 0.3 #probabilitas
v0 = 0 #kecepatan awal
N = 10 #banyaknya mobil
t_max =... | true |
af734f1e1e782b3966d060e830508853e487593d | Python | misaka-10032/leetcode | /coding/00286-walls-and-gates/solution.py | UTF-8 | 1,008 | 2.890625 | 3 | [] | no_license | # encoding: utf-8
"""
Created by misaka-10032 (longqic@andrew.cmu.edu).
TODO: purpose
"""
from collections import deque
inf = 2147483647
class Solution(object):
def wallsAndGates(self, rooms):
"""
:type rooms: List[List[int]]
:rtype: void Do not return anything, modify rooms in-place in... | true |
dc9ea538f5834cc9307a37bf2f0c7b9127c109cc | Python | elliesiegel/Ambiguity_Patterns | /experiments/helper_programs/get_average.py | UTF-8 | 2,294 | 2.75 | 3 | [
"MIT"
] | permissive | import pandas
import math
import sys
# python3 get_average.py JSON_data_comparison_2/both_false/RESULTS_figure_CSV/word-nodes-edges.csv
'''
calculate average value per category per column in a csv file:
(nodes, edges, clique-node, clique-node-edges, variance within clique-nodes, variance of clique-edge weights)
'''... | true |
271a653979a2b2e9bac042c6b836c7abdd5a518e | Python | KevinBdn/ULYSSE | /workspaceUlysse/src/ulysse_tf/src/Ulysse_marker/boat_simulator.py | UTF-8 | 2,501 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
"""
__author__ = "Kevin Bedin"
__version__ = "1.0.1"
__date__ = "2019-12-01"
__status__ = "Development"
"""
"""
The ``Ulysse TF`` module
======================
Use it to :
- publish the Ulysse marker
Context
-------------------
Ulysse Unmaned Surface ... | true |
f5157d843e1bf2f831eb8768eceb4413896e18b8 | Python | gustavoccintrao/BabySteps | /URI/1010.py | UTF-8 | 293 | 3.03125 | 3 | [
"MIT"
] | permissive | peca1 = input().split()
peca2 = input().split()
quantidadePeca1 = int(peca1[1])
quantidadePeca2 = int(peca2[1])
valorPeca1 = float(peca1[2])
valorPeca2 = float(peca2[2])
total = (quantidadePeca1 * valorPeca1) + (quantidadePeca2 * valorPeca2)
print("VALOR A PAGAR: R$ {:.2f}".format(total))
| true |
246adbc8762d6527e1ca71cdff0da72f21e17bef | Python | David15117/A-an-lise-emp-rica---Algoritmos-de-ordena-o | /geradorCsv.py | UTF-8 | 811 | 3.078125 | 3 | [] | no_license | from random import randint, shuffle, choice
import random
#-------------- Aleatorio-----------------#
tamanho = 1000000 #<========= digite o valor tamanho da lista
#-------------- Descrecente-----------------#
arq = open(str(tamanho)+'Decrescente'+'.csv', 'w')
result = list(range(tamanho))
print(result)
for i in resu... | true |
19270047910dbb68e07b86f9dd2d3c4f047810f6 | Python | JoshuaSocrates/JoshuaSocrates.github.io | /CSC497__3_7.py | UTF-8 | 6,367 | 3.390625 | 3 | [] | no_license | import math
class State():
def __init__(self, cannibalLeft, missionaryLeft, boat, cannibalRight, missionaryRight):
self.cannibalLeft = cannibalLeft
self.missionaryLeft = missionaryLeft
self.boat = boat
self.cannibalRight = cannibalRight
self.missionaryRight = missionaryRight
self.parent = None
... | true |
7cb3093bec2c546f3aa050038fddc91b5d2a4b9a | Python | thedavidharris/advent-of-code-2020 | /day22/22a.py | UTF-8 | 795 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python3
from collections import deque
with open("input.txt") as f:
input = f.read().split("\n\n")
p1_cards = deque()
for line in input[0].splitlines()[1:]:
p1_cards.append(int(line))
p2_cards = deque()
for line in input[1].splitlines()[1:]:
p2_cards.append(int(line))
while len(p1_cards) ... | true |
a710f30ba10a95954d2d18a102e5baf504a752e9 | Python | Almenon/open-anything | /quickOpen.py | UTF-8 | 4,134 | 2.734375 | 3 | [
"MIT"
] | permissive | from importlib import import_module
from os import path
from sys import version_info
from fileTypes import openDict
from openers import open_website
if version_info >= (3,3,6):
module = import_module('ipaddress')
ip_address = getattr(module, 'ip_address')
else: ip_address = None
protocols = ['https://','http:... | true |
3e34bff29765ef6874b769c6bb7841927abf46ea | Python | xuru/chatter | /src/chatter/grammar.py | UTF-8 | 3,578 | 2.8125 | 3 | [
"MIT"
] | permissive | import logging
import random
from collections import defaultdict, OrderedDict
from chatter.parser import PATTERN_RESERVED_CHARS
from chatter.placeholder import get_all_possible_values
logger = logging.getLogger(__name__)
def process_template(template, grammars):
values = []
if '{' in template:
all_v... | true |
8b83269297162e1f3eafbd84445f41f95ec7166c | Python | raghumb/ml-unsupervised-learning | /learner/NMF.py | UTF-8 | 1,080 | 2.6875 | 3 | [] | no_license | from sklearn import decomposition
import numpy as np
class NMF:
def __init__(self,
n_components = None,
init = None,
solver = 'cd',
beta_loss = 'frobenius',
tol = 0.0001,
max_iter = 200,
random_state = N... | true |
ee1cfa541addb2cda68951fd46c99c78a896d01e | Python | yuxichen2019/Test | /selenium/Fixture.py | UTF-8 | 756 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 2019/11/27 14:31
# Test
# Fixture.py
# company
import unittest
def setUpModule():
print("test module start>>>>>>>>>>>>>>>>>>>>>>>>>")
def tearDownModule():
print("test module end>>>>>>>>>>>>>>>>>>>>>>>>>")
class MyTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
... | true |
a4ddce70f54c5781d2f7b56a3e341b2ba68a0e7b | Python | Bing8023/Test | /venv/ๆฃ็นๅพๅ็ฑปๆฐๆฎ้ข่ฒ.py | UTF-8 | 2,904 | 2.796875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import os
import xml.etree.ElementTree as ET
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from PIL import Image
def parse_obj(xml_path, filename):
tree = ET.parse(xml_path + filename)
classname1 = []
for obj in tree.findall('object'):
classname... | true |
64a6ea8ee2a91bb5554c7f7dadc329e8ff43752a | Python | Natacha7/Python | /Tuplas/funcion_orden_superior_filter2.py | UTF-8 | 702 | 3.9375 | 4 | [] | no_license | '''
Tal como su nombre indica filter significa filtrar, y es una de mis
funciones favoritas, ya que a partir de una lista o iterador y una
funciรณn condicional, es capaz de devolver una nueva colecciรณn con
los elementos filtrados que cumplan la condiciรณn.
'''
"""
Desarrolle un programa que reciba como parรกmetro una ... | true |
a3e666410c974821ae392ed7552a8bc58d64074f | Python | DiegoAyalaH/Mision-07 | /Misiรณn7.py | UTF-8 | 1,885 | 4.375 | 4 | [] | no_license | #DiegoArmandoAyalaHernรกndez
#A01376727
#Menu que da la opcion para dividir o para encontrar un numero mayor
def dividir(dividendo, divisor): # Recibe un dividendo y divisor y calcula el resultado
divedendo = dividendo
cociente = 0
while dividendo >= divisor:
dividendo = dividendo - divisor
... | true |
cd9b7b8f42ea2aaee5261174cf60c112baa5a313 | Python | darthsuogles/phissenschaft | /dlsys/params.py | UTF-8 | 809 | 3.015625 | 3 | [] | no_license | """
Metaprogramming
"""
from collections import namedtuple
class ParamsRegistry(type):
def __init__(cls, name, bases, namespace):
super(ParamsRegistry, cls).__init__(name, bases, namespace)
if not hasattr(cls, 'registry'):
cls.registry = set()
cls.registry.add(cls)
cls.r... | true |
cdbf27d17780bb577abbc8815222a396ffa30276 | Python | MSheshera/PUResultConv | /extractData.py | UTF-8 | 15,453 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Code to extract data from the text file generated from the results
pdf file.
"""
import re
import math
import inspect
class Branch(object):
"""
Holds information for a give branch.
Attributes: brAbbr, prnCount, tmCount, subvCount, colAbr,
year, exDate, exPat
"""
def __init__(sel... | true |
6e47e9822c1fe6a274ccd20055961de8acfd9011 | Python | Raghav714/Cable-TV | /stream.py | UTF-8 | 2,978 | 3.109375 | 3 | [
"MIT"
] | permissive | import urllib.request
import subprocess
import argparse
class PlaylistParser():
def __init__(self):
self.filename = None
self.channels = []
def is_m3u(self, filename=None):
fname = filename or self.filename
try:
with open(fname, "r") as fhand:
while ... | true |
9745cd7d3c13fdfc4461d96c2b0e7597d47ecfd0 | Python | matheus-alves/social-training | /socialtraining/dataset.py | UTF-8 | 4,928 | 3.453125 | 3 | [] | no_license | from enum import Enum
__author__ = 'Matheus Alves'
"""
This module contains the DataSet abstraction class. This class was created
to simplify the data set loading process. This module also contains the
UnlabeledDataRates Enum.
"""
_TEST_GROUP_RATE = 0.25
class UnlabeledDataRates(Enum):
"""
Enum to define th... | true |
2faf410118f3b8d2b53f59d41fff71643bf78718 | Python | Ayushkumar11/Data-structure-Algo | /problem_2.py | UTF-8 | 1,777 | 3.765625 | 4 | [] | no_license | def rotated_array_search (input_list, number):
offset = 0
if len(input_list) == 0:
return -2
midpoint = len(input_list) // 2
if input_list[midpoint] == number:
return midpoint
sub_list = list([])
left_side = input_list[0:midpoint]
right_side = input_list[midp... | true |
72bffaff9be333f0921286433f460e0f779dfbb3 | Python | ducfilan/algorithms-practice | /Array/large_cont_sum.py | UTF-8 | 448 | 3.875 | 4 | [] | no_license | # Given an array of integers (positive and negative) find the largest continuous sum.
#
# So the input:
#
# large_cont_sum([1,2,-1,3,4,10,10,-10,-1])
#
# would return:
#
# 29
def large_cont_sum(arr):
if len(arr) == 0:
return 0
sum_val = max_val = arr[0]
for i in arr[1:]:
sum_val += i
... | true |
16192c12a1825510ede234e369542aa4ac12a9d0 | Python | zkstewart/personal_projects | /masters/N8942188_557_Ass2/adsmachinery/admin.py | UTF-8 | 9,491 | 2.71875 | 3 | [
"MIT"
] | permissive | # Import third-party packages
from flask import Blueprint
from . import db
from datetime import datetime
# Import custom classes
from .manufacturer import Manufacturer
from .mitresaw import MitreSaw
from .order import Order
from .orderDetail import OrderDetail
# Initialise blueprint for database seed route
bp = Bluep... | true |
b995c27bfb97b9380f91a4f59f758b6c3e0f1ce7 | Python | brianhu0716/LeetCode-Solution | /61. Rotate List.py | UTF-8 | 748 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 10 10:58:02 2021
@author: Brian
"""
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
node = list()
ptr = head
while ptr :
node.append(ptr)
if ptr.next == None : break
ptr = ptr.next... | true |
c1fce57010eec9aaf53b3054805d651ca8aea2a8 | Python | Krystana/KMP-supermarket-simulation | /simpro_02_customer_Murat.py | UTF-8 | 1,050 | 3.21875 | 3 | [
"MIT"
] | permissive |
import numpy as np
import pandas as pd
transition_matrix = pd.read_csv("trans_matrix_prob.csv", index_col = 0)
class Customer:
def __init__(self, id, state, transition_mat):
self.id = id
self.state = state
self.transition_mat = transition_matrix
def __repr__(self):
"""
Ret... | true |
4bf2e05e8464a0d0c3af9b0f96e7001c8d256227 | Python | nitram2342/dumpmon | /dumpmon.py | UTF-8 | 3,246 | 2.515625 | 3 | [] | no_license | # dumpmon.py
# Author: Jordan Wright
# Version: 0.0 (in dev)
# ---------------------------------------------------
# To Do:
#
# - Refine Regex
# - Create/Keep track of statistics
from lib.regexes import regexes
from lib.Pastebin import Pastebin, PastebinPaste
from lib.Slexy import Slexy, SlexyPaste
from lib.Pastie im... | true |
ee3d721919e44f023f5a415d174fe25b467237c6 | Python | jacob1299/TwitterRecommendationSystem | /tool/Search_and_Recommend.py | UTF-8 | 5,914 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 20 18:05:42 2021
Search and Recommend Alg
@author: Devan Thomas
"""
from sklearn.feature_extraction.text import TfidfVectorizer
import re
import pandas as pd
import numpy as np
from math import log
from sklearn.metrics.pairwise import euclidean_distances
im... | true |
fc04f93b11684504010116537704c9279869ea38 | Python | jjack94/jj-game | /game_over.py | UTF-8 | 478 | 2.84375 | 3 | [] | no_license | import time
import jjgame
import globalvaribles
import main
#game over screen upon death of player character
def game_over():
yes = ["yes", "y"]
time.sleep(3)
print("YOU DIED")
time.sleep(3)
print("would you like to try again? ")
option = input(">")
if option in yes:
... | true |
0442b4b63f73fd09f17b289b4a72c8643975c8e8 | Python | kantel/nodebox-pyobjc | /examples/Extended Application/matplotlib/examples/event_handling/zoom_window.py | UTF-8 | 2,014 | 3.28125 | 3 | [
"MIT"
] | permissive | """
===========
Zoom Window
===========
This example shows how to connect events in one window, for example, a mouse
press, to another figure window.
If you click on a point in the first window, the z and y limits of the
second will be adjusted so that the center of the zoom in the second
window will be the x,y coord... | true |
e239e96cfb35cd981b59f906fb2f1c4f98d3ae8c | Python | ikanwalkhalsa/Jet | /Game.py | UTF-8 | 3,229 | 3.03125 | 3 | [] | no_license | import pygame
from Jet import Jet
from Background import Background
from Enemy import Enemy
from Bullets import Bullet
import sys
class Main:
def __init__(self):
self.bg = Background()
self.jet = Jet(self.bg)
self.b = Bullet(self.bg,self.jet)
self.Score = 0
... | true |
4a8ef14a676cecf1880a4de8cdcbd5d6b9d96ecc | Python | echoprotocol/test-framework | /networking_tests/framework/echopy_wrapper.py | UTF-8 | 3,666 | 2.5625 | 3 | [
"MIT"
] | permissive | import string
import random
from echopy import Echo
from echopy.echobase.account import PrivateKey
from .node import Node
from .objects import Account, AssetDistribution, EqualDistribution, RandomDistribution, FixedDistribution
from .utils import ASSET_DISTRIBUTION_TYPES, DEFAULT_ASSET_DISTRIBUTION_TYPE,\
DEFAULT... | true |
fcedf491f615be17af398297e369dc9adc9a23da | Python | MarianoCol/um-programacion-i-2020 | /58164-von-Kesselstatt-Philipp/TP1/ejercicio16.py | UTF-8 | 390 | 3.3125 | 3 | [] | no_license | archivo = input("ingrese el nombre del archivo ")
path = __file__.replace("ejercicio16.py", "")
texto = open(path + archivo).read()
nombre = input("ingrese el nombre del vendedor ")
texto = texto[texto.find(nombre):]
lista = texto[:texto.find("\n")].split(", ")
print("nombre:", lista[0], ", monto: $",... | true |
c5f59c350b3bae77fdfdf0e8204c8ff53f14ba38 | Python | dominictarro/Cagen | /generators/bishop/solution.py | UTF-8 | 788 | 3.15625 | 3 | [] | no_license | import time
d={c:i+1 for i,c in enumerate('abcdefgh')}
def solution1(a,b,n):
if n==0:return a==b
x=abs(d[a[0]]-d[b[0]])
y=abs(int(a[1])-int(b[1]))
if n==1:return x==y
return (x+y)%2==0
def solution(a,b,n):
if n==0:return a==b
x=abs(d[a[0]]-d[b[0]])
y=abs(int(a[1])-int(b[1]))
if n==1:return x==y
re... | true |
9e3018f67dbdf88d8fb504b067404a20edb99433 | Python | majorlongval/theLongvalGitRepo | /mike/Day-17-start/quiz-game-start/Data2.py | UTF-8 | 8,326 | 2.84375 | 3 | [] | no_license | question_data2 = [{"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "medium",
"text": "Nintendo started out as a playing card manufacturer.",
"answer": "True", "incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boo... | true |
aae75ae75e7624214d0a3fb8572a24b2f286d009 | Python | andy-wagner/Thesaurus | /arcs-top-250K/converter-r.py | UTF-8 | 1,169 | 3.125 | 3 | [] | no_license | '''reads in p-arcs and converts to longs with bit shifting'''
indices = {}
rels = {}
with open('word-values.txt','r') as f:
count = 0
for line in f:
indices[line.rstrip()] = count
count += 1
with open('p-arcs/relcounts.txt','r') as f:
count = 0
for line in f:
rels[line[:line.find('\t')]] = count
count +=... | true |
0b083058e7d64048546027c40abd372f3e689dfd | Python | LuccaSantos/curso-em-video-python3 | /Desafios/modulo01/def03.py | UTF-8 | 284 | 4.25 | 4 | [] | no_license | '''
Crie um script python que leia dois nรบmeros e tente mostrar
a soma entre eles
'''
fistNumber = int(input('Informe o primeiro nรบmero: '))
secondNumber = int(input('Informe o segundo nรบmero: '))
result = fistNumber + secondNumber
print('A soma vale {}'.format(result))
| true |
9afbec827fdd576f0235ba7e6f543f693dc6f914 | Python | SantoshCode/gui_deploy_text_summarization | /model.py | UTF-8 | 20,905 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import tensorflow as tf
import re
from nltk.corpus import stopwords
from tensorflow.python.layers.core import Dense
from tensorflow.python.ops.rnn_cell_impl import _zero_state_tensors
################################################
reviews = pd.read_csv('/home/sant/projects/gui_... | true |
d4404a05846cca1a1e184bac64337fab70d82cbc | Python | Seshusmart/Session-Code-Python-DS140821 | /W07D05/pdb_working.py | UTF-8 | 644 | 4.03125 | 4 | [] | no_license | # pdb is a inbuilt python debugger.
# What is Debugging ?
# Finding and Fixing the Error.
a = input()
b = input()
breakpoint()
def sum_the_values(a,b):
print('We are inside the function')
print(int(a)+int(b))
sum_the_values(a,b)
# pdb console appears whenever it sees a breakpoint().
# c(continue) => con... | true |
6742cc7a9c1c25df471e727342b63edc6574ea6f | Python | Superbeet/data-structure-and-algorithm | /CC150/Chapter2-2.4.py | UTF-8 | 3,211 | 3.640625 | 4 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: 507061
#
# Created: 26/08/2015
# Copyright: (c) 507061 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
class Sing... | true |
8c9c4c4a72cb824d36c3885a97128fdbbb2fdc54 | Python | devanhoyt/algorithm-design | /TEXTGAME.py | UTF-8 | 15,770 | 3.59375 | 4 | [] | no_license | import time
import random
from random import randint
storytime = random.randint(0, 130)
storytime2 = random.randint(0, 130)
def intro():
print ("Hello....................")
time.sleep(2)
print("Welcome. You are about to engage in the difficult process of decision making. ")
print("Your choices ... | true |
b72e454405173146a42a1c4f1bdd6af02b5c8e41 | Python | BioGeneTools/HL-tutorial | /programTwo.py | UTF-8 | 819 | 3.859375 | 4 | [] | no_license | seqFile = open('expression.txt', 'r')
# Creating two empty Lists "gene and expression"
gene = []
expression = []
# For loop to extract columns from the file and put(append()) them into the Lists(gene, expression)
for line in seqFile:
gene.append(line.split("\t")[0].strip())
expression.append(line.split("\t")[... | true |
ef8fdafa47703af36e2b20e2a82dfca1c17fb42b | Python | freemagma/AI | /ladder/comps.py | UTF-8 | 1,412 | 3.0625 | 3 | [] | no_license | import cProfile
import time
class Holder:
def __init__(self, val):
self.val = val
self.data_s = None
def data(self):
cur = None
if self.data_s: cur = self.data_s
else: cur = self
while isinstance(cur.val, Holder):
cur = cur.val
se... | true |
2d03e412eeea81b86df9cfd269bb6a1533bbdd9a | Python | jhardin4/APE | /Examples/FlexPrinter Monolith/TemplateTPGen.py | UTF-8 | 2,656 | 2.5625 | 3 | [] | no_license | from ToolPathGeneration import ToolPathTools as tpt
def Make_TPGen_Data(material):
TPGen_Data = {}
# Material naming
TPGen_Data['materialname'] = material
# Structure Geometry
TPGen_Data['length'] = 5
TPGen_Data['tiph'] = 0.8 # offset from printing surface
# Computational Geometry Tole... | true |
49fa869b8b1775a1f7f9b1c8a88662df4d636261 | Python | thydungeonsean/Shinar_Genesis | /src/map/scenario_generation/scenario_generator.py | UTF-8 | 2,809 | 2.625 | 3 | [] | no_license | from src.enum.terrain import *
from random import *
from src.game_object.village import Village
from src.game_object.palace import Palace
from src.game_object.granary import Granary
from src.enum.object_codes import *
from map_tools import *
class ScenarioGenerator(object):
def __init__(self, state):
s... | true |
3d0f0d6c1a1ad7a8a5764bbc3ebcb54c56c6e786 | Python | Nick-Chapman/Tetris | /tetris.py | UTF-8 | 11,904 | 2.984375 | 3 | [] | no_license |
from random import randrange
from time import sleep
import pygame
import os
height = 25
width = 10
cell_size = 35
hs_file = os.environ['HOME'] + '/.tetris.high'
def read_hs():
if os.path.isfile(hs_file):
return int(open(hs_file).read())
else:
return 0
def write_hs(n):
open(hs_file,'w').... | true |
a99e6fa9a26a954004007fb9740d04f4d6a420d1 | Python | wrudebusch/Machine-Learning-Practice | /benefits_short.py | UTF-8 | 1,804 | 2.84375 | 3 | [] | no_license | import pandas as pd
from sklearn.feature_extraction import DictVectorizer
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn.preprocessing import StandardScaler
raw = pd.read_csv('benefits_short.csv')
#raw = raw[['StateCode', 'BusinessYear', 'EHBVarReason']].dropna()
data = raw.T.to_dict().va... | true |
da928a35f4ef6d2d85ceec3db50078d5970e838f | Python | sachio222/socketchat_v3 | /lib/xfer/FileXfer.py | UTF-8 | 7,503 | 3.0625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | """A complex process that communicates between SERVER and 2 CLIENTS
Steps to send a file with recipient and confirmation.
1. CLIENT1: Wishes to send file.
/sendfile -> sendfile_process...
2. LOCAL CHANNEL: Asks for file to send.
xfer.sender_prompt() -> bool
3. LOCAL CHANNEL: Asks for recipient.
xfer.user_prompt() -> ... | true |
068aab69fb8209d14342106e9130c9eaa320f8a1 | Python | aravindsrinivasan/YouTube-Virality-Predictor | /models/LSTM/lstm.py | UTF-8 | 4,641 | 2.71875 | 3 | [] | no_license | # LSTM and CNN for sequence classification on Top10
# based on https://github.com/fchollet/keras/blob/master/examples/pretrained_word_embeddings.py
# and https://machinelearningmastery.com/sequence-classification-lstm-recurrent-neural-networks-python-keras/
import numpy as np
import pandas as pd
from sklearn.model_sel... | true |
31bc52e6a0edbd9e1368196fba353358e373ee87 | Python | bmoretz/Python-Playground | /src/Classes/MSDS400/Module 2/m2_discussion.py | UTF-8 | 706 | 3.015625 | 3 | [
"MIT"
] | permissive | import pulp
hedge_model = pulp.LpProblem( "LP Heding Problem", pulp.LpMaximize )
# risk > 0
r = pulp.LpVariable( 'r', lowBound = 1 )
# hedge > 0
h = pulp.LpVariable( 'h', lowBound = 1 )
# P = r + h
hedge_model += r + h, "Objective"
# must be at least 2 units of hedge per 3 units of risk.
hedge_model += 3*r <= 2*r
... | true |
1bc21503922411826c8ea85414fe17360ae0b1ae | Python | deathgrindfreak/ProjectEuler | /prob36.py | UTF-8 | 757 | 3.921875 | 4 | [] | no_license | # Project Euler Problem: 36
# Goal: find the sum of all numbers less than one-million that are palindromic in both decimal and binary bases
# Author: Cooper Bell
n = 1000000
def dig_list(num):
num_list = []
lim = num_length(num)
for n in range(lim):
num_list += [(num%(10**(n+1)) - num%(10**n))/(10**n)... | true |
4feba87fe8603181bdc56f7c7e4637a78baac1e4 | Python | sangmain/Shooting-Stars-in-the-Sky-An-Online-Algorithm-for-Skyline-Queries | /skyline_query.py | UTF-8 | 2,680 | 3.390625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
############################# ๊ฑฐ๋ฆฌํจ์
def euclidean_distance_2d(x, y):
distance = math.sqrt(sum([(a - b) ** 2 for a, b in zip(x, y)]))
return distance
def euclidean_distance(x,y):
n= x**2 + y**2
return math.sqrt(n)
#############... | true |
4e7ba58a3d65fa5e1c9cf15d28967fc0e1e009f9 | Python | lcy2218/python_robot | /python_rob/test_bs4.py | UTF-8 | 666 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : test_bs4.py
@Time : 2021/04/12 22:07:52
@Author : Liu ChaoYang
@Version : 1.0
@Contact : 2218932687@qq.com
'''
# here put the import lib
from bs4 import BeautifulSoup
file = open("./easy.html", "rb")
html = file.read()
bs = BeautifulSoup(htm... | true |
02f9dd7d40129e7b55b1929e1b2c1bfb78aa4284 | Python | amirkhan1092/competitive-coding | /look and say.py | UTF-8 | 690 | 4 | 4 | [] | no_license | '''
Good morning! Here's your coding interview problem for today.
This problem was asked by Epic.
The "look and say" sequence is defined as follows: beginning with the term 1, each subsequent term visually describes the digits appearing in the previous term. The first few terms are as follows:
1
11
21
1211
111221
As... | true |
834de298b3c97f2f2c733234dd0eebc5626b0cc4 | Python | smartinternz02/SPS-9302-Machine-Learning- | /ibm_autoai_flask/app.py | UTF-8 | 2,332 | 2.625 | 3 | [] | no_license |
from flask import Flask, request,render_template
import requests
# NOTE: you must manually set API_KEY below using information retrieved from your IBM Cloud account.
API_KEY = "IyLCilvCI12d6-gDMi0CpHPlCVaDLA4-yHduGnVH8RBz"
token_response = requests.post('https://iam.eu-gb.bluemix.net/identity/token', data={"api... | true |
f90c442bf9872a1d176fd1c6e5de9013d31fc8b1 | Python | melinaverger/ed_project | /src/preprocessing/transformation/activity.py | UTF-8 | 1,602 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Transform activity variables."""
from datetime import datetime
import matplotlib.pyplot as plt
OUTPUT_PATH = "../../results/visualization/"
DATE = datetime.today().strftime('%Y%m%d')
def remove_date_variables(dataset):
for column in dataset.columns:
if... | true |
3d03cc1df5a1c2c75848d39dcea2570de4d3e7ae | Python | okimin/operatingsystemclass | /SampleCode/client.py | UTF-8 | 731 | 3.421875 | 3 | [] | no_license | #! /usr/bin/python3
'''
Client - calls server, opens file, sends server data line by line.
'''
import socket
def connect(host, port):
with open('input.txt', 'rt') as infile:
lines = infile.read().split('\n')
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((... | true |
d31ffe7f60aa85e1391a585d3a24517bcb309436 | Python | duttaANI/genrl | /genrl/classical/bandit/policies/base.py | UTF-8 | 3,382 | 3.21875 | 3 | [
"MIT"
] | permissive | from typing import List
import numpy as np
from genrl.classical.bandit.bandits import Bandit
class BanditPolicy(object):
"""
Base Class for Multi-armed Bandit solving Policy
:param bandit: The Bandit to solve
:param requires_init_run: Indicated if initialisation of quality values is required
:t... | true |
645a33ce3a52a27674a867e91d7c55521fa6dec4 | Python | aparajita89/compiler | /assembly/generator.py | UTF-8 | 266 | 3.078125 | 3 | [
"BSD-2-Clause"
] | permissive | import sys
print 'int main() {'
for i in range(25, -1, -1):
print 'int ' + chr(i+97) + ' = ' + str(i) + ';'
sys.stdout.write('return ')
for i in range(0, 16):
sys.stdout.write('(29 / %s) * (' % chr(i+97))
sys.stdout.write(')' * 16)
print
print '}'
| true |
f4be40401256c9127b1922f4913bcde4c363f1cd | Python | wrightchin/tf_playground | /tf_play4.py | UTF-8 | 1,315 | 2.703125 | 3 | [] | no_license | from sklearn import datasets
from sklearn.model_selection import train_test_split
import tensorflow as tf
import numpy as np
iris = datasets.load_iris()
category=3
dim=4
x_train , x_test , y_train , y_test = train_test_split(iris.data,iris.target,test_size=0.2)
y_train2=tf.keras.utils.to_categorical(y_train, num_cla... | true |
c17f4144b60e733d7c1d1b7275941a1e4ed15af1 | Python | JonisPann/fplatform | /juyou_prototype.py | UTF-8 | 2,324 | 3.015625 | 3 | [] | no_license | import random
from matplotlib import pyplot as plt
simutime = 86400
class Juyou:
tyourijikanmin = 300
tyourijikanmax = 600
ageki_youryou = 20
hotters_youryou = 40
karaagelife = 10800
def __init__(self): #, name):
# self.name = name
self.num_zaiko = 100000
self.ageki = []
self.hotters = []
self.nu... | true |
935ec0fc94757abb0a5f40fd83247911adde01b0 | Python | masato-sso/Spam_Detection | /main.py | UTF-8 | 1,235 | 2.703125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import BernoulliNB
from gensim.models import word2vec
data=pd.read_csv("./data/spam.csv",encoding="latin-1")... | true |
4f63eed695b63c43d71ed808faf4987f39766587 | Python | Mads-J/wave | /py/lib/wavecon/IO/text_files.py | UTF-8 | 1,845 | 3.625 | 4 | [] | no_license | """
Overview
--------
Functions for extracting data from text files.
**Development Status:**
**Last Modified:** December 22, 2010 by Charlie Sharpsteen
"""
#------------------------------------------------------------------------------
# Imports from Python 2.7 standard library
#-----------------------------------... | true |
8d1d9238e6f0d2ae2e585a8a289331cc2a7797cf | Python | balint-daniel/recipes_for_machine_learning | /binaryClassIndiansDiabetes.py | UTF-8 | 9,997 | 3.296875 | 3 | [] | no_license | import warnings
warnings.filterwarnings("ignore")
# Load CSV using Pandas
from pandas import read_csv
filename = 'diabetes.data.csv'
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = read_csv(filename, names=names)
# UNDERSTANDING YOUR DATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | true |
619d3c1ec9ba1bd46f21fb94f861dd01f5e59260 | Python | huazhige/EART119_Lab | /hw2/submission/alvarezalejandra/alvarezalejandra_9951_1275105_HW_2_2.py | UTF-8 | 3,467 | 2.515625 | 3 | [] | no_license |
from __future__ import division
import os
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.basemap import Basemap
# my modules
import seis_utils
#data-time to decimal years
def decyear(YR, MO, DY, HR, MN, SC):
decyear_final = YR + (MO-1)/12 + (DY-1)/365.25+ HR/(365.25*24) + MN/(36... | true |
f90243e79f674a6e71ffc493262483fec80d111e | Python | rerupp/weather | /weather/configuration/weather_config.py | UTF-8 | 11,744 | 2.578125 | 3 | [
"MIT"
] | permissive | from copy import deepcopy
from datetime import datetime
from enum import Enum
from importlib.resources import read_text
from logging import basicConfig, Formatter, getLogger, Logger, LogRecord, StreamHandler, DEBUG, INFO, WARNING
from pathlib import Path
from typing import Callable, Dict, List, Tuple, Union, NamedTuple... | true |
348b76c52118eb84aeddcbbfd4302b4143d91204 | Python | UTMUniverStuff/university_labs | /CDE_Lupan/lab1/code/potentialChart.py | UTF-8 | 648 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def markRegion(x1, x2, color, text):
plt.axvspan(x1, x2, color = color, alpha = 0.2)
plt.text((x1 + x2) / 2.0, 0, text)
rootPath = '../report/imgs/'
x = [0, 1, 1, 3, 6, 7.8, 7.8]
y = [0, -1, 4.9, 1, -1.5, -2.5, 0]
fig, ax = plt.subplots(1)
ax.plot(x, y, 'o-')
p... | true |
58122aca79cd21d958ad300e06a2f319f8ddec18 | Python | aarich/3DLocalization | /Localization/src/GUI/PyViewer/Viewer.py | UTF-8 | 4,352 | 3.046875 | 3 | [] | no_license | # Viewer.py
from graphics import *
from time import sleep
filename = 'ParticleLists.txt'
# filename = 'Perspectives.txt'
def main(last):
win = GraphWin('Points', 570, 570)
while True:
f = open(filename)
particles = []
minx = 200
maxx = 0
miny = 200
maxy = 0... | true |
1e55d008c3e0d4d7529de8ee8e7746dd1469ff0f | Python | Thananjaya/blog_using_django | /blog/forms.py | UTF-8 | 605 | 2.609375 | 3 | [] | no_license | """
Django comes with two base classes to build forms:
Form: allows us to build standard forms
ModelForm: allows us to build forms dynamically along with the model
"""
from django import forms
from .models import Comment
class SharePostForm(forms.Form):
name = forms.CharField(max_length = 25)
email = forms.Ema... | true |
9c8a034e0578081891352a5fa8495e7da5ad33e5 | Python | Smart-Control-System/ServerSystem | /Server/DatabaseConnector.py | UTF-8 | 1,111 | 3.03125 | 3 | [] | no_license | import sqlite3
import time
class Connector:
def __init__(self):
self.db_n_allq = 'db.sqlite'
self.connection = None
self.cursor = None
def write_query(self, query):
query = f'''INSERT INTO "all_queries" (id, query) VALUES ({int(time.time()*10000)}, "{query}")'''
self.... | true |
7f76dc0f6e00a7819271747e3592c35e834c7b1e | Python | 9harshit/AI-Trading-BOT | /live_predict_5min.py | UTF-8 | 7,401 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 27 11:42:36 2020
@author: harshit
"""
# Recurrent Neural Network
# Part 1 - Data Preprocessing
# Importing the libraries
import numpy as np
import pandas as pd
import requests,json
import time
import statistics
import yfinance as yf
with ope... | true |
ee20c32aa31906aea34d5145b1f6d21a27cf1573 | Python | dcasati/Custom-vision-service-iot-edge-raspberry-pi | /modules/ImageClassifierService-BEARS/app/predict-bears.py | UTF-8 | 2,115 | 2.671875 | 3 | [
"MIT"
] | permissive | import requests
from urllib.request import urlopen
# If using a Jupyter notebook, uncomment the following line.
#%matplotlib inline
import matplotlib.pyplot as plt
from PIL import Image
from io import BytesIO
import cv2
import numpy as np
# Sucscription key for Azure cognitive services
subscription_key = "55b5b49fc2cb... | true |
4278f1f1d47eea7d06a576a279e8198d597f2990 | Python | sabaduy/ProjectEuler | /python/0027.py | UTF-8 | 717 | 3.125 | 3 | [] | no_license | from lib.primes import sieve, sieve_until_count
primes_check = sieve_until_count(1000)
primes = sieve(1000)
primes_with_neg = [(-i) for i in primes[::-1]]
primes_with_neg.extend(primes)
# print(primes_with_neg)
best_a = None
best_b = None
best_n = 0
# best_series = []
for a in primes_with_neg:
for b in primes_wit... | true |
099d7f72e39d2f8e6a6bcedcf36d82ffcf87d23e | Python | xudongsun/6.00-Problem-Sets | /problem set/ps2/ps2/untitled5.py | UTF-8 | 1,931 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 27 19:52:09 2016
@author: AUGUSTUS
"""
import random
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word list, this... | true |