hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
95d03efd181e2a914d974162776734b8bd8db276 | 493 | py | Python | envs/__init__.py | atavakol/action-branching-agents | 3664381b5087b3575d8a8b106a04de783c08c6f6 | [
"MIT"
] | 84 | 2018-02-04T22:38:26.000Z | 2022-03-03T01:51:54.000Z | envs/__init__.py | yinziyang123/action-branching-agents | 3664381b5087b3575d8a8b106a04de783c08c6f6 | [
"MIT"
] | 6 | 2019-02-20T21:50:58.000Z | 2021-06-19T20:43:20.000Z | envs/__init__.py | yinziyang123/action-branching-agents | 3664381b5087b3575d8a8b106a04de783c08c6f6 | [
"MIT"
] | 22 | 2019-02-11T22:11:35.000Z | 2022-03-09T06:47:44.000Z | from gym.envs.registration import register
# MuJoCO environments
register(id='Reacher3DOF-v0', entry_point='envs.mujoco.reacher_3dof:Reacher3DOFEnv', max_episode_steps=50)
register(id='Reacher4DOF-v0', entry_point='envs.mujoco.reacher_4dof:Reacher4DOFEnv', max_episode_steps=60)
register(id='Reacher5DOF-v0', entry_point='envs.mujoco.reacher_5dof:Reacher5DOFEnv', max_episode_steps=70)
register(id='Reacher6DOF-v0', entry_point='envs.mujoco.reacher_6dof:Reacher6DOFEnv', max_episode_steps=80) | 70.428571 | 106 | 0.833671 | 68 | 493 | 5.808824 | 0.470588 | 0.101266 | 0.121519 | 0.162025 | 0.293671 | 0.293671 | 0 | 0 | 0 | 0 | 0 | 0.050633 | 0.03854 | 493 | 7 | 107 | 70.428571 | 0.7827 | 0.03854 | 0 | 0 | 0 | 0 | 0.448203 | 0.32981 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
95e9da708bb4a0110373c87a24f57b352b461f0d | 1,102 | py | Python | generic_iterative_stemmer/training/stemming/fixed_vocabulary_stem_generator.py | asaf-kali/generic-iterative-stemmer | 2d2e031ecab71cf04e6756e8062cb1c72feb6d14 | [
"MIT"
] | null | null | null | generic_iterative_stemmer/training/stemming/fixed_vocabulary_stem_generator.py | asaf-kali/generic-iterative-stemmer | 2d2e031ecab71cf04e6756e8062cb1c72feb6d14 | [
"MIT"
] | 13 | 2021-12-22T06:56:30.000Z | 2022-01-30T20:39:40.000Z | generic_iterative_stemmer/training/stemming/fixed_vocabulary_stem_generator.py | asaf-kali/generic-iterative-stemmer | 2d2e031ecab71cf04e6756e8062cb1c72feb6d14 | [
"MIT"
] | null | null | null | from typing import Iterable
from ...training.stemming import StemDict, StemGenerator
from ...utils import get_logger
log = get_logger(__name__)
class FixedVocabularyStemGenerator(StemGenerator):
def __init__(self, legal_words: Iterable[str], workers_amount: int = 5):
super().__init__(workers_amount=workers_amount)
self.legal_words = set(legal_words)
def is_legal(self, word: str) -> bool:
return word in self.legal_words
def find_word_inflections(self, word: str) -> StemDict:
if self.is_legal(word):
return {}
similarities = self.model.most_similar(word, topn=5)
first_similarity = similarities[0]
return {word: first_similarity[0]}
# similarities = model.most_similar(word, topn=20)
# for candidate, grade in similarities:
# if not self.is_legal(candidate):
# continue
# if candidate in word:
# return {word: candidate}
# return {}
@property
def params(self) -> dict:
return {"legal_words": list(self.legal_words)}
| 32.411765 | 76 | 0.647005 | 128 | 1,102 | 5.320313 | 0.414063 | 0.088106 | 0.082232 | 0.058737 | 0.070485 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007299 | 0.254083 | 1,102 | 33 | 77 | 33.393939 | 0.821168 | 0.189655 | 0 | 0 | 0 | 0 | 0.012429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.157895 | 0.105263 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
2515d1acc58c91e8452a7ad40b6b89e61d5d08b3 | 232 | py | Python | apicrud/controllers/credential.py | instantlinux/apicrud | 883b5d29aa291f696f22a6774371d8558fb9c4fc | [
"Apache-2.0"
] | 2 | 2020-10-25T16:37:48.000Z | 2020-12-22T20:55:01.000Z | apicrud/controllers/credential.py | instantlinux/apicrud | 883b5d29aa291f696f22a6774371d8558fb9c4fc | [
"Apache-2.0"
] | 4 | 2021-02-08T17:12:28.000Z | 2021-06-03T07:38:12.000Z | apicrud/controllers/credential.py | instantlinux/apicrud | 883b5d29aa291f696f22a6774371d8558fb9c4fc | [
"Apache-2.0"
] | null | null | null | """credential.py
Credential storage
created 13-mar-2019 by richb@instantlinux.net
"""
from apicrud import BasicCRUD
class CredentialController(BasicCRUD):
def __init__(self):
super().__init__(resource='credential')
| 16.571429 | 47 | 0.74569 | 26 | 232 | 6.346154 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030303 | 0.146552 | 232 | 13 | 48 | 17.846154 | 0.80303 | 0.344828 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
251a7163f9e828ed2f20e416306dfa8398f41e55 | 744 | py | Python | code/checkgpuspeed.py | diksha42/erecognition | 48c6df3f3f854195b7f8b830b9f70fac19acdc9a | [
"BSD-3-Clause"
] | 166 | 2015-01-26T22:24:00.000Z | 2021-04-20T03:47:24.000Z | code/checkgpuspeed.py | diksha42/erecognition | 48c6df3f3f854195b7f8b830b9f70fac19acdc9a | [
"BSD-3-Clause"
] | 18 | 2015-04-05T19:04:01.000Z | 2018-11-28T21:49:19.000Z | code/checkgpuspeed.py | diksha42/erecognition | 48c6df3f3f854195b7f8b830b9f70fac19acdc9a | [
"BSD-3-Clause"
] | 84 | 2015-01-26T22:24:04.000Z | 2020-05-13T15:46:21.000Z | """ Use this file to check the speed difference between a big matrix multiplication
performed on the GPU or on the CPU.
"""
import theano
import theano.tensor as T
from theano import function, shared
import numpy as np
import time
x = T.matrix('x', dtype=theano.config.floatX)
y = T.matrix('y', dtype=theano.config.floatX)
sc = shared(np.zeros((10, 10), dtype = theano.config.floatX), name='sc')
mydot = function( [x,y], updates=( (sc, T.dot(x,y)), ))
# We need to declare the variables shared to run on GPU
a = np.ones((20000, 20000), dtype = theano.config.floatX) * 40.0
b = np.ones((20000, 20000), dtype = theano.config.floatX) * 23.0
print "go"
before = time.time()
mydot(a,b)
print time.time() - before
print sc.get_value().sum()
| 24.8 | 83 | 0.697581 | 127 | 744 | 4.07874 | 0.456693 | 0.106178 | 0.164093 | 0.222008 | 0.150579 | 0.150579 | 0.150579 | 0.150579 | 0 | 0 | 0 | 0.047695 | 0.15457 | 744 | 29 | 84 | 25.655172 | 0.775835 | 0.071237 | 0 | 0 | 0 | 0 | 0.010619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.3125 | null | null | 0.1875 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2524a65af04b3dcb5d22049fc00415d85af88ecc | 298 | py | Python | list_review.py | codered-by-ec-council/Black-Hat-Python-for-Pentesters- | df0cc8b22bcd8f96152ad0b7086a14dd850d5024 | [
"MIT"
] | 10 | 2020-03-15T18:08:50.000Z | 2021-12-10T05:46:50.000Z | list_review.py | codered-by-ec-council/Black-Hat-Python-for-Pentesters- | df0cc8b22bcd8f96152ad0b7086a14dd850d5024 | [
"MIT"
] | null | null | null | list_review.py | codered-by-ec-council/Black-Hat-Python-for-Pentesters- | df0cc8b22bcd8f96152ad0b7086a14dd850d5024 | [
"MIT"
] | 6 | 2020-05-27T06:56:00.000Z | 2022-03-14T13:48:38.000Z | squares = [1, 4, 9, 16, 25]
print(squares)
print(squares[0]) #Get first value; remember index offset
print(squares[-1]) #Get last value in sequence
print(squares[2:4]) #Return slice of list
squares.append(54) #Add new value
print(squares)
squares[3] = 88 #Insert new value
print(squares)
| 19.866667 | 58 | 0.708054 | 49 | 298 | 4.306122 | 0.591837 | 0.341232 | 0.123223 | 0.189573 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064 | 0.161074 | 298 | 14 | 59 | 21.285714 | 0.78 | 0.379195 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
25339e09a3149c5c0dfc7f179d01b9e37abd2f94 | 3,407 | py | Python | database_setup.py | JLZ-coder/bestOffer-API | af21f6ffb3d97c0bf65bd58827cb59f7953cc15e | [
"MIT"
] | null | null | null | database_setup.py | JLZ-coder/bestOffer-API | af21f6ffb3d97c0bf65bd58827cb59f7953cc15e | [
"MIT"
] | null | null | null | database_setup.py | JLZ-coder/bestOffer-API | af21f6ffb3d97c0bf65bd58827cb59f7953cc15e | [
"MIT"
] | null | null | null | import psycopg2
from werkzeug.security import generate_password_hash
# Connect to an existing database
conn = psycopg2.connect("dbname=bestoffer user=juanliu password=1234")
# Open a cursor to perform database operations
cur = conn.cursor()
cur.execute("DROP TABLE offers")
cur.execute("DROP TABLE products")
cur.execute("DROP TABLE users")
# Execute a command: this creates a new table
cur.execute("""CREATE TABLE users (
id serial PRIMARY KEY,
email varchar(150),
password varchar(150)
);""")
cur.execute(
"""CREATE TABLE products (
id serial PRIMARY KEY,
name varchar(150),
description text
);"""
)
cur.execute(
"""CREATE TABLE offers (
id serial PRIMARY KEY,
user_id int,
product_id int,
price money,
site varchar(150),
CONSTRAINT fk_user
FOREIGN KEY(user_id)
REFERENCES users(id)
ON DELETE SET NULL,
CONSTRAINT fk_product
FOREIGN KEY(product_id)
REFERENCES products(id)
ON DELETE CASCADE
);"""
)
# Pass data to fill a query placeholders and let Psycopg perform
# the correct conversion (no more SQL injections!)
cur.execute("insert into products (name, description) values ('Wine - Carmenere Casillero Del', 'ññññáéíóúñññññ¿?¡Caracteres raros!');")
cur.execute("insert into products (name, description) values ('Soup Campbells Beef With Veg', 'ññññáéíóúñññññ¿?¡Caracteres raros!');")
cur.execute("insert into products (name, description) values ('Cream - 10%', 'ññññáéíóúñññññ¿?¡Caracteres raros!');")
cur.execute("insert into products (name, description) values ('Momiji Oroshi Chili Sauce', 'ññññáéíóúñññññ¿?¡Caracteres raros!');")
cur.execute("insert into products (name, description) values ('Remy Red', 'ññññáéíóúñññññ¿?¡Caracteres raros!');")
cur.execute("insert into users (email, password) values (%s, %s)", ("lbreckon0@gmail.com", generate_password_hash("1234")))
cur.execute("insert into users (email, password) values (%s, %s)", ("juan@gmail.com", generate_password_hash("1234")))
cur.execute("insert into users (email, password) values (%s, %s)", ("ana@gmail.com", generate_password_hash("1234")))
cur.execute("insert into users (email, password) values (%s, %s)", ("pedro@gmail.com", generate_password_hash("1234")))
cur.execute("insert into users (email, password) values (%s, %s)", ("lebigmac@gmail.com", generate_password_hash("1234")))
cur.execute("insert into offers (user_id, product_id, price, site) values (%s, %s, %s, %s)",
(1, 1, 10.00, "https://www.amazon.com/"))
cur.execute("insert into offers (user_id, product_id, price, site) values (%s, %s, %s, %s)",
(2, 1, 35.56, "https://www.amazon.com/"))
cur.execute("insert into offers (user_id, product_id, price, site) values (%s, %s, %s, %s)",
(3, 3, 35.56, "https://www.amazon.com/"))
cur.execute("insert into offers (user_id, product_id, price, site) values (%s, %s, %s, %s)",
(1, 2, 35.56, "https://www.amazon.com/"))
cur.execute("insert into offers (user_id, product_id, price, site) values (%s, %s, %s, %s)",
(4, 2, 35.56, "https://www.amazon.com/"))
# Query the database and obtain data as Python objects
cur.execute("SELECT * FROM users WHERE id=%s", (1,))
# Make the changes to the database persistent
conn.commit()
# Close communication with the database
cur.close()
conn.close() | 42.5875 | 136 | 0.671852 | 473 | 3,407 | 4.801269 | 0.274841 | 0.096874 | 0.10568 | 0.1321 | 0.5262 | 0.5262 | 0.5262 | 0.516072 | 0.494496 | 0.480845 | 0 | 0.025614 | 0.174934 | 3,407 | 80 | 137 | 42.5875 | 0.778726 | 0.107719 | 0 | 0.175 | 1 | 0.2 | 0.663835 | 0.056634 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0.05 | 0 | 0.05 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2548290812205895f5ae6293c47f43beb6d997a7 | 442 | py | Python | app/resources/__init__.py | dpfg/kicker-scorer-api | 38dcf85e8e80a7a6a2213fb80f7f480c74f87cac | [
"MIT"
] | null | null | null | app/resources/__init__.py | dpfg/kicker-scorer-api | 38dcf85e8e80a7a6a2213fb80f7f480c74f87cac | [
"MIT"
] | null | null | null | app/resources/__init__.py | dpfg/kicker-scorer-api | 38dcf85e8e80a7a6a2213fb80f7f480c74f87cac | [
"MIT"
] | null | null | null | from flask_restful import Resource, Api
from flask_jwt import jwt_required
from app.decorators import json_content, community_resource, match_resource
class ProtectedResource(Resource):
method_decorators = [jwt_required()]
class CommunityBasedResource(ProtectedResource):
method_decorators = [jwt_required(), community_resource]
class MatchBasedResource(ProtectedResource):
method_decorators = [jwt_required(), match_resource]
| 34 | 75 | 0.825792 | 47 | 442 | 7.468085 | 0.404255 | 0.125356 | 0.162393 | 0.230769 | 0.250712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106335 | 442 | 12 | 76 | 36.833333 | 0.888608 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
254d9839202dc4eff577f5b53f60d8211f678002 | 940 | py | Python | app/request.py | kelvinadeu/Blog | cc9de0053fe0b3f771d6c80ee4ec496f3582abdb | [
"MIT",
"Unlicense"
] | null | null | null | app/request.py | kelvinadeu/Blog | cc9de0053fe0b3f771d6c80ee4ec496f3582abdb | [
"MIT",
"Unlicense"
] | null | null | null | app/request.py | kelvinadeu/Blog | cc9de0053fe0b3f771d6c80ee4ec496f3582abdb | [
"MIT",
"Unlicense"
] | null | null | null | import urllib.request,json
from .models import Random
base_url =None
#
# def configure_request(app):
#
# global base_url
# base_url= app.config['BASE_URL']
#
# def get_single(name):
# '''
# function that returns the json response from url
# :return:
# '''
# get_single_url = base_url.format(name)
# with urllib.request.urlopen(get_single_url) as url:
# get_single_data = url.read()
# get_single_response = json.loads(get_single_data)
#
# single_result = None
#
# single_result=process_single_result(get_single_response)
#
#
# return single_result
#
#
# # def process_single_result(single_list):
# # single_result = []
# for today_item in single_list:
# author = today_item.get('author')
# quote = today_item.get('quote')
#
# single_object = Random(author,quotes)
# single_result.append(single_object)
#
# return single_result
| 23.5 | 66 | 0.655319 | 117 | 940 | 4.957265 | 0.367521 | 0.165517 | 0.034483 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230851 | 940 | 39 | 67 | 24.102564 | 0.802213 | 0.848936 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2559468157cc42b97ebb9fac5723f9cad844798f | 176 | py | Python | app/urls.py | fernanduandrade/120-years-athletes | bec51dce3cb475603f6c45c38f368e9b636602bd | [
"MIT"
] | null | null | null | app/urls.py | fernanduandrade/120-years-athletes | bec51dce3cb475603f6c45c38f368e9b636602bd | [
"MIT"
] | null | null | null | app/urls.py | fernanduandrade/120-years-athletes | bec51dce3cb475603f6c45c38f368e9b636602bd | [
"MIT"
] | null | null | null | from rest_framework import routers
from .views import AthleteViewSet
router = routers.DefaultRouter()
router.register('athletes', AthleteViewSet)
urlpatterns = router.urls
| 17.6 | 43 | 0.8125 | 19 | 176 | 7.473684 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113636 | 176 | 9 | 44 | 19.555556 | 0.910256 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
256d705344fcaf58d38402bd12fe4a9167753628 | 23 | py | Python | src/simplerBLESS/freqAnalysis/__init__.py | julieweeds/BLESS | dbae2c4e0eea4cec0e6a9fff9caff5799e4319d4 | [
"Apache-2.0"
] | null | null | null | src/simplerBLESS/freqAnalysis/__init__.py | julieweeds/BLESS | dbae2c4e0eea4cec0e6a9fff9caff5799e4319d4 | [
"Apache-2.0"
] | null | null | null | src/simplerBLESS/freqAnalysis/__init__.py | julieweeds/BLESS | dbae2c4e0eea4cec0e6a9fff9caff5799e4319d4 | [
"Apache-2.0"
] | null | null | null | __author__ = 'juliewe'
| 11.5 | 22 | 0.73913 | 2 | 23 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 23 | 1 | 23 | 23 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c25c76f5aa991ee42454f82dc763c5148b3d6919 | 720 | py | Python | app/seed.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | app/seed.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | app/seed.py | baloo1379/transposition-api | 23b7ee0c53776fda1e27643410761a3e0832b101 | [
"MIT"
] | null | null | null | from sqlalchemy.exc import IntegrityError
import warnings
from sqlalchemy.orm import Session
from app.models.user import User as UserEntity, Base
from app.repositories.user_repository import save_user
from app.database.connection import SessionLocal, engine
from app.services.auth import get_password_hash
from os import getenv
def seeder(db: Session = SessionLocal()):
try:
Base.metadata.create_all(bind=engine)
save_user(db, UserEntity(username=getenv('DEFAULT_USER', 'diagonal'),
password=get_password_hash(getenv('DEFAULT_PASSWORD', 'transposition'))))
except IntegrityError as er:
warnings.warn(er.orig)
if __name__ == '__main__':
seeder()
| 30 | 106 | 0.733333 | 89 | 720 | 5.730337 | 0.52809 | 0.054902 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181944 | 720 | 23 | 107 | 31.304348 | 0.865874 | 0 | 0 | 0 | 0 | 0 | 0.079167 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0.117647 | 0.470588 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
c25fde84c45e24a7efa4e60c2b5c12fb7e76a8df | 138 | py | Python | latihan/forms.py | fadhifatah/Fataservice | 58bbed1eddc3384f37137a497f24077a30079f50 | [
"MIT"
] | null | null | null | latihan/forms.py | fadhifatah/Fataservice | 58bbed1eddc3384f37137a497f24077a30079f50 | [
"MIT"
] | null | null | null | latihan/forms.py | fadhifatah/Fataservice | 58bbed1eddc3384f37137a497f24077a30079f50 | [
"MIT"
] | null | null | null | from django import forms
class DocumentForm(forms.Form):
file = forms.FileField(
label='Pick a file to be compressed'
)
| 17.25 | 44 | 0.673913 | 18 | 138 | 5.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.246377 | 138 | 7 | 45 | 19.714286 | 0.894231 | 0 | 0 | 0 | 0 | 0 | 0.202899 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c2636fd6261f3171b4794b6dd9b0f24d2dbfcda3 | 97 | py | Python | src/bgapi/coex/types.py | GetAmbush/python-bgapi | 985e5849275eb5e7cf794c30ef87e16ffa91fa63 | [
"MIT"
] | null | null | null | src/bgapi/coex/types.py | GetAmbush/python-bgapi | 985e5849275eb5e7cf794c30ef87e16ffa91fa63 | [
"MIT"
] | null | null | null | src/bgapi/coex/types.py | GetAmbush/python-bgapi | 985e5849275eb5e7cf794c30ef87e16ffa91fa63 | [
"MIT"
] | null | null | null | class Option:
OPTION_ENABLE = 256
OPTION_TX_ABORT = 1024
OPTION_HIGH_PRIORITY = 2048
| 19.4 | 31 | 0.721649 | 13 | 97 | 5 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148649 | 0.237113 | 97 | 4 | 32 | 24.25 | 0.72973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c2699787b4404b77936a52cd14138e39bbc07638 | 22 | py | Python | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/tumblr/__init__.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 6,342 | 2015-01-01T07:40:30.000Z | 2022-03-31T04:18:30.000Z | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/tumblr/__init__.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 2,198 | 2015-01-02T15:17:45.000Z | 2022-03-28T10:20:43.000Z | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/tumblr/__init__.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 2,928 | 2015-01-01T10:44:13.000Z | 2022-03-31T03:20:16.000Z | __author__ = "jshedd"
| 11 | 21 | 0.727273 | 2 | 22 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c2a09fbb2673ea68b1160a4c36bc5587c0d10a7d | 296 | py | Python | perawatan/views/fasilitas_view.py | userbaruu/aerotron | f2f2fb7797a75a7a3b3c0eb3836193bc05650c65 | [
"MIT"
] | null | null | null | perawatan/views/fasilitas_view.py | userbaruu/aerotron | f2f2fb7797a75a7a3b3c0eb3836193bc05650c65 | [
"MIT"
] | null | null | null | perawatan/views/fasilitas_view.py | userbaruu/aerotron | f2f2fb7797a75a7a3b3c0eb3836193bc05650c65 | [
"MIT"
] | 1 | 2021-07-28T23:19:27.000Z | 2021-07-28T23:19:27.000Z | from rest_framework import generics
from perawatan.models.fasilitas import Fasilitas
from perawatan.serializers.fasilitas_serializer import FasilitasSerializer
class DaftarFasilitas(generics.ListCreateAPIView):
serializer_class = FasilitasSerializer
queryset = Fasilitas.objects.all()
| 29.6 | 74 | 0.847973 | 29 | 296 | 8.551724 | 0.586207 | 0.104839 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10473 | 296 | 9 | 75 | 32.888889 | 0.935849 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c2a9e56b59f6ab4c9d8cf787e0d5110626cf5f8c | 2,314 | py | Python | qcloudsdkbmvpc/CreateBmNatGatewayRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkbmvpc/CreateBmNatGatewayRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdkbmvpc/CreateBmNatGatewayRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class CreateBmNatGatewayRequest(Request):
def __init__(self):
super(CreateBmNatGatewayRequest, self).__init__(
'bmvpc', 'qcloudcliV1', 'CreateBmNatGateway', 'bmvpc.api.qcloud.com')
def get_assignedEipSet(self):
return self.get_params().get('assignedEipSet')
def set_assignedEipSet(self, assignedEipSet):
self.add_param('assignedEipSet', assignedEipSet)
def get_autoAllocEipNum(self):
return self.get_params().get('autoAllocEipNum')
def set_autoAllocEipNum(self, autoAllocEipNum):
self.add_param('autoAllocEipNum', autoAllocEipNum)
def get_exclusive(self):
return self.get_params().get('exclusive')
def set_exclusive(self, exclusive):
self.add_param('exclusive', exclusive)
def get_forwardMode(self):
return self.get_params().get('forwardMode')
def set_forwardMode(self, forwardMode):
self.add_param('forwardMode', forwardMode)
def get_ips(self):
return self.get_params().get('ips')
def set_ips(self, ips):
self.add_param('ips', ips)
def get_isBackup(self):
return self.get_params().get('isBackup')
def set_isBackup(self, isBackup):
self.add_param('isBackup', isBackup)
def get_maxConcurrent(self):
return self.get_params().get('maxConcurrent')
def set_maxConcurrent(self, maxConcurrent):
self.add_param('maxConcurrent', maxConcurrent)
def get_natName(self):
return self.get_params().get('natName')
def set_natName(self, natName):
self.add_param('natName', natName)
def get_subnetIds(self):
return self.get_params().get('subnetIds')
def set_subnetIds(self, subnetIds):
self.add_param('subnetIds', subnetIds)
def get_unSubnetIds(self):
return self.get_params().get('unSubnetIds')
def set_unSubnetIds(self, unSubnetIds):
self.add_param('unSubnetIds', unSubnetIds)
def get_unVpcId(self):
return self.get_params().get('unVpcId')
def set_unVpcId(self, unVpcId):
self.add_param('unVpcId', unVpcId)
def get_vpcId(self):
return self.get_params().get('vpcId')
def set_vpcId(self, vpcId):
self.add_param('vpcId', vpcId)
| 28.219512 | 81 | 0.674157 | 265 | 2,314 | 5.675472 | 0.139623 | 0.047872 | 0.111702 | 0.135638 | 0.207447 | 0.207447 | 0 | 0 | 0 | 0 | 0 | 0.001082 | 0.201383 | 2,314 | 81 | 82 | 28.567901 | 0.812771 | 0.009075 | 0 | 0 | 0 | 0 | 0.121344 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.471698 | false | 0 | 0.018868 | 0.226415 | 0.735849 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6c044ebbf7059a65fee6d17daec344c534194177 | 2,916 | py | Python | analysis/simulator/main.py | zry98/AutoCita | 90cdcb898ea2e0632d81bc8685970fb39159e549 | [
"WTFPL"
] | null | null | null | analysis/simulator/main.py | zry98/AutoCita | 90cdcb898ea2e0632d81bc8685970fb39159e549 | [
"WTFPL"
] | null | null | null | analysis/simulator/main.py | zry98/AutoCita | 90cdcb898ea2e0632d81bc8685970fb39159e549 | [
"WTFPL"
] | null | null | null | import requests
from flask import Flask, redirect, request
import random
import string
app = Flask(__name__)
@app.route('/')
def index():
return redirect('/pagina/index/directorio/icpplus')
@app.route('/pagina/index/directorio/icpplus')
def portal():
return app.send_static_file('portal.html')
@app.route('/icpplus/', methods=['POST'])
def icpplus():
return app.send_static_file('icpplus.html')
@app.route('/icpplustieb/citar')
def citar():
return app.send_static_file('citar.html')
@app.route('/icpplustieb/muestraMensajesTramite', methods=['POST'])
def muestraMensajesTramite():
return app.send_static_file('muestraMensajesTramite.html')
@app.route('/icpplustieb/acInfo', methods=['POST'])
@app.route('/icpplustieb/acInfo<jsessionid>', methods=['POST'])
def acInfo(jsessionid=''):
return app.send_static_file('acInfo.html')
@app.route('/icpplustieb/acEntrada', methods=['POST'])
def acEntrada():
return app.send_static_file('acEntrada.html')
@app.route('/icpplustieb/acValidarEntrada', methods=['POST'])
def acValidarEntrada():
return app.send_static_file('acValidarEntrada.html')
@app.route('/icpplustieb/acCitar', methods=['POST'])
def acCitar():
return app.send_static_file('acCitar.html')
@app.route('/icpplustieb/acVerFormulario', methods=['GET', 'POST'])
def acVerFormulario():
return app.send_static_file('acVerFormulario.html')
@app.route('/icpplustieb/acOfertarCita', methods=['POST'])
def acOfertarCita():
return app.send_static_file('acOfertarCita.html')
@app.route('/icpplustieb/acVerificarCita', methods=['POST'])
def acVerificarCita():
action = request.form.get('action')
recaptcha_response = request.form.get('g-recaptcha-response')
if not is_human(recaptcha_response, action):
print('reCAPTCHA triggered', flush=True)
return app.send_static_file('acVerificarCita.failed.html')
print('reCAPTCHA passed', flush=True)
sms_verification_code = ''.join(random.choice(string.digits) for _ in range(5))
print(sms_verification_code, flush=True)
return app.send_static_file('acVerificarCita.html')
@app.route('/icpplustieb/acGrabarCita', methods=['POST'])
def acGrabarCita():
return app.send_static_file('acGrabarCita.html')
@app.route('/<path:path>')
def serve_static(path):
return app.send_static_file(path)
def is_human(recaptcha_response: str, action: str) -> bool:
recaptcha_secret_key = '6Lc3i_kcAAAAABx1xuczs-6kcEfLmhOtjwk7FRkf'
payload = {'secret': recaptcha_secret_key, 'response': recaptcha_response, 'action': action}
response = requests.post('https://www.google.com/recaptcha/api/siteverify', data=payload).json()
if response['success']:
print(f"reCAPTCHA score: {response['score']}", flush=True)
else:
print(response, flush=True)
return response['success'] and response['score'] > 0.8
if __name__ == '__main__':
app.run()
| 28.871287 | 100 | 0.722908 | 348 | 2,916 | 5.893678 | 0.255747 | 0.058508 | 0.088737 | 0.129693 | 0.1804 | 0.045831 | 0.045831 | 0.045831 | 0 | 0 | 0 | 0.003106 | 0.116598 | 2,916 | 100 | 101 | 29.16 | 0.79309 | 0 | 0 | 0 | 0 | 0 | 0.296639 | 0.138203 | 0 | 0 | 0 | 0 | 0 | 1 | 0.223881 | false | 0.014925 | 0.059701 | 0.19403 | 0.522388 | 0.074627 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6c1ae3c78b38290adfa485d89764d62b2b42c77d | 8,676 | py | Python | rihanna_bot/similarity.py | emylincon/chatbot | 60bf7ab8bda0f4207cdd61e15d798ab1bbdad895 | [
"MIT"
] | null | null | null | rihanna_bot/similarity.py | emylincon/chatbot | 60bf7ab8bda0f4207cdd61e15d798ab1bbdad895 | [
"MIT"
] | 6 | 2021-03-19T16:09:50.000Z | 2022-03-12T00:55:40.000Z | rihanna_bot/similarity.py | emylincon/chatbot | 60bf7ab8bda0f4207cdd61e15d798ab1bbdad895 | [
"MIT"
] | null | null | null | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
ps = PorterStemmer()
stop_words = set(stopwords.words("english"))
def remove_stopwords(enter_words):
words = word_tokenize(enter_words)
stemmed = [ps.stem(w) for w in words]
filt_sen = ' '.join([w for w in stemmed if not w in stop_words])
return train(filt_sen)
def train(sentence):
documents = (
sentence,
'hot 100', 'billboard 200', 'artist 100', 'social 50', 'stream song', 'radio song', 'digit song sale', 'demand song', 'top album sale', 'current album', 'catalog album', 'independ album', 'soundtrack', 'vinyl album', 'greatest billboard 200 album', 'greatest billboard 200 artist', 'greatest hot 100 singl', 'greatest hot 100 artist', 'greatest hot 100 song women', 'greatest hot 100 women artist', 'greatest billboard 200 album women', 'greatest billboard 200 women artist', 'greatest billboard top song 80', 'greatest billboard top song 90', 'greatest time pop song', 'greatest time pop song artist', 'greatest adult pop song', 'greatest adult pop artist', 'greatest countri song', 'greatest countri album', 'greatest countri artist', 'greatest hot latin song', 'greatest hot latin song artist', 'greatest top danc club artist', 'greatest r b hip hop song', 'greatest r b hip hop album', 'greatest r b hip hop artist', 'greatest altern song', 'greatest altern artist', 'pop song', 'adult contemporari', 'adult pop song', 'countri song', 'countri album', 'countri stream song', 'countri airplay', 'countri digit song sale', 'bluegrass album', 'americana folk album', 'rock song', 'rock album', 'rock stream song', 'rock airplay', 'rock digit song sale', 'altern song', 'altern album', 'tripl', 'hot mainstream rock track', 'hard rock album', 'r b hip hop song', 'r b hip hop album', 'r b hip hop stream song', 'hot r b hip hop airplay', 'hot r b hip hop recurr airplay', 'r b hip hop digit song sale', 'r b song', 'r b album', 'r b stream song', 'r b digit song sale', 'rap song', 'rap album', 'rap stream song', 'hot rap track', 'rap digit song sale', 'mainstream r b hip hop', 'hot adult r b airplay', 'rhythmic 40', 'latin song', 'latin album', 'latin stream song', 'latin airplay', 'latin digit song sale', 'region mexican album', 'latin region mexican airplay', 'latin pop album', 'latin pop airplay', 'tropic album', 'latin tropic airplay', 'latin rhythm album', 'latin rhythm airplay', 'danc electron song', 'danc electron album', 'danc electron stream song', 'danc electron digit song sale', 'hot danc airplay', 'danc club play song', 'christian song', 'christian album', 'christian stream song', 'christian airplay', 'christian digit song sale', 'hot christian adult contemporari', 'gospel song', 'gospel album', 'gospel stream song', 'gospel airplay', 'gospel digit song sale', 'classic album', 'classic crossov album', 'tradit classic album', 'jazz album', 'contemporari jazz', 'tradit jazz album', 'jazz song', 'emerg artist', 'heatseek album', 'lyricfind global', 'lyricfind us', 'next big sound 25', 'hot holiday song', 'holiday album', 'holiday stream song', 'holiday song', 'holiday season digit song sale', 'summer song', 'canadian hot 100', 'canadian album', 'hot canada digit song sale', 'canada emerg artist', 'canada ac', 'canada format airplay', 'canada chr top 40', 'canada countri', 'canada hot ac', 'canada rock', 'mexico', 'mexico ingl', 'mexico popular', 'mexico espanol', 'japan hot 100', 'k pop hot 100', 'billboard china social chart', 'billboard argentina hot 100', 'offici uk song', 'offici uk album', 'uk digit song sale', 'euro digit song sale', 'franc digit song sale', 'germani song', 'german album', 'greec album', 'itali album', 'itali digit song sale', 'spain digit song sale', 'switzerland digit song sale', 'australian album', 'australia digit song sale', 'blue album', 'bubbl hot 100 singl', 'cast album', 'comedi album', 'compil album', 'hot singl recurr', 'kid album', 'new age album', 'regga album', 'tastemak album', 'world album', 'world digit song sale'
)
tfidf_vectorizer = TfidfVectorizer()
tfidf_matrix = tfidf_vectorizer.fit_transform(documents)
array = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix)
return array[0][1:]
def similarity(phrase):
arr = remove_stopwords(phrase)
max_sim = max(arr)
ind = list(arr).index(max_sim)
if max_sim > 0.50:
return ind
else:
return -1
def sim_main(word):
y = similarity(word)
if y == -1:
return 0
else:
return chart[y]
chart = ['hot-100', 'billboard-200', 'artist-100', 'social-50', 'streaming-songs', 'radio-songs', 'digital-song-sales', 'on-demand-songs', 'top-album-sales', 'current-albums', 'catalog-albums', 'independent-albums', 'soundtracks', 'vinyl-albums', 'greatest-billboard-200-albums', 'greatest-billboard-200-artists', 'greatest-hot-100-singles', 'greatest-hot-100-artists', 'greatest-hot-100-songs-by-women', 'greatest-hot-100-women-artists', 'greatest-billboard-200-albums-by-women', 'greatest-billboard-200-women-artists', 'greatest-billboards-top-songs-80s', 'greatest-billboards-top-songs-90s', 'greatest-of-all-time-pop-songs', 'greatest-of-all-time-pop-songs-artists', 'greatest-adult-pop-songs', 'greatest-adult-pop-artists', 'greatest-country-songs', 'greatest-country-albums', 'greatest-country-artists', 'greatest-hot-latin-songs', 'greatest-hot-latin-songs-artists', 'greatest-top-dance-club-artists', 'greatest-r-b-hip-hop-songs', 'greatest-r-b-hip-hop-albums', 'greatest-r-b-hip-hop-artists', 'greatest-alternative-songs', 'greatest-alternative-artists', 'pop-songs', 'adult-contemporary', 'adult-pop-songs', 'country-songs', 'country-albums', 'country-streaming-songs', 'country-airplay', 'country-digital-song-sales', 'bluegrass-albums', 'americana-folk-albums', 'rock-songs', 'rock-albums', 'rock-streaming-songs', 'rock-airplay', 'rock-digital-song-sales', 'alternative-songs', 'alternative-albums', 'triple-a', 'hot-mainstream-rock-tracks', 'hard-rock-albums', 'r-b-hip-hop-songs', 'r-b-hip-hop-albums', 'r-and-b-hip-hop-streaming-songs', 'hot-r-and-b-hip-hop-airplay', 'hot-r-and-b-hip-hop-recurrent-airplay', 'r-and-b-hip-hop-digital-song-sales', 'r-and-b-songs', 'r-and-b-albums', 'r-and-b-streaming-songs', 'r-and-b-digital-song-sales', 'rap-song', 'rap-albums', 'rap-streaming-songs', 'hot-rap-tracks', 'rap-digital-song-sales', 'mainstream-r-and-b-hip-hop', 'hot-adult-r-and-b-airplay', 'rhythmic-40', 'latin-songs', 'latin-albums', 'latin-streaming-songs', 'latin-airplay', 'latin-digital-song-sales', 'regional-mexican-albums', 'latin-regional-mexican-airplay', 'latin-pop-albums', 'latin-pop-airplay', 'tropical-albums', 'latin-tropical-airplay', 'latin-rhythm-albums', 'latin-rhythm-airplay', 'dance-electronic-songs', 'dance-electronic-albums', 'dance-electronic-streaming-songs', 'dance-electronic-digital-song-sales', 'hot-dance-airplay', 'dance-club-play-songs', 'christian-songs', 'christian-albums', 'christian-streaming-songs', 'christian-airplay', 'christian-digital-song-sales', 'hot-christian-adult-contemporary', 'gospel-songs', 'gospel-albums', 'gospel-streaming-songs', 'gospel-airplay', 'gospel-digital-song-sales', 'classical-albums', 'classical-crossover-albums', 'traditional-classic-albums', 'jazz-albums', 'contemporary-jazz', 'traditional-jazz-albums', 'jazz-songs', 'emerging-artists', 'heatseekers-albums', 'lyricfind-global', 'lyricfind-us', 'next-big-sound-25', 'hot-holiday-songs', 'holiday-albums', 'holiday-streaming-songs', 'holiday-songs', 'holiday-season-digital-song-sales', 'summer-songs', 'canadian-hot-100', 'canadian-albums', 'hot-canada-digital-song-sales', 'canada-emerging-artists', 'canada-ac', 'canada-all-format-airplay', 'canada-chr-top-40', 'canada-country', 'canada-hot-ac', 'canada-rock', 'mexico', 'mexico-ingles', 'mexico-popular', 'mexico-espanol', 'japan-hot-100', 'k-pop-hot-100', 'billboard-china-social-chart', 'billboard-argentina-hot-100', 'official-uk-songs', 'official-uk-albums', 'uk-digital-song-sales', 'euro-digital-song-sales', 'france-digital-song-sales', 'germany-songs', 'german-albums', 'greece-albums', 'italy-albums', 'italy-digital-song-sales', 'spain-digital-song-sales', 'switzerland-digital-song-sales', 'australian-albums', 'australia-digital-song-sales', 'blues-albums', 'bubbling-under-hot-100-singles', 'cast-albums', 'comedy-albums', 'compilation-albums', 'hot-singles-recurrents', 'kids-albums', 'new-age-albums', 'reggae-albums', 'tastemaker-albums', 'world-albums', 'world-digital-song-sales']
| 170.117647 | 3,996 | 0.720148 | 1,218 | 8,676 | 5.110837 | 0.178161 | 0.019277 | 0.041767 | 0.019277 | 0.160803 | 0.101044 | 0.079357 | 0.058153 | 0.046908 | 0.046908 | 0 | 0.016798 | 0.107999 | 8,676 | 50 | 3,997 | 173.52 | 0.787569 | 0 | 0 | 0.055556 | 0 | 0 | 0.720148 | 0.228907 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.138889 | 0 | 0.416667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6c502f4202c61eadca464fe714f53bf3c3ad181a | 175 | py | Python | app/lib/tanspeedexe.py | JesterOrNot/pymath | 5c93ee4bb754d2e90d222c2b43357f88b7bd0623 | [
"MIT"
] | null | null | null | app/lib/tanspeedexe.py | JesterOrNot/pymath | 5c93ee4bb754d2e90d222c2b43357f88b7bd0623 | [
"MIT"
] | 25 | 2019-10-19T18:03:00.000Z | 2021-06-25T15:27:51.000Z | app/lib/tanspeedexe.py | JesterOrNot/pymath | 5c93ee4bb754d2e90d222c2b43357f88b7bd0623 | [
"MIT"
] | null | null | null | import pymath
radius = float(input())
time = float(input())
cycles = float(input())
print("tangental speed = {}".format(pymath.physics.tangental_speed(radius, time, cycles)))
| 29.166667 | 90 | 0.725714 | 22 | 175 | 5.727273 | 0.545455 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097143 | 175 | 5 | 91 | 35 | 0.797468 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6c54581d422fd9293fa449cd7eefa55c67e3e6fd | 1,365 | py | Python | classes/banList.py | VMAJSTER/openstreamingplatform | f002246db922dab9a3f019f46001f3901326feaf | [
"MIT"
] | 40 | 2020-07-15T16:17:16.000Z | 2022-03-14T12:25:40.000Z | classes/banList.py | VMAJSTER/openstreamingplatform | f002246db922dab9a3f019f46001f3901326feaf | [
"MIT"
] | 9 | 2020-05-13T17:22:49.000Z | 2022-03-12T00:29:41.000Z | classes/banList.py | VMAJSTER/openstreamingplatform | f002246db922dab9a3f019f46001f3901326feaf | [
"MIT"
] | 13 | 2020-10-01T05:31:00.000Z | 2022-02-09T07:40:57.000Z | from .shared import db
class banList(db.Model):
id = db.Column(db.Integer,primary_key=True)
channelLoc = db.Column(db.String(255))
userID = db.Column(db.Integer, db.ForeignKey('user.id'))
def __init__(self,channelLoc,userID):
self.channelLoc = channelLoc
self.userID = userID
def __repr__(self):
return '<id %r>' % self.id
class ipList(db.Model):
id = db.Column(db.Integer, primary_key=True)
ipAddress = db.Column(db.String(1024))
reason = db.Column(db.String(1024))
def __init__(self, ipAddress, reason="None"):
self.ipAddress = ipAddress
self.reason = reason
def __repr__(self):
return '<id %r>' % self.id
class channelBanList(db.Model):
id = db.Column(db.Integer, primary_key=True)
channelLoc = db.Column(db.String(255))
username = db.Column(db.String(255))
userUUID = db.Column(db.String(255))
def __init__(self, channelLoc, username, userUUID):
self.channelLoc = channelLoc
self.username = username
self.userUUID = userUUID
def __repr__(self):
return '<id %r>' % self.id
class chatBannedWords(db.Model):
id = db.Column(db.Integer, primary_key=True)
word = db.Column(db.String(1028))
def __init__(self, word):
self.word = word
def __repr__(self):
return '<id %r>' % self.id | 27.857143 | 60 | 0.641026 | 180 | 1,365 | 4.661111 | 0.2 | 0.114422 | 0.143027 | 0.133492 | 0.494636 | 0.401669 | 0.401669 | 0.401669 | 0.370679 | 0.259833 | 0 | 0.022642 | 0.223443 | 1,365 | 49 | 61 | 27.857143 | 0.768868 | 0 | 0 | 0.432432 | 0 | 0 | 0.028551 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.216216 | false | 0 | 0.027027 | 0.108108 | 0.783784 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6c67e01e631baf0b14285092634025905ee97892 | 14,294 | py | Python | Makerspace-multimodal-tracker-main (1)/Makerspace-multimodal-tracker-main/code/webcam_post_process.py | ChenweWu/multimodal-tracker | b1213cfc5e6b1834c03d9a378a299749e2579b01 | [
"MIT"
] | null | null | null | Makerspace-multimodal-tracker-main (1)/Makerspace-multimodal-tracker-main/code/webcam_post_process.py | ChenweWu/multimodal-tracker | b1213cfc5e6b1834c03d9a378a299749e2579b01 | [
"MIT"
] | null | null | null | Makerspace-multimodal-tracker-main (1)/Makerspace-multimodal-tracker-main/code/webcam_post_process.py | ChenweWu/multimodal-tracker | b1213cfc5e6b1834c03d9a378a299749e2579b01 | [
"MIT"
] | null | null | null | import os
import argparse
import pandas as pd
import glob
import subprocess
import shlex
import datetime
import schedule
import time
# function to execute command in shell
def run_command(command):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if process.poll() is not None:
break
if output:
print(output.strip())
rc = process.poll()
return rc
# function to execute command in shell and save output to file
def run_command_out(command,outfile):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
with open(outfile,"ab") as f:
f.write(output)
if process.poll() is not None:
break
if output:
print(output.strip())
rc = process.poll()
return rc
# function to create directories
def create_dir(target_dir):
if not os.path.exists(target_dir):
try:
os.makedirs(target_dir)
except:
pass
# helper function for time string
def get_str(dt_subobject):
out = str(dt_subobject)
if len(out) == 1:
out = '0' + out
return out
# helper function for micro time string
def get_micro_str(dt_subobject):
out = str(dt_subobject)
no_zeros = 6 - len(out)
out = no_zeros*'0' + out
return out
# convert unix to datetime
def convert_unix(timestamp):
unix_conversion = datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S.%f')
return unix_conversion
# function format datetime object
def timestamp_format(dt_object):
year = get_str(dt_object.year)
month = get_str(dt_object.month)
day = get_str(dt_object.day)
hour = get_str(dt_object.hour)
minute = get_str(dt_object.minute)
second = get_str(dt_object.second)
microsecond = get_micro_str(dt_object.microsecond)
timestamp_str = '{}-{}-{}T{}:{}:{}.{}+00:00'.format(year,month,day,hour,minute,second,microsecond)
return timestamp_str
# helper function to get time
def get_time(system_start=None,system_date=None):
if system_start == None:
dt_system_start = datetime.datetime.now()
else:
dt_system_start = datetime.datetime.strptime(system_start,'%H:%M')
if system_date == None:
dt_system_date = datetime.datetime.now()
else:
dt_system_date = datetime.datetime.strptime(system_date,'%Y-%m-%d')
hour = get_str(dt_system_start.hour)
minute = get_str(dt_system_start.minute)
second = get_str(dt_system_start.second)
year = get_str(dt_system_date.year)
month = get_str(dt_system_date.month)
day = get_str(dt_system_date.day)
out_date = '{}-{}-{}'.format(year,month,day)
out_time = '{}:{}:{}'.format(hour,minute,second)
return out_date, out_time
# helper function to create time folders in directory
def get_time_folder(base_dir,system_start,system_date=None,time_level='day',setup=True):
if system_date == None:
dt_system_date = datetime.datetime.now()
dt_system_start = datetime.datetime.strptime(system_start,'%H:%M')
else:
dt_system_date = datetime.datetime.strptime(system_date,'%Y-%m-%d')
dt_system_start = datetime.datetime.strptime(system_start,'%H:%M')
year = str(dt_system_date.year)
month = str(dt_system_date.month)
day = str(dt_system_date.day)
hour = str(dt_system_start.hour)
minute = str(dt_system_start.minute)
year_folder = base_dir + '{}/'.format(year)
month_folder = year_folder + '{}/'.format(month)
day_folder = month_folder + '{}/'.format(day)
if time_level == 'min':
time_folder = day_folder + '{}_{}/'.format(hour,minute)
time_string = '{}-{}-{}_{}-{}'.format(year,month,day,hour,minute)
elif time_level == 'hr':
time_folder = day_folder + '{}/'.format(hour)
time_string = '{}-{}-{}_{}'.format(year,month,day,hour)
elif time_level == 'day':
time_folder = day_folder
time_string = '{}-{}-{}'.format(year,month,day)
if setup:
create_dir(year_folder)
create_dir(month_folder)
create_dir(day_folder)
create_dir(time_folder)
return time_folder, time_string
# process to setup time folders
def time_folders_setup(webcam_dir,system_start,system_date=None,time_level='day',setup=True):
# get time folders
time_folder, _ = get_time_folder(webcam_dir,system_start,system_date=system_date,time_level=time_level,setup=setup)
# obtain output folders
video_store_folder = time_folder + 'video_store'
video_alphapose_folder = time_folder + 'video_alphapose/'
# obtain info folders
info_dir = time_folder + 'info/'
video_info_folder = info_dir + 'video_info/'
# create folders
if setup:
create_dir(video_store_folder)
#create_dir(video_alphapose_folder)
#create_dir(info_dir)
#create_dir(video_info_folder)
return video_store_folder, video_alphapose_folder,info_dir,video_info_folder
# helper function to convert video
def convert_video(input_video,output_video,new_resolution=None,new_fps=None):
old_video = '"{}"'.format(input_video)
new_video = '"{}"'.format(output_video)
# convert video to new resolution and new fps
if new_resolution!=None and new_fps!=None:
raise Exception('Only change resolution or fps!')
# convert video to new resolution
elif new_resolution!=None and new_fps==None:
command_line = 'ffmpeg -i {} -preset ultrafast -copyts -vf scale={}:{} {}'.format(old_video,new_resolution[0],new_resolution[1],new_video)
run_command(command_line)
# convert video to new fps
elif new_resolution==None and new_fps!=None:
command_line = 'ffmpeg -i {} -preset ultrafast -copyts -vf fps={} {}'.format(old_video,new_fps,new_video)
run_command(command_line)
# convert video to new codec
elif new_resolution==None and new_fps==None:
command_line = 'ffmpeg -i {} -preset ultrafast -copyts {}'.format(old_video,new_video)
run_command(command_line)
# helper function to convert store video
def convert_store_video(target_video,video_id,video_store_folder):
# convert raw video to store video
store_video = '{}{}.mp4'.format(video_store_folder,video_id)
convert_video(target_video,store_video)
# remove raw video
os.remove(target_video)
return store_video
# helper function to convert alphapose video
def convert_alphapose_video(target_video,video_id,video_alphapose_folder,video_info_folder,df_webcam_new,df_image_timestamps):
# copy df
f_df_webcam_new = df_webcam_new.copy()
f_df_image_timestamps = df_image_timestamps.copy()
# convert video for alphapose process
alphapose_video_temp = '{}{}_temp.mp4'.format(video_alphapose_folder,video_id)
convert_video(target_video,alphapose_video_temp,new_resolution=[1920,1080])
alphapose_video = '{}{}.mp4'.format(video_alphapose_folder,video_id)
convert_video(alphapose_video_temp,alphapose_video,new_fps=15)
os.remove(alphapose_video_temp)
# extract video information from newly created alphapose video
video_info_out = '{}{}_raw_info.csv'.format(video_info_folder,video_id)
alphapose_video = '"{}{}.mp4"'.format(video_alphapose_folder,video_id)
command_line = 'ffprobe -v error -hide_banner -print_format csv -show_entries stream=width,height,avg_frame_rate,start_time,duration,nb_frames {}'.format(alphapose_video)
run_command_out(command_line,video_info_out)
df_video_info = pd.read_csv(video_info_out,header=None)
width = df_video_info[1].values[0]
height = df_video_info[2].values[0]
fps = eval(df_video_info[3].values[0])
start_time = timestamp_format(datetime.datetime.strptime(convert_unix(df_video_info[4].values[0]),'%Y-%m-%d %H:%M:%S.%f'))
end_time = timestamp_format(datetime.datetime.strptime(convert_unix(df_video_info[5].values[0]),'%Y-%m-%d %H:%M:%S.%f'))
no_frames = df_video_info[6].values[0]
f_df_webcam_new = f_df_webcam_new.append({'video_id': video_id,
'video_path': alphapose_video,
'no_of_images':no_frames,
'start_time':start_time,
'end_time':end_time,
'fps':fps,
'image_width':width,
'image_height':height},ignore_index=True)
# extract timestamps for each frame
frame_ts_out = '{}{}_raw_frame_ts.csv'.format(video_info_folder,video_id)
command_line = 'ffprobe -v error -hide_banner -print_format csv -show_entries frame=best_effort_timestamp_time {}'.format(alphapose_video)
run_command_out(command_line,frame_ts_out)
df_frame_ts_out = pd.read_csv(frame_ts_out,header=None)
for i, row in df_frame_ts_out.iterrows():
timestamp = timestamp_format(datetime.datetime.strptime(convert_unix(row[1]),'%Y-%m-%d %H:%M:%S.%f'))
f_df_image_timestamps = f_df_image_timestamps.append({'video_id':video_id,
'video_path': alphapose_video,
'image_no':i,
'timestamp':timestamp},ignore_index=True)
# remove unwanted files
os.remove(video_info_out)
os.remove(frame_ts_out)
return f_df_webcam_new, f_df_image_timestamps
# process webcam information
def webcam_post_process(f_webcam_dir,convert_store=False,convert_alphapose=False):
def get_str(dt_subobject):
out = str(dt_subobject)
if len(out) == 1:
out = '0' + out
return out
# obtain process time
process_date, process_time = get_time()
dt_process_time = datetime.datetime.strptime('{}_{}'.format(process_date,process_time),'%Y-%m-%d_%H:%M:%S')
# create main folders
video_raw_folder = f_webcam_dir + 'video_raw/'
video_store_folder = f_webcam_dir + 'video_store/'
video_alphapose_folder = f_webcam_dir + 'video_alphapose/'
info_dir = f_webcam_dir + 'info/'
video_info_folder = info_dir + 'video_info/'
create_dir(video_store_folder)
#create_dir(video_alphapose_folder)
#create_dir(info_dir)
#create_dir(video_info_folder)
# create dataframes
df_webcam_new = pd.DataFrame(columns=['video_id','video_path','no_of_images','start_time','end_time','fps','image_width','image_height'])
df_image_timestamps = pd.DataFrame(columns=['video_id','video_path','image_no','timestamp'])
# obtain videos in video raw folder
raw_videos = sorted(glob.glob(video_raw_folder+'*.mp4'))
for raw_video in raw_videos:
# obtain video information
video_id = raw_video.split('/')[-1].split('.')[0]
dt_video_time = datetime.datetime.strptime(video_id.split('_')[-1],'%Y-%m-%d-%H-%M-%S')
time_diff = (dt_process_time - dt_video_time).total_seconds() / 60
# only process raw videos that were recorded at least 15 minutes before
if time_diff > 15:
print('\nStarting webcam post processing for {}'.format(video_id))
# set up time folders
#video_store_folder,video_alphapose_folder,info_dir,video_info_folder = time_folders_setup(f_webcam_dir,'{}:{}'.format(get_str(dt_video_time.hour),get_str(dt_video_time.minute)),system_date='{}-{}-{}'.format(get_str(dt_video_time.year),get_str(dt_video_time.month),get_str(dt_video_time.day)),time_level='day',setup=True)
# convert raw video to store video
if convert_store:
store_video = convert_store_video(raw_video,video_id,video_store_folder)
else:
# move raw video to store folder
store_video = '{}{}.mp4'.format(video_store_folder,video_id)
os.rename(raw_video, store_video)
# convert store video to alphapose
if convert_alphapose:
df_webcam_new, df_image_timestamps = convert_alphapose_video(store_video,video_id,video_alphapose_folder,video_info_folder,df_webcam_new,df_image_timestamps)
# save
if len(df_webcam_new) != 0:
df_webcam_new.to_csv(video_info_folder+'{}_info.csv'.format(process_time),index=0)
if len(df_image_timestamps) != 0:
df_image_timestamps.to_csv(video_info_folder+'{}_frame_ts.csv'.format(process_time),index=0)
print('\nEnding webcam post processing for {} at {}'.format(camera_id,process_time))
def start_post_process(f_webcam_dir):
# schedule jobs
schedule.every(15).minutes.do(webcam_post_process,f_webcam_dir=f_webcam_dir)
# start scheduler
try:
while True:
schedule.run_pending()
time.sleep(1)
except KeyboardInterrupt:
print('\nEnding scheduler...')
"""----------------------------- options -----------------------------"""
parser = argparse.ArgumentParser(description='Webcam Post Processing')
parser.add_argument('--station', type=int,
help='id for station')
parser.add_argument('--webcam', type=int, default=0,
help='id for webcam')
parser.add_argument('--webcam_dir', type=str, default='../outputs/',
help='location of webcam drive')
args = parser.parse_args()
if __name__ == "__main__":
# create necessary variables
station_id = args.station
webcam = int(args.webcam)
camera_id = '{}_{}'.format(args.station,args.webcam)
code_dir = os.getcwd() +'/'
os.chdir(args.webcam_dir)
webcam_dir = os.getcwd() +'/'
os.chdir(code_dir)
# start webcam post process
start_post_process(webcam_dir)
| 14,294 | 14,294 | 0.651392 | 1,879 | 14,294 | 4.637041 | 0.131453 | 0.016642 | 0.017445 | 0.002755 | 0.47894 | 0.41088 | 0.324343 | 0.284403 | 0.274303 | 0.225984 | 0 | 0.00529 | 0.232895 | 14,294 | 1 | 14,294 | 14,294 | 0.78933 | 0.125787 | 0 | 0.25 | 0 | 0.004237 | 0.108552 | 0.011558 | 0 | 0 | 0 | 0 | 0 | 1 | 0.067797 | false | 0.004237 | 0.038136 | 0 | 0.15678 | 0.029661 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6c68df9c3bfd6226474cdab1ec85fa592e8cb724 | 86 | py | Python | pydis_site/apps/home/models/__init__.py | Transfusion/site | 6992491f8c5f074e17c34d09553a715425112652 | [
"MIT"
] | 700 | 2018-11-17T15:56:51.000Z | 2022-03-30T22:53:17.000Z | pydis_site/apps/home/models/__init__.py | Transfusion/site | 6992491f8c5f074e17c34d09553a715425112652 | [
"MIT"
] | 542 | 2018-11-17T13:39:42.000Z | 2022-03-31T11:24:00.000Z | pydis_site/apps/home/models/__init__.py | Transfusion/site | 6992491f8c5f074e17c34d09553a715425112652 | [
"MIT"
] | 178 | 2018-11-21T09:06:56.000Z | 2022-03-31T07:43:28.000Z | from .repository_metadata import RepositoryMetadata
__all__ = ["RepositoryMetadata"]
| 21.5 | 51 | 0.837209 | 7 | 86 | 9.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093023 | 86 | 3 | 52 | 28.666667 | 0.858974 | 0 | 0 | 0 | 0 | 0 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6c743e52f2d9946f3f53bcf759937547a6327096 | 185 | py | Python | osnaptest/__init__.py | jamesabel/osnaptest | 5f46a02bcd12b528e967be9546d406f849200c0c | [
"MIT"
] | null | null | null | osnaptest/__init__.py | jamesabel/osnaptest | 5f46a02bcd12b528e967be9546d406f849200c0c | [
"MIT"
] | null | null | null | osnaptest/__init__.py | jamesabel/osnaptest | 5f46a02bcd12b528e967be9546d406f849200c0c | [
"MIT"
] | null | null | null |
__application_name__ = 'osnaptest'
__version__ = '0.0.1'
__author__ = 'abel'
__python_version__ = '3.6.3'
from .logger import init_logger, get_logger
from .osnaptest import osnaptest
| 20.555556 | 43 | 0.772973 | 25 | 185 | 4.92 | 0.64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 0.124324 | 185 | 8 | 44 | 23.125 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6665d1b57456151478ab8cb4440454c753daf6d3 | 114 | py | Python | c__16.py | fhansmann/coding-challenges | eebb37565c72e05b77383c24e8273a1e4019b58e | [
"MIT"
] | null | null | null | c__16.py | fhansmann/coding-challenges | eebb37565c72e05b77383c24e8273a1e4019b58e | [
"MIT"
] | null | null | null | c__16.py | fhansmann/coding-challenges | eebb37565c72e05b77383c24e8273a1e4019b58e | [
"MIT"
] | null | null | null | import math
numbers = input())
x = [sqrt(i) for i in numbers.split(",") if int(i)%2!=0)]
print(",".join(numbers))
| 22.8 | 57 | 0.614035 | 20 | 114 | 3.5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020202 | 0.131579 | 114 | 4 | 58 | 28.5 | 0.686869 | 0 | 0 | 0 | 0 | 0 | 0.017544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.25 | null | null | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66660f5625b8225bd3b4327c7fad77662a4497eb | 3,243 | py | Python | blaze/idx.py | davidfischer/blaze-core | 19b55ed469aec742fd871b959115a3d87a89acb9 | [
"BSD-2-Clause"
] | 1 | 2015-01-02T18:16:07.000Z | 2015-01-02T18:16:07.000Z | blaze/idx.py | davidfischer/blaze-core | 19b55ed469aec742fd871b959115a3d87a89acb9 | [
"BSD-2-Clause"
] | null | null | null | blaze/idx.py | davidfischer/blaze-core | 19b55ed469aec742fd871b959115a3d87a89acb9 | [
"BSD-2-Clause"
] | null | null | null | from abc import ABCMeta
from numbers import Integral
from collections import Set, Mapping, Sequence
from itertools import count
from datashape import Fixed, dynamic
from numpy import searchsorted, lexsort
"""
An index describes how we map the entire "space" of indexer objects to
the range of storage blocks that comprise the NDArray.
"""
#------------------------------------------------------------------------
# Space
#------------------------------------------------------------------------
# The unordered conglomeration of spaces that comprise a indexable
# object. This is endowed with structure from the parent object
# (NDArray, NDTable). it can be iterated over but has no intrinsic
# order. It merely holds references to the spaces that the charts of
# indexes use can dig into when given high-level coordinate objects.
class Space(Set):
"""
A bag of subspaces with no notion of ordering or dimension.
"""
def __init__(self, *subspaces):
self.subspaces = subspaces
def __contains__(self, other):
return other in self.subspaces
def __iter__(self):
return iter(self.subspaces)
def __len__(self):
return len(self.subspaces)
def __repr__(self):
out = ''
for space in self.subspaces:
out += 'Subspace: %r\n' % space
return out
class Subspace(object):
def __init__(self, underlying):
self.underlying = underlying
def size(self, ntype):
# TODO: rethink this
itemsize = ntype.size()
if isinstance(itemsize, Integral):
return Fixed(self.underlying.calculate(itemsize))
else:
return dynamic
def __repr__(self):
return repr(self.underlying)
# =======
# Indexes
# =======
class Index(object):
__metaclass__ = ABCMeta
ordered = False
monotonic = False
injective = True
def as_contigious(self):
pass
def as_strided(self):
pass
def as_stream(self):
pass
def __or__(self, other):
return self.union(self, other)
def union(self, other):
return
@classmethod
def __subclasshook__(cls, other):
"""
ABC Magic so that the user doesn't need to subclass Index
in order to make a custom one.
"""
if cls is Index:
# Sequence of tuples kind
if isinstance(other, Sequence):
return True
# Dictionary mapping to parameters of subspaces
# (i.e. filenames, pointers, DDFS tags )
elif isinstance(other, Mapping):
return True
# Arbitrary logic
elif hasattr(other, '__index__'):
return True
raise NotImplemented
class AutoIndex(Index):
"""
Take a collection of subspaces and just create the outer
index by enumerating them.
"""
ordered = True
monotonic = True
injective = True
def __init__(self, shape, space):
self.shape = shape
self.space = space
self.mapping = dict(enumerate(space.subspaces))
@property
def start(self):
return self.mapping[0]
@property
def end(self):
return self.mapping[1]
| 24.022222 | 73 | 0.596053 | 367 | 3,243 | 5.128065 | 0.446866 | 0.041445 | 0.017535 | 0.013815 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000863 | 0.28523 | 3,243 | 134 | 74 | 24.201493 | 0.811044 | 0.270429 | 0 | 0.171429 | 0 | 0 | 0.010688 | 0 | 0 | 0 | 0 | 0.007463 | 0 | 1 | 0.242857 | false | 0.042857 | 0.085714 | 0.114286 | 0.685714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
666c6f2505182894265eb7ccfa4eda5a30c1cec6 | 30,687 | py | Python | exceltypes/__init__.py | pyxll/exceltypes | 35c19f198084531f5582b47c02f456811d0017c8 | [
"MIT"
] | 9 | 2016-12-15T13:47:11.000Z | 2021-05-13T03:01:05.000Z | exceltypes/__init__.py | pyxll/exceltypes | 35c19f198084531f5582b47c02f456811d0017c8 | [
"MIT"
] | null | null | null | exceltypes/__init__.py | pyxll/exceltypes | 35c19f198084531f5582b47c02f456811d0017c8 | [
"MIT"
] | 7 | 2016-05-04T21:15:57.000Z | 2020-11-03T21:52:38.000Z | # Auto-generated by C:/github/tonyroberts/exceltypes/tools/makeinit.py
from .gen_py._00020813_0000_0000_C000_000000000046x0x1x9 import (
Constants,
XlAboveBelow,
XlActionType,
XlAllocation,
XlAllocationMethod,
XlAllocationValue,
XlApplicationInternational,
XlApplyNamesOrder,
XlArabicModes,
XlArrangeStyle,
XlArrowHeadLength,
XlArrowHeadStyle,
XlArrowHeadWidth,
XlAutoFillType,
XlAutoFilterOperator,
XlAxisCrosses,
XlAxisGroup,
XlAxisType,
XlBackground,
XlBarShape,
XlBinsType,
XlBorderWeight,
XlBordersIndex,
XlBuiltInDialog,
XlCVError,
XlCalcFor,
XlCalcMemNumberFormatType,
XlCalculatedMemberType,
XlCalculation,
XlCalculationInterruptKey,
XlCalculationState,
XlCategoryLabelLevel,
XlCategorySortOrder,
XlCategoryType,
XlCellChangedState,
XlCellInsertionMode,
XlCellType,
XlChartElementPosition,
XlChartGallery,
XlChartItem,
XlChartLocation,
XlChartPicturePlacement,
XlChartPictureType,
XlChartSplitType,
XlChartType,
XlCheckInVersionType,
XlClipboardFormat,
XlCmdType,
XlColorIndex,
XlColumnDataType,
XlCommandUnderlines,
XlCommentDisplayMode,
XlConditionValueTypes,
XlConnectionType,
XlConsolidationFunction,
XlContainsOperator,
XlCopyPictureFormat,
XlCorruptLoad,
XlCreator,
XlCredentialsMethod,
XlCubeFieldSubType,
XlCubeFieldType,
XlCutCopyMode,
XlDVAlertStyle,
XlDVType,
XlDataBarAxisPosition,
XlDataBarBorderType,
XlDataBarFillType,
XlDataBarNegativeColorType,
XlDataLabelPosition,
XlDataLabelSeparator,
XlDataLabelsType,
XlDataSeriesDate,
XlDataSeriesType,
XlDeleteShiftDirection,
XlDirection,
XlDisplayBlanksAs,
XlDisplayDrawingObjects,
XlDisplayUnit,
XlDupeUnique,
XlDynamicFilterCriteria,
XlEditionFormat,
XlEditionOptionsOption,
XlEditionType,
XlEnableCancelKey,
XlEnableSelection,
XlEndStyleCap,
XlErrorBarDirection,
XlErrorBarInclude,
XlErrorBarType,
XlErrorChecks,
XlFileAccess,
XlFileFormat,
XlFileValidationPivotMode,
XlFillWith,
XlFilterAction,
XlFilterAllDatesInPeriod,
XlFilterStatus,
XlFindLookIn,
XlFixedFormatQuality,
XlFixedFormatType,
XlForecastAggregation,
XlForecastChartType,
XlForecastDataCompletion,
XlFormControl,
XlFormatConditionOperator,
XlFormatConditionType,
XlFormatFilterTypes,
XlFormulaLabel,
XlFormulaVersion,
XlGenerateTableRefs,
XlGeoMappingLevel,
XlGeoProjectionType,
XlGradientFillType,
XlGradientStopPositionType,
XlHAlign,
XlHebrewModes,
XlHighlightChangesTime,
XlHtmlType,
XlIMEMode,
XlIcon,
XlIconSet,
XlImportDataAs,
XlInsertFormatOrigin,
XlInsertShiftDirection,
XlLayoutFormType,
XlLayoutRowType,
XlLegendPosition,
XlLineStyle,
XlLink,
XlLinkInfo,
XlLinkInfoType,
XlLinkStatus,
XlLinkType,
XlLinkedDataTypeState,
XlListConflict,
XlListDataType,
XlListObjectSourceType,
XlLocationInTable,
XlLookAt,
XlLookFor,
XlMSApplication,
XlMailSystem,
XlMarkerStyle,
XlMeasurementUnits,
XlModelChangeSource,
XlMouseButton,
XlMousePointer,
XlOLEType,
XlOLEVerb,
XlOartHorizontalOverflow,
XlOartVerticalOverflow,
XlObjectSize,
XlOrder,
XlOrientation,
XlPTSelectionMode,
XlPageBreak,
XlPageBreakExtent,
XlPageOrientation,
XlPaperSize,
XlParameterDataType,
XlParameterType,
XlParentDataLabelOptions,
XlPasteSpecialOperation,
XlPasteType,
XlPattern,
XlPhoneticAlignment,
XlPhoneticCharacterType,
XlPictureAppearance,
XlPictureConvertorType,
XlPieSliceIndex,
XlPieSliceLocation,
XlPivotCellType,
XlPivotConditionScope,
XlPivotFieldCalculation,
XlPivotFieldDataType,
XlPivotFieldOrientation,
XlPivotFieldRepeatLabels,
XlPivotFilterType,
XlPivotFormatType,
XlPivotLineType,
XlPivotTableMissingItems,
XlPivotTableSourceType,
XlPivotTableVersionList,
XlPlacement,
XlPlatform,
XlPortugueseReform,
XlPrintErrors,
XlPrintLocation,
XlPriority,
XlPropertyDisplayedIn,
XlProtectedViewCloseReason,
XlProtectedViewWindowState,
XlPublishToDocsDisclosureScope,
XlPublishToPBINameConflictAction,
XlPublishToPBIPublishType,
XlQueryType,
XlQuickAnalysisMode,
XlRangeAutoFormat,
XlRangeValueDataType,
XlReferenceStyle,
XlReferenceType,
XlRegionLabelOptions,
XlRemoveDocInfoType,
XlRgbColor,
XlRobustConnect,
XlRoutingSlipDelivery,
XlRoutingSlipStatus,
XlRowCol,
XlRunAutoMacro,
XlSaveAction,
XlSaveAsAccessMode,
XlSaveConflictResolution,
XlScaleType,
XlSearchDirection,
XlSearchOrder,
XlSearchWithin,
XlSeriesColorGradientStyle,
XlSeriesNameLevel,
XlSheetType,
XlSheetVisibility,
XlSizeRepresents,
XlSlicerCacheType,
XlSlicerCrossFilterType,
XlSlicerSort,
XlSmartTagControlType,
XlSmartTagDisplayMode,
XlSortDataOption,
XlSortMethod,
XlSortMethodOld,
XlSortOn,
XlSortOrder,
XlSortOrientation,
XlSortType,
XlSourceType,
XlSpanishModes,
XlSparkScale,
XlSparkType,
XlSparklineRowCol,
XlSpeakDirection,
XlSpecialCellsValue,
XlStdColorScale,
XlSubscribeToFormat,
XlSubtototalLocationType,
XlSummaryColumn,
XlSummaryReportType,
XlSummaryRow,
XlTabPosition,
XlTableStyleElementType,
XlTextParsingType,
XlTextQualifier,
XlTextVisualLayoutType,
XlThemeColor,
XlThemeFont,
XlThreadMode,
XlTickLabelOrientation,
XlTickLabelPosition,
XlTickMark,
XlTimePeriods,
XlTimeUnit,
XlTimelineLevel,
XlToolbarProtection,
XlTopBottom,
XlTotalsCalculation,
XlTrendlineType,
XlUnderlineStyle,
XlUpdateLinks,
XlVAlign,
XlValueSortOrder,
XlWBATemplate,
XlWebFormatting,
XlWebSelectionType,
XlWindowState,
XlWindowType,
XlWindowView,
XlXLMMacroType,
XlXmlExportResult,
XlXmlImportResult,
XlXmlLoadOption,
XlYesNoGuess,
AboveAverage,
Action,
Actions,
AddIn,
AddIns,
AddIns2,
Adjustments,
AllowEditRange,
AllowEditRanges,
AppEvents,
Arc,
Arcs,
Areas,
Author,
AutoCorrect,
AutoFilter,
AutoRecover,
Axes,
Axis,
AxisTitle,
Border,
Borders,
Button,
Buttons,
CalculatedFields,
CalculatedItems,
CalculatedMember,
CalculatedMembers,
CalloutFormat,
CategoryCollection,
CellFormat,
Characters,
ChartArea,
ChartCategory,
ChartColorFormat,
ChartEvents,
ChartFillFormat,
ChartFormat,
ChartGroup,
ChartGroups,
ChartObject,
ChartObjects,
ChartSeriesGradientStopData,
ChartTitle,
ChartView,
Charts,
CheckBox,
CheckBoxes,
ColorFormat,
ColorScale,
ColorScaleCriteria,
ColorScaleCriterion,
ColorStop,
ColorStops,
Comment,
CommentThreaded,
Comments,
CommentsThreaded,
ConditionValue,
Connections,
ConnectorFormat,
ControlFormat,
Corners,
CubeField,
CubeFields,
CustomProperties,
CustomProperty,
CustomView,
CustomViews,
DataBarBorder,
DataFeedConnection,
DataLabel,
DataLabels,
DataTable,
Databar,
DefaultPivotTableLayoutOptions,
DefaultWebOptions,
Diagram,
DiagramNode,
DiagramNodeChildren,
DiagramNodes,
Dialog,
DialogFrame,
DialogSheet,
DialogSheetView,
DialogSheets,
Dialogs,
DisplayFormat,
DisplayUnitLabel,
DocEvents,
DownBars,
Drawing,
DrawingObjects,
Drawings,
DropDown,
DropDowns,
DropLines,
EditBox,
EditBoxes,
Error,
ErrorBars,
ErrorCheckingOptions,
Errors,
FileExportConverter,
FileExportConverters,
FillFormat,
Filter,
Filters,
Floor,
Font,
FormatColor,
FormatCondition,
FormatConditions,
FreeformBuilder,
FullSeriesCollection,
Graphic,
Gridlines,
GroupBox,
GroupBoxes,
GroupObject,
GroupObjects,
GroupShapes,
HPageBreak,
HPageBreaks,
HeaderFooter,
HiLoLines,
Hyperlink,
Hyperlinks,
IAboveAverage,
IAction,
IActions,
IAddIn,
IAddIns,
IAddIns2,
IAllowEditRange,
IAllowEditRanges,
IAppEvents,
IArc,
IArcs,
IAreas,
IAuthor,
IAutoCorrect,
IAutoFilter,
IAutoRecover,
IAxes,
IAxis,
IAxisTitle,
IBorder,
IBorders,
IButton,
IButtons,
ICalculatedFields,
ICalculatedItems,
ICalculatedMember,
ICalculatedMembers,
ICanvasShapes,
ICategoryCollection,
ICellFormat,
ICharacters,
IChartArea,
IChartCategory,
IChartColorFormat,
IChartEvents,
IChartFillFormat,
IChartFormat,
IChartGroup,
IChartGroups,
IChartObject,
IChartObjects,
IChartSeriesGradientStopData,
IChartTitle,
IChartView,
ICharts,
ICheckBox,
ICheckBoxes,
IColorScale,
IColorScaleCriteria,
IColorScaleCriterion,
IColorStop,
IColorStops,
IComment,
ICommentThreaded,
IComments,
ICommentsThreaded,
IConditionValue,
IConnections,
IConnectorFormat,
IControlFormat,
ICorners,
ICustomProperties,
ICustomProperty,
ICustomView,
ICustomViews,
IDataBarBorder,
IDataFeedConnection,
IDataLabel,
IDataLabels,
IDataTable,
IDatabar,
IDefaultPivotTableLayoutOptions,
IDiagram,
IDialog,
IDialogFrame,
IDialogSheet,
IDialogSheetView,
IDialogSheets,
IDialogs,
IDisplayFormat,
IDisplayUnitLabel,
IDocEvents,
IDownBars,
IDrawing,
IDrawingObjects,
IDrawings,
IDropDown,
IDropDowns,
IDropLines,
IDummy,
IEditBox,
IEditBoxes,
IError,
IErrorBars,
IErrorCheckingOptions,
IErrors,
IFileExportConverter,
IFileExportConverters,
IFilter,
IFilters,
IFloor,
IFont,
IFormatColor,
IFormatCondition,
IFormatConditions,
IFreeformBuilder,
IFullSeriesCollection,
IGraphic,
IGridlines,
IGroupBox,
IGroupBoxes,
IGroupObject,
IGroupObjects,
IGroupShapes,
IHPageBreak,
IHPageBreaks,
IHeaderFooter,
IHiLoLines,
IHyperlink,
IHyperlinks,
IIcon,
IIconCriteria,
IIconCriterion,
IIconSet,
IIconSetCondition,
IIconSets,
IInterior,
ILabel,
ILabels,
ILeaderLines,
ILegend,
ILegendEntries,
ILegendEntry,
ILegendKey,
ILine,
ILinearGradient,
ILines,
ILinkFormat,
IListBox,
IListBoxes,
IListColumn,
IListColumns,
IListDataFormat,
IListObject,
IListObjects,
IListRow,
IListRows,
IMailer,
IMenu,
IMenuBar,
IMenuBars,
IMenuItem,
IMenuItems,
IMenus,
IModel,
IModelChanges,
IModelColumnChange,
IModelColumnChanges,
IModelColumnName,
IModelColumnNames,
IModelConnection,
IModelFormatBoolean,
IModelFormatCurrency,
IModelFormatDate,
IModelFormatDecimalNumber,
IModelFormatGeneral,
IModelFormatPercentageNumber,
IModelFormatScientificNumber,
IModelFormatWholeNumber,
IModelMeasure,
IModelMeasureName,
IModelMeasureNames,
IModelMeasures,
IModelRelationship,
IModelRelationships,
IModelTable,
IModelTableColumn,
IModelTableColumns,
IModelTableNameChange,
IModelTableNameChanges,
IModelTableNames,
IModelTables,
IModule,
IModuleView,
IModules,
IMultiThreadedCalculation,
IName,
INamedSheetView,
INamedSheetViewCollection,
INames,
INegativeBarFormat,
IODBCConnection,
IODBCError,
IODBCErrors,
IOLEDBConnection,
IOLEDBError,
IOLEDBErrors,
IOLEFormat,
IOLEObjectEvents,
IOLEObjects,
IOptionButton,
IOptionButtons,
IOutline,
IOval,
IOvals,
IPage,
IPageSetup,
IPages,
IPane,
IPanes,
IParameter,
IParameters,
IPhonetic,
IPhonetics,
IPicture,
IPictures,
IPivotAxis,
IPivotCache,
IPivotCaches,
IPivotCell,
IPivotField,
IPivotFields,
IPivotFilter,
IPivotFilters,
IPivotFormula,
IPivotFormulas,
IPivotItem,
IPivotItemList,
IPivotItems,
IPivotLayout,
IPivotLine,
IPivotLineCells,
IPivotLines,
IPivotTable,
IPivotTableChangeList,
IPivotTables,
IPivotValueCell,
IPlotArea,
IPoint,
IPoints,
IProtectedViewWindow,
IProtectedViewWindows,
IProtection,
IPublishObjects,
IPublishedDoc,
IPublishedDocs,
IQueries,
IQueryTables,
IQuickAnalysis,
IRTD,
IRTDUpdateEvent,
IRange,
IRanges,
IRecentFile,
IRecentFiles,
IRectangle,
IRectangles,
IRectangularGradient,
IRefreshEvents,
IResearch,
IRoutingSlip,
IRtdServer,
IScenario,
IScenarios,
IScrollBar,
IScrollBars,
ISeries,
ISeriesCollection,
ISeriesGradientStopColorFormat,
ISeriesLines,
IServerViewableItems,
IShape,
IShapeRange,
IShapes,
ISheetViews,
ISlicer,
ISlicerCache,
ISlicerCacheLevel,
ISlicerCacheLevels,
ISlicerCaches,
ISlicerItem,
ISlicerItems,
ISlicerPivotTables,
ISlicers,
ISmartTag,
ISmartTagAction,
ISmartTagActions,
ISmartTagOptions,
ISmartTagRecognizer,
ISmartTagRecognizers,
ISmartTags,
ISort,
ISortField,
ISortFields,
ISoundNote,
ISparkAxes,
ISparkColor,
ISparkHorizontalAxis,
ISparkPoints,
ISparkVerticalAxis,
ISparkline,
ISparklineGroup,
ISparklineGroups,
ISpeech,
ISpellingOptions,
ISpinner,
ISpinners,
IStyle,
IStyles,
ITab,
ITableObject,
ITableStyle,
ITableStyleElement,
ITableStyleElements,
ITableStyles,
ITextBox,
ITextBoxes,
ITextConnection,
ITextFrame,
ITickLabels,
ITimelineState,
ITimelineViewState,
IToolbar,
IToolbarButton,
IToolbarButtons,
IToolbars,
ITop10,
ITrendline,
ITrendlines,
IUniqueValues,
IUpBars,
IUsedObjects,
IUserAccess,
IUserAccessList,
IVPageBreak,
IVPageBreaks,
IValidation,
IValueChange,
IWalls,
IWatch,
IWatches,
IWindow,
IWindows,
IWorkbookConnection,
IWorkbookEvents,
IWorkbookQuery,
IWorksheetDataConnection,
IWorksheetFunction,
IWorksheetView,
IWorksheets,
IXPath,
IXmlDataBinding,
IXmlMap,
IXmlMaps,
IXmlNamespace,
IXmlNamespaces,
IXmlSchema,
IXmlSchemas,
Icon,
IconCriteria,
IconCriterion,
IconSet,
IconSetCondition,
IconSets,
Interior,
Label,
Labels,
LeaderLines,
Legend,
LegendEntries,
LegendEntry,
LegendKey,
Line,
LineFormat,
LinearGradient,
Lines,
LinkFormat,
ListBox,
ListBoxes,
ListColumn,
ListColumns,
ListDataFormat,
ListObject,
ListObjects,
ListRow,
ListRows,
Mailer,
Menu,
MenuBar,
MenuBars,
MenuItem,
MenuItems,
Menus,
Model,
Model3DFormat,
ModelChanges,
ModelColumnChange,
ModelColumnChanges,
ModelColumnName,
ModelColumnNames,
ModelConnection,
ModelFormatBoolean,
ModelFormatCurrency,
ModelFormatDate,
ModelFormatDecimalNumber,
ModelFormatGeneral,
ModelFormatPercentageNumber,
ModelFormatScientificNumber,
ModelFormatWholeNumber,
ModelMeasure,
ModelMeasureName,
ModelMeasureNames,
ModelMeasures,
ModelRelationship,
ModelRelationships,
ModelTable,
ModelTableColumn,
ModelTableColumns,
ModelTableNameChange,
ModelTableNameChanges,
ModelTableNames,
ModelTables,
Module,
ModuleView,
Modules,
MultiThreadedCalculation,
Name,
NamedSheetView,
NamedSheetViewCollection,
Names,
NegativeBarFormat,
ODBCConnection,
ODBCError,
ODBCErrors,
OLEDBConnection,
OLEDBError,
OLEDBErrors,
OLEFormat,
OLEObjectEvents,
OLEObjects,
OptionButton,
OptionButtons,
Outline,
Oval,
Ovals,
Page,
PageSetup,
Pages,
Pane,
Panes,
Parameter,
Parameters,
Phonetic,
Phonetics,
Picture,
PictureFormat,
Pictures,
PivotAxis,
PivotCache,
PivotCaches,
PivotCell,
PivotField,
PivotFields,
PivotFilter,
PivotFilters,
PivotFormula,
PivotFormulas,
PivotItem,
PivotItemList,
PivotItems,
PivotLayout,
PivotLine,
PivotLineCells,
PivotLines,
PivotTable,
PivotTableChangeList,
PivotTables,
PivotValueCell,
PlotArea,
Point,
Points,
ProtectedViewWindow,
ProtectedViewWindows,
Protection,
PublishObject,
PublishObjects,
PublishedDoc,
PublishedDocs,
Queries,
QueryTables,
QuickAnalysis,
RTD,
Range,
Ranges,
RecentFile,
RecentFiles,
Rectangle,
Rectangles,
RectangularGradient,
RefreshEvents,
Research,
RoutingSlip,
Scenario,
Scenarios,
ScrollBar,
ScrollBars,
Series,
SeriesCollection,
SeriesGradientStopColorFormat,
SeriesLines,
ServerViewableItems,
ShadowFormat,
Shape,
ShapeNode,
ShapeNodes,
ShapeRange,
Shapes,
SheetViews,
Sheets,
Slicer,
SlicerCache,
SlicerCacheLevel,
SlicerCacheLevels,
SlicerCaches,
SlicerItem,
SlicerItems,
SlicerPivotTables,
Slicers,
SmartTag,
SmartTagAction,
SmartTagActions,
SmartTagOptions,
SmartTagRecognizer,
SmartTagRecognizers,
SmartTags,
Sort,
SortField,
SortFields,
SoundNote,
SparkAxes,
SparkColor,
SparkHorizontalAxis,
SparkPoints,
SparkVerticalAxis,
Sparkline,
SparklineGroup,
SparklineGroups,
Speech,
SpellingOptions,
Spinner,
Spinners,
Style,
Styles,
Tab,
TableObject,
TableStyle,
TableStyleElement,
TableStyleElements,
TableStyles,
TextBox,
TextBoxes,
TextConnection,
TextEffectFormat,
TextFrame,
TextFrame2,
ThreeDFormat,
TickLabels,
TimelineState,
TimelineViewState,
Toolbar,
ToolbarButton,
ToolbarButtons,
Toolbars,
Top10,
TreeviewControl,
Trendline,
Trendlines,
UniqueValues,
UpBars,
UsedObjects,
UserAccess,
UserAccessList,
VPageBreak,
VPageBreaks,
Validation,
ValueChange,
Walls,
Watch,
Watches,
WebOptions,
Window,
Windows,
WorkbookConnection,
WorkbookEvents,
WorkbookQuery,
Workbooks,
WorksheetDataConnection,
WorksheetFunction,
WorksheetView,
Worksheets,
XPath,
XmlDataBinding,
XmlMap,
XmlMaps,
XmlNamespace,
XmlNamespaces,
XmlSchema,
XmlSchemas,
_Application,
_Chart,
_Global,
_IOLEObject,
_IQueryTable,
_OLEObject,
_QueryTable,
_Workbook,
_Worksheet,
Application,
Chart,
Global,
OLEObject,
QueryTable,
Workbook,
Worksheet
)
from .gen_py._2DF8D04C_5BFA_101B_BDE5_00AA0044DE52x0x2x8 import (
BackstageGroupStyle,
CertificateDetail,
CertificateVerificationResults,
ContentVerificationResults,
DocProperties,
EncryptionCipherMode,
EncryptionProviderDetail,
MailFormat,
MsoAlertButtonType,
MsoAlertCancelType,
MsoAlertDefaultType,
MsoAlertIconType,
MsoAlignCmd,
MsoAnimationType,
MsoAppLanguageID,
MsoArrowheadLength,
MsoArrowheadStyle,
MsoArrowheadWidth,
MsoAssignmentMethod,
MsoAutoShapeType,
MsoAutoSize,
MsoAutomationSecurity,
MsoBackgroundStyleIndex,
MsoBalloonButtonType,
MsoBalloonErrorType,
MsoBalloonType,
MsoBarPosition,
MsoBarProtection,
MsoBarRow,
MsoBarType,
MsoBaselineAlignment,
MsoBevelType,
MsoBlackWhiteMode,
MsoBlogCategorySupport,
MsoBlogImageType,
MsoBroadcastCapabilities,
MsoBroadcastState,
MsoBulletType,
MsoButtonSetType,
MsoButtonState,
MsoButtonStyle,
MsoButtonStyleHidden,
MsoCTPDockPosition,
MsoCTPDockPositionRestrict,
MsoCalloutAngleType,
MsoCalloutDropType,
MsoCalloutType,
MsoCharacterSet,
MsoChartElementType,
MsoChartFieldType,
MsoClipboardFormat,
MsoColorType,
MsoComboStyle,
MsoCommandBarButtonHyperlinkType,
MsoCondition,
MsoConnector,
MsoConnectorType,
MsoContactCardAddressType,
MsoContactCardStyle,
MsoContactCardType,
MsoControlOLEUsage,
MsoControlType,
MsoCustomXMLNodeType,
MsoCustomXMLValidationErrorType,
MsoDateTimeFormat,
MsoDiagramNodeType,
MsoDiagramType,
MsoDistributeCmd,
MsoDocInspectorStatus,
MsoDocProperties,
MsoEditingType,
MsoEncoding,
MsoExtraInfoMethod,
MsoExtrusionColorType,
MsoFarEastLineBreakLanguageID,
MsoFeatureInstall,
MsoFileDialogType,
MsoFileDialogView,
MsoFileFindListBy,
MsoFileFindOptions,
MsoFileFindSortBy,
MsoFileFindView,
MsoFileNewAction,
MsoFileNewSection,
MsoFileType,
MsoFileValidationMode,
MsoFillType,
MsoFilterComparison,
MsoFilterConjunction,
MsoFlipCmd,
MsoFontLanguageIndex,
MsoGradientColorType,
MsoGradientStyle,
MsoGraphicStyleIndex,
MsoHTMLProjectOpen,
MsoHTMLProjectState,
MsoHorizontalAnchor,
MsoHyperlinkType,
MsoIconType,
MsoIodGroup,
MsoLanguageID,
MsoLanguageIDHidden,
MsoLastModified,
MsoLightRigType,
MsoLineCapStyle,
MsoLineDashStyle,
MsoLineFillType,
MsoLineJoinStyle,
MsoLineStyle,
MsoMenuAnimation,
MsoMergeCmd,
MsoMetaPropertyType,
MsoMixedType,
MsoModeType,
MsoMoveRow,
MsoNumberedBulletStyle,
MsoOLEMenuGroup,
MsoOrgChartLayoutType,
MsoOrgChartOrientation,
MsoOrientation,
MsoParagraphAlignment,
MsoPathFormat,
MsoPatternType,
MsoPermission,
MsoPickerField,
MsoPictureColorType,
MsoPictureCompress,
MsoPictureEffectType,
MsoPictureType,
MsoPresetCamera,
MsoPresetExtrusionDirection,
MsoPresetGradientType,
MsoPresetLightingDirection,
MsoPresetLightingSoftness,
MsoPresetMaterial,
MsoPresetTextEffect,
MsoPresetTextEffectShape,
MsoPresetTexture,
MsoPresetThreeDFormat,
MsoPrivacyOptionSetting,
MsoReflectionType,
MsoRelativeNodePosition,
MsoScaleFrom,
MsoScreenSize,
MsoScriptLanguage,
MsoScriptLocation,
MsoSearchIn,
MsoSegmentType,
MsoSensitivityLabelError,
MsoShadowStyle,
MsoShadowType,
MsoShapeStyleIndex,
MsoShapeType,
MsoSharedWorkspaceTaskPriority,
MsoSharedWorkspaceTaskStatus,
MsoSignatureSubset,
MsoSmartArtNodePosition,
MsoSmartArtNodeType,
MsoSoftEdgeType,
MsoSortBy,
MsoSortOrder,
MsoSyncAvailableType,
MsoSyncCompareType,
MsoSyncConflictResolutionType,
MsoSyncErrorType,
MsoSyncEventType,
MsoSyncStatusType,
MsoSyncVersionType,
MsoTabStopType,
MsoTargetBrowser,
MsoTelemetryConsentLevel,
MsoTextCaps,
MsoTextChangeCase,
MsoTextCharWrap,
MsoTextDirection,
MsoTextEffectAlignment,
MsoTextFontAlign,
MsoTextOrientation,
MsoTextRangeInsertPosition,
MsoTextStrike,
MsoTextTabAlign,
MsoTextUnderlineType,
MsoTextureAlignment,
MsoTextureType,
MsoThemeColorIndex,
MsoThemeColorSchemeIndex,
MsoTriState,
MsoVerticalAnchor,
MsoWarpFormat,
MsoWizardActType,
MsoWizardMsgType,
MsoZOrderCmd,
RibbonControlSize,
SignatureDetail,
SignatureLineImage,
SignatureProviderDetail,
SignatureType,
XlAxisCrosses,
XlAxisGroup,
XlAxisType,
XlBarShape,
XlBinsType,
XlBorderWeight,
XlCategoryLabelLevel,
XlCategorySortOrder,
XlCategoryType,
XlChartElementPosition,
XlChartItem,
XlChartOrientation,
XlChartPictureType,
XlChartSplitType,
XlChartType,
XlColorIndex,
XlConstants,
XlDataLabelPosition,
XlDataLabelsType,
XlDisplayBlanksAs,
XlDisplayUnit,
XlEndStyleCap,
XlErrorBarDirection,
XlErrorBarInclude,
XlErrorBarType,
XlGeoMappingLevel,
XlGeoProjectionType,
XlGradientStopPositionType,
XlHAlign,
XlLegendPosition,
XlMarkerStyle,
XlParentDataLabelOptions,
XlPieSliceIndex,
XlPieSliceLocation,
XlPivotFieldOrientation,
XlReadingOrder,
XlRegionLabelOptions,
XlRowCol,
XlScaleType,
XlSeriesColorGradientStyle,
XlSeriesNameLevel,
XlSizeRepresents,
XlTickLabelOrientation,
XlTickLabelPosition,
XlTickMark,
XlTimeUnit,
XlTrendlineType,
XlUnderlineStyle,
XlVAlign,
XlValueSortOrder,
Adjustments,
AnswerWizard,
AnswerWizardFiles,
Assistant,
Axes,
Balloon,
BalloonCheckbox,
BalloonCheckboxes,
BalloonLabel,
BalloonLabels,
BulletFormat2,
COMAddIn,
COMAddIns,
CalloutFormat,
CanvasShapes,
CategoryCollection,
ChartColorFormat,
ChartFillFormat,
ChartFont,
ChartGroups,
ChartPoint,
ColorFormat,
CommandBar,
CommandBarControl,
CommandBarControls,
CommandBarPopup,
ConnectorFormat,
ContactCard,
Crop,
CustomTaskPaneEvents,
CustomXMLNode,
CustomXMLNodes,
CustomXMLPrefixMapping,
CustomXMLPrefixMappings,
CustomXMLSchema,
CustomXMLValidationError,
CustomXMLValidationErrors,
DataPrivacyOptions,
DiagramNode,
DiagramNodeChildren,
DiagramNodes,
DocumentInspector,
DocumentInspectors,
DocumentLibraryVersion,
DocumentLibraryVersions,
DocumentProperties,
DocumentProperty,
EffectParameter,
EffectParameters,
EncryptionProvider,
FileDialog,
FileDialogFilter,
FileDialogFilters,
FileDialogSelectedItems,
FileSearch,
FileTypes,
FillFormat,
Font2,
FoundFiles,
FreeformBuilder,
FullSeriesCollection,
GlowFormat,
GradientStop,
GradientStops,
GridLines,
GroupShapes,
HTMLProject,
HTMLProjectItem,
HTMLProjectItems,
IAccessible,
IAssistance,
IBlogExtensibility,
IBlogPictureExtensibility,
ICTPFactory,
ICommandBarButtonEvents,
ICommandBarComboBoxEvents,
ICommandBarsEvents,
ICustomTaskPaneConsumer,
ICustomXMLPartEvents,
ICustomXMLPartsEvents,
IFind,
IFoundFiles,
ILicAgent,
ILicValidator,
ILicWizExternal,
IMsoAxis,
IMsoAxisTitle,
IMsoBorder,
IMsoCategory,
IMsoCharacters,
IMsoChart,
IMsoChartArea,
IMsoChartData,
IMsoChartFormat,
IMsoChartGroup,
IMsoChartTitle,
IMsoContactCard,
IMsoCorners,
IMsoDataLabel,
IMsoDataLabels,
IMsoDataTable,
IMsoDiagram,
IMsoDispCagNotifySink,
IMsoDisplayUnitLabel,
IMsoDownBars,
IMsoDropLines,
IMsoEServicesDialog,
IMsoEnvelopeVB,
IMsoEnvelopeVBEvents,
IMsoErrorBars,
IMsoFloor,
IMsoHiLoLines,
IMsoHyperlinks,
IMsoInterior,
IMsoLeaderLines,
IMsoLegend,
IMsoLegendKey,
IMsoPlotArea,
IMsoSeries,
IMsoSeriesLines,
IMsoTickLabels,
IMsoTrendline,
IMsoUpBars,
IMsoWalls,
IRibbonControl,
IRibbonExtensibility,
IRibbonUI,
ISensitivityLabel,
ISensitivityLabelEvents,
LabelInfo,
LanguageSettings,
LegendEntries,
LegendEntry,
LineFormat,
MetaProperties,
MetaProperty,
Model3DFormat,
MsoDebugOptions,
MsoDebugOptions_UT,
MsoDebugOptions_UTManager,
MsoDebugOptions_UTRunResult,
MsoDebugOptions_UTs,
NewFile,
ODSOColumn,
ODSOColumns,
ODSOFilter,
ODSOFilters,
OfficeDataSourceObject,
OfficeTheme,
ParagraphFormat2,
Permission,
PickerDialog,
PickerField,
PickerFields,
PickerProperties,
PickerProperty,
PickerResult,
PickerResults,
PictureEffect,
PictureEffects,
PictureFormat,
Points,
PolicyItem,
PropertyTest,
PropertyTests,
ReflectionFormat,
Ruler2,
RulerLevel2,
RulerLevels2,
ScopeFolder,
ScopeFolders,
Script,
Scripts,
SearchFolders,
SearchScope,
SearchScopes,
SensitivityLabelInitInfo,
SensitivityLabelPolicy,
SeriesCollection,
SeriesGradientStopColorFormat,
SeriesGradientStopData,
ServerPolicy,
ShadowFormat,
Shape,
ShapeNode,
ShapeNodes,
ShapeRange,
Shapes,
SharedWorkspace,
SharedWorkspaceFile,
SharedWorkspaceFiles,
SharedWorkspaceFolder,
SharedWorkspaceFolders,
SharedWorkspaceLink,
SharedWorkspaceLinks,
SharedWorkspaceMember,
SharedWorkspaceMembers,
SharedWorkspaceTask,
SharedWorkspaceTasks,
Signature,
SignatureInfo,
SignatureProvider,
SignatureSet,
SignatureSetup,
SmartArt,
SmartArtColor,
SmartArtColors,
SmartArtLayout,
SmartArtLayouts,
SmartArtNode,
SmartArtNodes,
SmartArtQuickStyle,
SmartArtQuickStyles,
SmartDocument,
SoftEdgeFormat,
Sync,
TabStop2,
TabStops2,
TextColumn2,
TextEffectFormat,
TextFrame,
TextFrame2,
TextRange2,
ThemeColor,
ThemeColorScheme,
ThemeEffectScheme,
ThemeFont,
ThemeFontScheme,
ThemeFonts,
ThreeDFormat,
Trendlines,
UserPermission,
WebComponent,
WebComponentFormat,
WebComponentProperties,
WebComponentWindowExternal,
WebPageFont,
WebPageFonts,
WorkflowTask,
WorkflowTasks,
WorkflowTemplate,
WorkflowTemplates,
_CommandBarActiveX,
_CommandBarButton,
_CommandBarButtonEvents,
_CommandBarComboBox,
_CommandBarComboBoxEvents,
_CommandBars,
_CommandBarsEvents,
_CustomTaskPane,
_CustomTaskPaneEvents,
_CustomXMLPart,
_CustomXMLPartEvents,
_CustomXMLParts,
_CustomXMLPartsEvents,
_CustomXMLSchemaCollection,
_IMsoDispObj,
_IMsoOleAccDispObj,
_SensitivityLabelEvents,
CommandBarButton,
CommandBarComboBox,
CommandBars,
CustomTaskPane,
CustomXMLPart,
CustomXMLParts,
CustomXMLSchemaCollection,
MsoEnvelope,
SensitivityLabel
)
| 19.734405 | 70 | 0.696516 | 1,579 | 30,687 | 13.509816 | 0.931602 | 0.000656 | 0.000844 | 0.005907 | 0.004875 | 0.004875 | 0 | 0 | 0 | 0 | 0 | 0.003226 | 0.252583 | 30,687 | 1,554 | 71 | 19.747104 | 0.92684 | 0.002216 | 0 | 0.105738 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.002579 | 0 | 0.002579 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66917665e328dd40dc981016d6afc88393fd5ede | 602 | py | Python | class_method.py | hanwhhanwh/python-test | ac97ae83fc9eac3157ff7dc39d6295bc5b15d589 | [
"MIT"
] | null | null | null | class_method.py | hanwhhanwh/python-test | ac97ae83fc9eac3157ff7dc39d6295bc5b15d589 | [
"MIT"
] | null | null | null | class_method.py | hanwhhanwh/python-test | ac97ae83fc9eac3157ff7dc39d6295bc5b15d589 | [
"MIT"
] | null | null | null | # reference : https://wikidocs.net/16074
class Language:
default_language = "English"
def __init__(self):
self.show = '나의 언어는 ' + self.default_language
@classmethod
def class_my_language(cls):
return cls()
@staticmethod
def static_my_language():
return Language()
def print_language(self):
print(self.show)
class KoreanLanguage(Language):
default_language = "한국어"
a = KoreanLanguage.static_my_language()
b = KoreanLanguage.class_my_language()
a.print_language()
b.print_language()
""" 실행결과 >>>
나의 언어는 English
나의 언어는 한국어
""" | 15.842105 | 53 | 0.669435 | 71 | 602 | 5.422535 | 0.380282 | 0.103896 | 0.119481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010638 | 0.219269 | 602 | 38 | 54 | 15.842105 | 0.808511 | 0.063123 | 0 | 0 | 0 | 0 | 0.03263 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.555556 | 0.222222 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
669288c53790db7eb250864921ca4a1f4d7763d2 | 1,372 | py | Python | kde/plasma/powerdevil/powerdevil.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 14 | 2017-09-04T09:01:03.000Z | 2022-01-04T20:09:00.000Z | kde/plasma/powerdevil/powerdevil.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 14 | 2017-12-15T08:11:22.000Z | 2020-12-29T19:11:13.000Z | kde/plasma/powerdevil/powerdevil.py | KDE/craft-blueprints-kde | 14932d4b95ce0070ab8ae5669411c62ffa304c9b | [
"BSD-2-Clause"
] | 19 | 2017-09-05T19:16:21.000Z | 2020-10-18T12:46:06.000Z | import info
class subinfo(info.infoclass):
def setTargets(self):
self.versionInfo.setDefaultValues()
def setDependencies(self):
self.runtimeDependencies["libs/qt5/qtbase"] = None
self.runtimeDependencies["kde/frameworks/tier1/kconfig"] = None
self.runtimeDependencies["kde/frameworks/tier1/ki18n"] = None
self.runtimeDependencies["kde/frameworks/tier1/kidletime"] = None
self.runtimeDependencies["kde/frameworks/tier1/kdbusaddons"] = None
self.runtimeDependencies["kde/frameworks/tier1/solid"] = None
self.runtimeDependencies["kde/frameworks/tier2/kactivities"] = None
self.runtimeDependencies["kde/frameworks/tier2/kauth"] = None
self.runtimeDependencies["kde/frameworks/tier2/kcrash"] = None
self.runtimeDependencies["kde/frameworks/tier2/kdoctools"] = None
self.runtimeDependencies["kde/frameworks/tier3/kglobalaccel"] = None
self.runtimeDependencies["kde/frameworks/tier3/kio"] = None
self.runtimeDependencies["kde/frameworks/tier3/knotifications"] = None
self.runtimeDependencies["kde/frameworks/tier3/knotifyconfig"] = None
self.runtimeDependencies["kde/plasma/plasma-workspace"] = None
from Package.CMakePackageBase import *
class Package(CMakePackageBase):
def __init__(self):
CMakePackageBase.__init__(self)
| 42.875 | 78 | 0.725219 | 132 | 1,372 | 7.477273 | 0.30303 | 0.349544 | 0.382979 | 0.425532 | 0.592705 | 0.592705 | 0 | 0 | 0 | 0 | 0 | 0.013865 | 0.158892 | 1,372 | 31 | 79 | 44.258065 | 0.841421 | 0 | 0 | 0 | 0 | 0 | 0.309767 | 0.298834 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.083333 | 0 | 0.291667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6697b5eb65d495d1bb1175413b3b29a9daa2873d | 2,169 | py | Python | opfunu/cec/cec2010/utils.py | mcrimi/opfunu | 9c8a074c5dca604acc3ddc7fbf15ef30f57d1756 | [
"Apache-2.0"
] | 1 | 2021-05-25T14:46:21.000Z | 2021-05-25T14:46:21.000Z | opfunu/cec/cec2010/utils.py | HaaLeo/opfunu | 1ff3ecf4b7818a0edd5d92ce5475839fa9477da1 | [
"Apache-2.0"
] | null | null | null | opfunu/cec/cec2010/utils.py | HaaLeo/opfunu | 1ff3ecf4b7818a0edd5d92ce5475839fa9477da1 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 12:31, 20/04/2020 %
# %
# Email: nguyenthieu2102@gmail.com %
# Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 %
# Github: https://github.com/thieunguyen5991 %
#-------------------------------------------------------------------------------------------------------%
import pkg_resources
from pandas import read_csv
from numpy import cos, sqrt, pi, e, exp, sum
CURRENT_PATH = pkg_resources.resource_filename("opfunu", "cec/cec2010/")
SUPPORT_PATH_DATA = pkg_resources.resource_filename("opfunu", "cec/cec2010/support_data/")
def load_shift_data__(data_file=None):
data = read_csv(SUPPORT_PATH_DATA + data_file, delimiter='\s+', index_col=False, header=None)
return data.values.reshape((-1))
def load_matrix_data__(data_file=None):
data = read_csv(SUPPORT_PATH_DATA + data_file, delimiter='\s+', index_col=False, header=None)
return data.values
def f1_sphere__(solution=None):
return sum(solution**2)
def f2_elliptic__(solution=None):
result = 0.0
for i in range(0, len(solution)):
result += (10**6)**(i/(len(solution)-1)) * solution[i]**2
return result
def f3_rastrigin__(solution=None):
return sum(solution ** 2 - 10 * cos(2 * pi * solution) + 10)
def f4_ackley__(solution=None):
return -20 * exp(-0.2 * sqrt(sum(solution ** 2) / len(solution))) - exp(sum(cos(2 * pi * solution)) / len(solution)) + 20 + e
def f5_schwefel__(solution=None):
return sum([ sum(solution[:i])**2 for i in range(0, len(solution))])
def f6_rosenbrock__(solution=None):
result = 0.0
for i in range(len(solution) - 1):
result += 100 * (solution[i] ** 2 - solution[i + 1]) ** 2 + (solution[i] - 1) ** 2
return result | 46.148936 | 129 | 0.516367 | 246 | 2,169 | 4.353659 | 0.365854 | 0.056022 | 0.044818 | 0.058824 | 0.448179 | 0.426704 | 0.370682 | 0.338002 | 0.242764 | 0.184874 | 0 | 0.045455 | 0.26971 | 2,169 | 47 | 130 | 46.148936 | 0.630682 | 0.344859 | 0 | 0.206897 | 0 | 0 | 0.038897 | 0.01768 | 0 | 0 | 0 | 0 | 0 | 1 | 0.275862 | false | 0 | 0.103448 | 0.137931 | 0.655172 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
66a806e3df7c257cb7ab901a971141595512d43c | 1,055 | py | Python | src/the_tale/the_tale/accounts/clans/logic.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | 1 | 2020-04-02T11:51:20.000Z | 2020-04-02T11:51:20.000Z | src/the_tale/the_tale/accounts/clans/logic.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/accounts/clans/logic.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null |
import smart_imports
smart_imports.all()
class ClanInfo(object):
def __init__(self, account):
self.account = account
@utils_decorators.lazy_property
def membership(self):
if self.account.is_authenticated:
return prototypes.MembershipPrototype.get_by_account_id(self.account.id)
@utils_decorators.lazy_property
def clan(self):
if self.membership:
return prototypes.ClanPrototype.get_by_id(self.membership.clan_id)
@utils_decorators.lazy_property
def clan_id(self):
if self.membership:
return self.membership.clan_id
def is_member_of(self, clan):
return self.membership and clan and self.membership.clan_id == clan.id
def is_owner_of(self, clan):
return self.is_member_of(clan) and self.membership.role.is_LEADER
@property
def can_invite(self):
return self.membership and self.membership.role.is_LEADER
@property
def can_remove(self):
return self.membership and self.membership.role.is_LEADER
| 26.375 | 84 | 0.704265 | 138 | 1,055 | 5.144928 | 0.26087 | 0.216901 | 0.112676 | 0.114085 | 0.502817 | 0.330986 | 0.330986 | 0.229577 | 0.229577 | 0.149296 | 0 | 0 | 0.216114 | 1,055 | 39 | 85 | 27.051282 | 0.858525 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.296296 | false | 0 | 0.074074 | 0.148148 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
66ad27fb8a14b6b379babd91d923785bac43555f | 789 | py | Python | Large number reverse calculator.py | EliasL/Happy-number-calculators | 9ce9c481f4cf3d1ca66af8ac28632260a2bda09a | [
"MIT"
] | null | null | null | Large number reverse calculator.py | EliasL/Happy-number-calculators | 9ce9c481f4cf3d1ca66af8ac28632260a2bda09a | [
"MIT"
] | null | null | null | Large number reverse calculator.py | EliasL/Happy-number-calculators | 9ce9c481f4cf3d1ca66af8ac28632260a2bda09a | [
"MIT"
] | null | null | null | import math
# Note, this calculator does not compact
def square(x):
return int(x) * int(x)
def happy(number):
return sum(map(square, list(str(number))))
def findD(n, number, d):
m = 0
if n >= (d**2):
m = math.floor(n/d**2)
print("There are/is "+str(m)+" \""+str(d)+"\"s")
n = n - (d**2 * m)
return n, number
def reverse(n):
i = 0
number = []
n, number = findD(n, number, 9)
n, number = findD(n, number, 8)
n, number = findD(n, number, 7)
n, number = findD(n, number, 6)
n, number = findD(n, number, 5)
n, number = findD(n, number, 4)
n, number = findD(n, number, 3)
n, number = findD(n, number, 2)
n, number = findD(n, number, 1)
while True:
n = int(input("Enter number: "))
reverse(n)
| 19.725 | 56 | 0.538657 | 129 | 789 | 3.294574 | 0.356589 | 0.329412 | 0.282353 | 0.275294 | 0.402353 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024648 | 0.280101 | 789 | 39 | 57 | 20.230769 | 0.723592 | 0.048162 | 0 | 0 | 0 | 0 | 0.050734 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.148148 | false | 0 | 0.037037 | 0.074074 | 0.296296 | 0.037037 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66de2ce3c641a2c536b44ef3333b45bc92d07aea | 283 | py | Python | AP1/strings1.py | GiovannaPazello/Projetos-em-Python | 3cf7edbdf2a2350605a775389f7fe2cc7fe8032e | [
"MIT"
] | null | null | null | AP1/strings1.py | GiovannaPazello/Projetos-em-Python | 3cf7edbdf2a2350605a775389f7fe2cc7fe8032e | [
"MIT"
] | null | null | null | AP1/strings1.py | GiovannaPazello/Projetos-em-Python | 3cf7edbdf2a2350605a775389f7fe2cc7fe8032e | [
"MIT"
] | null | null | null | string = input('Digite a palavra:')
stringSemEspacos = string.replace(' ', '')
stringTodaMinuscula = stringSemEspacos.lower()
stringInvertida = stringTodaMinuscula[::-1]
if stringInvertida == stringTodaMinuscula:
print("É um palíndromo.")
else:
print("Não é um palíndromo.")
| 31.444444 | 46 | 0.734982 | 27 | 283 | 7.703704 | 0.666667 | 0.326923 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004049 | 0.127208 | 283 | 8 | 47 | 35.375 | 0.838057 | 0 | 0 | 0 | 0 | 0 | 0.190813 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd00d74aa6483721cd3718978ea9ae5caed5442f | 165 | py | Python | asci_number.py | sonmezbaris/python-exercises | 949934bde2a78a718fbac76906e888ca24ae4103 | [
"Apache-2.0"
] | null | null | null | asci_number.py | sonmezbaris/python-exercises | 949934bde2a78a718fbac76906e888ca24ae4103 | [
"Apache-2.0"
] | null | null | null | asci_number.py | sonmezbaris/python-exercises | 949934bde2a78a718fbac76906e888ca24ae4103 | [
"Apache-2.0"
] | null | null | null | def result(text):
count=0
for i in range(len(metin)):
if(ord(metin[i])>=65 and ord(metin[i])<=90):
count=count+1
return count
| 23.571429 | 52 | 0.527273 | 26 | 165 | 3.346154 | 0.692308 | 0.183908 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053097 | 0.315152 | 165 | 6 | 53 | 27.5 | 0.716814 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd0a9a0a503fb9bb06c5aee95fc5e1e716f042ad | 4,062 | py | Python | tests/test_store.py | orest-d/liquer | 7a5b5a69cf673b4a849dd2da3050ccd75081e454 | [
"MIT"
] | 3 | 2019-12-10T10:22:36.000Z | 2019-12-12T16:36:11.000Z | tests/test_store.py | orest-d/liquer | 7a5b5a69cf673b4a849dd2da3050ccd75081e454 | [
"MIT"
] | null | null | null | tests/test_store.py | orest-d/liquer | 7a5b5a69cf673b4a849dd2da3050ccd75081e454 | [
"MIT"
] | 2 | 2019-11-14T16:26:52.000Z | 2021-07-26T04:53:54.000Z | import pytest
from liquer.store import *
class TestStore:
@pytest.fixture
def store(self, tmpdir):
store = FileStore(tmpdir)
assert str(tmpdir) in str(store)
return store
def test_file_store_creation(self, store):
assert list(store.keys()) == []
assert store.contains("x") is False
def test_file_store_basic(self, store):
assert list(store.keys()) == []
assert store.contains("a") is False
assert store.contains("a/b") is False
store.store("a/b", b"test", dict(x="xx"))
assert store.contains("a") is True
assert store.contains("a/b") is True
assert store.is_dir("a") is True
assert store.is_dir("a/b") is False
assert store.get_bytes("a/b") == b"test"
assert store.get_metadata("a/b")["x"] == "xx"
assert store.get_metadata("a")["fileinfo"]["is_dir"] == True
assert store.get_metadata("a/b")["fileinfo"]["is_dir"] == False
assert sorted(store.keys()) == ["a", "a/b"]
assert store.listdir("a") == ["b"]
assert store.listdir("") == ["a"]
store.remove("a/b")
assert store.contains("a/b") is False
assert store.listdir("a") == []
store.removedir("a")
assert store.contains("a") is False
assert list(store.keys()) == []
assert store.listdir("") == []
def test_parent_key(self, store):
assert store.parent_key("") == None
assert store.parent_key("a") == ""
assert store.parent_key("a/b") == "a"
class TestMemoryStore(TestStore):
@pytest.fixture
def store(self, tmpdir):
return MemoryStore()
class TestOverlayStore(TestStore):
@pytest.fixture
def store(self, tmpdir):
return OverlayStore(MemoryStore(), MemoryStore())
class TestFileSystemStore(TestStore):
@pytest.fixture
def store(self, tmpdir):
import fs
return FileSystemStore(fs.open_fs("mem://"))
class TestFileStore(TestStore):
@pytest.fixture
def store(self, tmpdir):
return FileStore(tmpdir)
def test_filesystem_path(self, store):
store.store("dir_a/file_b", b"test", dict(x="xx"))
assert store.get_metadata("dir_a/file_b")["x"] == "xx"
assert store.get_metadata("dir_a")["fileinfo"]["is_dir"] == True
assert store.get_metadata("dir_a/file_b")["fileinfo"][
"filesystem_path"
].startswith(str(store.path))
assert store.get_metadata("dir_a/file_b")["fileinfo"][
"filesystem_path"
].endswith("dir_a/file_b")
class TestMountPointStore:
def test_file_store_creation(self):
store = MountPointStore(MemoryStore())
assert list(store.keys()) == []
store.mount("a", MemoryStore())
assert list(store.keys()) == ["a"]
assert store.contains("x") is False
def test_file_store_basic(self):
store = MountPointStore(MemoryStore())
assert list(store.keys()) == []
assert store.contains("a") is False
store.mount("a", MemoryStore())
assert list(store.keys()) == ["a"]
assert store.contains("a") is True
assert store.contains("a/b") is False
store.store("a/b", b"test", dict(x="xx"))
assert store.contains("a") is True
assert store.contains("a/b") is True
assert store.is_dir("a") is True
assert store.is_dir("a/b") is False
assert store.get_bytes("a/b") == b"test"
assert store.get_metadata("a/b")["x"] == "xx"
assert store.get_metadata("a")["fileinfo"]["is_dir"] == True
assert sorted(store.keys()) == ["a", "a/b"]
assert store.listdir("a") == ["b"]
assert store.listdir("") == ["a"]
store.remove("a/b")
assert store.contains("a/b") is False
assert store.listdir("a") == []
with pytest.raises(StoreException):
store.removedir("a")
assert store.contains("a") is True
assert list(store.keys()) == ["a"]
assert store.listdir("") == ["a"]
| 34.423729 | 72 | 0.587888 | 515 | 4,062 | 4.535922 | 0.12233 | 0.193065 | 0.122003 | 0.111301 | 0.785103 | 0.767123 | 0.755993 | 0.685788 | 0.525685 | 0.499144 | 0 | 0 | 0.245938 | 4,062 | 117 | 73 | 34.717949 | 0.762651 | 0 | 0 | 0.666667 | 0 | 0 | 0.074101 | 0 | 0 | 0 | 0 | 0 | 0.525253 | 1 | 0.111111 | false | 0 | 0.030303 | 0.030303 | 0.252525 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd11b205c239384ad9b8f6a12d948373e6ad3447 | 5,578 | py | Python | tonguetwister/decompiler/data/statements.py | lham/tonguetwister | ae8cd1555782f2e551a5d4156d8d247e08e354e1 | [
"MIT"
] | 4 | 2021-03-06T19:26:27.000Z | 2022-02-07T16:00:01.000Z | tonguetwister/decompiler/data/statements.py | lham/tonguetwister | ae8cd1555782f2e551a5d4156d8d247e08e354e1 | [
"MIT"
] | null | null | null | tonguetwister/decompiler/data/statements.py | lham/tonguetwister | ae8cd1555782f2e551a5d4156d8d247e08e354e1 | [
"MIT"
] | null | null | null | class PropertyReference:
def __init__(self, var_name, property_name):
self.var_name = var_name
self.property_name = property_name
def __str__(self):
return f'{self.var_name}.{self.property_name}'
def code_gen_string(self):
return str(self)
class FunctionCallArgument:
def __init__(self, arg_type, value):
self.arg_type = arg_type
self.value = value
def __str__(self):
return f'{self.arg_type}: {self.value}'
def code_gen_string(self):
if isinstance(self.value, str) or isinstance(self.value, int) or isinstance(self.value, float):
return f'{self.value}'
return self.value.code_gen_string()
class FunctionCall:
def __init__(self, name, args, result):
self.name = name
self.args = args
self.result = result
def __str__(self):
return_str = ''
args = ', '.join(map(str, self.args))
return f'{return_str}{self.name}({args})'
def code_gen_string(self):
args = ', '.join(map(lambda x: x.code_gen_string(), self.args))
return f'{self.name}({args})'
class AssignVariable:
def __init__(self, var_name, var_type, value):
self.var_name = var_name
self.var_type = var_type
self.value = value
def __str__(self):
val = self.value
if isinstance(val, list):
val = ', '.join(map(str, self.value))
return f'{self.var_type}: {self.var_name} = {val}'
def code_gen_string(self):
if isinstance(self.value, list):
val = f"[{', '.join(map(lambda x: x.code_gen_string(), self.value))}]"
elif isinstance(self.value, str):
val = self.value
else:
val = self.value.code_gen_string()
return f'{self.var_name} = {val}'
class ModifyString:
def __init__(self, insert_mode, int_val, str_val, obj):
self.insert_mode = insert_mode
self.int_val = int_val
self.str_val = str_val
self.obj = obj
def __str__(self):
return f'modify_string_59({self.insert_mode}, {self.int_val}, {self.str_val}, {self.obj})'
def code_gen_string(self):
return str(self)
class BinaryIntermediate:
def __init__(self, op, left, right):
self.op = op
self.left = left
self.right = right
def __str__(self):
return f'{self.left} {self.op} {self.right}'
def code_gen_string(self):
return f'{self.left.code_gen_string()} {self.op} {self.right.code_gen_string()}'
class UnaryIntermediate:
def __init__(self, operator, operand):
self.operator = operator
self.operand = operand
def __str__(self):
return f'{self.operator} {self.operand}'
def code_gen_string(self):
return f'{self.operator} {self.operand.code_gen_string()}'
class EndControlStatement:
def __init__(self, control_statement):
self.control_statement = control_statement
def __str__(self):
return f'end{self.control_statement}'
def code_gen_string(self):
return str(self)
class BreakStatement:
def __str__(self):
return 'break'
def code_gen_string(self):
return str(self)
class LoopOpenStatement:
def __init__(self, cond):
self.cond = cond
def __str__(self):
return f'loop while( {self.cond} )'
def code_gen_string(self):
return f'repeat while ( {self.cond.code_gen_string()} )'
class LoopEndStatement(EndControlStatement):
def __init__(self):
super().__init__('repeat')
class LoopCounterIncrement:
def __init__(self, var):
self.var = var
def __str__(self):
return f'increment( {self.var.name} )'
def code_gen_string(self):
return f'{self.var.name}++'
class IfEndStatement(EndControlStatement):
def __init__(self):
super().__init__('if')
class IfControlStatement:
def __init__(self, expr):
self.expr = expr
def __str__(self):
return f'if( {self.expr} )'
def code_gen_string(self):
return f'if ({self.expr.code_gen_string()})'
class ElseifControlStatement:
def __init__(self, expr):
self.expr = expr
def __str__(self):
return f'elseif( {self.expr} )'
def code_gen_string(self):
return f'elseif ({self.expr.code_gen_string()})'
class ElseControlStatement:
def __str__(self):
return 'else'
def code_gen_string(self):
return str(self)
class SwitchOpenStatement:
def __init__(self, cond):
self.cond = cond
def __str__(self):
return f'switch ( {self.cond} ):'
def code_gen_string(self):
if isinstance(self.cond, str):
val = self.cond
else:
val = self.cond.code_gen_string()
return f'switch ({val})'
class SwitchCaseStatement:
def __init__(self, case_opt):
self.case_opt = case_opt
def __str__(self):
return f'case {self.case_opt.code_gen_string()}:'
def code_gen_string(self):
return str(self)
class SwitchEndStatement(EndControlStatement):
def __init__(self):
super().__init__('switch')
class SwitchBreakStatement(BreakStatement):
pass
class ReturnStatement:
def __str__(self):
return 'return'
def code_gen_string(self):
return str(self)
class GotoStatement:
def __init__(self, label):
self.label = label
def __str__(self):
return f'goto {self.label}'
def code_gen_string(self):
return str(self)
| 23.241667 | 103 | 0.624059 | 704 | 5,578 | 4.573864 | 0.115057 | 0.096273 | 0.121118 | 0.11087 | 0.509317 | 0.398137 | 0.304348 | 0.254658 | 0.204348 | 0.054658 | 0 | 0.000483 | 0.257619 | 5,578 | 239 | 104 | 23.338912 | 0.777107 | 0 | 0 | 0.391304 | 0 | 0.006211 | 0.160273 | 0.062029 | 0 | 0 | 0 | 0 | 0 | 1 | 0.335404 | false | 0.006211 | 0 | 0.186335 | 0.701863 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
dd16adb35b08699dcf00ab0c4ba2efc18d29bacd | 2,257 | py | Python | enhterm/watcher/__init__.py | pyl1b/enhterm | b4eacc25ef1bdfecab9a662b5269d016070d4e6b | [
"MIT"
] | null | null | null | enhterm/watcher/__init__.py | pyl1b/enhterm | b4eacc25ef1bdfecab9a662b5269d016070d4e6b | [
"MIT"
] | null | null | null | enhterm/watcher/__init__.py | pyl1b/enhterm | b4eacc25ef1bdfecab9a662b5269d016070d4e6b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Contains the definition of the Watcher class.
"""
import logging
from enhterm.message import Message
from enhterm.base import EtBase
logger = logging.getLogger('et.w')
class Watcher(EtBase):
"""
A base class for structures informed by the terminal about its events.
The user will subclass this class and implement the methods, then will
simply append an instance to the terminal:
>>> from enhterm import EnhTerm
>>> from enhterm.watcher import Watcher
>>> term = EnhTerm()
>>> watcher = Watcher()
>>> term.watchers.append(watcher)
Attributes:
term (EnhTerm):
The terminal that is being monitored.
"""
def __init__(self, term=None, *args, **kwargs):
"""
Constructor.
Arguments:
term (EnhTerm)
The terminal that is serviced by this watcher.
"""
super().__init__(*args, **kwargs)
self.term = term
def __str__(self):
""" Represent this object as a human-readable string. """
return 'Watcher()'
def __repr__(self):
""" Represent this object as a python constructor. """
return 'Watcher()'
def pre_loop(self):
"""
The watcher is informed that the terminal entered the command loop.
"""
pass
def post_loop(self):
"""
The watcher is informed that the terminal is exiting the command loop.
"""
pass
def pre_cmd(self, command):
"""
The watcher is informed that the terminal is about to execute a command.
Arguments:
command (Command):
The command to be executed.
"""
pass
def post_cmd(self, command):
"""
The watcher is informed that the terminal has executed a command.
At this point the result is set in the command structure.
Arguments:
command (Command):
The command that was executed.
"""
pass
def message_issued(self, message: Message):
"""
The watcher is informed that the terminal has issued a message.
:param message: The message that was issued.
"""
pass
| 24.268817 | 80 | 0.586619 | 259 | 2,257 | 5.030888 | 0.34749 | 0.075979 | 0.046048 | 0.076746 | 0.34152 | 0.258634 | 0.175748 | 0.175748 | 0.141213 | 0.075211 | 0 | 0.000657 | 0.326097 | 2,257 | 92 | 81 | 24.532609 | 0.856016 | 0.564909 | 0 | 0.318182 | 0 | 0 | 0.032305 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0.227273 | 0.136364 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
dd1cb5a1e7c1d85ec1a972a12d6260a655b73e43 | 49 | py | Python | disco/version.py | daniel-thom/disco | 2de6869888c015ff70985bf6f6b1a0fcc15fc561 | [
"BSD-3-Clause"
] | null | null | null | disco/version.py | daniel-thom/disco | 2de6869888c015ff70985bf6f6b1a0fcc15fc561 | [
"BSD-3-Clause"
] | null | null | null | disco/version.py | daniel-thom/disco | 2de6869888c015ff70985bf6f6b1a0fcc15fc561 | [
"BSD-3-Clause"
] | null | null | null | """disco version number"""
__version__ = "0.1.4"
| 16.333333 | 26 | 0.653061 | 7 | 49 | 4 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0.122449 | 49 | 2 | 27 | 24.5 | 0.581395 | 0.408163 | 0 | 0 | 0 | 0 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd464dd2411f6c31b012ffd6cf2b26a9cd79065b | 835 | py | Python | setup.py | kakakaya/tweetsave-python | 582048320c8c13abc7e33b3ac720231e3c573fad | [
"MIT"
] | 2 | 2018-09-01T17:45:36.000Z | 2020-11-18T03:41:03.000Z | setup.py | kakakaya/tweetsave-python | 582048320c8c13abc7e33b3ac720231e3c573fad | [
"MIT"
] | null | null | null | setup.py | kakakaya/tweetsave-python | 582048320c8c13abc7e33b3ac720231e3c573fad | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kakakaya, Date: Sat Feb 4 18:59:06 2017
from setuptools import setup, find_packages
setup(
name="tweetsave",
version="1.1.0",
description='A Python3 library for https://tweetsave.com',
author='kakakaya',
author_email="kakakaya@gmail.com",
url="https://github.com/kakakaya/tweetsave-python",
license="MIT",
packages=find_packages(),
test_suite="nose.collector",
entry_points={
'console_scripts': 'tweetsave = tweetsave.cli:cli'
},
install_requires=[
'requests',
'click'
],
classifiers=[
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3 :: Only",
]
)
| 26.935484 | 62 | 0.611976 | 94 | 835 | 5.361702 | 0.648936 | 0.150794 | 0.198413 | 0.206349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037325 | 0.22994 | 835 | 30 | 63 | 27.833333 | 0.746501 | 0.108982 | 0 | 0 | 0 | 0 | 0.479082 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.04 | 0 | 0.04 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd4fe7b71e8df6adf5a6dfca40cb08f1819ec65f | 161 | py | Python | aiocloudflare/api/accounts/storage/kv/namespaces/values/values.py | Stewart86/aioCloudflare | 341c0941f8f888a8b7e696e64550bce5da4949e6 | [
"MIT"
] | 2 | 2021-09-14T13:20:55.000Z | 2022-02-24T14:18:24.000Z | aiocloudflare/api/accounts/storage/kv/namespaces/values/values.py | Stewart86/aioCloudflare | 341c0941f8f888a8b7e696e64550bce5da4949e6 | [
"MIT"
] | 46 | 2021-09-08T08:39:45.000Z | 2022-03-29T12:31:05.000Z | aiocloudflare/api/accounts/storage/kv/namespaces/values/values.py | Stewart86/aioCloudflare | 341c0941f8f888a8b7e696e64550bce5da4949e6 | [
"MIT"
] | 1 | 2021-12-30T23:02:23.000Z | 2021-12-30T23:02:23.000Z | from aiocloudflare.commons.auth import Auth
class Values(Auth):
_endpoint1 = "accounts"
_endpoint2 = "storage/kv/namespaces"
_endpoint3 = "values"
| 20.125 | 43 | 0.720497 | 17 | 161 | 6.647059 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0.180124 | 161 | 7 | 44 | 23 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.217391 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
dd67502dd5e2b5786263ff7c75ab496082fd5bda | 74 | py | Python | dv18.py | dhruv-varshney/cleargit | e001f2bf594106110488e1aa44a74b95d30e6b4c | [
"MIT"
] | 2 | 2021-05-27T17:45:38.000Z | 2021-06-09T17:18:25.000Z | dv18.py | dhruv-varshney/Python | e001f2bf594106110488e1aa44a74b95d30e6b4c | [
"MIT"
] | null | null | null | dv18.py | dhruv-varshney/Python | e001f2bf594106110488e1aa44a74b95d30e6b4c | [
"MIT"
] | null | null | null | a = [1,2,3,4,5]
k =2
del a[0]
for i in range(0,len(a)):
print(a[i])
| 10.571429 | 25 | 0.486486 | 21 | 74 | 1.714286 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0.243243 | 74 | 6 | 26 | 12.333333 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd8f2c00db6256949240692dbc1e7561ae28e119 | 206 | py | Python | QUEEN/qint.py | yachielab/QUEEN | 94ed667dbb3b95712e5a2473afc889d625c7824a | [
"MIT"
] | 9 | 2021-11-09T23:25:50.000Z | 2021-12-31T23:53:08.000Z | QUEEN/qint.py | yachielab/QUEEN | 94ed667dbb3b95712e5a2473afc889d625c7824a | [
"MIT"
] | null | null | null | QUEEN/qint.py | yachielab/QUEEN | 94ed667dbb3b95712e5a2473afc889d625c7824a | [
"MIT"
] | null | null | null | class Qint(int):
def __init__(self, num):
self.qkey = None
self.parent = None
self.parental_id = None
self.name = None
self._qint = True
| 25.75 | 31 | 0.485437 | 23 | 206 | 4.086957 | 0.608696 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.432039 | 206 | 7 | 32 | 29.428571 | 0.803419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dd90075180f53445fc68e461f607f8079ffdc6db | 193 | py | Python | main.py | IljaDR/JobBot-Belgium | ea44d615945dc5115441fa3110a4c8280cb02059 | [
"MIT"
] | null | null | null | main.py | IljaDR/JobBot-Belgium | ea44d615945dc5115441fa3110a4c8280cb02059 | [
"MIT"
] | null | null | null | main.py | IljaDR/JobBot-Belgium | ea44d615945dc5115441fa3110a4c8280cb02059 | [
"MIT"
] | null | null | null | # https://docs.python.org/3/library/sqlite3.html
from database import Database
db = Database()
db.create_tables()
db.populate_base_tables()
db.populate_company_websites()
db.get_all_websites() | 24.125 | 48 | 0.803109 | 29 | 193 | 5.103448 | 0.689655 | 0.135135 | 0.216216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011111 | 0.067358 | 193 | 8 | 49 | 24.125 | 0.811111 | 0.238342 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
06b725c45045be9969ef50919bc77f587c1ca6d7 | 372 | py | Python | vyked/utils/ordered_class_member.py | shivank-gupta/vyked | 98836b3230775c5ad52dfc72291b2958d3a244c9 | [
"MIT"
] | 2 | 2016-04-07T13:32:36.000Z | 2020-11-15T17:19:25.000Z | vyked/utils/ordered_class_member.py | shivank-gupta/vyked | 98836b3230775c5ad52dfc72291b2958d3a244c9 | [
"MIT"
] | 13 | 2015-12-28T05:38:19.000Z | 2019-06-27T09:10:10.000Z | vyked/utils/ordered_class_member.py | shivank-gupta/vyked | 98836b3230775c5ad52dfc72291b2958d3a244c9 | [
"MIT"
] | 6 | 2016-03-15T09:09:37.000Z | 2020-12-07T11:19:37.000Z | import collections
class OrderedClassMembers(type):
@classmethod
def __prepare__(self, name, bases):
return collections.OrderedDict()
def __new__(self, name, bases, classdict):
classdict['__ordered__'] = [key for key in classdict.keys() if key not in ('__module__', '__qualname__')]
return type.__new__(self, name, bases, classdict)
| 31 | 113 | 0.693548 | 41 | 372 | 5.707317 | 0.585366 | 0.102564 | 0.166667 | 0.136752 | 0.213675 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196237 | 372 | 11 | 114 | 33.818182 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0.08871 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
06c29ecf6906c4b3467989f86c5e96b50583500e | 209 | py | Python | assets/getIp.py | securityhook/Discord-Recon | 3386a423dd290c43de25c7c60572e9e43cda9557 | [
"MIT"
] | 30 | 2021-02-20T04:03:40.000Z | 2022-03-17T20:42:31.000Z | assets/getIp.py | securityhook/Discord-Recon | 3386a423dd290c43de25c7c60572e9e43cda9557 | [
"MIT"
] | 20 | 2021-02-21T04:02:06.000Z | 2021-06-08T20:12:57.000Z | assets/getIp.py | securityhook/Discord-Recon | 3386a423dd290c43de25c7c60572e9e43cda9557 | [
"MIT"
] | 11 | 2021-04-09T15:49:29.000Z | 2022-03-20T21:20:54.000Z | import socket
def getIp(Domain):
try:
IP = socket.gethostbyname(Domain)
return f"Your Domain IP Address: {IP}"
except Exception:
return "**Sorry We Can't Resolve This Domain**" | 26.125 | 55 | 0.636364 | 27 | 209 | 4.925926 | 0.740741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | 209 | 8 | 55 | 26.125 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0.314286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
06cccb806601112436cb78f9f35e627dd3699ace | 5,395 | py | Python | tests/cp2/test_cp2_exception_epcc_rep.py | capt-hb/cheritest | d3b3637a81a0005ee7272eca0f33a9f9911fdb32 | [
"Apache-2.0"
] | null | null | null | tests/cp2/test_cp2_exception_epcc_rep.py | capt-hb/cheritest | d3b3637a81a0005ee7272eca0f33a9f9911fdb32 | [
"Apache-2.0"
] | 2 | 2020-06-02T13:44:55.000Z | 2020-06-02T14:06:29.000Z | tests/cp2/test_cp2_exception_epcc_rep.py | capt-hb/cheritest | d3b3637a81a0005ee7272eca0f33a9f9911fdb32 | [
"Apache-2.0"
] | null | null | null | #-
# Copyright (c) 2011 Robert N. M. Watson
# Copyright (c) 2017 Robert M. Norton
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BERI Open Systems C.I.C. (BERI) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. BERI licenses this
# file to you under the BERI Hardware-Software License, Version 1.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.beri-open-systems.org/legal/license-1-0.txt
#
# Unless required by applicable law or agreed to in writing, Work distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
# @BERI_LICENSE_HEADER_END@
#
from beritest_tools import BaseBERITestCase, attr
#
# Test to ensure that EPCC is set correctly when offset (PC) goes just
# outside the bounds of PCC, which should be representable even with
# compressed capabilities
#
@attr('capabilities')
class test_cp2_exception_epcc_rep(BaseBERITestCase):
#
# Check that various stages of the test did actually run.
#
def test_exception_counter(self):
self.assertRegisterEqual(self.MIPS.a0, 1, "CP2 exception counter not 1")
def test_insandbox(self):
self.assertRegisterEqual(self.MIPS.a1, 1, "sandbox not recorded")
#
# Check that sandbox was configured roughly as expected
#
def test_sandbox_length(self):
self.assertRegisterEqual(self.MIPS.s0, 8, "sandbox length not 20")
#
# Check that exception code was CP2 fault
#
def test_excode(self):
self.assertRegisterMaskEqual(self.MIPS.s1, 0x1f << 2, 18 << 2, "last exception not a CP2 fault")
#
# Check that capcause shows length violation on PCC
#
def test_capcause(self):
self.assertRegisterEqual(self.MIPS.s2, 0x1ff, "incorrect capcause")
#
# Check that EPC is as expected
#
def test_epc(self):
self.assertRegisterEqual(self.MIPS.s3, self.MIPS.s0, "sandbox EPC unexpected")
#
# Check that sandbox cap is as expected
#
def test_sandbox_pcc_tag(self):
self.assertRegisterEqual(self.MIPS.cp2[2].t, 1, "sandbox tag incorrect")
def test_sandbox_pcc_unsealed(self):
self.assertRegisterEqual(self.MIPS.cp2[2].s, 0, "sandbox sealed incorrect")
def test_sandbox_pcc_perms(self):
self.assertRegisterEqual(self.MIPS.cp2[2].perms, 7, "sandbox perms incorrect")
def test_sandbox_pcc_ctype(self):
self.assertRegisterEqual(self.MIPS.cp2[2].ctype, self.unsealed_otype, "sandbox ctype incorrect")
def test_sandbox_pcc_offset(self):
self.assertRegisterEqual(self.MIPS.cp2[2].offset, 0x4, "sandbox offset incorrect")
def test_sandbox_pcc_base(self):
self.assertRegisterEqual(self.MIPS.cp2[2].base, self.MIPS.a7, "sandbox base incorrect")
def test_sandbox_pcc_length(self):
self.assertRegisterEqual(self.MIPS.cp2[2].length, self.MIPS.s0, "sandbox length incorrect")
#
# Check that the post-sandbox EPCC is as expected: sandboxed.
#
@attr('cap_precise')
def test_sandbox_epcc_tag_precise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].t, 1, "sandbox EPCC tag incorrect")
@attr('cap_imprecise')
def test_sandbox_epcc_tag_imprecise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].t, 1, "sandbox EPCC tag incorrect")
def test_sandbox_epcc_unsealed(self):
self.assertRegisterEqual(self.MIPS.cp2[3].s, 0, "sandbox EPCC unsealed incorrect")
@attr('cap_precise')
def test_sandbox_epcc_perms_precise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].perms, 0x0007, "sandbox EPCC perms incorrect")
@attr('cap_imprecise')
def test_sandbox_epcc_perms_imprecise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].perms, 0x0007, "sandbox EPCC perms incorrect")
def test_sandbox_epcc_ctype(self):
self.assertRegisterEqual(self.MIPS.cp2[3].ctype, self.unsealed_otype, "sandbox EPCC ctype incorrect")
def test_sandbox_epcc_offset(self):
self.assertRegisterEqual(self.MIPS.cp2[3].base + self.MIPS.cp2[3].offset, self.MIPS.a7 + self.MIPS.s0, "sandbox EPCC offset incorrect")
@attr('cap_precise')
def test_sandbox_epcc_base_precise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].base, self.MIPS.a7, "sandbox EPCC base incorrect")
@attr('cap_precise')
def test_sandbox_epcc_length_precise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].length, self.MIPS.s0, "sandbox EPCC length incorrect")
@attr('cap_imprecise')
def test_sandbox_epcc_base_imprecise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].base, self.MIPS.a7, "sandbox EPCC base incorrect")
@attr('cap_imprecise')
def test_sandbox_epcc_length_imprecise(self):
self.assertRegisterEqual(self.MIPS.cp2[3].length, self.MIPS.s0, "sandbox EPCC length incorrect")
| 38.535714 | 143 | 0.722706 | 743 | 5,395 | 5.125168 | 0.269179 | 0.071429 | 0.163078 | 0.187237 | 0.533613 | 0.374737 | 0.362395 | 0.251838 | 0.173057 | 0.173057 | 0 | 0.024994 | 0.17683 | 5,395 | 139 | 144 | 38.81295 | 0.83247 | 0.29861 | 0 | 0.271186 | 0 | 0 | 0.191638 | 0 | 0 | 0 | 0.006433 | 0 | 0.40678 | 1 | 0.40678 | false | 0 | 0.016949 | 0 | 0.440678 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6612dcee3495ff2b7483c7dfaa29ffb363a8f190 | 92 | py | Python | third_party/fancy_cli_header.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | 29 | 2019-03-25T09:35:12.000Z | 2022-01-08T22:09:03.000Z | third_party/fancy_cli_header.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | null | null | null | third_party/fancy_cli_header.py | DahlitzFlorian/python-snippets | 212f63f820b6f5842f74913ed08da18d41dfe7a4 | [
"MIT"
] | 4 | 2020-05-19T21:18:12.000Z | 2021-05-18T12:49:21.000Z | from pyfiglet import Figlet
f = Figlet(font="slant")
print(f.renderText("text to render"))
| 18.4 | 37 | 0.73913 | 14 | 92 | 4.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119565 | 92 | 4 | 38 | 23 | 0.839506 | 0 | 0 | 0 | 0 | 0 | 0.206522 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6617623f6a6c0798859b0da53af2e40ce3496d44 | 532 | py | Python | oriskami/test/resources/test_router.py | oriskami/oriskami-python | 2b0d81f713a9149977907183c67eec136d49ee8c | [
"MIT"
] | 4 | 2017-05-28T19:37:31.000Z | 2017-06-13T11:34:26.000Z | oriskami/test/resources/test_router.py | ubivar/ubivar-python | 2b0d81f713a9149977907183c67eec136d49ee8c | [
"MIT"
] | null | null | null | oriskami/test/resources/test_router.py | ubivar/ubivar-python | 2b0d81f713a9149977907183c67eec136d49ee8c | [
"MIT"
] | null | null | null | import os
import oriskami
import warnings
from oriskami.test.helper import (OriskamiTestCase)
class OriskamiAPIResourcesTests(OriskamiTestCase):
def test_router_retrieve(self):
response = oriskami.Router.retrieve("0")
self.assertTrue(hasattr(response.data, "__iter__"))
router = response.data[0]
self.assertTrue(hasattr(router, "parameters"))
self.assertTrue(hasattr(router, "data"))
self.assertTrue(hasattr(router, "flows"))
self.assertTrue(hasattr(router, "test"))
| 28 | 59 | 0.704887 | 55 | 532 | 6.709091 | 0.4 | 0.189702 | 0.284553 | 0.292683 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004577 | 0.178571 | 532 | 18 | 60 | 29.555556 | 0.839817 | 0 | 0 | 0 | 0 | 0 | 0.060264 | 0 | 0 | 0 | 0 | 0 | 0.384615 | 1 | 0.076923 | false | 0 | 0.307692 | 0 | 0.461538 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
663c0682ca42c0efd6a2e69e2814ec2fc0f55b39 | 121 | py | Python | Aniyom Ebenezer/Phase 2/LIST/Day_42_Challenge_Solution/Question 6 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Aniyom Ebenezer/Phase 2/LIST/Day_42_Challenge_Solution/Question 6 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Aniyom Ebenezer/Phase 2/LIST/Day_42_Challenge_Solution/Question 6 Solution.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | """
Write a Python program to get variable unique identification number or string.
"""
x = 100
print(format(id(x), "x")) | 24.2 | 79 | 0.702479 | 19 | 121 | 4.473684 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.157025 | 121 | 5 | 80 | 24.2 | 0.803922 | 0.644628 | 0 | 0 | 0 | 0 | 0.028571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
663dafc7e36f420b907e0bd4480b630283e11e58 | 205 | py | Python | FreeTAKServer/model/ServiceObjects/FederationClientServiceVariables.py | logikal/FreeTakServer | c0916ce65781b5c60079d6440e52db8fc6ee0467 | [
"MIT"
] | 27 | 2020-05-01T01:45:59.000Z | 2020-07-03T00:17:13.000Z | FreeTAKServer/model/ServiceObjects/FederationClientServiceVariables.py | logikal/FreeTakServer | c0916ce65781b5c60079d6440e52db8fc6ee0467 | [
"MIT"
] | 34 | 2020-04-26T11:25:52.000Z | 2020-07-03T21:06:34.000Z | FreeTAKServer/model/ServiceObjects/FederationClientServiceVariables.py | logikal/FreeTakServer | c0916ce65781b5c60079d6440e52db8fc6ee0467 | [
"MIT"
] | 15 | 2020-05-01T01:46:07.000Z | 2020-07-03T12:14:04.000Z | class FederationClientServiceVariables:
def __init__(self):
self.FederationClientServiceStatus = ''
self.FederationClientServicePort = 9000
self.FederationClientServiceIP = None | 41 | 47 | 0.746341 | 13 | 205 | 11.461538 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024242 | 0.195122 | 205 | 5 | 48 | 41 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
66477ba59cdd30e8b0a2245d59f0702ae849e2f3 | 1,917 | py | Python | morphocut_server/pipeline/logs.py | madelinetharp/morphocut-server | a82ad5916adbd168816f7b26432b4a98d978c299 | [
"MIT"
] | null | null | null | morphocut_server/pipeline/logs.py | madelinetharp/morphocut-server | a82ad5916adbd168816f7b26432b4a98d978c299 | [
"MIT"
] | 1 | 2019-08-14T20:07:53.000Z | 2019-08-14T20:07:53.000Z | morphocut_server/pipeline/logs.py | madelinetharp/morphocut-server | a82ad5916adbd168816f7b26432b4a98d978c299 | [
"MIT"
] | 2 | 2019-11-28T13:10:28.000Z | 2021-11-19T20:37:19.000Z | from abc import abstractmethod
from morphocut.pipeline import NodeBase
class LogBase(NodeBase):
def __init__(self):
self.log_data = {}
def __call__(self, input=None):
for obj in input:
self.log()
yield obj
def get_log(self):
'''
Get the log data
'''
return self.log_data
@abstractmethod
def log(self):
"""
Process the facet and return a new one.
"""
pass
class ObjectCountLog(LogBase):
"""Writes the progress into the current Job. The progress is accessible via job.meta.get('progress', 0).
Note
----
Do not include the `self` parameter in the ``Parameters`` section.
Parameters
----------
msg : str
Human readable string describing the exception.
code : :obj:`int`, optional
Numeric error code.
Attributes
----------
msg : str
Human readable string describing the exception.
code : int
Numeric error code.
"""
def __init__(self, name):
super().__init__()
self.name = name
self.log_data[self.name] = 0
def log(self):
self.log_data[self.name] += 1
class ParamsLog(LogBase):
"""Writes the progress into the current Job. The progress is accessible via job.meta.get('progress', 0).
Note
----
Do not include the `self` parameter in the ``Parameters`` section.
Parameters
----------
msg : str
Human readable string describing the exception.
code : :obj:`int`, optional
Numeric error code.
Attributes
----------
msg : str
Human readable string describing the exception.
code : int
Numeric error code.
"""
def __init__(self, name, params):
super().__init__()
self.name = name
self.log_data[self.name] = params
def log(self):
pass
| 20.836957 | 108 | 0.576943 | 222 | 1,917 | 4.846847 | 0.301802 | 0.052045 | 0.051115 | 0.070632 | 0.697955 | 0.680297 | 0.680297 | 0.680297 | 0.680297 | 0.680297 | 0 | 0.00304 | 0.313511 | 1,917 | 91 | 109 | 21.065934 | 0.81459 | 0.485133 | 0 | 0.321429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.071429 | 0.071429 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
664a509302769a7f445d2375b4fc4a94ba56413f | 557 | py | Python | noisemix/formats.py | noisemix/noisemix | e93c843549ac3b18b442f071fd2c056aa1140c5a | [
"MIT"
] | 34 | 2018-05-19T15:07:28.000Z | 2021-09-08T08:20:33.000Z | noisemix/formats.py | noisemix/noisemix | e93c843549ac3b18b442f071fd2c056aa1140c5a | [
"MIT"
] | 6 | 2018-05-25T15:24:07.000Z | 2019-02-01T22:37:58.000Z | noisemix/formats.py | noisemix/noisemix | e93c843549ac3b18b442f071fd2c056aa1140c5a | [
"MIT"
] | 7 | 2019-02-20T17:33:22.000Z | 2021-09-09T09:54:10.000Z |
class Format:
def skip(self, line):
False
def before(self, line):
return s, None
def after(self, line, data):
return s
class fastText(Format):
LABEL_PREFIX = '__label__'
def before(self, line):
labels = []
_ = []
for w in line.split(' '):
if w.startswith(fastText.LABEL_PREFIX):
labels.append(w)
else:
_.append(w)
return ' '.join(_), labels
def after(self, line, data):
return ' '.join(data) + ' ' + line
| 19.206897 | 51 | 0.499102 | 61 | 557 | 4.409836 | 0.42623 | 0.148699 | 0.096654 | 0.126394 | 0.193309 | 0.193309 | 0 | 0 | 0 | 0 | 0 | 0 | 0.37702 | 557 | 28 | 52 | 19.892857 | 0.775216 | 0 | 0 | 0.2 | 0 | 0 | 0.023381 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.15 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
664c92ee353ceb5b455a1adc69fa761e93fe9407 | 25 | py | Python | frontegg/helpers/singleton.py | amitripshtos/python-sdk | d8897c6be1eb730b563a08243b03d9df2c73c20e | [
"MIT"
] | 1 | 2020-12-31T07:09:13.000Z | 2020-12-31T07:09:13.000Z | frontegg/helpers/singleton.py | amitripshtos/python-sdk | d8897c6be1eb730b563a08243b03d9df2c73c20e | [
"MIT"
] | 9 | 2020-11-09T13:02:57.000Z | 2022-01-19T03:41:51.000Z | frontegg/helpers/singleton.py | amitripshtos/python-sdk | d8897c6be1eb730b563a08243b03d9df2c73c20e | [
"MIT"
] | 3 | 2020-11-04T08:36:47.000Z | 2021-07-29T08:55:33.000Z | singleton = lambda c: c() | 25 | 25 | 0.68 | 4 | 25 | 4.25 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 25 | 1 | 25 | 25 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0dcfa1b7e21399e68c6d072c4c62c691706e064 | 2,485 | py | Python | actividades/contraparte/templatetags/tools.py | shiminasai/plataforma_FADCANIC | 14831525e4104da7f05ce87e59238f1e4193c184 | [
"MIT"
] | null | null | null | actividades/contraparte/templatetags/tools.py | shiminasai/plataforma_FADCANIC | 14831525e4104da7f05ce87e59238f1e4193c184 | [
"MIT"
] | null | null | null | actividades/contraparte/templatetags/tools.py | shiminasai/plataforma_FADCANIC | 14831525e4104da7f05ce87e59238f1e4193c184 | [
"MIT"
] | 2 | 2015-05-19T20:50:41.000Z | 2015-05-19T20:51:04.000Z | # -*- coding: utf-8 -*-
from django import template
register = template.Library()
#-------- begin inclusion tags ------------
@register.inclusion_tag('actividades/contraparte/load_table.html')
def load_table(dicc, opts2, var2, main_field, total, tipo, borde=None, comment=None):
return { 'dicc' : dicc, 'opts2': opts2,
'var2': var2, 'main_field': main_field,
'total': total, 'tipo': tipo,
'borde': borde, 'comment': comment}
@register.inclusion_tag('actividades/contraparte/bar_graph.html')
def bar_graph(dicc, var2, main_field, tipo):
return { 'dicc' : dicc,
'var2': var2,
'main_field': main_field,
'tipo': tipo}
@register.inclusion_tag('actividades/contraparte/pie_graph.html')
def pie_graph(dicc, var2, main_field, tipo):
return { 'dicc' : dicc,
'var2': var2,
'main_field': main_field,
'tipo': tipo}
#---------- end inclusion tags ---------------
#---------- other filter and tags ------------
@register.filter
def unslugify(value):
return ' '.join([s.capitalize() \
if i == 0 else s \
for i, s in enumerate(value.split('_'))])
@register.filter
def get_value(dicc, key):
'''donde dicc es el diccionario con valores y key la llave a obtener'''
return dicc[key]
@register.filter
def total_dict_query(value):
return sum([x.count() for x in value.values()])
@register.filter
def total_dict(value):
return sum(value.values())
@register.filter
def total_per_key(value, arg):
'''value es el dict y arg es el key del que se quiere obtener el total o suma'''
return sum([v[arg] for v in value.values()])
@register.filter
def total_per_query_key(value, arg):
'''value es el dict y arg es el key del que se quiere obtener el total o suma'''
return sum([v[arg].count() for v in value.values()])
@register.filter
def total_general(tabla, qs=None):
'''donde tabla es un dicc donde estan todos los valores'''
if qs==1:
return sum([sum(len(a) for a in value.values()) for value in tabla.values()])
return sum([sum(value.values()) for value in tabla.values()])
MESES = {1: 'Ene', 2: 'Feb', 3: 'Mar',
4: 'Abr', 5: 'May', 6: 'Jun',
7: 'Jul', 8: 'Ago', 9: 'Sep',
10: 'Oct', 11: 'Nov', 12: 'Dic'}
@register.filter
def month_name(month_number):
return MESES[int(month_number)]
| 33.133333 | 90 | 0.596781 | 340 | 2,485 | 4.267647 | 0.335294 | 0.055824 | 0.093728 | 0.07581 | 0.487939 | 0.380427 | 0.362509 | 0.267402 | 0.267402 | 0.213646 | 0 | 0.015823 | 0.237022 | 2,485 | 74 | 91 | 33.581081 | 0.749473 | 0.170221 | 0 | 0.307692 | 0 | 0 | 0.118311 | 0.056456 | 0 | 0 | 0 | 0.013514 | 0 | 1 | 0.211538 | false | 0 | 0.019231 | 0.134615 | 0.461538 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
b0e7c1bca67de7aa426369b2a31005d2d7c60a61 | 267 | py | Python | algo/orderOfGrowth.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | 8 | 2015-06-07T13:25:48.000Z | 2022-03-22T23:14:50.000Z | algo/orderOfGrowth.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | 30 | 2016-01-29T01:36:41.000Z | 2018-09-19T07:01:22.000Z | algo/orderOfGrowth.py | liuyang1/test | a4560e0c9ffd0bc054d55bbcf12a894ab5b7d417 | [
"MIT"
] | null | null | null | lst = [1, 5, 27, 168, 1084, 6861,
41269, 260445, 1639117]
# lst = [2600, 20825, 166650, 1333300, 10666600]
from math import log
for i in xrange(1, len(lst)):
a = lst[i - 1]
b = lst[i] + 0.0
d = b / a
print "%.2f, %.2f" % (d, log(d) / log(2))
| 24.272727 | 48 | 0.520599 | 47 | 267 | 2.957447 | 0.659574 | 0.057554 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.366492 | 0.284644 | 267 | 10 | 49 | 26.7 | 0.361257 | 0.172285 | 0 | 0 | 0 | 0 | 0.045662 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.125 | null | null | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b0f899e6069e36ce135a595509ebfd8ebe8de0f4 | 241 | py | Python | riddles/gcd.py | TomLefley/sphinx | 1c12ea28d3ddbbab94353c3ffb4a15b468780dab | [
"Apache-2.0"
] | null | null | null | riddles/gcd.py | TomLefley/sphinx | 1c12ea28d3ddbbab94353c3ffb4a15b468780dab | [
"Apache-2.0"
] | null | null | null | riddles/gcd.py | TomLefley/sphinx | 1c12ea28d3ddbbab94353c3ffb4a15b468780dab | [
"Apache-2.0"
] | null | null | null | from fractions import gcd
from random import randint
def description():
return 'Find the Greated Common Divisor'
def question():
a = randint(1, 999)
b = randint(0, 999)
d = gcd(a, b)
return ('(%d,%d)' % (a, b), str(d))
| 20.083333 | 44 | 0.609959 | 37 | 241 | 3.972973 | 0.594595 | 0.027211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043716 | 0.240664 | 241 | 11 | 45 | 21.909091 | 0.759563 | 0 | 0 | 0 | 0 | 0 | 0.157676 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9ff3158089d265735d41c1dcc4387d05f2f69bed | 86 | py | Python | gaze_project/pythons/data_transform/ex1.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | 1 | 2022-01-18T01:53:34.000Z | 2022-01-18T01:53:34.000Z | gaze_project/pythons/data_transform/ex1.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | null | null | null | gaze_project/pythons/data_transform/ex1.py | kidrabit/Data-Visualization-Lab-RND | baa19ee4e9f3422a052794e50791495632290b36 | [
"Apache-2.0"
] | null | null | null | from scipy.fft import fft, ifft
x = np.array([1.0, 2.0, 1.0, -1.0, 1.5])
y = fft(x)
y
| 17.2 | 40 | 0.569767 | 23 | 86 | 2.130435 | 0.565217 | 0.122449 | 0.122449 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 0.186047 | 86 | 4 | 41 | 21.5 | 0.557143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9ff8b6e7614d71064764e2cb8cdd19affba545e6 | 431 | py | Python | application/views.py | jdgwartney/flask-blueprint | 0b306653db8170d30a0fab906a980f6222fa4d31 | [
"Apache-2.0"
] | null | null | null | application/views.py | jdgwartney/flask-blueprint | 0b306653db8170d30a0fab906a980f6222fa4d31 | [
"Apache-2.0"
] | null | null | null | application/views.py | jdgwartney/flask-blueprint | 0b306653db8170d30a0fab906a980f6222fa4d31 | [
"Apache-2.0"
] | null | null | null | from application import app
@app.route("/")
def hello():
return "Hello World!"
@app.route("/contact")
def contact():
return "You can contact me at 555-5555, or "
" email me at test@example.com"
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
# Logic for handling login
return "login-post"
else:
# Display login form
return "login-get"
| 20.52381 | 48 | 0.603248 | 57 | 431 | 4.561404 | 0.596491 | 0.092308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021538 | 0.24594 | 431 | 20 | 49 | 21.55 | 0.778462 | 0.099768 | 0 | 0 | 0 | 0 | 0.314286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | true | 0 | 0.071429 | 0.071429 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b00731376be6d2165f86b9705ff1a4d542df1da5 | 628 | py | Python | app/ML.py | UnifyID/python-ml-microservice | 3d18d9e1c9f1190915734fcddde1220ac4087700 | [
"MIT"
] | 8 | 2016-10-06T07:07:20.000Z | 2017-05-17T03:26:12.000Z | app/ML.py | elefthei/python-ml-microservice | 3d18d9e1c9f1190915734fcddde1220ac4087700 | [
"MIT"
] | null | null | null | app/ML.py | elefthei/python-ml-microservice | 3d18d9e1c9f1190915734fcddde1220ac4087700 | [
"MIT"
] | 4 | 2018-04-28T05:57:24.000Z | 2019-08-31T04:48:24.000Z | # Initialize your ML model here
class ML():
def __init__():
pass
def handleInputFile(contents):
# Dear ML engineer, feel free to handle the inputs
# of your model here.
print 'Received /input file, contents...'
print contents
def handleTrainFile(contents):
# Dear ML engineer, feel free to handle the training
# of your model here.
print 'Received /train file, contents...'
print contents
def handleOutputFile(contents):
# Dear ML engineer, feel free to return the output
# of your model here.
print 'Received /output file, contents...'
print contents
return 42
| 27.304348 | 56 | 0.681529 | 81 | 628 | 5.234568 | 0.382716 | 0.084906 | 0.099057 | 0.15566 | 0.599057 | 0.466981 | 0.268868 | 0.193396 | 0.193396 | 0 | 0 | 0.004193 | 0.240446 | 628 | 22 | 57 | 28.545455 | 0.884696 | 0.378981 | 0 | 0.230769 | 0 | 0 | 0.26178 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.076923 | 0 | null | null | 0.461538 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 3 |
b01a29e700964abcda12e62c7145d555fa5f8e98 | 194 | py | Python | test/conftest.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | null | null | null | test/conftest.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | null | null | null | test/conftest.py | ScottWales/cosima-cookbook | 0ed83e2165efe5badfca59e2dccf835ab7acecca | [
"Apache-2.0"
] | null | null | null | import pytest
from dask.distributed import Client
@pytest.fixture(scope='module')
def client():
client = Client(processes=False, dashboard_address=None)
yield client
client.close()
| 21.555556 | 60 | 0.747423 | 24 | 194 | 6 | 0.708333 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149485 | 194 | 8 | 61 | 24.25 | 0.872727 | 0 | 0 | 0 | 0 | 0 | 0.030928 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b037b6d8edaec3cd3aaabb19914f6f2aaa00236f | 320 | py | Python | blog/models.py | li-acm/website_backEnd | c045abc014d007def26819fefa3d59701659a9da | [
"MIT"
] | null | null | null | blog/models.py | li-acm/website_backEnd | c045abc014d007def26819fefa3d59701659a9da | [
"MIT"
] | null | null | null | blog/models.py | li-acm/website_backEnd | c045abc014d007def26819fefa3d59701659a9da | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
from wagtail.core.models import Page
class BlogPage(Page):
blog_title = models.CharField(max_length=400,help_text='博客名称',verbose_name='博客名称')
blog_intro = models.CharField(max_length=400,help_text='博客概要',verbose_name='博客概要')
class Meta:
pass | 29.090909 | 86 | 0.746875 | 47 | 320 | 4.914894 | 0.595745 | 0.12987 | 0.155844 | 0.207792 | 0.30303 | 0.30303 | 0.30303 | 0 | 0 | 0 | 0 | 0.021898 | 0.14375 | 320 | 11 | 87 | 29.090909 | 0.821168 | 0.075 | 0 | 0 | 0 | 0 | 0.054237 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.142857 | 0.285714 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
b0504dc4e02e789aab07b57a64e925fd5e0c7712 | 2,440 | py | Python | c3_1123_review.py | Julia-Run/Dive-into-DL-PyTorch | c67e80223bbb0f86b3708d4795162c9a5af76684 | [
"MIT"
] | null | null | null | c3_1123_review.py | Julia-Run/Dive-into-DL-PyTorch | c67e80223bbb0f86b3708d4795162c9a5af76684 | [
"MIT"
] | null | null | null | c3_1123_review.py | Julia-Run/Dive-into-DL-PyTorch | c67e80223bbb0f86b3708d4795162c9a5af76684 | [
"MIT"
] | null | null | null | import torch
# 一些创造tensor的基础函数#######################################
# x = torch.empty(3, 4)
# print(x, '\n', x.size(), x.shape) # 一些极小值
#
# x = torch.zeros(3, 4)
# print(x, '\n', x.size(), x.shape)
#
# x = torch.ones(3, 4)
# print(x, '\n', x.size(), x.shape)
#
# x = torch.eye(3)
# print(x, '\n', x.size(), x.shape)
#
# x = torch.rand(3, 4) # 0-1之间的随机数
# print(x, '\n', x.size(), x.shape)
#
# x = torch.randn(3, 4) # 包含复数
# print(x, '\n', x.size(), x.shape)
#
# x = torch.arange(1, 10, 3)
# print(x, '\n', x.size(), x.shape) # 和range用法一致
#
# x = torch.linspace(1, 10, 3) # 等距,均匀分布,包尾
# print(x, '\n', x.size(), x.shape)
#
# x = torch.randperm(10) # 打乱排序
# print(x, '\n', x.size(), x.shape)
#
# x = torch.tensor([1, 2, 3]) # np中的啊绕任意转换为tensor
# print(x, '\n', x.size(), x.shape)
# # tenor的加法#################################################
# a = torch.ones(3, 2, 4)
# b = torch.rand(3, 2, 4)
# y = a + b
# print(y, id(y))
# y = torch.add(a, b)
# print(y, id(y))
# a += b
# print(a, id(a))
# a.add_(b)
# print(a, id(a))
# r1 = torch.sum(y, dim=1) # dim对应轴(0,1,2)。。倒着数就是(-1,-2,-3)
# # 针对某维度求和就是向该维度塌陷
# print(r1)
# r2 = torch.sum(y, dim=-2)
# print(r2)
# tensor的索引#########################################################
# a = torch.rand(2, 3, 4)
# print(a)
# x = a[1, :]
# print(x)
# x = a[:, 2, :]
# print(x)
# x = torch.index_select(a, 2, torch.tensor([1, 2])) # dim=0,选前两个box
# print(x)
# x = torch.nonzero(a)
# print(x) # 返回索引
# # dim参数和加法的理解############################################################
# x = torch.sum(a, dim=2) # - -2*3
# # dim=2,最内部的矩阵内的元素压缩求和,变成单一元素,去掉中括号
# print(x)
#
# x = torch.sum(a, dim=1) # - -2*4
# # dim=1,最外面的每个box里,3*4沿着3向方向压缩成1*4,整体变成2*4
# print(x)
#
# x = torch.sum(a, dim=0) # - -3*4
# # dim=0,最外面两个box叠加,对应元素求和
# print(x)
#
# # view # 广播
# a = torch.rand(2, 3, 4)
# print(a, id(a))
# x = a.view(-1, 12) # 共享data,id不一致
# print(x, id(x))
# x = a.clone().view(-1, 12) # 不共享data
# print(x, id(x))
# x = a + torch.tensor([1, 1, 1, 1])
# print(x)
# print(id(a))
# a.add_(x)
# print(a,id(a))
#
# numpy to tensor or reverse
import numpy as np
# a = torch.ones(5)
# b = a.numpy()
# print(type(a), type(b))
# print(a, b)
# a = np.ones(5)
# b = torch.from_numpy(a)
# print(type(a), type(b))
# print(a, b)
# # 以上两种方案均share data
# a = torch.tensor([1, 2, 3]) # 不share data ,速度比较慢
# 自动求梯度
| 23.238095 | 76 | 0.473361 | 397 | 2,440 | 2.899244 | 0.206549 | 0.104257 | 0.060817 | 0.069505 | 0.390964 | 0.342311 | 0.304083 | 0.25543 | 0.166811 | 0.045178 | 0 | 0.046656 | 0.209426 | 2,440 | 104 | 77 | 23.461538 | 0.550026 | 0.768852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b0566ae751b22b08b02e4cea752af311ec11f358 | 234 | py | Python | exercicios/ex023b.py | LuanGermano/Mundo-1-curso-em-Video-Python | 01aedb85f4141a584360048f523229efcfa50083 | [
"MIT"
] | null | null | null | exercicios/ex023b.py | LuanGermano/Mundo-1-curso-em-Video-Python | 01aedb85f4141a584360048f523229efcfa50083 | [
"MIT"
] | null | null | null | exercicios/ex023b.py | LuanGermano/Mundo-1-curso-em-Video-Python | 01aedb85f4141a584360048f523229efcfa50083 | [
"MIT"
] | null | null | null | num = int(input( "Digite um valor de 0 a 9999: "))
num1 = str(num)
num2 = num1.zfill(4)
print('Unidade: {}'.format(num2[3]))
print('Dezena: {}'.format(num2[2]))
print('Centena: {}'.format(num2[1]))
print('Milhar: {}'.format(num2[0]))
| 29.25 | 50 | 0.623932 | 37 | 234 | 3.945946 | 0.648649 | 0.273973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08134 | 0.106838 | 234 | 7 | 51 | 33.428571 | 0.617225 | 0 | 0 | 0 | 0 | 0 | 0.303419 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
b06e9416fa628320a1d57e2477d7718b114bed7d | 180 | py | Python | python_basic/01InputAndOutput/01output.py | hstarorg/HstarDemoProject | 0b13fc777b3e45ea2fbaa5fe7780605138c1ec78 | [
"MIT"
] | 17 | 2016-01-19T09:04:18.000Z | 2020-03-21T09:35:39.000Z | python_basic/01InputAndOutput/01output.py | hstarorg/PythonDemo | 0b13fc777b3e45ea2fbaa5fe7780605138c1ec78 | [
"MIT"
] | 2 | 2016-01-19T07:34:06.000Z | 2021-09-01T07:31:26.000Z | python_basic/01InputAndOutput/01output.py | hstarorg/PythonDemo | 0b13fc777b3e45ea2fbaa5fe7780605138c1ec78 | [
"MIT"
] | 18 | 2016-09-04T01:39:28.000Z | 2021-01-21T07:24:31.000Z | # 最简单的输出
print('Hello World!')
# 输出表达式值
print(20+10)
# print函数支持多个参数,遇到逗号输出空格。
print('Nice','to','meet','you!',999)
# 字符串连接
print('a'+'b')
# 格式化输出
print('100 + 200 =',100+200) | 12.857143 | 37 | 0.622222 | 26 | 180 | 4.307692 | 0.769231 | 0.107143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121019 | 0.127778 | 180 | 14 | 38 | 12.857143 | 0.592357 | 0.272222 | 0 | 0 | 0 | 0 | 0.309524 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
c67ac48f701a46defb10f63762d70a1c5a3c6edb | 399 | py | Python | ftp_upgrade/server/lib/load_dump_data.py | Eeyhan/ftp | 98dd189d8fe5855e129d330a89ff0890f1ed84f5 | [
"MIT"
] | null | null | null | ftp_upgrade/server/lib/load_dump_data.py | Eeyhan/ftp | 98dd189d8fe5855e129d330a89ff0890f1ed84f5 | [
"MIT"
] | null | null | null | ftp_upgrade/server/lib/load_dump_data.py | Eeyhan/ftp | 98dd189d8fe5855e129d330a89ff0890f1ed84f5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:Eeyhan
import os, sys, json
from conf import settings
def load_data():
'''
加载用户数据
:return:
'''
with open(os.path.join(settings.data_path, '.userdata')) as f:
userdata = json.load(f)
return userdata
def dump_data(userdata):
# username = list(userdata.keys())[0]
# with open(os.path.join())
pass
| 15.96 | 66 | 0.606516 | 54 | 399 | 4.425926 | 0.62963 | 0.066946 | 0.083682 | 0.117155 | 0.150628 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006536 | 0.233083 | 399 | 24 | 67 | 16.625 | 0.77451 | 0.333333 | 0 | 0 | 0 | 0 | 0.03719 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.125 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c681a9ae888f6ded2d694500b40bb8193a72d5ee | 164 | py | Python | userinput.py | Shohanurcsevu/Python_Basics_Practice | 08bc8834775ab7bfc97a557ac458e15385ec4df0 | [
"MIT"
] | 1 | 2021-01-13T09:49:05.000Z | 2021-01-13T09:49:05.000Z | userinput.py | Shohanurcsevu/Python_Basics_Practice | 08bc8834775ab7bfc97a557ac458e15385ec4df0 | [
"MIT"
] | null | null | null | userinput.py | Shohanurcsevu/Python_Basics_Practice | 08bc8834775ab7bfc97a557ac458e15385ec4df0 | [
"MIT"
] | null | null | null | def weather_conditions(temp):
if temp > 7:
print("Warm")
else:
print("Cold")
x = int(input("Enter a temparature"))
weather_conditions(x)
| 16.4 | 37 | 0.603659 | 21 | 164 | 4.619048 | 0.761905 | 0.350515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008197 | 0.256098 | 164 | 9 | 38 | 18.222222 | 0.786885 | 0 | 0 | 0 | 0 | 0 | 0.164634 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.142857 | 0.285714 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6967e8221651aa5d67b44ef03acc9a9a5af6e85 | 203 | py | Python | Facebook/2018/Qualification/B.py | lxdlam/ACM | cde519ef9732ff9e4e9e3f53c00fb30d07bdb306 | [
"MIT"
] | 1 | 2019-11-12T15:08:16.000Z | 2019-11-12T15:08:16.000Z | Facebook/2018/Qualification/B.py | lxdlam/ACM | cde519ef9732ff9e4e9e3f53c00fb30d07bdb306 | [
"MIT"
] | null | null | null | Facebook/2018/Qualification/B.py | lxdlam/ACM | cde519ef9732ff9e4e9e3f53c00fb30d07bdb306 | [
"MIT"
] | 1 | 2021-05-05T01:16:28.000Z | 2021-05-05T01:16:28.000Z | T = int(input())
for kase in range(1, T + 1):
n = int(input())
[input() for i in range(0, n + 1)]
if n & 1:
print(f'Case #{kase}: 1\n0.0')
else:
print(f'Case #{kase}: 0') | 22.555556 | 38 | 0.46798 | 37 | 203 | 2.567568 | 0.459459 | 0.168421 | 0.210526 | 0.294737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064748 | 0.315271 | 203 | 9 | 39 | 22.555556 | 0.618705 | 0 | 0 | 0 | 0 | 0 | 0.171569 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6b1c23d3559ae8fce8fde526695d176b993b12d | 18,211 | py | Python | elements_sdk/models/media_root_permission_access_options.py | elements-storage/elements-sdk-python | 39c365fe079dcd5928c5fe1bbaa67389bd5a3d81 | [
"MIT"
] | 6 | 2020-11-16T23:15:18.000Z | 2022-03-14T03:56:12.000Z | elements_sdk/models/media_root_permission_access_options.py | elements-storage/elements-sdk-python | 39c365fe079dcd5928c5fe1bbaa67389bd5a3d81 | [
"MIT"
] | 1 | 2021-07-28T13:03:49.000Z | 2021-08-25T12:24:01.000Z | elements_sdk/models/media_root_permission_access_options.py | elements-storage/elements-sdk-python | 39c365fe079dcd5928c5fe1bbaa67389bd5a3d81 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
ELEMENTS API
The version of the OpenAPI document: 2
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from elements_sdk.configuration import Configuration
class MediaRootPermissionAccessOptions(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'show_tags': 'bool',
'show_comments': 'bool',
'show_locations': 'bool',
'show_custom_fields': 'bool',
'show_ratings': 'bool',
'show_subclips': 'bool',
'show_ai_metadata': 'bool',
'show_markers': 'bool',
'show_history': 'bool',
'allow_create': 'bool',
'allow_write_fs': 'bool',
'allow_write_db': 'bool',
'allow_proxy_download': 'bool',
'allow_original_download': 'bool',
'allow_upload': 'bool',
'allow_sharing': 'bool',
'allow_delete_fs': 'bool',
'allow_delete_db': 'bool'
}
attribute_map = {
'show_tags': 'show_tags',
'show_comments': 'show_comments',
'show_locations': 'show_locations',
'show_custom_fields': 'show_custom_fields',
'show_ratings': 'show_ratings',
'show_subclips': 'show_subclips',
'show_ai_metadata': 'show_ai_metadata',
'show_markers': 'show_markers',
'show_history': 'show_history',
'allow_create': 'allow_create',
'allow_write_fs': 'allow_write_fs',
'allow_write_db': 'allow_write_db',
'allow_proxy_download': 'allow_proxy_download',
'allow_original_download': 'allow_original_download',
'allow_upload': 'allow_upload',
'allow_sharing': 'allow_sharing',
'allow_delete_fs': 'allow_delete_fs',
'allow_delete_db': 'allow_delete_db'
}
def __init__(self, show_tags=None, show_comments=None, show_locations=None, show_custom_fields=None, show_ratings=None, show_subclips=None, show_ai_metadata=None, show_markers=None, show_history=None, allow_create=None, allow_write_fs=None, allow_write_db=None, allow_proxy_download=None, allow_original_download=None, allow_upload=None, allow_sharing=None, allow_delete_fs=None, allow_delete_db=None, local_vars_configuration=None): # noqa: E501
"""MediaRootPermissionAccessOptions - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._show_tags = None
self._show_comments = None
self._show_locations = None
self._show_custom_fields = None
self._show_ratings = None
self._show_subclips = None
self._show_ai_metadata = None
self._show_markers = None
self._show_history = None
self._allow_create = None
self._allow_write_fs = None
self._allow_write_db = None
self._allow_proxy_download = None
self._allow_original_download = None
self._allow_upload = None
self._allow_sharing = None
self._allow_delete_fs = None
self._allow_delete_db = None
self.discriminator = None
if show_tags is not None:
self.show_tags = show_tags
if show_comments is not None:
self.show_comments = show_comments
if show_locations is not None:
self.show_locations = show_locations
if show_custom_fields is not None:
self.show_custom_fields = show_custom_fields
if show_ratings is not None:
self.show_ratings = show_ratings
if show_subclips is not None:
self.show_subclips = show_subclips
if show_ai_metadata is not None:
self.show_ai_metadata = show_ai_metadata
if show_markers is not None:
self.show_markers = show_markers
if show_history is not None:
self.show_history = show_history
if allow_create is not None:
self.allow_create = allow_create
if allow_write_fs is not None:
self.allow_write_fs = allow_write_fs
if allow_write_db is not None:
self.allow_write_db = allow_write_db
if allow_proxy_download is not None:
self.allow_proxy_download = allow_proxy_download
if allow_original_download is not None:
self.allow_original_download = allow_original_download
if allow_upload is not None:
self.allow_upload = allow_upload
if allow_sharing is not None:
self.allow_sharing = allow_sharing
if allow_delete_fs is not None:
self.allow_delete_fs = allow_delete_fs
if allow_delete_db is not None:
self.allow_delete_db = allow_delete_db
@property
def show_tags(self):
"""Gets the show_tags of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_tags of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_tags
@show_tags.setter
def show_tags(self, show_tags):
"""Sets the show_tags of this MediaRootPermissionAccessOptions.
:param show_tags: The show_tags of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_tags = show_tags
@property
def show_comments(self):
"""Gets the show_comments of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_comments of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_comments
@show_comments.setter
def show_comments(self, show_comments):
"""Sets the show_comments of this MediaRootPermissionAccessOptions.
:param show_comments: The show_comments of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_comments = show_comments
@property
def show_locations(self):
"""Gets the show_locations of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_locations of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_locations
@show_locations.setter
def show_locations(self, show_locations):
"""Sets the show_locations of this MediaRootPermissionAccessOptions.
:param show_locations: The show_locations of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_locations = show_locations
@property
def show_custom_fields(self):
"""Gets the show_custom_fields of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_custom_fields of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_custom_fields
@show_custom_fields.setter
def show_custom_fields(self, show_custom_fields):
"""Sets the show_custom_fields of this MediaRootPermissionAccessOptions.
:param show_custom_fields: The show_custom_fields of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_custom_fields = show_custom_fields
@property
def show_ratings(self):
"""Gets the show_ratings of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_ratings of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_ratings
@show_ratings.setter
def show_ratings(self, show_ratings):
"""Sets the show_ratings of this MediaRootPermissionAccessOptions.
:param show_ratings: The show_ratings of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_ratings = show_ratings
@property
def show_subclips(self):
"""Gets the show_subclips of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_subclips of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_subclips
@show_subclips.setter
def show_subclips(self, show_subclips):
"""Sets the show_subclips of this MediaRootPermissionAccessOptions.
:param show_subclips: The show_subclips of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_subclips = show_subclips
@property
def show_ai_metadata(self):
"""Gets the show_ai_metadata of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_ai_metadata of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_ai_metadata
@show_ai_metadata.setter
def show_ai_metadata(self, show_ai_metadata):
"""Sets the show_ai_metadata of this MediaRootPermissionAccessOptions.
:param show_ai_metadata: The show_ai_metadata of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_ai_metadata = show_ai_metadata
@property
def show_markers(self):
"""Gets the show_markers of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_markers of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_markers
@show_markers.setter
def show_markers(self, show_markers):
"""Sets the show_markers of this MediaRootPermissionAccessOptions.
:param show_markers: The show_markers of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_markers = show_markers
@property
def show_history(self):
"""Gets the show_history of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The show_history of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._show_history
@show_history.setter
def show_history(self, show_history):
"""Sets the show_history of this MediaRootPermissionAccessOptions.
:param show_history: The show_history of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._show_history = show_history
@property
def allow_create(self):
"""Gets the allow_create of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_create of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_create
@allow_create.setter
def allow_create(self, allow_create):
"""Sets the allow_create of this MediaRootPermissionAccessOptions.
:param allow_create: The allow_create of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_create = allow_create
@property
def allow_write_fs(self):
"""Gets the allow_write_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_write_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_write_fs
@allow_write_fs.setter
def allow_write_fs(self, allow_write_fs):
"""Sets the allow_write_fs of this MediaRootPermissionAccessOptions.
:param allow_write_fs: The allow_write_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_write_fs = allow_write_fs
@property
def allow_write_db(self):
"""Gets the allow_write_db of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_write_db of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_write_db
@allow_write_db.setter
def allow_write_db(self, allow_write_db):
"""Sets the allow_write_db of this MediaRootPermissionAccessOptions.
:param allow_write_db: The allow_write_db of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_write_db = allow_write_db
@property
def allow_proxy_download(self):
"""Gets the allow_proxy_download of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_proxy_download of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_proxy_download
@allow_proxy_download.setter
def allow_proxy_download(self, allow_proxy_download):
"""Sets the allow_proxy_download of this MediaRootPermissionAccessOptions.
:param allow_proxy_download: The allow_proxy_download of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_proxy_download = allow_proxy_download
@property
def allow_original_download(self):
"""Gets the allow_original_download of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_original_download of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_original_download
@allow_original_download.setter
def allow_original_download(self, allow_original_download):
"""Sets the allow_original_download of this MediaRootPermissionAccessOptions.
:param allow_original_download: The allow_original_download of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_original_download = allow_original_download
@property
def allow_upload(self):
"""Gets the allow_upload of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_upload of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_upload
@allow_upload.setter
def allow_upload(self, allow_upload):
"""Sets the allow_upload of this MediaRootPermissionAccessOptions.
:param allow_upload: The allow_upload of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_upload = allow_upload
@property
def allow_sharing(self):
"""Gets the allow_sharing of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_sharing of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_sharing
@allow_sharing.setter
def allow_sharing(self, allow_sharing):
"""Sets the allow_sharing of this MediaRootPermissionAccessOptions.
:param allow_sharing: The allow_sharing of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_sharing = allow_sharing
@property
def allow_delete_fs(self):
"""Gets the allow_delete_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_delete_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_delete_fs
@allow_delete_fs.setter
def allow_delete_fs(self, allow_delete_fs):
"""Sets the allow_delete_fs of this MediaRootPermissionAccessOptions.
:param allow_delete_fs: The allow_delete_fs of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_delete_fs = allow_delete_fs
@property
def allow_delete_db(self):
"""Gets the allow_delete_db of this MediaRootPermissionAccessOptions. # noqa: E501
:return: The allow_delete_db of this MediaRootPermissionAccessOptions. # noqa: E501
:rtype: bool
"""
return self._allow_delete_db
@allow_delete_db.setter
def allow_delete_db(self, allow_delete_db):
"""Sets the allow_delete_db of this MediaRootPermissionAccessOptions.
:param allow_delete_db: The allow_delete_db of this MediaRootPermissionAccessOptions. # noqa: E501
:type: bool
"""
self._allow_delete_db = allow_delete_db
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, MediaRootPermissionAccessOptions):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, MediaRootPermissionAccessOptions):
return True
return self.to_dict() != other.to_dict()
| 32.461676 | 451 | 0.662786 | 2,037 | 18,211 | 5.62052 | 0.062838 | 0.037733 | 0.238973 | 0.198096 | 0.693947 | 0.571054 | 0.492969 | 0.380732 | 0.290768 | 0.156957 | 0 | 0.013102 | 0.262369 | 18,211 | 560 | 452 | 32.519643 | 0.839202 | 0.38312 | 0 | 0.090164 | 1 | 0 | 0.088002 | 0.007028 | 0 | 0 | 0 | 0 | 0 | 1 | 0.172131 | false | 0 | 0.016393 | 0 | 0.303279 | 0.008197 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c6cd2be15224325632f21f267047527aed5eee18 | 91 | py | Python | src/bt_utils/get_content.py | zaanposni/umfrageBot | 3e19dc0629cde394da2ae8706e6e043b4e87059d | [
"MIT"
] | 6 | 2019-08-15T20:19:38.000Z | 2021-02-28T21:33:19.000Z | src/bt_utils/get_content.py | zaanposni/umfrageBot | 3e19dc0629cde394da2ae8706e6e043b4e87059d | [
"MIT"
] | 31 | 2019-08-14T08:42:08.000Z | 2020-05-07T13:43:43.000Z | src/bt_utils/get_content.py | zaanposni/umfrageBot | 3e19dc0629cde394da2ae8706e6e043b4e87059d | [
"MIT"
] | 5 | 2019-08-17T13:39:53.000Z | 2020-04-01T07:25:51.000Z | import os.path
content_dir = "content" if os.path.isdir("content") else "content-default"
| 22.75 | 74 | 0.747253 | 14 | 91 | 4.785714 | 0.642857 | 0.179104 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10989 | 91 | 3 | 75 | 30.333333 | 0.82716 | 0 | 0 | 0 | 0 | 0 | 0.318681 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c6df02930c90dd5f6051cfd6f586d30fccbf45f6 | 359 | py | Python | aws/boto3/src/main.py | GuillaumeFalourd/formulas-python | 8fb299598f6d63d42ceb39d2a64f65485aa39428 | [
"Apache-2.0"
] | 16 | 2021-02-17T14:40:07.000Z | 2022-01-14T23:44:43.000Z | aws/boto3/src/main.py | ErosMLima/formulas-python | 15f1f56630131a2d3202ca7a1f685c2708a4815b | [
"Apache-2.0"
] | 1 | 2021-03-08T16:06:17.000Z | 2021-03-08T16:06:17.000Z | aws/boto3/src/main.py | ErosMLima/formulas-python | 15f1f56630131a2d3202ca7a1f685c2708a4815b | [
"Apache-2.0"
] | 4 | 2021-02-04T16:31:42.000Z | 2021-04-09T04:16:44.000Z | #!/usr/bin/python3
import os
from formula import formula
access_key = os.environ.get("RIT_ACCESS_KEY")
secret_access_key = os.environ.get("RIT_SECRET_ACCESS_KEY")
region = os.environ.get("RIT_REGION")
vpc_cidr = os.environ.get("RIT_VPC_CIDR")
vpc_name = os.environ.get("RIT_VPC_NAME")
formula.run(access_key, secret_access_key, region, vpc_cidr, vpc_name)
| 27.615385 | 70 | 0.785515 | 61 | 359 | 4.295082 | 0.295082 | 0.206107 | 0.229008 | 0.28626 | 0.469466 | 0.183206 | 0 | 0 | 0 | 0 | 0 | 0.00304 | 0.083565 | 359 | 12 | 71 | 29.916667 | 0.793313 | 0.047354 | 0 | 0 | 0 | 0 | 0.202346 | 0.061584 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05cfc09393c3a98594b1cff29a69ef86b133a350 | 490 | py | Python | models/alarm_model.py | ajmcateer/RaspberryAlarm | df8b774e72b2e3d077268d00c0b6b2e132b37070 | [
"MIT"
] | null | null | null | models/alarm_model.py | ajmcateer/RaspberryAlarm | df8b774e72b2e3d077268d00c0b6b2e132b37070 | [
"MIT"
] | 2 | 2019-09-03T00:44:59.000Z | 2021-06-01T23:50:36.000Z | models/alarm_model.py | ajmcateer/RaspberryAlarm | df8b774e72b2e3d077268d00c0b6b2e132b37070 | [
"MIT"
] | null | null | null | from PyQt5.QtCore import QTime
class AlarmModel:
name = ""
set_hour = ""
set_minute = ""
def __init__(self, name: str, set_hour, set_minute):
self.name = name
self.set_hour = set_hour
self.set_minute = set_minute
def time(self):
return QTime(self.set_hour, self.set_minute)
def dict(self):
return {
"name": self.name,
"set_hour": self.set_hour,
"set_minute": self.set_minute
}
| 21.304348 | 56 | 0.571429 | 62 | 490 | 4.225806 | 0.290323 | 0.187023 | 0.152672 | 0.183206 | 0.305344 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003021 | 0.32449 | 490 | 22 | 57 | 22.272727 | 0.78852 | 0 | 0 | 0 | 0 | 0 | 0.044898 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.058824 | 0.117647 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
05d551b22ef035fdb0fe91f8a404c6086ee1ef9a | 41 | py | Python | python/testData/inspections/PyRedeclarationInspection/typeDeclarationAfterDefinition.py | tgodzik/intellij-community | f5ef4191fc30b69db945633951fb160c1cfb7b6f | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/inspections/PyRedeclarationInspection/typeDeclarationAfterDefinition.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2022-02-19T09:45:05.000Z | 2022-02-27T20:32:55.000Z | python/testData/inspections/PyRedeclarationInspection/typeDeclarationAfterDefinition.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | for x in func():
x: int
print(x)
| 10.25 | 16 | 0.487805 | 8 | 41 | 2.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.365854 | 41 | 3 | 17 | 13.666667 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
05e413aad768cc4cedb55335e060a6a2808dda47 | 75 | py | Python | mmedit/core/export/__init__.py | Yshuo-Li/mmediting-test | ff8349a183b3d266495a53be0c8ad8e342e8b461 | [
"Apache-2.0"
] | 2 | 2021-04-20T11:31:37.000Z | 2021-05-27T13:04:40.000Z | mmedit/core/export/__init__.py | Yshuo-Li/mmediting-test | ff8349a183b3d266495a53be0c8ad8e342e8b461 | [
"Apache-2.0"
] | 1 | 2021-08-05T16:20:39.000Z | 2021-08-05T16:20:39.000Z | mmedit/core/export/__init__.py | Yshuo-Li/mmediting-test | ff8349a183b3d266495a53be0c8ad8e342e8b461 | [
"Apache-2.0"
] | 2 | 2021-04-22T12:10:14.000Z | 2021-05-19T02:09:48.000Z | from .wrappers import ONNXRuntimeEditing
__all__ = ['ONNXRuntimeEditing']
| 18.75 | 40 | 0.813333 | 6 | 75 | 9.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106667 | 75 | 3 | 41 | 25 | 0.850746 | 0 | 0 | 0 | 0 | 0 | 0.24 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
05edcef87f823bc87ec8be0d67564bae0cdbfda1 | 112 | py | Python | project/app/urls.py | kmdouglass/python-webapp | 4bb2018d194bc66c801e43f871dae3307e3ce7fd | [
"MIT"
] | 1 | 2020-11-05T16:03:16.000Z | 2020-11-05T16:03:16.000Z | project/app/urls.py | kmdouglass/python-webapp | 4bb2018d194bc66c801e43f871dae3307e3ce7fd | [
"MIT"
] | 6 | 2020-06-05T23:55:53.000Z | 2022-02-10T13:17:08.000Z | project/app/urls.py | kmdouglass/python-webapp | 4bb2018d194bc66c801e43f871dae3307e3ce7fd | [
"MIT"
] | null | null | null | from django.urls import path
from .views import Foo
urlpatterns = [
path('', Foo.as_view(), name='foo')
]
| 14 | 39 | 0.660714 | 16 | 112 | 4.5625 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 112 | 7 | 40 | 16 | 0.802198 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
af14edc71f3459aa621633ec17f602b10a8c8b73 | 6,104 | py | Python | doc/jupyter_execute/examples/keda/keda_prom_auto_scale.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | doc/jupyter_execute/examples/keda/keda_prom_auto_scale.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | doc/jupyter_execute/examples/keda/keda_prom_auto_scale.py | edshee/seldon-core | 78c10fbca16a5e2a0c25b9673aa3deb220070e26 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
#
# # Scale Seldon Deployments based on Prometheus Metrics.
# This notebook shows how you can scale Seldon Deployments based on Prometheus metrics via KEDA.
#
# [KEDA](https://keda.sh/) is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed.
#
# With the support of KEDA in Seldon, you can scale your seldon deployments with any scalers listed [here](https://keda.sh/docs/2.0/scalers/).
# In this example we will scale the seldon deployment with Prometheus metrics as an example.
# ## Install Seldon Core
#
# Install Seldon Core as described in [docs](https://docs.seldon.io/projects/seldon-core/en/latest/workflow/install.html)
#
# Make sure add `--set keda.enabled=true`
# ## Install Seldon Core Analytic
#
# seldon-core-analytics contains Prometheus and Grafana installation with a basic Grafana dashboard showing the default Prometheus metrics exposed by Seldon for each inference graph deployed.
# Later we will use the Prometheus service installed to provide metrics in order to scale the Seldon models.
#
# Install Seldon Core Analytics as described in [docs](https://docs.seldon.io/projects/seldon-core/en/latest/analytics/analytics.html)
# In[ ]:
get_ipython().system('helm install seldon-core-analytics ../../helm-charts/seldon-core-analytics -n seldon-system --wait')
# ## Install KEDA
# In[ ]:
get_ipython().system('kubectl delete -f https://github.com/kedacore/keda/releases/download/v2.0.0/keda-2.0.0.yaml')
get_ipython().system('kubectl apply -f https://github.com/kedacore/keda/releases/download/v2.0.0/keda-2.0.0.yaml')
# In[ ]:
get_ipython().system('kubectl get pod -n keda')
# ## Create model with KEDA
# To create a model with KEDA autoscaling you just need to add a KEDA spec referring in the Deployment, e.g.:
# ```yaml
# kedaSpec:
# pollingInterval: 15 # Optional. Default: 30 seconds
# minReplicaCount: 1 # Optional. Default: 0
# maxReplicaCount: 5 # Optional. Default: 100
# triggers:
# - type: prometheus
# metadata:
# # Required
# serverAddress: http://seldon-core-analytics-prometheus-seldon.seldon-system.svc.cluster.local
# metricName: access_frequency
# threshold: '10'
# query: rate(seldon_api_executor_client_requests_seconds_count{seldon_app=~"seldon-model-example"}[10s]
# ```
# The full SeldonDeployment spec is shown below.
# In[ ]:
VERSION = get_ipython().getoutput('cat ../../version.txt')
VERSION = VERSION[0]
VERSION
# In[ ]:
get_ipython().run_cell_magic('writefile', 'model_with_keda_prom.yaml', 'apiVersion: machinelearning.seldon.io/v1\nkind: SeldonDeployment\nmetadata:\n name: seldon-model\nspec:\n name: test-deployment\n predictors:\n - componentSpecs:\n - spec:\n containers:\n - image: seldonio/mock_classifier:1.5.0-dev\n imagePullPolicy: IfNotPresent\n name: classifier\n resources:\n requests:\n cpu: \'0.5\'\n kedaSpec:\n pollingInterval: 15 # Optional. Default: 30 seconds\n minReplicaCount: 1 # Optional. Default: 0\n maxReplicaCount: 5 # Optional. Default: 100\n triggers:\n - type: prometheus\n metadata:\n # Required\n serverAddress: http://seldon-core-analytics-prometheus-seldon.seldon-system.svc.cluster.local\n metricName: access_frequency\n threshold: \'10\'\n query: rate(seldon_api_executor_client_requests_seconds_count{seldon_app=~"seldon-model-example"}[1m])\n graph:\n children: []\n endpoint:\n type: REST\n name: classifier\n type: MODEL\n name: example')
# In[ ]:
get_ipython().system('kubectl create -f model_with_keda_prom.yaml')
# In[ ]:
get_ipython().system("kubectl rollout status deploy/$(kubectl get deploy -l seldon-deployment-id=seldon-model -o jsonpath='{.items[0].metadata.name}')")
# ## Create Load
# We label some nodes for the loadtester. We attempt the first two as for Kind the first node shown will be the master.
# In[ ]:
get_ipython().system("kubectl label nodes $(kubectl get nodes -o jsonpath='{.items[0].metadata.name}') role=locust")
get_ipython().system("kubectl label nodes $(kubectl get nodes -o jsonpath='{.items[1].metadata.name}') role=locust")
# Before add loads to the model, there is only one replica
# In[ ]:
get_ipython().system('kubectl get deployment seldon-model-example-0-classifier')
# In[ ]:
get_ipython().system('helm install seldon-core-loadtesting seldon-core-loadtesting --repo https://storage.googleapis.com/seldon-charts --set locust.host=http://seldon-model-example:8000 --set oauth.enabled=false --set locust.hatchRate=1 --set locust.clients=1 --set loadtest.sendFeedback=0 --set locust.minWait=0 --set locust.maxWait=0 --set replicaCount=1')
# After a few mins you should see the deployment scaled to 5 replicas
# In[ ]:
import json
import time
def getNumberPods():
dp = get_ipython().getoutput('kubectl get deployment seldon-model-example-0-classifier -o json')
dp = json.loads("".join(dp))
return dp["status"]["replicas"]
scaled = False
for i in range(60):
pods = getNumberPods()
print(pods)
if pods > 1:
scaled = True
break
time.sleep(5)
assert scaled
# In[ ]:
get_ipython().system('kubectl get deployment/seldon-model-example-0-classifier scaledobject/seldon-model-example-0-classifier')
# ## Remove Load
# In[ ]:
get_ipython().system('helm delete seldon-core-loadtesting')
# After 5-10 mins you should see the deployment replica number decrease to 1
# In[ ]:
get_ipython().system('kubectl get pods,deployments,hpa,scaledobject')
# In[ ]:
get_ipython().system('kubectl delete -f model_with_keda_prom.yaml')
# In[ ]:
| 34.681818 | 1,264 | 0.679227 | 817 | 6,104 | 5.019584 | 0.325581 | 0.041453 | 0.054621 | 0.05267 | 0.39722 | 0.340892 | 0.277737 | 0.228481 | 0.197513 | 0.197513 | 0 | 0.015337 | 0.198886 | 6,104 | 175 | 1,265 | 34.88 | 0.823313 | 0.40924 | 0 | 0 | 0 | 0.333333 | 0.742622 | 0.220772 | 0 | 0 | 0 | 0 | 0.030303 | 1 | 0.030303 | false | 0 | 0.060606 | 0 | 0.121212 | 0.030303 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
af2dfbac802a81ae8aad42203a0bd4f8ec9da9e8 | 2,952 | py | Python | lib/galaxy/managers/annotatable.py | vimalkumarvelayudhan/galaxy | ea89dd8f149778b6c2f0f3f4a34c8b21f7033af7 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/managers/annotatable.py | vimalkumarvelayudhan/galaxy | ea89dd8f149778b6c2f0f3f4a34c8b21f7033af7 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/managers/annotatable.py | vimalkumarvelayudhan/galaxy | ea89dd8f149778b6c2f0f3f4a34c8b21f7033af7 | [
"CC-BY-3.0"
] | null | null | null | """
Mixins for Annotatable model managers and serializers.
"""
import logging
log = logging.getLogger( __name__ )
class AnnotatableManagerMixin( object ):
#: class of AnnotationAssociation (e.g. HistoryAnnotationAssociation)
annotation_assoc = None
# TODO: most of this seems to be covered by item_attrs.UsesAnnotations
# TODO: use these below (serializer/deserializer)
def user_annotation( self, item, user ):
return item.get_item_annotation_str( self.session(), user, item )
def owner_annotation( self, item ):
return self.user_annotation( item, item.user )
def delete_annotation( self, item, user ):
return item.delete_item_annotation( self.session(), user, item )
def annotate( self, item, user, annotation ):
if annotation is None:
self.delete_annotation( item, user )
return None
annotation_obj = item.add_item_annotation( self.session(), user, item, annotation )
return annotation_obj.annotation
#def by_user( self, user, **kwargs ):
# pass
class AnnotatableSerializerMixin( object ):
def add_serializers( self ):
self.serializers[ 'annotation' ] = self.serialize_annotation
def serialize_annotation( self, item, key, user=None, **context ):
"""
Get and serialize an `item`'s annotation.
"""
# user = item.user
sa_session = self.app.model.context
returned = item.get_item_annotation_str( sa_session, user, item )
return returned
class AnnotatableDeserializerMixin( object ):
def add_deserializers( self ):
self.deserializers[ 'annotation' ] = self.deserialize_annotation
def deserialize_annotation( self, item, key, val, user=None, **context ):
"""
Make sure `val` is a valid annotation and assign it, deleting any existing
if `val` is None.
"""
val = self.validate.nullable_basestring( key, val )
return self.manager.annotate( item, user, val )
# TODO: I'm not entirely convinced this (or tags) are a good idea for filters since they involve a/the user
class AnnotatableFilterMixin( object ):
def _owner_annotation( self, item ):
"""
Get the annotation by the item's owner.
"""
if not item.user:
return None
for annotation in item.annotations:
if annotation.user == item.user:
return annotation.annotation
return None
def filter_annotation_contains( self, item, val ):
"""
Test whether `val` is in the owner's annotation.
"""
owner_annotation = self._owner_annotation( item )
if owner_annotation is None:
return False
return val in owner_annotation
def _add_parsers( self ):
self.fn_filter_parsers.update({
'annotation' : { 'op': { 'has': self.filter_annotation_contains, } },
})
| 32.086957 | 107 | 0.64668 | 337 | 2,952 | 5.522255 | 0.323442 | 0.082751 | 0.058033 | 0.030629 | 0.133262 | 0.069855 | 0 | 0 | 0 | 0 | 0 | 0 | 0.26355 | 2,952 | 91 | 108 | 32.43956 | 0.856026 | 0.213753 | 0 | 0.065217 | 0 | 0 | 0.015859 | 0 | 0 | 0 | 0 | 0.021978 | 0 | 1 | 0.23913 | false | 0 | 0.021739 | 0.065217 | 0.630435 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
af31daaa8b03cab42cb13cd19523a23eda669e0f | 68 | py | Python | btrack/__init__.py | chisyliu/BayesianTracker | 6eb5261c706b8fd15d22ce4ad1782af4513a7d32 | [
"MIT"
] | 1 | 2019-03-20T21:24:18.000Z | 2019-03-20T21:24:18.000Z | btrack/__init__.py | chisyliu/BayesianTracker | 6eb5261c706b8fd15d22ce4ad1782af4513a7d32 | [
"MIT"
] | null | null | null | btrack/__init__.py | chisyliu/BayesianTracker | 6eb5261c706b8fd15d22ce4ad1782af4513a7d32 | [
"MIT"
] | null | null | null | __all__ = ['core','utils','constants','render']
from core import *
| 17 | 47 | 0.661765 | 8 | 68 | 5.125 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 68 | 3 | 48 | 22.666667 | 0.683333 | 0 | 0 | 0 | 0 | 0 | 0.352941 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
af55cb641d1ef795b21d0aabbf6962b8a328bb14 | 609 | py | Python | fern/primitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | 1 | 2021-12-13T12:50:35.000Z | 2021-12-13T12:50:35.000Z | fern/primitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | 1 | 2018-07-19T03:54:17.000Z | 2018-07-19T03:54:17.000Z | fern/primitives.py | andrewf/fern | 16c155ff1d0c8a096b43c2c19d1f478a334682e4 | [
"MIT"
] | null | null | null | '''
This file contains any primitives for Lyanna that aren't just
borrowed from the language. Basically this is Nothing and Undefined,
which are singletons. That is, their classes are stuck here and only
selected instances are exported through __all__
'''
class NothingType(object):
def __str__(self):
return "Nothing"
class UndefinedType(object):
def __str__(self):
return "Undefined"
Nothing = NothingType()
Undefined = UndefinedType()
def is_primitive(item):
return isinstance(item, (NothingType, UndefinedType, bool, int, basestring))
__all__ = ['Nothing', 'Undefined']
| 24.36 | 80 | 0.738916 | 74 | 609 | 5.851351 | 0.635135 | 0.04157 | 0.055427 | 0.073903 | 0.101617 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174056 | 609 | 24 | 81 | 25.375 | 0.860835 | 0.405583 | 0 | 0.181818 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0 | 0.272727 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
af5d9873956e672f5dee7e92ae08e26772fcdd1b | 3,617 | py | Python | coloring/test/coloring_grader_test.py | mike715/assignment | f69378420ce2bb845abaef0f448eab303aa7a7e7 | [
"MIT"
] | 101 | 2016-08-08T05:41:27.000Z | 2022-03-09T15:04:42.000Z | coloring/test/coloring_grader_test.py | sthagen/assignment | 57d18b188177269c8fe07f3d9bef416720c7b465 | [
"MIT"
] | 44 | 2016-08-07T20:57:56.000Z | 2022-02-01T08:07:50.000Z | coloring/test/coloring_grader_test.py | sthagen/assignment | 57d18b188177269c8fe07f3d9bef416720c7b465 | [
"MIT"
] | 88 | 2016-10-05T23:38:45.000Z | 2022-02-28T09:28:46.000Z | import sys, os, pytest
sys.path.append(os.getcwd())
from do_grader_lib import PartQuality
from coloring import grader
with open('coloring/data/gc_4_1', 'r') as input_data_file:
input_data = input_data_file.read()
quality = PartQuality('test', 3, 2)
greedy_submission = '3 0\n0 1 2 2\n123\n'
opt_submission = '2 0\n1 2 1 1\n123\n'
# Score Test
def test_full_credit():
result = grader.grade(input_data, quality, opt_submission)
assert(result['score'] == 1.0)
def test_full_credit_opt():
result = grader.grade(input_data, quality, '2 1\n1 2 1 1\n123\n')
assert(result['score'] == 1.0)
def test_full_credit_opt_big():
result = grader.grade(input_data, quality, '2 99\n1 2 1 1\n123\n')
assert(result['score'] == 1.0)
def test_full_credit_opt_neg():
result = grader.grade(input_data, quality, '2 -99\n1 2 1 1\n123\n')
assert(result['score'] == 1.0)
def test_partial_credit():
result = grader.grade(input_data, quality, greedy_submission)
assert(result['score'] == 0.7)
def test_feasible_credit():
result = grader.grade(input_data, quality, '4 0\n1 2 3 4\n123\n')
assert(result['score'] == 0.3)
def test_partial_credit_timelimit():
result = grader.grade(input_data, quality, '2 0\n1 2 1 1\n99999\n')
assert(result['score'] == 0.7)
assert('runtime exceeded' in result['feedback'])
def test_objective_value_warning():
result = grader.grade(input_data, quality, '4 0\n1 2 1 1\n123\n')
assert(result['score'] == 1.0)
assert('Warning' in result['feedback'])
# Not implementable without the leader board
# passed += testGrade(grade, metadata, db, 'Opt Flag Warning (7/10): ' , '3 1\n0 1 2 2\n123\n', 7)
# Constraint Tests
def test_neq_violated():
result = grader.grade(input_data, quality, '1 0\n1 1 1 1\n123\n')
assert(result['score'] == 0.0)
# I/O Tests
def test_objective_line_long():
result = grader.grade(input_data, quality, '2 0 0\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_objective_line_short():
result = grader.grade(input_data, quality, '2 \n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_solution_line_long():
result = grader.grade(input_data, quality, '2 0\n1 2 1 1 0\n123\n')
assert(result['score'] == 0.0)
def test_solution_line_short():
result = grader.grade(input_data, quality, '2 0\n1 2 1 \n123\n')
assert(result['score'] == 0.0)
def test_line_count_long():
result = grader.grade(input_data, quality, '0\n 2 0\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_line_count_short():
result = grader.grade(input_data, quality, '1 2 1 1\n123\n')
assert(result['score'] == 0.0)
# Type Tests
def test_nan_objective():
result = grader.grade(input_data, quality, 'NaN 0\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_inf_objective():
result = grader.grade(input_data, quality, 'Inf 0\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_alpha_objective():
result = grader.grade(input_data, quality, 'a 0\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_alpha_optflag():
result = grader.grade(input_data, quality, '2 b\n1 2 1 1\n123\n')
assert(result['score'] == 0.0)
def test_alpha_solution():
result = grader.grade(input_data, quality, '2 0\n1 2 c 1\n123\n')
assert(result['score'] == 0.0)
def test_float_solution():
result = grader.grade(input_data, quality, '2 0\n1 2.1 1 1\n123\n')
assert(result['score'] == 0.0)
def test_alpha_time():
result = grader.grade(input_data, quality, '2 0\n1 2 1 1\n123d\n')
assert(result['score'] == 0.0)
| 31.181034 | 99 | 0.670169 | 615 | 3,617 | 3.79187 | 0.149594 | 0.096484 | 0.160377 | 0.207547 | 0.727702 | 0.710978 | 0.683962 | 0.517581 | 0.512007 | 0.491424 | 0 | 0.0858 | 0.168648 | 3,617 | 115 | 100 | 31.452174 | 0.689724 | 0.052253 | 0 | 0.272727 | 0 | 0 | 0.176901 | 0 | 0 | 0 | 0 | 0 | 0.311688 | 1 | 0.285714 | false | 0 | 0.038961 | 0 | 0.324675 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
af88d6d54ad7c50573328a48116a9eb1ff06d097 | 9,499 | py | Python | core/yggdrasil.py | hit-mc/YggdrasilMux | 69648de5a95446e92d2d80e1530d1561a89882ec | [
"MIT"
] | 1 | 2022-02-27T15:46:23.000Z | 2022-02-27T15:46:23.000Z | core/yggdrasil.py | hit-mc/YggdrasilMux | 69648de5a95446e92d2d80e1530d1561a89882ec | [
"MIT"
] | null | null | null | core/yggdrasil.py | hit-mc/YggdrasilMux | 69648de5a95446e92d2d80e1530d1561a89882ec | [
"MIT"
] | null | null | null | import json
import logging
import requests
class YggdrasilSessionServer:
"""
Yggdrasil session server interface
"""
# def authenticate(self, form) -> (str, int):
# """
# 登录
# POST /authserver/authenticate
# 使用密码进行身份验证,并分配一个新的令牌。
# 请求格式:
# {
# "username":"邮箱(或其他凭证,详见 §使用角色名称登录)",
# "password":"密码",
# "clientToken":"由客户端指定的令牌的 clientToken(可选)",
# "requestUser":true/false, // 是否在响应中包含用户信息,默认 false
# "agent":{
# "name":"Minecraft",
# "version":1
# }
# }
# 若请求中未包含 clientToken,服务端应该随机生成一个无符号 UUID 作为 clientToken。
# 但需要注意 clientToken 可以为任何字符串,即请求中提供任何 clientToken 都是可以接
# 受的,不一定要为无符号 UUID。
# 对于令牌要绑定的角色:若用户没有任何角色,则为空;若用户仅有一个角色,那么通常绑定到该
# 角色;若用户有多个角色,通常为空,以便客户端进行选择。也就是说如果绑定的角色为空,则需
# 要客户端进行角色选择。
# 响应格式:
# {
# "accessToken":"令牌的 accessToken",
# "clientToken":"令牌的 clientToken",
# "availableProfiles":[ // 用户可用角色列表
# // ,... 每一项为一个角色(格式见 §角色信息的序列化)
# ],
# "selectedProfile":{
# // ... 绑定的角色,若为空,则不需要包含(格式见 §角色信息的序列化)
# },
# "user":{
# // ... 用户信息(仅当请求中 requestUser 为 true 时包含,格式见 §用户信息的序列化)
# }
# }
# 安全提示: 该 API 可以被用于密码暴力破解,应受到速率限制。限制应针对用户,而不是客户端 IP。
# 使用角色名称登录
# 除使用邮箱登录外,验证服务器还可以允许用户使用角色名称登录。要实现这一点,验证服务器需要进行以下工作:
#
# 将 API 元数据中的 feature.non_email_login 字段设置为 true。(见 API 元数据获取§功能选项)
# 接受在登录接口中使用角色名称作为 username 参数。
# 当用户使用角色名称登录时,验证服务器应自动将令牌绑定到相应角色,即上文响应中的 selectedProfile
# 应为用户登录时所用的角色。
# 这种情况下,如果用户拥有多个角色,那么他可以省去选择角色的操作。考虑到某些程序不支持多角色
# (例如 Geyser),还可以通过上述方法绕过角色选择。
#
# :param form:
# :return:
# """
# raise NotImplementedError()
#
# def refresh(self, form) -> (str, int):
# """
# 刷新
# POST /authserver/refresh
# 吊销原令牌,并颁发一个新的令牌。
# 请求格式:
# {
# "accessToken":"令牌的 accessToken",
# "clientToken":"令牌的 clientToken(可选)",
# "requestUser":true/false, // 是否在响应中包含用户信息,默认 false
# "selectedProfile":{
# // ... 要选择的角色(可选,格式见 §角色信息的序列化)
# }
# }
# 当指定 clientToken 时,服务端应检查 accessToken 和 clientToken 是否有效,
# 否则只需要检查 accessToken。
# 颁发的新令牌的 clientToken 应与原令牌的相同。
# 如果请求中包含 selectedProfile,那么这就是一个选择角色的操作。此操作要求原令
# 牌所绑定的角色为空,而新令牌则将绑定到 selectedProfile 所指定的角色上。如果
# 不包含 selectedProfile,那么新令牌所绑定的角色和原令牌相同。
# 刷新操作在令牌暂时失效时依然可以执行。若请求失败,原令牌依然有效。
# 响应格式:
# {
# "accessToken":"新令牌的 accessToken",
# "clientToken":"新令牌的 clientToken",
# "selectedProfile":{
# // ... 新令牌绑定的角色,若为空,则不需要包含(格式见 §角色信息的序列化)
# },
# "user":{
# // ... 用户信息(仅当请求中 requestUser 为 true 时包含,格式见 §用户信息的序列化)
# }
# }
# :param form:
# :return:
# """
# raise NotImplementedError()
#
# def validate(self, form) -> (str, int):
# """
# 验证令牌
# POST /authserver/validate
# 检验令牌是否有效。
# 请求格式:
# {
# "accessToken":"令牌的 accessToken",
# "clientToken":"令牌的 clientToken(可选)"
# }
# 当指定 clientToken 时,服务端应检查 accessToken 和 clientToken 是否有效,
# 否则只需要检查 accessToken 。
# 若令牌有效,服务端应返回 HTTP 状态 204 No Content,否则作为令牌无效的异常情况处理。
# :param form:
# :return:
# """
# raise NotImplementedError()
#
# def invalidate(self, form) -> (str, int):
# """
# POST /authserver/invalidate
# 吊销给定令牌。
# 请求格式:
# {
# "accessToken":"令牌的 accessToken",
# "clientToken":"令牌的 clientToken(可选)"
# }
# 服务端只需要检查 accessToken,即无论 clientToken 为何值都不会造成影响。
# 无论操作是否成功,服务端应返回 HTTP 状态 204 No Content。
# :param form:
# :return:
# """
# raise NotImplementedError()
#
# def signout(self, form) -> (str, int):
# """
# POST /authserver/signout
# 吊销用户的所有令牌。
# 请求格式:
# {
# "username":"邮箱",
# "password":"密码"
# }
# 若操作成功,服务端应返回 HTTP 状态 204 No Content。
# 安全提示: 该 API 也可用于判断密码的正确性,因此应受到和登录 API 一样的速率限制。
# :param form:
# :return:
# """
# raise NotImplementedError()
def join(self, form) -> (str, int):
"""
客户端进入服务器
POST /session/minecraft/join
记录服务端发送给客户端的 serverId,以备服务端检查。
请求格式:
{
"accessToken":"令牌的 accessToken",
"selectedProfile":"该令牌绑定的角色的 UUID(无符号)",
"serverId":"服务端发送给客户端的 serverId"
}
仅当 accessToken 有效,且 selectedProfile 与令牌所绑定的角色一致时,操作才成功。
服务端应记录以下信息:
serverId
accessToken
发送该请求的客户端 IP
实现时请注意:以上信息应记录在内存数据库中(如 Redis),且应该设置过期时间(如 30 秒)。
介于 serverId 的随机性,可以将其作为主键。
若操作成功,服务端应返回 HTTP 状态 204 No Content。
:param form:
:return:
"""
raise NotImplementedError()
def hasJoined(self, form) -> (str, int):
"""
服务端验证客户端
GET /session/minecraft/hasJoined?username={username}&serverId={serverId}&ip={ip}
检查客户端会话的有效性,即数据库中是否存在该 serverId 的记录,且信息正确。
请求参数:
参数 值
username 角色的名称
serverId 服务端发送给客户端的 serverId
ip (可选) Minecraft 服务端获取到的客户端 IP,仅当 prevent-proxy-connections 选项开启时包含
username 需要与 serverId 所对应令牌所绑定的角色的名称相同。
响应格式:
{
// ... 令牌所绑定角色的完整信息(包含角色属性及数字签名,格式见 §角色信息的序列化)
}
若操作失败,服务端应返回 HTTP 状态 204 No Content。
:param form:
:return:
"""
raise NotImplementedError()
def profile(self, form) -> (str, int):
"""
GET /session/minecraft/profile/{uuid}?unsigned={unsigned}
查询指定角色的完整信息(包含角色属性)。
请求参数:
参数 值
uuid 角色的 UUID(无符号)
unsigned (可选) true 或 false。是否在响应中不包含数字签名,默认为 true
响应格式:
{
// ... 角色信息(包含角色属性。若 unsigned 为 false,还需要包含数字签名。格式见 §角色信息的序列化)
}
若角色不存在,服务端应返回 HTTP 状态 204 No Content。
:param form:
:return:
"""
raise NotImplementedError()
class ConcreteYggdrasilSessionServer(YggdrasilSessionServer):
def __init__(self, server_url: str):
if not server_url.endswith('/'):
server_url += '/'
self._server_url = server_url
def __str__(self):
return self.get_server_url()
def join(self, form) -> (str, int):
return self._form_request(self._url_join(), form)
def hasJoined(self, form) -> (str, int):
return self._form_request(self._url_has_joined(), form)
def profile(self, form) -> (str, int):
return self._form_request(self._url_profile(), form)
def get_server_url(self) -> str:
return self._server_url
def _url_has_joined(self):
return self._server_url + 'sessionserver/session/minecraft/hasJoined'
def _url_join(self):
return self._server_url + 'sessionserver/session/minecraft/join'
def _url_profile(self):
return self._server_url + 'sessionserver/session/minecraft/profile'
def _form_request(self, url, form, method='GET') -> (str, int):
try:
method = method.upper()
logging.debug(f'Make request with form {json.dumps(form)}')
if method == 'GET':
r = requests.get(url, params=form, timeout=3, headers={'User-Agent': 'Java/1.8.0_271'})
elif method == 'POST':
r = requests.post(url, data=json.dumps(form), headers={
'Content-Type': 'application/json',
'User-Agent': 'Java/1.8.0_271'
}, timeout=3)
else:
raise ValueError(f'Unsupported method {method}')
logging.debug(
f'Form request returns (status_code={r.status_code}, headers={"".join([f"{k}: {v}; " for k, v in r.headers.items()])}'
f', text={r.text})')
return r.text, r.status_code
except IOError as e:
logging.error(f'Failed to {method} url {url} with form {form}: {e}')
return '', 500
class MojangYggdrasilSessionServer(ConcreteYggdrasilSessionServer):
def _url_has_joined(self):
return self._server_url + 'session/minecraft/hasJoined'
def _url_join(self):
return self._server_url + 'session/minecraft/join'
def _url_profile(self):
return self._server_url + 'session/minecraft/profile'
def is_mojang_yggdrasil_server(url: str):
return url in ('https://sessionserver.mojang.com',
'http://sessionserver.mojang.com',
'sessionserver.mojang.com')
class YggdrasilServerBuilder:
@staticmethod
def from_root_url(url: str):
"""
Create a Yggdrasil server from its root API url.
Accept both official and 3rd-party (defined in authlib-injector wiki) server.
:param url: the API root.
:return: the server instance.
"""
if is_mojang_yggdrasil_server(url):
return MojangYggdrasilSessionServer(server_url=url)
else:
return ConcreteYggdrasilSessionServer(server_url=url)
| 31.55814 | 134 | 0.550374 | 887 | 9,499 | 5.817362 | 0.342728 | 0.031395 | 0.02345 | 0.029845 | 0.348062 | 0.337985 | 0.262597 | 0.245543 | 0.18469 | 0.169961 | 0 | 0.006144 | 0.331719 | 9,499 | 300 | 135 | 31.663333 | 0.805135 | 0.529845 | 0 | 0.246377 | 0 | 0.014493 | 0.15882 | 0.069064 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.043478 | 0.173913 | 0.594203 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
afb059e9f522bb918d790b70fb0d6314d65b6160 | 440 | py | Python | src/ggrc/converters/common.py | sriharshakappala/ggrc-core | 7561ce27cd987d73468a44df5b6e2b7425f050ef | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2019-04-21T12:21:17.000Z | 2019-04-21T12:21:17.000Z | src/ggrc/converters/common.py | sriharshakappala/ggrc-core | 7561ce27cd987d73468a44df5b6e2b7425f050ef | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/ggrc/converters/common.py | sriharshakappala/ggrc-core | 7561ce27cd987d73468a44df5b6e2b7425f050ef | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import re
from ggrc import db
from pprint import pprint
from copy import *
# Temporary as I test new import functionality
DEBUG_IMPORT = True
def prepare_slug(slug):
return re.sub(r'\r|\n'," ", slug.strip()).upper()
class ImportException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message if self.message else "Could not import: verify the file is correctly formatted."
| 24.444444 | 104 | 0.738636 | 65 | 440 | 4.846154 | 0.630769 | 0.139683 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165909 | 440 | 17 | 105 | 25.882353 | 0.858311 | 0.1 | 0 | 0 | 0 | 0 | 0.159898 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.583333 | 0.166667 | 1.083333 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
afb272c3df790c08a501cd5fa505ca4fd9f5abe0 | 366 | py | Python | functions.py | adde9708/projects | 911ad1cd486082d2428d1f08af2a4b44659d87d8 | [
"BSD-3-Clause"
] | null | null | null | functions.py | adde9708/projects | 911ad1cd486082d2428d1f08af2a4b44659d87d8 | [
"BSD-3-Clause"
] | null | null | null | functions.py | adde9708/projects | 911ad1cd486082d2428d1f08af2a4b44659d87d8 | [
"BSD-3-Clause"
] | null | null | null | lst = [90, 180, 0]
empty = []
lst.append(empty)
def function_a():
for empty in lst:
if empty in lst:
print(lst)
function_b()
function_b()
print(lst)
def function_b():
for empty in lst:
if empty in lst:
print(lst)
function_b()
function_a()
| 13.071429 | 24 | 0.459016 | 44 | 366 | 3.681818 | 0.318182 | 0.17284 | 0.246914 | 0.160494 | 0.617284 | 0.617284 | 0.617284 | 0.617284 | 0.617284 | 0.617284 | 0 | 0.029557 | 0.445355 | 366 | 27 | 25 | 13.555556 | 0.768473 | 0 | 0 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.125 | 0.1875 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
afbf74c95ac016db571fb003173ab4da2cc294eb | 627 | py | Python | src/dataset.py | QTIM-Lab/rop_classification | f78e86d8a9b18aa824b9beadcab4c65ba8f9c746 | [
"MIT"
] | null | null | null | src/dataset.py | QTIM-Lab/rop_classification | f78e86d8a9b18aa824b9beadcab4c65ba8f9c746 | [
"MIT"
] | 1 | 2021-04-04T21:01:50.000Z | 2021-04-05T14:39:28.000Z | src/dataset.py | QTIM-Lab/rop_classification | f78e86d8a9b18aa824b9beadcab4c65ba8f9c746 | [
"MIT"
] | 1 | 2022-01-20T21:13:39.000Z | 2022-01-20T21:13:39.000Z | import os
import pandas as pd
import shutil
import tempfile
import matplotlib.pyplot as plt
import numpy as np
import PIL
import torch
import torchvision.models
from torchvision.transforms import Lambda, Normalize
class ROPDataset(torch.utils.data.Dataset):
def __init__(self, image_files, labels, transforms):
self.image_files = image_files
self.labels = labels
self.transforms = transforms
def __len__(self):
return len(self.image_files)
def __getitem__(self, index):
return self.transforms(self.image_files[index]), self.labels[index], self.image_files[index] | 27.26087 | 100 | 0.735247 | 82 | 627 | 5.402439 | 0.426829 | 0.13544 | 0.158014 | 0.108352 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191388 | 627 | 23 | 100 | 27.26087 | 0.873767 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0 | 0.526316 | 0.105263 | 0.842105 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
bb9e5c9b4117285f1f1406ba3e9c3c52ec90f7c6 | 334 | py | Python | ML/toolkit/move.py | KhaledElbasiouni222/UofTHacks-2020 | 25dd2e98181e2587e6545520c4e6c26eba1975eb | [
"MIT"
] | null | null | null | ML/toolkit/move.py | KhaledElbasiouni222/UofTHacks-2020 | 25dd2e98181e2587e6545520c4e6c26eba1975eb | [
"MIT"
] | 2 | 2022-02-18T23:22:42.000Z | 2022-02-27T01:38:27.000Z | ML/toolkit/move.py | KhaledElbasiouni222/UofTHacks-2020 | 25dd2e98181e2587e6545520c4e6c26eba1975eb | [
"MIT"
] | 1 | 2020-01-30T02:46:04.000Z | 2020-01-30T02:46:04.000Z | import numpy as np
import os
f = open("./data.dat")
data = f.readlines()
length = len(data)
N = 10
ran = np.random.randint(1,length,N)
for i in range(N):
os.system("cp -r /home/rahultarak12345/UofTHacks-2020/ML/dataset/tf_files/data/{} /home/rahultarak12345/UofTHacks-2020/ML/dataset/tf_files/temp/".format(data[ran[i]].strip())) | 37.111111 | 179 | 0.715569 | 57 | 334 | 4.157895 | 0.631579 | 0.160338 | 0.236287 | 0.270042 | 0.405063 | 0.405063 | 0.405063 | 0.405063 | 0 | 0 | 0 | 0.069767 | 0.098802 | 334 | 9 | 179 | 37.111111 | 0.717608 | 0 | 0 | 0 | 0 | 0.111111 | 0.426866 | 0.376119 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bbb3413578576322f9316c73219dcaabec5cebd6 | 321 | py | Python | pynet/nn/Simple.py | akman-wyk/my_alexnet | 868d53048165ce7f083b3b8549e9c969e3adaba8 | [
"Apache-2.0"
] | null | null | null | pynet/nn/Simple.py | akman-wyk/my_alexnet | 868d53048165ce7f083b3b8549e9c969e3adaba8 | [
"Apache-2.0"
] | null | null | null | pynet/nn/Simple.py | akman-wyk/my_alexnet | 868d53048165ce7f083b3b8549e9c969e3adaba8 | [
"Apache-2.0"
] | 1 | 2022-03-28T07:23:56.000Z | 2022-03-28T07:23:56.000Z | __all__ = ['Simple']
class Simple(object):
def __init__(self, func):
self.func = func
def __call__(self, inputs, params, other):
return self.forward(inputs)
def forward(self, inputs):
return self.func(inputs), None
def backward(self, grad_out, cache):
return grad_out
| 20.0625 | 46 | 0.629283 | 40 | 321 | 4.7 | 0.475 | 0.12766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.258567 | 321 | 15 | 47 | 21.4 | 0.789916 | 0 | 0 | 0 | 0 | 0 | 0.018692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.3 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
bbb6cf1759d983dbf3638a85bc7b8f00962527ce | 4,171 | py | Python | tests/test_paginate.py | sungmin-park/sqlalchemy-paginate | a0512a1f277ebe25a38b874f0acb6714f2c36851 | [
"MIT"
] | 1 | 2016-07-06T09:53:51.000Z | 2016-07-06T09:53:51.000Z | tests/test_paginate.py | sungmin-park/sqlalchemy-paginate | a0512a1f277ebe25a38b874f0acb6714f2c36851 | [
"MIT"
] | null | null | null | tests/test_paginate.py | sungmin-park/sqlalchemy-paginate | a0512a1f277ebe25a38b874f0acb6714f2c36851 | [
"MIT"
] | null | null | null | from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy_paginate import Pagination
engine = create_engine('sqlite://')
Session = sessionmaker(bind=engine)
Base = declarative_base(bind=engine)
class Item(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
__tablename__ = 'item'
Base.metadata.create_all()
def paginate(count, page=1):
def first(item):
return item[0]
session = Session()
map(session.add, [Item() for _ in range(count)])
try:
session.flush()
pagination = Pagination(session.query(Item.id), page=page, per_page=3,
per_nav=3, map_=first)
assert pagination.total == count
return pagination
finally:
session.rollback()
session.close()
def test_normalize_page():
assert paginate(0).page == 1
# prevent overflow
assert paginate(0, 2).page == 1
# prevent underflow
assert paginate(0, 0).page == 1
def test_last_page():
assert paginate(0).last == 1
assert paginate(1).last == 1
assert paginate(2).last == 1
assert paginate(3).last == 1
assert paginate(4).last == 2
assert paginate(5).last == 2
assert paginate(6).last == 2
def test_nav_head():
assert paginate(0).nav_head == 1
assert paginate(31, 1).nav_head == 1
assert paginate(31, 2).nav_head == 1
assert paginate(31, 3).nav_head == 1
assert paginate(31, 4).nav_head == 4
assert paginate(31, 5).nav_head == 4
assert paginate(31, 6).nav_head == 4
assert paginate(31, 7).nav_head == 7
assert paginate(31, 8).nav_head == 7
assert paginate(31, 9).nav_head == 7
def test_nav_tail():
assert paginate(0).nav_tail == 1
assert paginate(31, 1).nav_tail == 3
assert paginate(31, 2).nav_tail == 3
assert paginate(31, 3).nav_tail == 3
assert paginate(31, 4).nav_tail == 6
assert paginate(31, 5).nav_tail == 6
assert paginate(31, 6).nav_tail == 6
assert paginate(31, 7).nav_tail == 9
assert paginate(31, 8).nav_tail == 9
assert paginate(31, 9).nav_tail == 9
assert paginate(31, 10).nav_tail == 11
assert paginate(31, 11).nav_tail == 11
p = paginate(31, 12)
assert p.page == 11
assert p.nav_tail == 11
def test_pages():
assert paginate(0).pages == [1]
assert paginate(31, 1).pages == [1, 2, 3]
assert paginate(31, 2).pages == [1, 2, 3]
assert paginate(31, 3).pages == [1, 2, 3]
assert paginate(31, 4).pages == [4, 5, 6]
assert paginate(31, 5).pages == [4, 5, 6]
assert paginate(31, 6).pages == [4, 5, 6]
assert paginate(31, 7).pages == [7, 8, 9]
assert paginate(31, 8).pages == [7, 8, 9]
assert paginate(31, 9).pages == [7, 8, 9]
assert paginate(31, 10).pages == [10, 11]
assert paginate(31, 11).pages == [10, 11]
assert paginate(31, 12).pages == [10, 11]
def test_items():
assert paginate(0).items == []
assert paginate(31, 1).items == [1, 2, 3]
assert paginate(31, 2).items == [4, 5, 6]
assert paginate(31, 3).items == [7, 8, 9]
assert paginate(31, 10).items == [28, 29, 30]
assert paginate(31, 11).items == [31]
assert paginate(31, 12).items == [31]
def test_first():
assert paginate(0).first == 1
def test_prev():
assert paginate(0).prev == 1
def test_has_prev():
assert paginate(0).has_prev is False
assert paginate(4, 2).has_prev is True
def test_next():
assert paginate(0).next == 1
def test_has_next():
assert paginate(0).has_next is False
assert paginate(4).has_next is True
assert paginate(4, 2).has_next is False
def test_nav_prev():
assert paginate(0).nav_prev == 1
def test_has_nav_prev():
assert paginate(0).has_nav_prev is False
assert paginate(10, 1).has_nav_prev is False
assert paginate(10, 4).has_nav_prev is True
def test_nav_next():
assert paginate(0).nav_next == 1
def test_has_nav_next():
assert paginate(0).has_nav_next is False
assert paginate(10).has_nav_next is True
assert paginate(10, 4).has_nav_next is False
| 24.535294 | 78 | 0.638216 | 644 | 4,171 | 4.003106 | 0.124224 | 0.369279 | 0.235842 | 0.04616 | 0.507758 | 0.339798 | 0.126455 | 0.025601 | 0 | 0 | 0 | 0.084233 | 0.222968 | 4,171 | 169 | 79 | 24.680473 | 0.7112 | 0.008152 | 0 | 0 | 0 | 0 | 0.003145 | 0 | 0 | 0 | 0 | 0 | 0.63964 | 1 | 0.153153 | false | 0 | 0.036036 | 0.009009 | 0.234234 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bbb9ac368858944836cfca8633d9ae251e3d3890 | 59 | py | Python | tmp/answer_incoming_call.py | dtolb/docstring-extractor | f77ba4bc8e03eaa041eea92fdadf9442e6eb6ca6 | [
"MIT"
] | null | null | null | tmp/answer_incoming_call.py | dtolb/docstring-extractor | f77ba4bc8e03eaa041eea92fdadf9442e6eb6ca6 | [
"MIT"
] | null | null | null | tmp/answer_incoming_call.py | dtolb/docstring-extractor | f77ba4bc8e03eaa041eea92fdadf9442e6eb6ca6 | [
"MIT"
] | null | null | null | # Example: Answer incoming call
api.answer_call('callId')
| 19.666667 | 32 | 0.762712 | 8 | 59 | 5.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118644 | 59 | 2 | 33 | 29.5 | 0.846154 | 0.491525 | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bbc10dc1229911222181dba55bd52437eca8d496 | 228 | py | Python | core/admin.py | youtan-github/rwanda-regions-db | 8c4b3c654c0c4b11e57579e3fe44c10ef0509372 | [
"MIT"
] | null | null | null | core/admin.py | youtan-github/rwanda-regions-db | 8c4b3c654c0c4b11e57579e3fe44c10ef0509372 | [
"MIT"
] | null | null | null | core/admin.py | youtan-github/rwanda-regions-db | 8c4b3c654c0c4b11e57579e3fe44c10ef0509372 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Province)
admin.site.register(District)
admin.site.register(Sector)
admin.site.register(Cell)
admin.site.register(Village) | 22.8 | 32 | 0.807018 | 32 | 228 | 5.75 | 0.46875 | 0.244565 | 0.461957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 228 | 10 | 33 | 22.8 | 0.880383 | 0.114035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bbcc420e26f4e41bafe3d0bf50565fcb0b1c7a0c | 644 | py | Python | tests/integration/test_copyprocessor.py | magmax/livedoc | 40b7041bcb36b2a2ebbd3d5906ce5954dbc7f1ca | [
"Python-2.0"
] | null | null | null | tests/integration/test_copyprocessor.py | magmax/livedoc | 40b7041bcb36b2a2ebbd3d5906ce5954dbc7f1ca | [
"Python-2.0"
] | 2 | 2016-06-13T08:37:20.000Z | 2021-03-22T16:56:10.000Z | tests/integration/test_copyprocessor.py | magmax/livedoc | 40b7041bcb36b2a2ebbd3d5906ce5954dbc7f1ca | [
"Python-2.0"
] | null | null | null | import unittest
from livedoc import CopyProcessor
class CopyProcessorTest(unittest.TestCase):
def test_process_everything(self):
sut = CopyProcessor(report=unittest.mock.Mock())
assert sut.test('foo.html')
assert sut.test('foo.md')
assert sut.test('foo.rst')
assert sut.test('foo.py')
assert sut.test('foo.txt')
assert sut.test('whatever')
def test_process_returns_echo(self):
sut = CopyProcessor(report=unittest.mock.Mock())
result, status = sut.process_stream("whatever", {})
assert result == "whatever"
assert status == CopyProcessor.SUCCESS
| 32.2 | 59 | 0.658385 | 75 | 644 | 5.573333 | 0.4 | 0.129187 | 0.186603 | 0.191388 | 0.200957 | 0.200957 | 0.200957 | 0 | 0 | 0 | 0 | 0 | 0.220497 | 644 | 19 | 60 | 33.894737 | 0.832669 | 0 | 0 | 0.125 | 0 | 0 | 0.090062 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.3125 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bbd2b831aa5d88267b97e28d26dc609a76d449b8 | 779 | py | Python | morpher/jobs/__init__.py | hpi-dhc/morpher-toolkit | a0a15f1fa0e0d8b3cc06dea305a1c2cd03a65aa3 | [
"MIT"
] | 1 | 2021-04-23T13:16:20.000Z | 2021-04-23T13:16:20.000Z | morpher/jobs/__init__.py | hpi-dhc/morpher-toolkit | a0a15f1fa0e0d8b3cc06dea305a1c2cd03a65aa3 | [
"MIT"
] | null | null | null | morpher/jobs/__init__.py | hpi-dhc/morpher-toolkit | a0a15f1fa0e0d8b3cc06dea305a1c2cd03a65aa3 | [
"MIT"
] | null | null | null | from morpher.jobs.job import Job
from morpher.jobs.morpher_job import MorpherJob
from morpher.jobs.Load import Load
from morpher.jobs.Impute import Impute
from morpher.jobs.Scale import Scale
from morpher.jobs.Transform import Transform
from morpher.jobs.Sample import Sample
from morpher.jobs.Split import Split
from morpher.jobs.Train import Train
from morpher.jobs.Retrieve import Retrieve
from morpher.jobs.Evaluate import Evaluate
from morpher.jobs.Explain import Explain
from morpher.jobs.Calibrate import Calibrate
from morpher.jobs.Select import Select
__all__ = [
"Job",
"MorpherJob",
"Load",
"Impute",
"Scale",
"Sample",
"Transform",
"Split",
"Train",
"Retrieve",
"Evaluate",
"Explain",
"Calibrate",
"Select",
]
| 24.34375 | 47 | 0.738126 | 100 | 779 | 5.7 | 0.19 | 0.270175 | 0.368421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168164 | 779 | 31 | 48 | 25.129032 | 0.87963 | 0 | 0 | 0 | 0 | 0 | 0.116816 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.466667 | 0 | 0.466667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bbde4fda79b2a410cbb8417fbdef5c711720f143 | 94 | py | Python | setup.py | aabiddanda/tszip | ccaad012d2e8d001cca77fc52980d23c7c070c5f | [
"MIT"
] | 4 | 2019-05-01T10:38:54.000Z | 2020-03-20T21:48:37.000Z | setup.py | aabiddanda/tszip | ccaad012d2e8d001cca77fc52980d23c7c070c5f | [
"MIT"
] | 53 | 2019-05-01T16:54:49.000Z | 2022-02-22T09:36:23.000Z | setup.py | aabiddanda/tszip | ccaad012d2e8d001cca77fc52980d23c7c070c5f | [
"MIT"
] | 4 | 2019-05-01T10:30:23.000Z | 2021-04-07T21:39:47.000Z | from setuptools import setup
setup(
use_scm_version={"write_to": "tszip/_version.py"},
)
| 15.666667 | 54 | 0.723404 | 13 | 94 | 4.923077 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138298 | 94 | 5 | 55 | 18.8 | 0.790123 | 0 | 0 | 0 | 0 | 0 | 0.265957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a534126422967a3b00460d21f4f860d5976ebe31 | 20,295 | py | Python | tests/test_adapters.py | eduardogr/evalytics | fd2fc32851a0905313249120f232e96d805190b6 | [
"Apache-2.0"
] | 3 | 2020-03-30T09:21:38.000Z | 2020-06-26T15:30:56.000Z | tests/test_adapters.py | eduardogr/evalytics | fd2fc32851a0905313249120f232e96d805190b6 | [
"Apache-2.0"
] | 58 | 2020-03-26T20:49:18.000Z | 2022-03-10T14:05:07.000Z | tests/test_adapters.py | eduardogr/evalytics | fd2fc32851a0905313249120f232e96d805190b6 | [
"Apache-2.0"
] | 1 | 2020-03-26T15:42:32.000Z | 2020-03-26T15:42:32.000Z | from unittest import TestCase
from evalytics.adapters import EmployeeAdapter, ReviewerAdapter
from evalytics.models import EvalKind, Eval
from evalytics.models import ReviewerResponse
from evalytics.exceptions import MissingDataException
from tests.common.mocks import MockConfig, MockEmployeeAdapter
from tests.common.fixture import Fixture
class EmployeeAdapterSut(EmployeeAdapter, MockConfig):
'Inject mocks into EmployeeAdapter dependencies'
class ReviewerAdapterSut(ReviewerAdapter, MockEmployeeAdapter):
'Inject mocks into ReviewerAdapter dependencies'
class TestEmployeeAdapter(TestCase):
def setUp(self):
self.sut = EmployeeAdapterSut()
self.self_form = 'self form'
self.peer_manager_form = 'peer manager form'
self.manager_peer_form = 'manager peer form'
self.peer_to_peer_form = 'peer to peer form'
self.employees = Fixture().get_organization()
cto = self.employees['cto']
tl1 = self.employees['tl1']
sw1 = self.employees['sw1']
sw2 = self.employees['sw2']
self.employees_with_blacklisted_reviewers = {
'cto': cto,
'cto2': Fixture().create_employee('cto2', 'ceo'),
'tl1': tl1,
'sw1': sw1,
'sw2': sw2,
}
self.no_peers = {}
self.peers = {
'tl1': ['tl2', 'tl1', 'sw1', 'sw2'],
'sw1': ['tl1', 'sw1', 'sw2', 'sw3', 'sw4', 'sw5'],
'sw2': ['sw1', 'sw2', 'sw3', 'sw4'],
'sw3': ['tl2', 'sw1', 'sw3'],
'sw4': ['tl2', 'sw1'],
}
self.no_forms = {}
self.forms = {
cto.area: {
EvalKind.SELF.name: self.self_form,
EvalKind.PEER_MANAGER.name: self.peer_manager_form,
EvalKind.MANAGER_PEER.name: self.manager_peer_form,
EvalKind.PEER_TO_PEER.name: self.peer_to_peer_form,
}
}
self.forms_with_other_area = {
'NO_AREA': {}
}
def test_get_employee_manager_for_cto(self):
# given:
employee_uid = 'cto'
# when:
managers = self.sut.get_employee_managers(self.employees, employee_uid)
# then:
self.assertEqual(1, len(managers))
self.assertIn('ceo', managers)
def test_get_employee_manager_for_sw(self):
# given:
employee_uid = 'sw1'
# when:
managers = self.sut.get_employee_managers(self.employees, employee_uid)
self.assertEqual(3, len(managers))
self.assertIn('tl1', managers)
self.assertIn('cto', managers)
self.assertIn('ceo', managers)
def test_get_managers(self):
# when:
managers = self.sut.get_employees_by_manager(self.employees)
# then:
self.assertEqual(managers['ceo'], ['cto'])
self.assertEqual(managers['cto'], ['tl1', 'tl2'])
self.assertEqual(managers['tl1'], ['sw1', 'sw2'])
self.assertEqual(managers['tl2'], ['sw3', 'sw4', 'sw5'])
def test_get_manager_when_uncompleted_employees(self):
# when:
employees_by_manager = self.sut.get_employees_by_manager(self.employees_with_blacklisted_reviewers)
# then:
self.assertNotIn('ceo', employees_by_manager)
self.assertEqual(employees_by_manager['cto'], ['tl1'])
self.assertEqual(employees_by_manager['tl1'], ['sw1', 'sw2'])
def test_build_reviewers_correct_number_of_evals(self):
# when:
reviewers = self.sut.build_reviewers(self.employees, self.no_peers, self.forms)
# then:
self.__assert_all_employees_in(reviewers)
self.assertEqual(2, len(reviewers['ceo'].evals))
self.assertEqual(4, len(reviewers['cto'].evals))
self.assertEqual(4, len(reviewers['tl1'].evals))
self.assertEqual(5, len(reviewers['tl2'].evals))
self.assertEqual(2, len(reviewers['sw1'].evals))
self.assertEqual(2, len(reviewers['sw2'].evals))
self.assertEqual(2, len(reviewers['sw3'].evals))
self.assertEqual(2, len(reviewers['sw4'].evals))
self.assertEqual(2, len(reviewers['sw5'].evals))
def test_build_reviewers_correct_if_not_an_employee_and_is_manager(self):
# when:
reviewers = self.sut.build_reviewers(
self.employees_with_blacklisted_reviewers,
self.no_peers,
self.forms)
# then:
self.assertIn('ceo', reviewers)
self.assertEqual(2, len(reviewers['ceo'].evals))
def test_build_reviewers_correct_number_of_evals_when_uncompleted_employees(self):
reviewers = self.sut.build_reviewers(
self.employees_with_blacklisted_reviewers,
self.no_peers,
self.forms)
self.assertIn('ceo', reviewers)
self.assertIn('cto', reviewers)
self.assertIn('cto2', reviewers)
self.assertIn('tl1', reviewers)
self.assertIn('sw1', reviewers)
self.assertIn('sw2', reviewers)
self.assertEqual(2, len(reviewers['ceo'].evals))
self.assertEqual(3, len(reviewers['cto'].evals))
self.assertEqual(4, len(reviewers['tl1'].evals))
self.assertEqual(2, len(reviewers['sw1'].evals))
self.assertEqual(2, len(reviewers['sw2'].evals))
def test_build_reviewers_correct_evals(self):
# when:
reviewers = self.sut.build_reviewers(self.employees, self.no_peers, self.forms)
# then:
self.assertEqual(reviewers['ceo'].evals, [
Eval(reviewee='ceo',
kind=EvalKind.SELF, form=self.self_form),
Eval(reviewee='cto', kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
])
self.assertEqual(reviewers['cto'].evals, [
Eval(reviewee='cto',
kind=EvalKind.SELF, form=self.self_form),
Eval(reviewee='ceo',
kind=EvalKind.PEER_MANAGER, form=self.peer_manager_form),
Eval(reviewee='tl1',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
Eval(reviewee='tl2',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
])
self.assertEqual(reviewers['tl1'].evals, [
Eval(reviewee='tl1',
kind=EvalKind.SELF, form=self.self_form),
Eval(reviewee='cto',
kind=EvalKind.PEER_MANAGER, form=self.peer_manager_form),
Eval(reviewee='sw1',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
Eval(reviewee='sw2',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
])
self.assertEqual(reviewers['tl2'].evals, [
Eval(reviewee='tl2',
kind=EvalKind.SELF, form=self.self_form),
Eval(reviewee='cto',
kind=EvalKind.PEER_MANAGER, form=self.peer_manager_form),
Eval(reviewee='sw3',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
Eval(reviewee='sw4',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
Eval(reviewee='sw5',
kind=EvalKind.MANAGER_PEER, form=self.manager_peer_form),
])
def test_build_reviewers_with_no_forms(self):
with self.assertRaises(MissingDataException):
self.sut.build_reviewers(self.employees, self.no_peers, self.no_forms)
def test_build_reviewers_with_other_area_forms(self):
# given:
form_with_other_area = self.forms_with_other_area
# when:
with self.assertRaises(MissingDataException):
self.sut.build_reviewers(self.employees, self.no_peers, form_with_other_area)
def test_build_reviewers_with_peers(self):
# when:
reviewers = self.sut.build_reviewers(self.employees, self.peers, self.forms)
# then:
self.__assert_all_employees_in(reviewers)
self.assertEqual(2, len(reviewers['ceo'].evals))
self.assertEqual(4, len(reviewers['cto'].evals))
self.assertEqual(5, len(reviewers['tl1'].evals))
self.assertEqual(5, len(reviewers['tl2'].evals))
self.assertEqual(6, len(reviewers['sw1'].evals))
self.assertEqual(5, len(reviewers['sw2'].evals))
self.assertEqual(3, len(reviewers['sw3'].evals))
self.assertEqual(3, len(reviewers['sw4'].evals))
self.assertEqual(2, len(reviewers['sw5'].evals))
def __assert_all_employees_in(self, reviewers):
self.assertIn('ceo', reviewers)
self.assertIn('cto', reviewers)
self.assertIn('tl1', reviewers)
self.assertIn('tl2', reviewers)
self.assertIn('sw1', reviewers)
self.assertIn('sw2', reviewers)
self.assertIn('sw3', reviewers)
self.assertIn('sw4', reviewers)
self.assertIn('sw5', reviewers)
class TestReviewerAdapter(TestCase):
def setUp(self):
self.sut = ReviewerAdapterSut()
self.employees_by_manager = Fixture().get_organization_employees_by_managers()
self.reviewers = Fixture().get_organization_reviewers()
def test_get_status_from_responses_when_no_responses(self):
# given:
reviewers = {}
responses = {}
self.sut.set_employees_by_manager({})
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
reviewers,
responses)
# then:
self.assertEqual(0, len(completed))
self.assertEqual(0, len(pending))
self.assertEqual(0, len(inconsistent))
def test_get_status_from_responses_when_pending_responses(self):
# given:
self.sut.set_employees_by_manager(self.employees_by_manager)
responses = {
self.reviewers['cto'].uid: [],
self.reviewers['tl1'].uid: [],
self.reviewers['tl2'].uid: [],
self.reviewers['sw3'].uid: [],
self.reviewers['sw2'].uid: [],
self.reviewers['sw3'].uid: [],
}
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
self.reviewers,
responses)
# then:
self.assertEqual(0, len(completed))
self.assertEqual(6, len(pending))
self.assertEqual(0, len(inconsistent))
self.assertIn('cto', pending)
self.assertIn('tl1', pending)
self.assertIn('tl2', pending)
self.assertIn('sw1', pending)
self.assertIn('sw2', pending)
self.assertIn('sw3', pending)
self.assertEqual(2, len(pending['cto'].evals))
self.assertEqual(4, len(pending['tl1'].evals))
self.assertEqual(3, len(pending['tl2'].evals))
self.assertEqual(2, len(pending['sw1'].evals))
self.assertEqual(2, len(pending['sw2'].evals))
self.assertEqual(2, len(pending['sw3'].evals))
def test_get_status_from_responses_when_some_completed_responses(self):
# given:
self.sut.set_employees_by_manager(self.employees_by_manager)
responses = {
self.reviewers['cto'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl1',
reviewer='cto',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl2',
reviewer='cto',
filename='',
line_number=0,
eval_response=[])
],
self.reviewers['tl1'].uid: [],
self.reviewers['tl2'].uid: [],
self.reviewers['sw1'].uid: [],
self.reviewers['sw2'].uid: [],
self.reviewers['sw3'].uid: [],
}
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
self.reviewers,
responses)
# then:
self.assertEqual(0, len(inconsistent))
self.assertEqual(5, len(pending))
self.assertEqual(1, len(completed))
self.assertIn('cto', completed)
self.assertIn('tl1', completed['cto'])
self.assertIn('tl2', completed['cto'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl1']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl2']['kind'])
self.assertIn('tl1', pending)
self.assertIn('tl2', pending)
self.assertIn('sw1', pending)
self.assertIn('sw2', pending)
self.assertIn('sw3', pending)
def test_get_status_from_responses_when_completed_responses(self):
# given:
self.sut.set_employees_by_manager(self.employees_by_manager)
responses = {
self.reviewers['cto'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl1',
reviewer='cto',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl2',
reviewer='cto',
filename='',
line_number=0,
eval_response=[])
],
self.reviewers['tl1'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='sw1',
reviewer='tl1',
filename='',
line_number=0,
eval_response=[])
],
self.reviewers['tl2'].uid: [],
self.reviewers['sw1'].uid: [],
self.reviewers['sw2'].uid: [],
self.reviewers['sw3'].uid: [],
}
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
self.reviewers,
responses)
# then:
self.assertEqual(0, len(inconsistent))
self.assertEqual(5, len(pending))
self.assertEqual(2, len(completed))
self.assertIn('cto', completed)
self.assertIn('tl1', completed)
self.assertIn('tl1', completed['cto'])
self.assertIn('tl2', completed['cto'])
self.assertIn('sw1', completed['tl1'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl1']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl2']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['tl1']['sw1']['kind'])
self.assertEqual(3, len(pending['tl1'].evals))
def test_get_status_from_responses_when_inconsistent_reporter_responses(self):
# given:
self.sut.set_employees_by_manager(self.employees_by_manager)
responses = {
self.reviewers['cto'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl1',
reviewer='cto',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl2',
reviewer='cto',
filename='',
line_number=0,
eval_response=[])
],
self.reviewers['tl1'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='sw1',
reviewer='tl1',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='sw3',
reviewer='tl1',
filename='whatever',
line_number=10,
eval_response=[])
],
self.reviewers['tl2'].uid: [],
self.reviewers['sw1'].uid: [],
self.reviewers['sw2'].uid: [],
self.reviewers['sw3'].uid: [],
}
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
self.reviewers,
responses)
# then:
self.assertEqual(1, len(inconsistent))
self.assertEqual(5, len(pending))
self.assertEqual(2, len(completed))
self.assertIn('cto', completed)
self.assertIn('tl1', completed)
self.assertIn('tl1', completed['cto'])
self.assertIn('tl2', completed['cto'])
self.assertIn('sw1', completed['tl1'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl1']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl2']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['tl1']['sw1']['kind'])
self.assertIn('tl1', inconsistent)
self.assertIn('sw3', inconsistent['tl1'])
self.assertEqual(EvalKind.MANAGER_PEER.name, inconsistent['tl1']['sw3']['kind'])
self.assertTrue(inconsistent['tl1']['sw3']['reason'].startswith('WRONG_REPORTER'))
def test_get_status_from_responses_when_inconsistent_manager_responses(self):
# given;
self.sut.set_employees_by_manager(self.employees_by_manager)
responses = {
self.reviewers['cto'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl1',
reviewer='cto',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='tl2',
reviewer='cto',
filename='',
line_number=0,
eval_response=[])
],
self.reviewers['tl1'].uid: [
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='sw1',
reviewer='tl1',
filename='',
line_number=0,
eval_response=[]),
ReviewerResponse(
eval_kind=EvalKind.MANAGER_PEER,
reviewee='sw2',
reviewer='tl1',
filename='whatever',
line_number=10,
eval_response=[])
],
self.reviewers['tl2'].uid: [],
self.reviewers['sw1'].uid: [
ReviewerResponse(
eval_kind=EvalKind.PEER_MANAGER,
reviewee='tl2',
reviewer='sw1',
filename='whatever',
line_number=10,
eval_response=[])
],
self.reviewers['sw2'].uid: [],
self.reviewers['sw3'].uid: [],
}
# when:
completed, pending, inconsistent = self.sut.get_status_from_responses(
self.reviewers,
responses)
# then:
self.assertEqual(1, len(inconsistent))
self.assertEqual(5, len(pending))
self.assertEqual(2, len(completed))
self.assertIn('cto', completed)
self.assertIn('tl1', completed)
self.assertIn('tl1', completed['cto'])
self.assertIn('tl2', completed['cto'])
self.assertIn('sw1', completed['tl1'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl1']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['cto']['tl2']['kind'])
self.assertEqual(EvalKind.MANAGER_PEER.name, completed['tl1']['sw1']['kind'])
self.assertIn('sw1', inconsistent)
self.assertIn('tl2', inconsistent['sw1'])
self.assertEqual(EvalKind.PEER_MANAGER.name, inconsistent['sw1']['tl2']['kind'])
self.assertTrue(inconsistent['sw1']['tl2']['reason'].startswith('WRONG_MANAGER'))
| 37.793296 | 107 | 0.565607 | 2,011 | 20,295 | 5.525112 | 0.057185 | 0.099901 | 0.058141 | 0.04347 | 0.795608 | 0.743857 | 0.701017 | 0.675997 | 0.638286 | 0.625866 | 0 | 0.018821 | 0.303622 | 20,295 | 536 | 108 | 37.863806 | 0.767353 | 0.016014 | 0 | 0.659722 | 0 | 0 | 0.052629 | 0 | 0 | 0 | 0 | 0 | 0.3125 | 1 | 0.046296 | false | 0 | 0.016204 | 0 | 0.071759 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a54bc3c18fa0d9406a0c5b07efae41861c669cd4 | 292 | py | Python | app/db/session.py | fergusdixon/fastapi-example | 9e47e6f26dd5db86882f11b9e8eac0971925c019 | [
"MIT"
] | null | null | null | app/db/session.py | fergusdixon/fastapi-example | 9e47e6f26dd5db86882f11b9e8eac0971925c019 | [
"MIT"
] | null | null | null | app/db/session.py | fergusdixon/fastapi-example | 9e47e6f26dd5db86882f11b9e8eac0971925c019 | [
"MIT"
] | null | null | null | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(settings.SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
| 36.5 | 99 | 0.842466 | 37 | 292 | 6.459459 | 0.621622 | 0.117155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082192 | 292 | 7 | 100 | 41.714286 | 0.891791 | 0 | 0 | 0 | 0 | 0 | 0.058219 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a54e5ef65ce84d8bea480415aa75f0ef22210527 | 2,468 | py | Python | mb/mb/exports.py | rhertzog/mirrorbrain | 76f2909e33004a7f5e0dd52b816881eb9fbd4246 | [
"Apache-2.0"
] | 71 | 2015-06-05T07:52:13.000Z | 2022-03-12T07:40:19.000Z | mb/mb/exports.py | rhertzog/mirrorbrain | 76f2909e33004a7f5e0dd52b816881eb9fbd4246 | [
"Apache-2.0"
] | 181 | 2015-06-05T00:42:22.000Z | 2022-02-23T10:36:46.000Z | mb/mb/exports.py | rhertzog/mirrorbrain | 76f2909e33004a7f5e0dd52b816881eb9fbd4246 | [
"Apache-2.0"
] | 25 | 2015-06-11T19:16:41.000Z | 2022-03-12T07:40:19.000Z | import time
postgresql_header = """
--
-- generated on %s
--
""" % time.asctime()
postgresql_template = """\
--
-- %(identifier)s
--
INSERT INTO server (
identifier, baseurl, baseurl_ftp, baseurl_rsync, enabled, status_baseurl,
region, country, asn, prefix,
score, comment, operator_name, operator_url, public_notes,
admin, admin_email, lat, lng,
country_only, region_only, as_only, prefix_only,
other_countries, file_maxsize, scan_fpm)
VALUES (
'%(identifier)s', '%(baseurl)s', '%(baseurlFtp)s', '%(baseurlRsync)s', '%(enabled)s', '%(statusBaseurl)s',
'%(region)s', '%(country)s', '%(asn)s', '%(prefix)s',
'%(score)s', $QUOTE$%(comment)s$QUOTE$, $QUOTE$%(operatorName)s$QUOTE$, '%(operatorUrl)s', $QUOTE$%(publicNotes)s$QUOTE$,
$QUOTE$%(admin)s$QUOTE$, $QUOTE$%(adminEmail)s$QUOTE$, '%(lat)s', '%(lng)s',
'%(countryOnly)s', '%(regionOnly)s', '%(asOnly)s', '%(prefixOnly)s',
'%(otherCountries)s', '%(fileMaxsize)s', '%(scanFpm)s');
"""
django_header = """#!/usr/bin/env python
import os, sys
mybasepath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, mybasepath)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mirrordjango.settings'
from django.db import connection
from mirrordjango.mb.models import Contact, Operator, Project, Server, Mirror
"""
django_template = """\
# ------------------------------------------------------------
try:
c = Contact.objects.get_or_create(username=%(admin)r, password='UNSET', name=%(admin)r, email=%(adminEmail)r)[0]
except:
connection.connection.rollback()
c = None
o = Operator.objects.get_or_create(name='%(identifier)s', logo='')[0]
p = Project.objects.filter(name='%(project)s')
p = p[0]
s = Server.objects.get_or_create(identifier='%(identifier)s', operator=o, region='%(region)s', country='%(country)s', country_only='%(countryOnly)s', region_only='%(regionOnly)s', as_only='%(asOnly)s', prefix_only='%(prefixOnly)s', other_countries=%(otherCountries)r, file_maxsize='%(fileMaxsize)s', comment=%(comment)r, bandwidth=1)[0]
m = Mirror.objects.get_or_create(http='%(baseurl)s', ftp='%(baseurlFtp)s', rsync='%(baseurlRsync)s', prio='%(score)s', project=p, server=s)[0]
# s.mirrors.add(m)
if c:
s.contacts.add(c)
"""
# mirmon configured with "list_style = apache"
mirmon_apache_template = """%(proto)s\t%(country)s\t%(url)s\t%(adminEmail)s"""
# mirmon configured with "list_style = plain"
mirmon_template = """%(country)s\t%(url)s\t%(adminEmail)s"""
| 37.969231 | 336 | 0.668558 | 330 | 2,468 | 4.869697 | 0.351515 | 0.026136 | 0.029869 | 0.044804 | 0.087119 | 0.031114 | 0.031114 | 0.031114 | 0 | 0 | 0 | 0.003138 | 0.096029 | 2,468 | 64 | 337 | 38.5625 | 0.717167 | 0.035656 | 0 | 0.137255 | 1 | 0.156863 | 0.917122 | 0.417753 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.019608 | 0.078431 | 0 | 0.078431 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a554ffbb90abdf30602b274441cb904302260652 | 291 | py | Python | src/wheezy/caching/__init__.py | akornatskyy/wheezy.caching | 481586e97bc74a3aeaa59899864658ede7036ce7 | [
"MIT"
] | null | null | null | src/wheezy/caching/__init__.py | akornatskyy/wheezy.caching | 481586e97bc74a3aeaa59899864658ede7036ce7 | [
"MIT"
] | 24 | 2020-07-18T04:34:23.000Z | 2021-07-06T09:42:27.000Z | src/wheezy/caching/__init__.py | akornatskyy/wheezy.caching | 481586e97bc74a3aeaa59899864658ede7036ce7 | [
"MIT"
] | null | null | null | """
"""
from wheezy.caching.client import CacheClient
from wheezy.caching.dependency import CacheDependency
from wheezy.caching.memory import MemoryCache
from wheezy.caching.null import NullCache
__all__ = ("CacheClient", "CacheDependency", "MemoryCache", "NullCache")
__version__ = "0.1"
| 26.454545 | 72 | 0.790378 | 32 | 291 | 6.9375 | 0.5 | 0.18018 | 0.306306 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007634 | 0.099656 | 291 | 10 | 73 | 29.1 | 0.839695 | 0 | 0 | 0 | 0 | 0 | 0.172535 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a578b2b23a50606088306d2378afe11a26cd3ec8 | 718 | py | Python | MultiChoiceQuestion.py | PapaDoraemon/marina-AI | 9f9281b5decf889a55d6c1bdbfe3a62adadd47f9 | [
"Apache-2.0"
] | 1 | 2020-09-04T12:42:54.000Z | 2020-09-04T12:42:54.000Z | MultiChoiceQuestion.py | PapaDoraemon/marina-AI | 9f9281b5decf889a55d6c1bdbfe3a62adadd47f9 | [
"Apache-2.0"
] | null | null | null | MultiChoiceQuestion.py | PapaDoraemon/marina-AI | 9f9281b5decf889a55d6c1bdbfe3a62adadd47f9 | [
"Apache-2.0"
] | null | null | null |
from .Question import *
from .exceptions import *
class MultiChoiceQuestion(Question):
question_type = "multi_choice"
def __init__(self, msg):
self.msg = msg
self.choices = []
def ask(self):
return self.msg + " (Enter number between 1 and %d)" % len(self.choices)
def getPoints(self):
ans = int(self.getAnswer()) - 1
if ans < 0 or ans >= len(self.choices):
raise WrongAnswerException()
else:
return self.choices[ans][1]
def addChoice(self, choice, points):
self.choices.append((choice, points))
def getChoices(self):
return self.choices
def getMessage(self):
return self.msg
| 21.757576 | 80 | 0.593315 | 83 | 718 | 5.060241 | 0.457831 | 0.157143 | 0.1 | 0.080952 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007921 | 0.296657 | 718 | 32 | 81 | 22.4375 | 0.823762 | 0 | 0 | 0 | 0 | 0 | 0.061453 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.095238 | 0.142857 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
a58ee97add02e61b8c40754875cb7e1a142200b4 | 2,057 | py | Python | pagetags/reqparsers.py | pmatigakis/pagetags | 5e81d01493548edc2677453819c32de3cf75d159 | [
"MIT"
] | null | null | null | pagetags/reqparsers.py | pmatigakis/pagetags | 5e81d01493548edc2677453819c32de3cf75d159 | [
"MIT"
] | null | null | null | pagetags/reqparsers.py | pmatigakis/pagetags | 5e81d01493548edc2677453819c32de3cf75d159 | [
"MIT"
] | null | null | null | from flask_restful.reqparse import RequestParser
from pagetags import argtypes
post = RequestParser()
post.add_argument("title", required=True, location="json",
type=argtypes.post_title)
post.add_argument("url", required=True, location="json",
type=argtypes.post_url)
post.add_argument("tags", required=True, type=list, location="json")
post.add_argument("categories", required=True, type=list, location="json")
url_query = RequestParser()
url_query.add_argument("url", required=True, location="args")
url_query.add_argument("page", default=1, type=int, location="args")
url_query.add_argument("per_page", default=10, type=int, location="args")
posts = RequestParser()
posts.add_argument("page", default=1, type=int, location="args")
posts.add_argument("per_page", default=10, type=int, location="args")
tag_posts = RequestParser()
tag_posts.add_argument("page", default=1, type=int, location="args")
tag_posts.add_argument("per_page", default=10, type=int, location="args")
tags_posts = RequestParser()
tags_posts.add_argument("page", default=1, type=int, location="args")
tags_posts.add_argument("per_page", default=10, type=int, location="args")
update_post = RequestParser()
update_post.add_argument(
"title", required=True, location="json", type=argtypes.post_title)
update_post.add_argument(
"url", required=True, location="json", type=argtypes.post_url)
update_post.add_argument("tags", required=True, type=list, location="json")
categories_posts = RequestParser()
categories_posts.add_argument("page", default=1, type=int, location="args")
categories_posts.add_argument(
"per_page", default=10, type=int, location="args")
category_posts = RequestParser()
category_posts.add_argument("page", default=1, type=int, location="args")
category_posts.add_argument("per_page", default=10, type=int, location="args")
categories = RequestParser()
categories.add_argument("page", default=1, type=int, location="args")
categories.add_argument("per_page", default=10, type=int, location="args")
| 35.465517 | 78 | 0.753038 | 281 | 2,057 | 5.320285 | 0.117438 | 0.161873 | 0.140468 | 0.177926 | 0.793311 | 0.783278 | 0.695652 | 0.695652 | 0.695652 | 0.667559 | 0 | 0.01126 | 0.09334 | 2,057 | 57 | 79 | 36.087719 | 0.790349 | 0 | 0 | 0.052632 | 0 | 0 | 0.101604 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.052632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a59cece09ee68d1c60846574f2261f8840168e0f | 218 | py | Python | src/Seventh Chapter/Example3.py | matthijskrul/ThinkPython | 34c1d81f4ef535c32b8b0309b23c7ca37f851606 | [
"MIT"
] | null | null | null | src/Seventh Chapter/Example3.py | matthijskrul/ThinkPython | 34c1d81f4ef535c32b8b0309b23c7ca37f851606 | [
"MIT"
] | null | null | null | src/Seventh Chapter/Example3.py | matthijskrul/ThinkPython | 34c1d81f4ef535c32b8b0309b23c7ca37f851606 | [
"MIT"
] | null | null | null | def print_multiples(n, high):
for i in range(1, high+1):
print(n * i, end=" ")
print()
def print_mult_table(high):
for i in range(1, high+1):
print_multiples(i, i)
print_mult_table(7)
| 16.769231 | 31 | 0.591743 | 37 | 218 | 3.324324 | 0.378378 | 0.130081 | 0.130081 | 0.162602 | 0.422764 | 0.422764 | 0.422764 | 0.422764 | 0.422764 | 0 | 0 | 0.03125 | 0.266055 | 218 | 12 | 32 | 18.166667 | 0.7375 | 0 | 0 | 0.25 | 0 | 0 | 0.013761 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.25 | 0.75 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
a5ad930e4503298b1d077f0b1b8bc76ce1aa28d9 | 482 | py | Python | test_processy.py | tlevine/thready | 041ba203817d244b8d9198a1bedeb385b6dacd8d | [
"MIT"
] | null | null | null | test_processy.py | tlevine/thready | 041ba203817d244b8d9198a1bedeb385b6dacd8d | [
"MIT"
] | null | null | null | test_processy.py | tlevine/thready | 041ba203817d244b8d9198a1bedeb385b6dacd8d | [
"MIT"
] | null | null | null | try:
from queue import Queue
except ImportError:
from Queue import Queue
import processy
def test_processed():
import processy
results = Queue()
def f(fn):
open(fn, 'w').write('Hi')
processy.processed(['/tmp/a', '/tmp/b'], f)
for fn in ['/tmp/a', '/tmp/b']:
with open(fn) as fp:
assert fp.read() == 'Hi', fn
def test_error():
import processy
def f(i):
raise ValueError
processy.processed(range(10), f)
| 20.083333 | 47 | 0.580913 | 67 | 482 | 4.149254 | 0.492537 | 0.118705 | 0.107914 | 0.143885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005698 | 0.271784 | 482 | 23 | 48 | 20.956522 | 0.786325 | 0 | 0 | 0.157895 | 0 | 0 | 0.060166 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 1 | 0.210526 | false | 0 | 0.315789 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a5ae1835d269d2aec075973d26e933b276cc896d | 51 | py | Python | recipes/Python/577836_rawinput_All_Versions/recipe-577836.py | tdiprima/code | 61a74f5f93da087d27c70b2efe779ac6bd2a3b4f | [
"MIT"
] | 2,023 | 2017-07-29T09:34:46.000Z | 2022-03-24T08:00:45.000Z | recipes/Python/577836_rawinput_All_Versions/recipe-577836.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 32 | 2017-09-02T17:20:08.000Z | 2022-02-11T17:49:37.000Z | recipes/Python/577836_rawinput_All_Versions/recipe-577836.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 780 | 2017-07-28T19:23:28.000Z | 2022-03-25T20:39:41.000Z | import sys
if sys.version[0]=="3": raw_input=input
| 17 | 39 | 0.72549 | 10 | 51 | 3.6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0.098039 | 51 | 2 | 40 | 25.5 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0.019608 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3c0ac03453ca2fba845cb1792b496f1f64886740 | 4,306 | py | Python | creational/factories/abstract-factory/abstract_factory.py | software-foundations/design-patterns | db3a04cb17ab2d1d1b3c7d4c0df548c08659390b | [
"MIT"
] | null | null | null | creational/factories/abstract-factory/abstract_factory.py | software-foundations/design-patterns | db3a04cb17ab2d1d1b3c7d4c0df548c08659390b | [
"MIT"
] | null | null | null | creational/factories/abstract-factory/abstract_factory.py | software-foundations/design-patterns | db3a04cb17ab2d1d1b3c7d4c0df548c08659390b | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
# Abstract Vehicle classes
class LuxVehicle(ABC):
@abstractmethod
def search_client(self) -> None: pass
class PopularVehicle(ABC):
@abstractmethod
def search_client(self) -> None: pass
# Specialized Vehicle classes for filial 01
class LuxCarFilial01(LuxVehicle):
def search_client(self) -> None:
print('LuxCar Filial01 is looking for the client ...')
class LuxMotorcyleFilial01(LuxVehicle):
def search_client(self) -> None:
print('LuxMotorcycle Filial01 is looking for the client ...')
class PopularCarFilial01(PopularVehicle):
def search_client(self) -> None:
print('PopularCar Filial01 is looking for the client ...')
class PopularMotorcycleFilial01(PopularVehicle):
def search_client(self) -> None:
print('PopularMotorcycle Filial01 is looking for the client ...')
# Specialized Vehicle classes for filial 02
class LuxCarFilial02(LuxVehicle):
def search_client(self) -> None:
print('LuxCar Filial02 is looking for the client ...')
class LuxMotorcyleFilial02(LuxVehicle):
def search_client(self) -> None:
print('LuxMotorcycle Filial02 is looking for the client ...')
class PopularCarFilial02(PopularVehicle):
def search_client(self) -> None:
print('PopularCar Filial02 is looking for the client ...')
class PopularMotorcycleFilial02(PopularVehicle):
def search_client(self) -> None:
print('PopularMotorcycle Filial02 is looking for the client ...')
# Abstract Factory class
class VehicleFactory(ABC):
"""
Abstract Vehicle Factory
"""
"""
get lux and pop vehicles will be overrided
by the filial. It consider that each filial
has their own ways/RULES to get lux and pop
vehicles, like different costs or taxes.
Observ that 'if' is not used in neither of filial
implementations. It's accourding to open/closed
<<<<<<< HEAD
SOLID principle
=======
SOLID principle: open to extension, closed to
modification
>>>>>>> (creational/factories/abstract_factory.py) some comments, like open/closed SOLID principle
"""
@staticmethod
@abstractmethod
def get_lux_car() -> LuxVehicle: pass
@staticmethod
@abstractmethod
def get_lux_motorcycle() -> LuxVehicle: pass
@staticmethod
@abstractmethod
def get_popular_car() -> PopularVehicle: pass
@staticmethod
@abstractmethod
def get_popular_motorcycle() -> PopularVehicle: pass
# Specialized Factory classes for filial 01
class VehicleFactoryFilial01(VehicleFactory):
"""
Vehicle Factory of the Filial 01
"""
@staticmethod
def get_lux_car() -> LuxVehicle:
return LuxCarFilial01()
@staticmethod
def get_lux_motorcycle() -> LuxVehicle:
return LuxMotorcyleFilial01()
@staticmethod
def get_popular_car() -> PopularVehicle:
return PopularCarFilial01()
@staticmethod
def get_popular_motorcycle() -> PopularVehicle:
return PopularMotorcycleFilial01()
# Specialized Factory classes for filial 02
class VehicleFactoryFilial02(VehicleFactory):
"""
Vehicle Factory of the Filial 02
"""
@staticmethod
def get_lux_car() -> LuxVehicle:
return LuxCarFilial02()
@staticmethod
def get_lux_motorcycle() -> LuxVehicle:
return LuxMotorcyleFilial02()
@staticmethod
def get_popular_car() -> PopularVehicle:
return PopularCarFilial02()
@staticmethod
def get_popular_motorcycle() -> PopularVehicle:
return PopularMotorcycleFilial02()
# Client code
class Client():
def search_clients(self) -> None:
for factory in [VehicleFactoryFilial01(), VehicleFactoryFilial02()]:
# lux vehicles
lux_car = factory.get_lux_car()
lux_car.search_client()
lux_motorcycle = factory.get_lux_motorcycle()
lux_motorcycle.search_client()
# popular vehicles
popular_car = factory.get_popular_car()
popular_car.search_client()
popular_motorcycle = factory.get_popular_motorcycle()
popular_motorcycle.search_client()
if __name__ == '__main__':
client = Client()
client.search_clients()
| 25.329412 | 98 | 0.683929 | 441 | 4,306 | 6.530612 | 0.222222 | 0.058333 | 0.052083 | 0.065972 | 0.575694 | 0.472917 | 0.376389 | 0.173611 | 0 | 0 | 0 | 0.020531 | 0.230841 | 4,306 | 169 | 99 | 25.47929 | 0.849034 | 0.08105 | 0 | 0.428571 | 0 | 0 | 0.121678 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.27381 | false | 0.071429 | 0.011905 | 0.095238 | 0.547619 | 0.095238 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.