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 |
|---|---|---|---|---|---|---|---|---|---|---|
b09394712d4150f34a8371339030d7ade49d20f1 | ymsk-sky/atcoder | /abc287/d.py | UTF-8 | 484 | 3.140625 | 3 | [] | no_license | s = input()
t = input()
n = len(s)
m = len(t)
pre = [0] * (n + 1)
pre[0] = 1
for i in range(m):
if s[i] == "?" or t[i] == "?" or s[i] == t[i]:
pre[i + 1] = 1
else:
break
s = s[::-1]
t = t[::-1]
suf = [0] * (n + 1)
suf[0] = 1
for i in range(m):
if s[i] == "?" or t[i] == "?" or s[i] == t[i]... | true |
0cdb9c1b6ebaea0b5c08fc37002e86fc9f5d4dd9 | chintu0019/DCU-CA146-2021 | /CA146-test/markers/set-union.py/set-union.py | UTF-8 | 296 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
a = []
with open("a.txt") as f:
a += f.read().split()
with open("b.txt") as f:
a += f.read().split()
d = {}
i = 0
while i < len(a):
d[a[i]] = True
i = i + 1
# There is no need to sort the keys; the Einstein marker does that.
#
for key in d:
print(key)
| true |
28bab55133ce21d4cbc9af0cbd38bf4d312e3966 | marcusangeloni/smc2016 | /processing/xm2vts-preprocessing.py | UTF-8 | 3,991 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Marcus de Assis Angeloni <marcus@liv.ic.unicamp.br>
# Thu 7 Apr 2016 21:12:03
import sys
import os
import numpy
import argparse
from datetime import datetime
import preprocess
annotation_extension = "pts"
image_extension = "ppm"
output_extension... | true |
83893430b3ccde91e0ad3f7e7802bd90c58f3f1b | AlrauneZ/Macrodispersivity | /src/05_plot_AL-preasymptotic.py | UTF-8 | 1,362 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 11:50:21 2022
@author: zech0001
"""
import numpy as np
import matplotlib.pyplot as plt
def macrodispersivity_preassymptotic(sigmaY2,Ih,L,ee=1):
be = anisotropy_factor(ee)
alphaL_preasymp = sigmaY2 * Ih * (1. - np.exp(-L/Ih * be)) ... | true |
89343e7a152f4c384bdf119948536c6f493e73ad | Flakebi/masterthesis | /scripts/utils.py | UTF-8 | 6,453 | 2.859375 | 3 | [] | no_license | from math import *
class RunConfig:
def __init__(self, gen=False, use=False, per_wave=False, late=False, uniform=False, analysis=False, remove=False, non_atomic=False):
self.gen = gen
self.use = use
self.per_wave = per_wave
self.late = late
self.uniform = uniform
self.analysis = analysis
self.remove = r... | true |
16b8556f8983e29f67474620fdbf992a8879550e | rado0x54/project-euler | /python/problem0063.py | UTF-8 | 893 | 3.828125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Project Euler - Problem 63 Module"""
def problem63():
"""Problem 63 - Powerful digit counts"""
# Due to the special properties of base "1", we exlude it as a base and count 1^1=1 here
count = 1
exponent = 1
while True:
# base = 10 will always result in len(10^x)... | true |
8fa38c6555a1c0982be0d16c63dd35fff79199dd | zbc1054/Code | /jump7.py | UTF-8 | 166 | 2.984375 | 3 | [] | no_license | number = range(1,101)
for a in number:
if a % 7 == 0:
continue
elif a % 10 == 7:
continue
elif a // 7 == 7:
continue
print(a)
| true |
d4bc0acc065acf85aae23f1f4ef6056ffcb0a816 | Escias/MyTaskBoard_Py | /src/utils/project.py | UTF-8 | 493 | 3 | 3 | [] | no_license | def get_name_project():
req = "SELECT name_project FROM project AS P"
return req
def get_id_project(name):
req = "SELECT id FROM project WHERE name_project = '{name}'".format(name=name)
return req
def create_project():
admin = input("Enter admin's name of project")
name_project = input('Ente... | true |
396c118c1459e14920df8557f5971853693c0518 | eloghin/Python-courses | /PythonZTM/14.RegularExpressions/password-checker.py | UTF-8 | 341 | 3.890625 | 4 | [] | no_license | """
Check password:
- at least 8 char long
- contain anu sort of letters, numbers, $%#@
- has to end with a number
"""
import re
pattern = re.compile(r"[a-zA-Z0-9$%#@]{7,}\d$")
password = input('What\'s your password?')
if pattern.search(password):
print('Good password!')
else:
print('Password does not mee... | true |
ccbcb39ccc949c3f665497c7fc1e0df4eb3396b8 | amanbhal/ImportantQuestions | /EncodeDecodeStrings.py | UTF-8 | 1,701 | 4.1875 | 4 | [] | no_license | """
String encoding-decoding question. Given a digit sequence, return no. of ways it can be decoded.
Mapping : A->1, B->2, Z->26
For ex : Given a string "123", based on the mapping it can be decoded to following ways :-
(1) 1,2,3 -> A,B,C (2) 12,3 -> L,C (3) 1,23 -> A,W
"""
#=> Using Dynamic Programming
# every ... | true |
ee21ff28fcd81ccebbba757f4eb65b079b0514f0 | bethcozz/Code_practice | /ex12b.py | UTF-8 | 386 | 3.640625 | 4 | [] | no_license | y = raw_input("Name? ")
#puts entered name under variable y
#how you ask a question and get an answer
ybdate = raw_input ("What year were you born? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weight? ")
print "So, you're %r, %r years old, %r tall and %r pounds." % (
y, 2017-ybdat... | true |
adae38684266ccbcf65e3853230bac1a6e728918 | ray-abel12/python | /testing.py | UTF-8 | 195 | 3.390625 | 3 | [] | no_license | user_input = input("enter input ")
user_input = int(user_input)
user_input = user_input + 2
user_input = user_input * 3
user_input = user_input - 6
user_input = user_input //3
print(user_input)
| true |
66a19f13c627fa411ad02c24c369260f94226119 | geodesignhub/Sentinel-Evaluations-Generator | /DataHelper.py | UTF-8 | 1,166 | 2.578125 | 3 | [
"MIT"
] | permissive |
import config, requests
from urllib.parse import urlparse
from os.path import splitext, basename
import os
class DataDownloader():
def __init__(self):
self.cwd = os.getcwd()
def download_files(self, urls):
for url in urls:
disassembled = urlparse(url)
filename = basen... | true |
f84eb67bcc68b231da4eeb411d54a26887f2d885 | WinterWolfTaiga/pirate-security | /auxiliary/pentestools.py | UTF-8 | 6,205 | 2.5625 | 3 | [] | no_license | import os, time, urlparse
try:
import fileloader
except:
print '[-] Algumas libs nao foram carregadas...'
time.sleep(1)
exit()
def banner(type='pentools'):
os.system('clear')
if type == 'pentools':
print """
\r /$$$$$$$ /$$$$$$$$ /$$
\r| $$__ $$ ... | true |
a9e294e1da4b161f9347da466b9c42042f8c0848 | xia0nan/Daily-Coding-Problem | /p002.py | UTF-8 | 1,133 | 4.09375 | 4 | [
"MIT"
] | permissive | # Using python 3.6.6
import numpy as np
# Use division
# def skip_prod(input_list):
# total = np.prod(input_list)
# return [total // i for i in input_list]
# print(skip_prod([3, 2, 1]))
# print(skip_prod([1, 2, 3, 4, 5]))
# Solve it without division operator and in O(n).
# Ref. https://www.geeksforgeeks.org/a-pr... | true |
4b1c331bf72cd4bf4824dcb0641c87d80ec3b61b | cpark7/blockchain | /day2/day2_example9.py | UTF-8 | 643 | 3.34375 | 3 | [] | no_license | song = """by the rivers of babylon, there we sat down
yeah we wept, when we remember zion.
when ther wicked carried us away in captivity
required from us a song
now how shall we sing the lord's song in a strange land"""
alpha = dict()
for c in song:
if not c.isalpha():
continue
c = c.lower()
if c n... | true |
65f3a05a3b82cb9c102e6d25c7c519612fc6412b | callaunchpad/Illustrator | /server/tests.py | UTF-8 | 1,074 | 2.609375 | 3 | [] | no_license | from backend import app, socketio
import unittest
import json
class SampleTestCase(unittest.TestCase):
def test_simple_get(self):
tester = app.test_client(self)
response = tester.get('/')
self.assertEqual(response.status_code, 200)
response_json = json.loads(response.data)
print("response data is:... | true |
b6129011439b47ac8c99cbfff6fbd7ca6b2584c1 | Swkings/MOEA | /NSGA/NSGA-II-2/NSGA-II-2.py | UTF-8 | 6,964 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: Swking
@File : NSGA-II-2.py
@Date : 2019/01/01
@Desc :
"""
from pylab import *
import numpy as np
import pandas as pd
from operator import itemgetter
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from Individual import *
from ZDT i... | true |
de62645f9ff9d2c5d3ba8f873a44978836b2893d | lys-063/lys-git | /Vaccination/plot_omega.py | UTF-8 | 1,449 | 2.8125 | 3 | [] | no_license | import matplotlib.pyplot as pyplot
from math import tanh
font = {'family': 'Times New Roman',
'weight': 'normal',
'size': 15,
}
k11 = 0.5
k22 = 0.5
k33 = 0.5
k23 = 0.5
k12 = 0.8
k13 = 0.8
r0 = 3
beta = 10
vcost = 1
icost = 5
x = []
line = []
for i in range(1000):
x.append(i / 1000)
for i in... | true |
118c7aac7b59fa888f9c7ad2dbca2ed7c74f916f | ellisztamas/faps | /faps/read_genotypes.py | UTF-8 | 3,455 | 3.109375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
from faps.convert_genotypes import convert_genotypes
from faps.genotypeArray import genotypeArray
from faps.calculate_geno_probs import calculate_geno_probs
def read_genotypes(path, genotype_col = 1, mothers_col=None, fathers_col=None, mu=1e-12, delimiter=","):
"""
Import a text file contain... | true |
28f9e0a9031561e29ee4fa49f10aa98235e279ba | DragonBanana/rec_sys_challenge_2020 | /BERT/remove_duplicates.py | UTF-8 | 836 | 2.84375 | 3 | [] | no_license |
import pandas as pd
PATH = "tweet_tokens/subsample/val_text_tokens_days_2.csv"
RESULT_PATH = "tweet_tokens/subsample/val_text_tokens_days_2_unique.csv"
TWEET_ID = "tweet_features_tweet_id"
TWEET_TOKENS = "tweet_features_text_tokens"
current_index = 0
def save(df_row):
global current_index
if current_index... | true |
652a6456f3b9f8bc9feb4e3c40a30741e67e243a | adamallaf/nodemcu_py | /i2c.py | UTF-8 | 414 | 2.671875 | 3 | [] | no_license | from machine import Pin, I2C
class I2CBus:
def __init__(self, freq=100000):
self.__i2c = I2C(scl=Pin(5), sda=Pin(4), freq=freq)
def write(self, address, data):
_d = "".join([chr(_byte) for _byte in data])
self.__i2c.writeto(address, _d)
def read(self, address, count):
ret... | true |
7969d73fa3e183c77010de033ff36a81c7c2e906 | gitlxm/pandas_demo | /demo/010.py | UTF-8 | 462 | 2.984375 | 3 | [] | no_license | import pandas as pd
import os
path = os.path.abspath(os.path.join(os.getcwd(), "../demo/data"))
students = pd.read_excel('{}/Student_score.xlsx'.format(path), sheet_name='Students')
scores = pd.read_excel('{}/Student_score.xlsx'.format(path), sheet_name='Scores')
# left join, fillna(0)将NaN用0代替, left_on, right_on
tabl... | true |
e0f1269815c7b4df0395d091bb57d61ced0b024a | DireLines/hobby | /toRoman.py | UTF-8 | 590 | 3.890625 | 4 | [] | no_license | # decimal to Roman numeral converter. works up to 3999, at which point you run out of symbols.
print("number: ")
num = int(input())
roman = ""
suffixes = [
["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"],
["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"],
["", "C", "CC", "CCC", "CD", "D", "... | true |
5ba5efa780c801cd14cec727d0be42e466fb2ef3 | luanLTS/URI-Online-Judge | /Python/1036.py | UTF-8 | 431 | 3.484375 | 3 | [] | no_license | import math
entradas = input().split(" ")
a = float(entradas[0])
b = float(entradas[1])
c = float(entradas[2])
delta = (b**2) - (4*a*c)
if delta == 0 and a > 0:
x1 = (-b + math.sqrt(delta)) / (2*a)
print("R1 = %.5f" %x1)
elif delta > 0 and a > 0:
x1 = (-b + math.sqrt(delta)) / (2*a)
x2 = (-b - math.sq... | true |
0b6ed2c827ba430dbde42c042ca7c6f1151ce98e | felipelobasrocha/scalable_app | /example/application/service/account_service.py | UTF-8 | 2,458 | 2.71875 | 3 | [] | no_license | from example.application.factory.application_factory import ApplicationFactory
from example.domain.events.account_deposit import AccountDeposit
class AccountService:
_account_data_access = None
_customer_data_access = None
_regulation_data_access = None
_app_factory = ApplicationFactory.instance()
... | true |
47467cf43ffdb240d667f47f2dee47516b25f379 | matamkiran/python2020 | /regex/regex_find_specific_words.py | UTF-8 | 208 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 4 08:04:45 2021
@author: Divya
"""
import re
result=re.findall('[aeiouAEIOU]\w+','Python is largest Analytics community of India')
print(result)
| true |
7de60f54d3b5596618001431b45a6a4c42a29e4a | fitrialif/SuperMarket | /src/billing.py | UTF-8 | 4,667 | 2.515625 | 3 | [] | no_license | import sqlite3
import os
import random
from insert_items import insert_items
from view_details import view_items
from view_bills import view_bills
from modify_items import modify_items
D_BASE_URL = "/home/chakri/SQLite/smarket_db.sqlite"
def bill_gui_args(invoice_gui, cust_name_gui):
for x in invoice_gui:
... | true |
9c3bfd934f3ef633c066bdad21f6c73328ca1e1a | mortazavilab/TALON-paper-2020 | /length_analysis/gencode/plot_gencode_length_distribution.py | UTF-8 | 1,330 | 2.796875 | 3 | [
"MIT"
] | permissive | from Bio import SeqIO
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
infile = "../../refs/GENCODE_v29/gencode.v29.transcripts.fa"
dists = []
for record in SeqIO.parse(infile, "fasta"):
dists.append(len(record))
# Plot histogram
fname = "gencode_v29_isoform_length_di... | true |
e6ed0c51aa69d4b70ab64e600d30a829d21d8339 | ajohns5/GCUProjectArchive | /ModelingandSimulation/Project2RungeKutta/AustinJohnsProject2RungeKutta.py | UTF-8 | 1,277 | 4.40625 | 4 | [] | no_license | # Shelby Clow and Austin Johns
# CST-305
# Runge-Kutta method of solving an ODE, computational steps, and computation time
# import required packages for time, math, and plotting
import math
import matplotlib.pyplot as plt
import time
# starts timer for computation time
start_time = time.time()
# finds values for n... | true |
3dde0fd48e61af5f02274bb4f8155fc6efd545ae | kuredatan/nn-pipeline | /code/utils.py | UTF-8 | 5,817 | 2.65625 | 3 | [] | no_license | #coding: utf-8
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from scipy.misc import imresize
from random import sample
import csv
from tqdm import tqdm
import os
ntotal_patients = 61
# wc -l ../data/TrainingSet_20aimVO.csv -1 (header)
nrow = 9446
results = "../results/"
data_path = "../da... | true |
cf3c0092aceec02393d0a8d9d0ea0c901a751a2e | ekocibelli/Fundamentals-of-SE | /p12-ekocibelli.py | UTF-8 | 4,106 | 3.453125 | 3 | [] | no_license | """
Created on Monday, Nov 25 2019
Author: Ejona Kocibelli
Project Description: Using Web API's and JSON
"""
import json
import urllib.error
import urllib.parse
import urllib.request
from math import pi, sin, cos, sqrt, asin
import sys
def lookup_address(street_name, city_name, state_name, zip_code):
... | true |
607d39163866301adc0c38d082fc57cf857ca7b8 | Kyuuhachi/Dotfiles-legacy | /pylib/pp/util.py | UTF-8 | 623 | 3.390625 | 3 | [] | no_license | class dfsqueue:
def __init__(self, init=()):
self.stack = list(init)
self.top = None
def append(self, *item):
self.stack.extend(item)
def extend(self, items):
self.stack.extend(items)
def __iter__(self):
assert self.top is None, "Multiple concurrent iterations not supported"
s = self.stack
self.top... | true |
6efcdee2a0b78617ccf6ee0753dd0e870ac7748e | AudreyHyeans/POC | /python_prepa/.ipynb_checkpoints/TP_méthode_des_rectangles_er_des_trapèzes-checkpoint.py | UTF-8 | 422 | 3.390625 | 3 | [] | no_license | def MethodeRectangles(a,b,f,n):
S=0
h=(b-a)/n
for i in range (0,n):
S=S+h*f(a+i*h)
return S
def MethodeTrapezes(a,b,f,n):
S=0
h=(b-a)/(n)
for i in range (0,n):
S=S+(h*(f(a+i*h)+f(a+(i+1)*h)))/2
return(S)
def F(x):
y=4/(1+x**2)
return (y)
... | true |
8e299a76c16c8cfc2c2e8fe2ba44d12567316489 | Kexin-Wei/DeepReinforcementLearning | /DuelingDQN/test_per.py | UTF-8 | 3,032 | 2.9375 | 3 | [] | no_license | # test for priority replay buffer
#%%
import numpy as np
from collections import deque
class PReplay:
# priorited replay buffer
def __init__(self, MEMORY_SIZE = 5000, \
ALPHA = 0.5, \
BETA = 0.5, \
BASE = 0.1, \
BATCH... | true |
6211d9f966b218464956239b608d502bdd730a2c | undarmaa/dml4rec | /tests/test_testcase_generator.py | UTF-8 | 3,026 | 2.609375 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from rec.dataset.dataset import Dataset
from rec.dataset.testcase_generator import LeftNEventsTestCaseGenerator, SubsequentEventTestCaseGenerator, \
AllViewedItemsTestCaseGenerator
from rec.model import Session
class TestIdentityTestCaseGenerator(TestCase):
@classmethod
def ... | true |
f208b0c06af1402dd6fced1fc0b91cdb16e35a8c | Tonyloyt/Recommender | /02.Matrix_Factorization/01.MF_basic2.py | UTF-8 | 5,080 | 3.234375 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import pickle
dir = '../'
# Load the data
with open(dir + 'data/user_to_movie.json', 'rb') as f:
user_to_movie = pickle.load(f)
with open(dir + 'data/movie_to_user.json', 'rb') as f:
movie_to_user = pickle.load(f)
with open(dir + 'data/um_to_rating_tr.json', 'rb') as... | true |
01146dc75b0fba283122915b94a50878e1e4fd93 | sgpandey05/Digikull_Assignments | /Python_3/script_3/rectangle.py | UTF-8 | 622 | 4.6875 | 5 | [
"MIT"
] | permissive | """
Part 1: Define a class named Rectangle which can be constructed by a length and width.
The Rectangle class has a method which can compute the area.
Expected Input/Output 1:
Enter length of rectangle: 2
Enter breadth of rectangle: 2
Area of rectangle: 4
Expected Input/Output 2:
"""
import math
class Rectangle... | true |
abc3d5b13a95da7066455813e68882194e7f806e | anonamousemapper/genderratiomap | /scripts/ipum_csv_to_simplified_puma_csv.py | UTF-8 | 4,701 | 2.8125 | 3 | [
"MIT"
] | permissive | '''
From mapsite dir:
python -m scripts/ipum_csv_to_simplified_puma_csv \
demographic_data/ipums_by_puma_county_and_state_acs_2014/usa_00007.csv \
temp_data/simplified_puma_data.csv
'''
import csv
import sys
from app.constants import *
from datetime import date
if len(sys.argv) != 3:
print('python -m ipum_cs... | true |
295eba2fabbe57d94c38c23c0614a9d04885b108 | WUT-ML/privacy | /src/generative_siamese/CelebAUtils.py | UTF-8 | 1,734 | 2.96875 | 3 | [] | no_license | # coding=utf-8
"""Utility methods used for loading and evaluating the CelebA dataset."""
import os
from zipfile import ZipFile
import gdown
def download_dataset(path):
"""Download and unzips the CelebA dataset to the specified path."""
print("downloading the CelebA dataset...")
gdown.download(
"ht... | true |
cd3c099796d594d4da37654efc9883428161e98f | adamgreig/strictdoc | /tests/unit/helpers/test_string.py | UTF-8 | 602 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | from strictdoc.helpers.string import multireplace
def test_multireplace_01():
input_string = "hey abc"
replacements = {"ab": "AB", "abc": "ABC"}
result = multireplace(input_string, replacements)
assert result == "hey ABC"
input_string = "REQ1, REQ12"
replacements = {"REQ1": "!REQ1", "REQ12": ... | true |
8767d4f46c5dffee2b0ea83fdffc4b0fca603a94 | Insookim0702/python_Algorithm | /책/문제/자물쇠와 열쇠2.py | UTF-8 | 1,136 | 3 | 3 | [] | no_license | # 17:20 ~
def solution(key, lock):
n = len(lock)
m = len(key)
new_lock = [[0] * n * 3 for _ in range(n * 3)]
for i in range(n):
for j in range(n):
new_lock[i + n][j + n] = lock[i][j]
for _ in range(4):
key = rotate_90_degree_2matrix(key)
for x in range(n * 2):
... | true |
4115f3fbdb76f7dbca511457a463b06f96e05b1f | ProHiryu/Propheta | /Data_Retreiving/selenium/test.py | UTF-8 | 329 | 2.78125 | 3 | [] | no_license | import bs4 as bs
import urllib.request
url = 'http://lishi.tianqi.com/shantou/201101.html'
source = urllib.request.urlopen(url)
soup = bs.BeautifulSoup(source,'html.parser')
uls = soup.find_all('ul')
for ul in uls:
lis = ul.find_all('li')
if len(lis[0].text) == 10:
for li in lis:
print(... | true |
b1b7d1c949357647cbb89056f2cb18ec3e3b31ac | google-research/uda | /text/utils/imdb_format.py | UTF-8 | 3,417 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
# Copyright 2019 The Google UDA Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | true |
54b5ddd5739d60a173a2df7f4e73d85558315ff3 | roodrallec/MAI-machine-learning | /ex3-KNN/Parser.py | UTF-8 | 3,172 | 3.21875 | 3 | [] | no_license | # coding=utf-8
"""
Improve the parser developed in previous works in order to use the class attribute, too.
"""
import numpy as np
from scipy.io import arff
from collections import Counter
def read_dataset(fileroute, classfield='class', emptyNomField='?'):
""" Loads dataset information from file, computes val... | true |
8fdb8bc8be061b9385a6ba0abd4f51b033a115fe | timoruokonen/latrappe | /latrappe/npcstrategy.py | UTF-8 | 4,235 | 2.59375 | 3 | [] | no_license | from resource import *
from action import *
from occupation import *
class NpcStrategySimpleGreedy(object):
MINIMUM_FOOD = 2
MAXIMUM_FOOD = 5
def __init__(self, npc):
self.npc = npc
def to_string(self):
return str(self.npc.occupation)
def create_schedule(self):
to_buy = [... | true |
c03e811029560787676f436f14545ab802cf723d | leokhachatorians/algorithms | /chapter_1/1.3/file_lister.py | UTF-8 | 714 | 3.75 | 4 | [] | no_license | import os
import sys
class Checker():
"""
Exercise 1.3.43
- Didn't feel like dealing with having user input
specific folder to search. Just does it in the
calling directory.
"""
def __init__(self):
self.folders = []
def start(self):
for f in os.listdir('.'):
... | true |
c89768e162fb7ce02c7121b721a5a84bba269a7e | ML-KULeuven/socceraction | /socceraction/atomic/vaep/base.py | UTF-8 | 2,280 | 2.640625 | 3 | [
"MIT"
] | permissive | """Implements the Atomic-VAEP framework.
Attributes
----------
xfns_default : list(callable)
The default VAEP features.
"""
from typing import List, Optional
import socceraction.atomic.spadl as spadlcfg
from socceraction.vaep.base import VAEP
from . import features as fs
from . import formula as vaep
from . imp... | true |
3c8f5be8d827aa1f906b0d5f35a9351d82dd585a | mackenziekira/interview_cake | /completed/queue_two_stacks.py | UTF-8 | 948 | 3.640625 | 4 | [] | no_license | class Stack(object):
"""a stack class"""
def __init__(self):
self.stack = []
def __repr__(self):
return str(self.stack)
def push(self, num):
self.stack.append(num)
def pop(self):
return self.stack.pop()
class Queue(object):
"""implement a queue using two stack... | true |
f80fc9ad8ba1d7c4bbdb44b8362a67127c6077c5 | ekush/recipes | /test.py | UTF-8 | 160 | 2.671875 | 3 | [] | no_license | """
URL: https://www.codechef.com/problems/TEST
"""
while True:
_input = int(input())
if _input != 42:
print(_input)
else:
break
| true |
4dc40ea5fc4f91fdf18b31c87f2b1a2565daf714 | Sudarshan-Patil/Python | /Assignment6/Assignment6_1.py | UTF-8 | 366 | 3.6875 | 4 | [] | no_license | class Demo:
value=10
def __init__(self, no1, no2):
self.num1 = no1
self.num2 = no2
def fun(self):
print("First instance variable is ", self.num1)
def gun(self):
print("Second instance variable is ", self.num2)
def main():
obj1 = Demo(11,21)
obj2 = Demo(51,101)
obj1.fun()
obj2.fun()
obj1.gun()
ob... | true |
8c9348732524366cb4f2d0d583aa135b54061dab | broepke/GTx | /part_3/4.5.5_answer_key_dictionary.py | UTF-8 | 1,814 | 4.375 | 4 | [] | no_license | # -----------------------------------------------------------
# Recall in an earlier problem you were given two lists: one
# list was a student's answers to a test, and the other was
# the answer key. Your goal was to return a score
# representing the number of problems the student got correct.
#
# Let's do that again,... | true |
709f24c9fe515fbe839b98bbbd35ab2d34b78e3b | xxggsh/CAFA | /pintraces/time_my.py | UTF-8 | 978 | 2.75 | 3 | [] | no_license | import sys
def main(argv):
print len(argv)
f1=open(argv[1],'r')
#f2=open(argv[2],'w')
result = list()
line1=''
my_min = 0
result1= list()
for line in f1.readlines():
result.append(line)
for my_min in range(0,60):
for line in result:
if(line.find('min,... | true |
4292a2f36577257395c0e85e60051d7ca1816d22 | anubhav70747/NPAHierarchy | /LRvsCHSHTwoAlicesOneBob.py | UTF-8 | 1,686 | 2.796875 | 3 | [] | no_license | from __future__ import print_function
from ncpol2sdpa import *
import pickle
# for evaluating local randomness with contraints on CHSH values corresponding to two Alices and Bob
def chsh_AB(P):
chsh=0
for x in range(2):
for y in range(2):
for u in range(2):
for v in range(2):
if x * y =... | true |
a2ed89f5d78997ab0e3e1101f2eeaf32e94425f7 | tahabroachwala/lists | /LargestElementFinder.py | UTF-8 | 100 | 3.1875 | 3 | [] | no_license | list = [12, 45, 60, 32, 13, 50]
print(max(list))
list2 = ["Hello", "WhatDoYouDo"]
print(max(list2))
| true |
d3cfda16ae3163d0f7b46a18c649d51ce3d79ff4 | mwduncan2018/Python_Pytest-BDD_Selenium | /safeflightautomationframework/page_objects/login_page/login_page.py | UTF-8 | 2,930 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
"""Page-object model for the Login Page.
"""
import sys
from ...driver import Driver
from ..abstract_page.abstract_page import AbstractPage
from selenium.webdriver.common.by import By
from .login_command import LoginCommand
class LoginPage(AbstractPage):
"""Page-Object Model for the Login P... | true |
87a0d00e819918ae43aa2bfad282ddde61565d51 | raaedkabir/Socket.IO-Demo | /Backend/app.py | UTF-8 | 936 | 2.65625 | 3 | [] | no_license | import socketio
import base64
from datetime import datetime
from logger import log
# create Socket.IO server and wrap into a WSGI application
sio = socketio.Server()
sio = socketio.Server(cors_allowed_origins="*")
app = socketio.WSGIApp(sio)
print(f"{log('[STATUS]', 'blue')} Server Started")
# enocde image to Base6... | true |
3d716becfa6ce58a37179114fc0efe2bbc2d366a | kiranbanger/project_euler | /project54/PE54_poker_hands.py | UTF-8 | 7,546 | 3.578125 | 4 | [] | no_license | def compare_hands(h1,h2):
suits1, values1 = disect_hand(h1)
hand_analysis1 = check_hand(suits1, values1)
suits2, values2 = disect_hand(h2)
hand_analysis2 = check_hand(suits2, values2)
# get max value from arrays, excluding last value, which is the array of high cards
if len(hand_analys... | true |
046a6b9a458faf32bfc97a4e30863aa9504fbcdb | CppChan/Leetcode | /medium/mediumCode/BinaryTree/BTLongestConsecutivePath.py | UTF-8 | 515 | 3.015625 | 3 | [] | no_license | class Solution(object):
def longestConsecutive(self, root):
if not root: return 0
res = [0]
self.findpath(root, res)
return res[0]
def findpath(self, root, res):
if not root: return 0
left = self.findpath(root.left, res)
right = self.findpath(root.right, res)
templong = 1
if root.left an... | true |
4e2655d651bd25b4e6c7c845dce0b263e4142459 | SunicYosen/spider | /company-qa/get_shen_qas.py | UTF-8 | 1,649 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Main
"""
import time
from datetime import datetime
from qa.shenqas import ShenQA
from excel import Excel
from openpyxl.styles import Font
def get_shen_qas():
base_url = "http://irm.cninfo.com.cn/"
lmt_date = datetime.strptime("2020-09-01", "%Y-%m-%d")
key_words = ['华为', '断供']
save_file = "res... | true |
e34079a896b2fa7ac931d37a49130418c4c5bfce | Jromary/Python_Exemple | /test_thread.py | UTF-8 | 435 | 3.140625 | 3 | [] | no_license | import threading
import time
import random
class thread(threading.Thread):
def __init__(self,counter,nom):
threading.Thread.__init__(self)
self.c = counter
self.id = nom
def run(self):
while self.c < 10:
time.sleep(random.randint(0,2))
print(self.c, end="... | true |
475cc0368b7a915667b1511a7804a42e9c6d9488 | mementum/codeeval | /03-hard/0234-code-like-huffman/0234-code-like-huffman-single.py | UTF-8 | 1,985 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015, 2016 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | true |
d244ed7e04977c155e6b3a4a6038f2f63e9bee9d | guodao/jobforcast | /script/merge_by_col.py | UTF-8 | 667 | 2.8125 | 3 | [] | no_license | from version import *
def merge(f1path,f2path,col1,col2,outpath):
f1=open(f1path)
f2=open(f2path)
fout=open(outpath,"w")
f1lines=f1.readlines()
f2lines=f2.readlines()
fout.write(f1lines[0])
for i in xrange(1,len(f1lines)):
f1fields=f1lines[i][:-1].split(",")
f2fields=f2li... | true |
886aebaac31812dd390fa1a6634f90da27687e94 | Constantine19/leetcode | /989-Add-to-Array-Form-of-Integer.py | UTF-8 | 193 | 2.9375 | 3 | [] | no_license | def addToArrayForm(A, K):
a = ""
for i in A:
a += str(i)
my_list = map(int, list(str(int(a) + K)))
return my_list
A = [1, 2, 0, 0]
K = 34
print addToArrayForm(A, K)
| true |
b2d38452d1c16b1a2578d7c97b615d313c36c6c2 | rafaelperazzo/programacao-web | /moodledata/vpl_data/126/usersdata/231/32698/submittedfiles/ap2.py | UTF-8 | 534 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
x1=float(input('digite x1:'))
x2=float(input('digite x2:'))
x3=float(input('digite x3:'))
x4=float(input('digite x4:'))
if x1>x2 and x1>x3 and x1>x4:
print('%.f'%x1)
elif x2>x1 and x2>x3 and x2>x4:
print('%.f'%x2)
elif x3>x1 and x3>x2 and x3>x4:
print('%.f'%x3)
elif x4>x1 and x4>x2 a... | true |
727b3e86f103d805c2eb0b162b8fe63e0151ded0 | OldDon/this_time_its_serious | /sandbox_01.py | UTF-8 | 576 | 3.8125 | 4 | [] | no_license | """
Test file. Acts like a sandbox. Get ideas out of the head and in to a file.
"""
import random
polarity_check = True
while polarity_check:
lsl = int(input('What is the lower number you want to use in your range?' + '\n'))
usl = int(input('What is the upper number you want to use in your range?' + '\n'))
... | true |
a84de806b1ca25ea482b81323aa745754b3a90ff | bineetranjan1516/fantastic-system | /Stack/BalanceParatheses_Stack.py | UTF-8 | 735 | 3.5 | 4 | [] | no_license | from Stack import StackImplementation
def checkbalance(string):
s = StackImplementation.stack()
xlist = list(string)
print(xlist)
for x in range(len(xlist)):
if xlist[x] in '([{':
s.push(xlist[x])
# print(match_symbol(xlist[x], s.peek()))
elif s.size()==0:
... | true |
053cb06064b4a16164b4b95a70e85658ad67c5f3 | etibger/pdf2xlsx | /pdf2xlsx/logger.py | UTF-8 | 937 | 3.34375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Statistics collector helper class for pdf2xlsx
"""
class StatLogger():
"""
Collect statistic about the zip to xlsx process. Assembles a list containin invoice
number of items. Every item is the number of entries found during the invoice parsing.
It implements a simple API: ne... | true |
0cdb51ed47f5c700d354cb896f56b94e6f87f2d9 | agoose77/hivesystem | /hiveguilib/HUtil/Attribute.py | UTF-8 | 1,452 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | from __future__ import print_function, absolute_import
class Hook(object):
def __init__(self,
shape,
style,
color=(255, 255, 255),
tooltip=None,
hover_text=None,
order_dependent=False,
visible=Tr... | true |
ef9527e366b40745a23e6892ab3d4cc8c9d81334 | Mabs20/my-first-python-programs | /madlib.py | UTF-8 | 245 | 3.4375 | 3 | [] | no_license | noun1 = input (" Tell me a noun ")
noun2 = input (" Tell me another noun ")
verb1 = input (" Now, tell me a verb ")
verb2 = input (" Another verb ")
adjective1 = input (" Now, an adjective ")
place = input (" Think of a place ")
print("
| true |
38b5afb2e8ec735672c204fb37dcc315c516f6ba | hzwnhzq/face_mask_detection_um | /main.py | UTF-8 | 2,518 | 2.609375 | 3 | [] | no_license | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import cv2
import os
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models i... | true |
4f9465b064f61f9055583610250924d57706c063 | ibhargav7/amfoss-tasks | /task 13/2.py | UTF-8 | 178 | 2.84375 | 3 | [] | no_license | x=int(input())
for l in range (x):
k=int(input())
s=0
p=2
q=0
m=0
while m<k:
s+=p
m=4*p+q
q=p
p=m
print(s)
| true |
ae5e11099230ba5bdd3f8cb3d5a0ccf25959a593 | pkc-3/python | /Ch08/8_3_Excel.py | UTF-8 | 579 | 3.34375 | 3 | [] | no_license | """
날짜:2021/05/03
이름:고현석
내용:파이썬 외부패키지 설치 교재 p239
pip install openpyxl 엑셀열기가능하게
"""
from openpyxl import Workbook
#엑셀파일 쓰기
workbook = Workbook()
# 활성화된 sheet 선택
sheet = workbook.active
# 데이터 입력
sheet['A1'] = '홍길동'
sheet.append([1,2,3])
sheet.append(['김유신','김춘추','장보고'])
sheet.cell(6,2,'사과') #6행 2열에 사과 단어 넣기
# 엑셀파일 ... | true |
c911387db440e45b3750f7d9f7297ae008767929 | KKsharma99/energy_watch | /code/unused/artificial_generator.py | UTF-8 | 7,657 | 2.796875 | 3 | [] | no_license | # Draw Fingerprint
def fingerprint_draw_r(bldg, r, save=False, show=False, df=df):
theta = []
for i in range(0, len(r)):
theta.append((i%96)/96 * 2 * np.pi)
r = r.append(pd.Series(r.values[0]))
theta.append(0)
fig = plt.figure()
ax = plt.subplot(111, projection='polar', facecolor='white'... | true |
1586784ec0f413e458cd2c7aad0e353f924da259 | Anisha7/HackerRank | /interview-prep/warm-up/sockMerchant.py | UTF-8 | 834 | 2.875 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the sockMerchant function below.
def sockMerchant(n, ar):
pairs = 0
#checked = False
i = 0
while (i < len(ar)):
word = ar.pop(i)
if (len(ar) < 30):
print(ar)
print(i)
fou... | true |
c1a99022b6f5c2d23d52f756434b42782a40d7a1 | SportsUnity/facebook_bot | /cards.py | UTF-8 | 11,614 | 2.9375 | 3 | [] | no_license | import config
import requests
from PIL import Image, ImageDraw
import numpy
from time import time, ctime
from datetime import datetime, timedelta
from traceback import print_exc
import json
from urllib2 import quote
from StringIO import StringIO
import os
class SportsCards:
def __init__(self, server=""):
self.s... | true |
acce681a873fab06b8cfea2ee6ecb6e8e3224e60 | majoranaa/reinforcement | /acrobot/acrobot.py | UTF-8 | 2,068 | 2.59375 | 3 | [] | no_license | import pyglet
#from pyglet.window import key
#from pyglet.window import mouse
import numpy as np
# pyglet setup
window = pyglet.window.Window(800,600)
main_batch = pyglet.graphics.Batch()
# physical variables
omega1 = 0.0
omega2 = 0.0
length1 = 100 # pixels. also 1 meter => I = 1
length2 = 100
tau = 0
d1 = d2 = phi2... | true |
3a7f5a899c47b9a3b53a17f465e0fce99b8da913 | johnsonkee/swordToOffer | /chapter6/title46_ReverseSentence.py | UTF-8 | 1,261 | 4.34375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 方法 1
# 思路:首先将所给字符串转化为列表,对此列表进行逆序排序,之后再将列表中的元素进行拼接
class Solution:
def ReverseSentence(self, s):
# write code here
if not s:
return ''
s = s.split(' ')
s = s[::-1]
return ' '.join(s)
# 方法 2
# -*- coding:utf-8 -*-
# 思路: 类似于title45 方法2
clas... | true |
abb84117b095c74a28059e33890f05b0a897f131 | poushen/iot_hand_on | /lesson_06/bme280_test.py | UTF-8 | 451 | 2.890625 | 3 | [] | no_license | '''
Driver from : https://github.com/catdog2/mpy_bme280_esp8266
Notes: download bme280.py first, then upload to D1 Mini board
'''
from machine import I2C, Pin
import bme280
i2c = I2C(scl=Pin(5), sda=Pin(4))
bme = bme280.BME280(i2c=i2c)
print(bme.values)
print(bme.read_compensated_data())
print('Temperature: {:.2f}{}... | true |
efefe0b1847e128ddbbe6900428eb635ae6bf7b6 | HCILabOnlineCommunities/Graphlet_Measures | /Community_Entropy.py | UTF-8 | 14,176 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 23 11:45:46 2017
@author: Ryan Compton
"""
import nltk
from nltk import word_tokenize
from nltk import sent_tokenize
from nltk.util import ngrams
from collections import Counter
import numpy as np
import os
import datetime
import pickle
import string
from nltk.corpus imp... | true |
9a0dc3a6736fe4139f6658b6dde626a9c6bc9bff | djstull/COMS127 | /lab1/coinage.py | UTF-8 | 389 | 3.78125 | 4 | [] | no_license | #Write a program to calculate the coinage needed for a given amount of change.
amount = int(input('Please input the amount of cents: '))
quarters = amount // 25
amount = amount % 25
dimes = amount // 10
amount = amount % 10
nickels = amount // 5
pennies = amount % 5
print(' ')
print(quarters, "quarters\n")
print(dime... | true |
845f4d41c8542a68c78d0ec87f81254ddabdbb09 | timothypraditia/lstm_swl | /pre-processed/15-3M/m03_pre_process.py | UTF-8 | 9,616 | 3.140625 | 3 | [] | no_license | """
M03_PRE_PROCESS.PY
This script contains classes necessary for the data initialization, pre-
processing, and setup of dataloader
"""
import pandas as pd
import torch
import copy
from torch.utils.data import Dataset
class Initialize_Data:
"""
This class initialize data loading from the .csv file and pre-pro... | true |
17b2c4d746b44edb7e9367a509ded448c9b2728c | Sherydan/Python-Basic-Exercises | /string_lists.py | UTF-8 | 167 | 3.828125 | 4 | [] | no_license | word = input('Give me a word: ')
word_list = list(word)
word_list.reverse()
str1 = ''.join(word_list)
if str1 == word:
print(f'your word {word} is a palindrome') | true |
61f32b63a21b0ba53710ac92a44e5311597be59e | HelenaCarlArne/ProtokolleFP | /Tabellenmakro/table.py | UTF-8 | 4,843 | 2.546875 | 3 | [] | no_license | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import uncertainties.unumpy as unp
from uncertainties import ufloat
import sympy
from uncertainties import correlated_values, correlation_matrix
import scipy.integrate as int
from uncertainties.unumpy import... | true |
4ce831800367b889af3533706341c2aa0dfb9367 | Zhumatai-prog/Chapter-4-Task-3 | /task3.py | UTF-8 | 587 | 4.0625 | 4 | [] | no_license | class Car:
def __init__(self, mark, model, year):
self.mark = mark
self.model = model
self.year = year
self.odometer = 0
self.fuel = 70
def drive(self, km):
self.km = km
self.add_distance(km)
self.subtract_fuel(km)
if self.fuel > 0:
return f"{self.mark}--{self.model}--{self.year}. Let's driv... | true |
e24d1dde16326fc4426c944d1340149192b094f2 | CCI-Tools/cate | /tests/core/test_cdm.py | UTF-8 | 1,639 | 2.875 | 3 | [
"MIT"
] | permissive | import json
from unittest import TestCase
from cate.core.cdm import Schema
class SchemaTest(TestCase):
@staticmethod
def _test_schema() -> Schema:
return Schema('test',
dimensions=[Schema.Dimension('lon', length=720),
Schema.Dimension('lat', len... | true |
76b6522f70fa7ed9ca38b3e8bcd0ea3cbc25cc04 | jssellars/aniket_filed | /FacebookPixels/Infrastructure/Tools/Misc.py | UTF-8 | 1,337 | 2.609375 | 3 | [] | no_license | import itertools
import operator
import typing
from FacebookPixels.Infrastructure.Domain.FlatPixelStatsModel import FlatPixelStatsModel, PixelStatsRow
from FacebookPixels.Infrastructure.GraphAPIDtos.GraphAPIPixelStatsDto import GraphAPIPixelStatsDto
def flatten_pixel_stats(pixel_stats: typing.List[GraphAPIPixelStats... | true |
135a327964ba2470fc24b790ffea376e6e6598d8 | sybila/controlPlayground | /control/controllers/PID.py | UTF-8 | 935 | 3.046875 | 3 | [] | no_license | import time
class PID:
def __init__(self, P=0.2, I=0.0, D=0.0):
self.kP = P
self.kI = I
self.kD = D
self.prev_observed_value = 0
self.prev_ie = 0
self.prev_time = 0
def update(self, observed_value, set_point, time):
# print(observed_value, set_point, ti... | true |
ef876972f58ab3c4548b084dc5091e93eaeaa8d0 | code1990/bootPython | /python/05Numpy/NumPy013.py | UTF-8 | 9,210 | 4.4375 | 4 | [] | no_license | # Numpy 数组操作
# Numpy 中包含了一些函数用于处理数组,大概可分为以下几类:
#
# 修改数组形状
# reshape 不改变数据的条件下修改形状
# flat 数组元素迭代器
# flatten 返回一份数组拷贝,对拷贝所做的修改不会影响原始数组
# ravel 返回展开数组
# 翻转数组
# transpose 对换数组的维度
# ndarray.T 和 self.transpose() 相同
# rollaxis 向后滚动指定的轴
# swapaxes 对换数组的两个轴
# 修改数组维度
# broadcast 产生模仿广播的对象
# broadcast_to 将数组广播到新形状
... | true |
c838f7bcdfdf19a0ded99914cf8da6ba4aaf893b | mhhuang95/LeetCode | /python/leetcode049.py | UTF-8 | 630 | 3.5 | 4 | [] | no_license | class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
strs.sort()
hash = {}
for s in strs:
key = self.get_keys(s)
try:
hash[key].append(s)
except:
... | true |
8e9a930ab400580af25076e81a7d85a590ccb5bf | ZNHU-Old/Deep-Learning-with-TensorFlow-book-master | /ch07/BP-NN.py | UTF-8 | 7,029 | 2.96875 | 3 | [] | no_license | # encoding: utf-8
import tensorflow as tf
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.datasets import make_moons
# from sklearn.datasets import make_circles
from sklearn.model_selection import train_test_split
N_SAMPLES = 2000 # 采样点数
TEST_SIZE = 0.3 # 测试数量比率
# 产生一个简单的样本数... | true |
65b8cb9bfd901149c189fa3db6b93f2185bc0364 | Jasonpandiandpm/Logic-Building-Python3.6-and-higher | /Beginner Level/char_to_ascii.py | UTF-8 | 292 | 4.5625 | 5 | [] | no_license | '''
3.How to print ASCII values of any character
'''
user_input = input("Enter any character is get its ANCII value: ")
print(f"The ASCII value of the character {user_input} is {ord(user_input)}.")
print(f"The character of the ASCII value {ord(user_input)} is {chr(ord(user_input))}.") | true |
69043ea5320709b9dba6a5619b24a327e0ded1ed | hooshmandshr/DeepNetworks | /src/generative/latent_dynamics.py | UTF-8 | 8,924 | 2.921875 | 3 | [] | no_license |
import numpy as np
import tensorflow as tf
from normalizing_flow import PlanarFlow
from variational import MultiLayerPerceptron
class Transform(object):
def __init__(self, in_dim, out_dim, initial_value=None):
pass
def operator(self, x):
"""Gives the tensorflow operation for transforming a... | true |
222afcb1224ed784cb970f7730cac058de4b7e29 | SergV77/algorithms | /nod.py | UTF-8 | 541 | 4.15625 | 4 | [] | no_license | #Находим наибольший общий делитель a и b
def nod(a, b):
while b != 0:
# Вычисляем остаток
remainder = a % b
a, b = b, remainder
return a
a = int(input("Введите первое число: "))
b = int(input("Введите второе число: "))
NOD = nod(a, b)
print("НОД: ")
print(NOD)
arr1 = [1, 2, 3, 4, 5]
... | true |
a83cea3fe9d1fe67f464ac6ed34d41e2af6cff49 | firefloris/NHM-Classifier-and-Text-Remover | /0_download_images.py | UTF-8 | 2,576 | 2.640625 | 3 | [] | no_license | """Originally made by dr. G. Spigler Tilburg Univeristy"""
import sys, os, multiprocessing, csv
import tqdm
from urllib import request, error
from PIL import Image
from io import BytesIO
os.chdir('c:/Users/flori/OneDrive/Documents/Uni/8_Master_thesis/code')
out_dir = 'c:/Users/flori/download'
if not os.path.exists(o... | true |
4428b46563a0885061662db3bab73c0057b05c94 | Rrrapture/python-the-hard-way | /ex/ex20.py | UTF-8 | 3,772 | 4.0625 | 4 | [] | no_license | # Learn Python the Hard Way, exercise 20
# https://learnpythonthehardway.org/book/ex20.html
#imports the argv parameter from the sys module which the
#interpreter uses
#fyi a module is a file consisting of Python code.
#a module can define functions (def), classes, and
#variables
#a module is a Python object that conta... | true |
11a05158e61e33681fd59fe464b814935f70cc0a | elsaburren/claims-dashboard | /app.py | UTF-8 | 16,849 | 2.734375 | 3 | [
"MIT"
] | permissive | # python 37
# elsa@promasta.com
import pandas as pd
import openpyxl
import plotly.express as px
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import math, os, re
from scipy.stats import pareto, lognorm, gamma, binom, poisson, n... | true |
14cc8ceb7e4b901c2bac30aff64a96a92a116dfe | michaelberge8/multilayer-perceptron-1-hidden-layer | /graphics.py | UTF-8 | 6,972 | 3.140625 | 3 | [] | no_license | from pygame import gfxdraw
import pygame as pg
import matrix
import sys
'''
File name: main.py
Author: Michael Berge
Date created: 7/19/2018
Python Version: 3.8.1
'''
class Graphics:
def __init__(self, i, h, o):
self.__num_i_nodes = i
self.__num_h_nodes = h
... | true |
8089b4c8d4c8f117730d5c4059a1b0eb20ba6c91 | eksponente/alphazero-mancala | /mcts.py | UTF-8 | 2,306 | 2.765625 | 3 | [] | no_license | import numpy as np
class MCTS:
def __init__(self, board, network):
# state = root state
self.network = network
self.root = MCTSNode(board, network)
self.board = board
def search(self, node, board=None):
if board is not None:
self.board = board
# che... | true |
75fdc0bd26287485b66c4aa50ba9ac13c9097456 | cmzmasek/influenza-reassortment-detector | /graph_initializer.py | UTF-8 | 1,373 | 2.96875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import networkx as nx
import sys
class GraphInitializer(object):
"""docstring for GraphInitializer"""
def __init__(self, handle):
super(GraphInitializer, self).__init__()
self.handle = handle
self.data = None
self.G = nx.DiGraph()
def run(self):
self.read_data()
self.create_initial... | true |