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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eacc83c1b09b2c22dc8f20a731dd45ad866daeec | 27 | py | Python | src/id3/__init__.py | DevChuckNorris/MusicBox | 3feb9f13fc9e4b717e47ac4030bcead11c835854 | [
"Apache-2.0"
] | null | null | null | src/id3/__init__.py | DevChuckNorris/MusicBox | 3feb9f13fc9e4b717e47ac4030bcead11c835854 | [
"Apache-2.0"
] | null | null | null | src/id3/__init__.py | DevChuckNorris/MusicBox | 3feb9f13fc9e4b717e47ac4030bcead11c835854 | [
"Apache-2.0"
] | null | null | null | __author__ = 'ChuckNorris'
| 13.5 | 26 | 0.777778 | 2 | 27 | 8.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 27 | 1 | 27 | 27 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0.407407 | 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 |
eae1d6b20b0b38fa35eb85bce5b18dba6b654c75 | 4,126 | py | Python | env/lib/python2.7/site-packages/guess_language/data/models/sv.py | Eric-Muthemba/qontroverse | 1f12d0e3bbdee628a88bac77dc53426ded220755 | [
"MIT"
] | null | null | null | env/lib/python2.7/site-packages/guess_language/data/models/sv.py | Eric-Muthemba/qontroverse | 1f12d0e3bbdee628a88bac77dc53426ded220755 | [
"MIT"
] | 1 | 2021-06-02T01:45:42.000Z | 2021-06-02T01:45:42.000Z | env/lib/python2.7/site-packages/guess_language/data/models/sv.py | Eric-Muthemba/qontroverse | 1f12d0e3bbdee628a88bac77dc53426ded220755 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
model = {
u'en ': 0,
u' de': 1,
u'et ': 2,
u'er ': 3,
u'tt ': 4,
u'om ': 5,
u'för': 6,
u'ar ': 7,
u'de ': 8,
u'att': 9,
u' fö': 10,
u'ing': 11,
u' in': 12,
u' at': 13,
u' i ': 14,
u'det': 15,
u'ch ': 16,
u'an ': 17,
u'gen': 18,
u' an': 19,
u't s': 20,
u'som': 21,
u'te ': 22,
u' oc': 23,
u'ter': 24,
u' ha': 25,
u'lle': 26,
u'och': 27,
u' sk': 28,
u' so': 29,
u'ra ': 30,
u'r a': 31,
u' me': 32,
u'var': 33,
u'nde': 34,
u'är ': 35,
u' ko': 36,
u'on ': 37,
u'ans': 38,
u'int': 39,
u'n s': 40,
u'na ': 41,
u' en': 42,
u' fr': 43,
u' på': 44,
u' st': 45,
u' va': 46,
u'and': 47,
u'nte': 48,
u'på ': 49,
u'ska': 50,
u'ta ': 51,
u' vi': 52,
u'der': 53,
u'äll': 54,
u'örs': 55,
u' om': 56,
u'da ': 57,
u'kri': 58,
u'ka ': 59,
u'nst': 60,
u' ho': 61,
u'as ': 62,
u'stä': 63,
u'r d': 64,
u't f': 65,
u'upp': 66,
u' be': 67,
u'nge': 68,
u'r s': 69,
u'tal': 70,
u'täl': 71,
u'ör ': 72,
u' av': 73,
u'ger': 74,
u'ill': 75,
u'ng ': 76,
u'e s': 77,
u'ekt': 78,
u'ade': 79,
u'era': 80,
u'ers': 81,
u'har': 82,
u'll ': 83,
u'lld': 84,
u'rin': 85,
u'rna': 86,
u'säk': 87,
u'und': 88,
u'inn': 89,
u'lig': 90,
u'ns ': 91,
u' ma': 92,
u' pr': 93,
u' up': 94,
u'age': 95,
u'av ': 96,
u'iva': 97,
u'kti': 98,
u'lda': 99,
u'orn': 100,
u'son': 101,
u'ts ': 102,
u'tta': 103,
u'äkr': 104,
u' sj': 105,
u' ti': 106,
u'avt': 107,
u'ber': 108,
u'els': 109,
u'eta': 110,
u'kol': 111,
u'men': 112,
u'n d': 113,
u't k': 114,
u'vta': 115,
u'år ': 116,
u'juk': 117,
u'man': 118,
u'n f': 119,
u'nin': 120,
u'r i': 121,
u'rsä': 122,
u'sju': 123,
u'sso': 124,
u' är': 125,
u'a s': 126,
u'ach': 127,
u'ag ': 128,
u'bac': 129,
u'den': 130,
u'ett': 131,
u'fte': 132,
u'hor': 133,
u'nba': 134,
u'oll': 135,
u'rnb': 136,
u'ste': 137,
u'til': 138,
u' ef': 139,
u' si': 140,
u'a a': 141,
u'e h': 142,
u'ed ': 143,
u'eft': 144,
u'ga ': 145,
u'ig ': 146,
u'it ': 147,
u'ler': 148,
u'med': 149,
u'n i': 150,
u'nd ': 151,
u'så ': 152,
u'tiv': 153,
u' bl': 154,
u' et': 155,
u' fi': 156,
u' sä': 157,
u'at ': 158,
u'des': 159,
u'e a': 160,
u'gar': 161,
u'get': 162,
u'lan': 163,
u'lss': 164,
u'ost': 165,
u'r b': 166,
u'r e': 167,
u're ': 168,
u'ret': 169,
u'sta': 170,
u't i': 171,
u' ge': 172,
u' he': 173,
u' re': 174,
u'a f': 175,
u'all': 176,
u'bos': 177,
u'ets': 178,
u'lek': 179,
u'let': 180,
u'ner': 181,
u'nna': 182,
u'nne': 183,
u'r f': 184,
u'rit': 185,
u's s': 186,
u'sen': 187,
u'sto': 188,
u'tor': 189,
u'vav': 190,
u'ygg': 191,
u' ka': 192,
u' så': 193,
u' tr': 194,
u' ut': 195,
u'ad ': 196,
u'al ': 197,
u'are': 198,
u'e o': 199,
u'gon': 200,
u'kom': 201,
u'n a': 202,
u'n h': 203,
u'nga': 204,
u'r h': 205,
u'ren': 206,
u't d': 207,
u'tag': 208,
u'tar': 209,
u'tre': 210,
u'ätt': 211,
u' få': 212,
u' hä': 213,
u' se': 214,
u'a d': 215,
u'a i': 216,
u'a p': 217,
u'ale': 218,
u'ann': 219,
u'ara': 220,
u'byg': 221,
u'gt ': 222,
u'han': 223,
u'igt': 224,
u'kan': 225,
u'la ': 226,
u'n o': 227,
u'nom': 228,
u'nsk': 229,
u'omm': 230,
u'r k': 231,
u'r p': 232,
u'r v': 233,
u's f': 234,
u's k': 235,
u't a': 236,
u't p': 237,
u'ver': 238,
u' bo': 239,
u' br': 240,
u' ku': 241,
u' nå': 242,
u'a b': 243,
u'a e': 244,
u'del': 245,
u'ens': 246,
u'es ': 247,
u'fin': 248,
u'ige': 249,
u'm s': 250,
u'n p': 251,
u'någ': 252,
u'or ': 253,
u'r o': 254,
u'rbe': 255,
u'rs ': 256,
u'rt ': 257,
u's a': 258,
u's n': 259,
u'skr': 260,
u't o': 261,
u'ten': 262,
u'tio': 263,
u'ven': 264,
u' al': 265,
u' ja': 266,
u' p ': 267,
u' r ': 268,
u' sa': 269,
u'a h': 270,
u'bet': 271,
u'cke': 272,
u'dra': 273,
u'e f': 274,
u'e i': 275,
u'eda': 276,
u'eno': 277,
u'erä': 278,
u'ess': 279,
u'ion': 280,
u'jag': 281,
u'm f': 282,
u'ne ': 283,
u'nns': 284,
u'pro': 285,
u'r t': 286,
u'rar': 287,
u'riv': 288,
u'rät': 289,
u't e': 290,
u't t': 291,
u'ust': 292,
u'vad': 293,
u'öre': 294,
u' ar': 295,
u' by': 296,
u' kr': 297,
u' mi': 298,
u'arb': 299,
}
| 13.572368 | 23 | 0.447891 | 957 | 4,126 | 1.931034 | 0.574713 | 0.015152 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.258497 | 0.258362 | 4,126 | 303 | 24 | 13.617162 | 0.345425 | 0.00509 | 0 | 0 | 0 | 0 | 0.219352 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eaef43a76a14af1926a13c3f5213381b6852841e | 83 | py | Python | tests/tc8.py | crackaf/PythonInterpreter | 690b3ee8cff8c13dd834788a410a69d9ea923fc1 | [
"MIT"
] | 1 | 2021-07-28T13:25:20.000Z | 2021-07-28T13:25:20.000Z | tests/tc8.py | crackaf/PythonInterpreter | 690b3ee8cff8c13dd834788a410a69d9ea923fc1 | [
"MIT"
] | null | null | null | tests/tc8.py | crackaf/PythonInterpreter | 690b3ee8cff8c13dd834788a410a69d9ea923fc1 | [
"MIT"
] | null | null | null | ## wrong syntax; program should halt and display "error"
l1=[2,3]
l2=[4,5
l3=l1+l2
| 16.6 | 56 | 0.686747 | 17 | 83 | 3.352941 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126761 | 0.144578 | 83 | 4 | 57 | 20.75 | 0.676056 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eafd7bb14b495d2aeba123fa6cf52576adce75da | 335 | py | Python | sabueso/_private_tools/molecular_system/is_file.py | dprada/sabueso | 14843cf3522b5b89db5b61c1541a7015f114dd53 | [
"MIT"
] | null | null | null | sabueso/_private_tools/molecular_system/is_file.py | dprada/sabueso | 14843cf3522b5b89db5b61c1541a7015f114dd53 | [
"MIT"
] | 2 | 2022-01-31T21:22:17.000Z | 2022-02-04T20:20:12.000Z | sabueso/_private_tools/molecular_system/is_file.py | dprada/sabueso | 14843cf3522b5b89db5b61c1541a7015f114dd53 | [
"MIT"
] | 1 | 2021-07-20T15:01:14.000Z | 2021-07-20T15:01:14.000Z |
def is_file(molecular_system):
from sabueso.forms import file_extensions_recognized
output = False
if type(molecular_system) is str:
file_extension = molecular_system.split('.')[-1].lower()
if file_extension in file_extensions_recognized:
output = 'file:'+file_extension
return output
| 22.333333 | 64 | 0.695522 | 40 | 335 | 5.55 | 0.55 | 0.202703 | 0.216216 | 0.27027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003846 | 0.223881 | 335 | 14 | 65 | 23.928571 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0.018018 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.375 | 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 |
d80a345332867a8e52ea2095182305dcba5f4e1a | 556 | py | Python | mlprodict/onnxrt/ops_cpu/op_matmul.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 32 | 2018-03-04T23:33:30.000Z | 2022-03-10T19:15:06.000Z | mlprodict/onnxrt/ops_cpu/op_matmul.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 184 | 2017-11-30T14:10:35.000Z | 2022-02-21T08:29:31.000Z | mlprodict/onnxrt/ops_cpu/op_matmul.py | sdpython/mlprodic | 9367dacc91d35ec670c8a8a76708300a75bbc993 | [
"MIT"
] | 9 | 2019-07-24T13:18:00.000Z | 2022-03-07T04:08:07.000Z | # -*- encoding: utf-8 -*-
# pylint: disable=E0203,E1101,C0111
"""
@file
@brief Runtime operator.
"""
from ._op import OpRunBinaryNum
from ._op_numpy_helper import numpy_matmul_inplace
class MatMul(OpRunBinaryNum):
def __init__(self, onnx_node, desc=None, **options):
OpRunBinaryNum.__init__(self, onnx_node, desc=desc, **options)
def _run(self, a, b): # pylint: disable=W0221
return (numpy_matmul_inplace(self.inplaces, a, b), )
def to_python(self, inputs):
return "import numpy", "return %s @ %s" % tuple(inputs)
| 26.47619 | 70 | 0.683453 | 72 | 556 | 5 | 0.555556 | 0.072222 | 0.1 | 0.088889 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037199 | 0.178058 | 556 | 20 | 71 | 27.8 | 0.750547 | 0.19964 | 0 | 0 | 0 | 0 | 0.05977 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.222222 | 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 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
d82b59ff895bf09bb247c9a8a64aabf8b916fe66 | 239 | py | Python | output/models/nist_data/atomic/token/schema_instance/nistschema_sv_iv_atomic_token_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/token/schema_instance/nistschema_sv_iv_atomic_token_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/token/schema_instance/nistschema_sv_iv_atomic_token_pattern_1_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.token.schema_instance.nistschema_sv_iv_atomic_token_pattern_1_xsd.nistschema_sv_iv_atomic_token_pattern_1 import NistschemaSvIvAtomicTokenPattern1
__all__ = [
"NistschemaSvIvAtomicTokenPattern1",
]
| 39.833333 | 182 | 0.887029 | 28 | 239 | 6.892857 | 0.642857 | 0.170984 | 0.145078 | 0.207254 | 0.341969 | 0.341969 | 0.341969 | 0 | 0 | 0 | 0 | 0.017778 | 0.058577 | 239 | 5 | 183 | 47.8 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0.138075 | 0.138075 | 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 |
d830d2df10873c05bc76ce5add462055f728cca2 | 2,648 | py | Python | DB/Repositorio_Grado_De_Ocupacion_Apartamentos_En_Fin_De_Semana_INE.py | SergioCMDev/Busines-Inteligence-applied-to-tourism | 61834a46fce22453e94b7bbdf8d4ecdcf128285a | [
"Apache-2.0"
] | null | null | null | DB/Repositorio_Grado_De_Ocupacion_Apartamentos_En_Fin_De_Semana_INE.py | SergioCMDev/Busines-Inteligence-applied-to-tourism | 61834a46fce22453e94b7bbdf8d4ecdcf128285a | [
"Apache-2.0"
] | null | null | null | DB/Repositorio_Grado_De_Ocupacion_Apartamentos_En_Fin_De_Semana_INE.py | SergioCMDev/Busines-Inteligence-applied-to-tourism | 61834a46fce22453e94b7bbdf8d4ecdcf128285a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 12:50:46 2017
@author: Sergio Cristauro Manzano
"""
from ..DB.MySQL_INE import MySQLAccessINE as DBContext #Server
#from self.db.MySQL import MySQLAccess as DBContext #Local
class RepositoryGradoOcupacionApartamentosFinDeSemanaINE():
#####################################################################################################################################################################
##################################PORCENTAJE DE OCUPACION DE APARTAMENTOS EN CIUDAD EN FIN DE SEMANA####################################################
#####################################################################################################################################################################
def ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnAnio( self, Ciudad, Anio):
self.db = DBContext()
self.labels = ['Anio', 'Cantidad']
return (self.db.ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnAnio( Ciudad, str(Anio)), self.labels)
def ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnAnioMensualmente( self, Ciudad, Anio):
self.db = DBContext()
self.labels = ['Mes','Cantidad']
return (self.db.ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnAnioMensualmente( Ciudad, str(Anio)), self.labels)
def ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAniosMensualmente(self, Ciudad, anioInicio, anioFin):
self.db = DBContext()
self.labels = ['Anio', 'Mes', 'Cantidad']
return (self.db.ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAniosMensualmente( Ciudad, str(anioInicio), str(anioFin)), self.labels)
def ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAnios(self, Ciudad, anioInicio, anioFin):
self.db = DBContext()
self.labels = ['Anio', 'Cantidad']
return (self.db.ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAnios( Ciudad, str(anioInicio), str(anioFin)), self.labels)
def ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAniosEnMes(self, Ciudad, anioInicio, anioFin, Mes):
self.db = DBContext()
self.labels = ['Anio', 'Cantidad']
return (self.db.ObtenerPorcentajeDelGradoDeOcupacionPorApartamentosEnFinDeSemanaEnCiudadEnRangoAniosEnMes(Ciudad, str(anioInicio), str(anioFin), Mes), self.labels)
| 58.844444 | 175 | 0.638218 | 164 | 2,648 | 10.29878 | 0.317073 | 0.039076 | 0.044405 | 0.056246 | 0.292481 | 0.248076 | 0.217288 | 0.217288 | 0.136175 | 0.136175 | 0 | 0.005657 | 0.132175 | 2,648 | 44 | 176 | 60.181818 | 0.72933 | 0.083459 | 0 | 0.363636 | 0 | 0 | 0.031 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.227273 | false | 0 | 0.045455 | 0 | 0.545455 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d8394488b6bcdc84962f84687cd208fca6a1aec1 | 165 | py | Python | Interface/constants.py | deepakkumar1984/ml-api | 8d09e9ef99c39838cd2f2db1e70226b8d6cbc77e | [
"MIT"
] | 60 | 2017-08-17T11:24:16.000Z | 2019-02-13T02:09:24.000Z | Interface/constants.py | deepakkumar1984/ml-api | 8d09e9ef99c39838cd2f2db1e70226b8d6cbc77e | [
"MIT"
] | null | null | null | Interface/constants.py | deepakkumar1984/ml-api | 8d09e9ef99c39838cd2f2db1e70226b8d6cbc77e | [
"MIT"
] | 35 | 2017-09-27T03:02:23.000Z | 2019-04-25T20:50:43.000Z | class ServiceTypes():
MachineLearning = "ml"
Vision = "vision"
ChatBot = "bot"
Speech = "speech"
LangIntent = "intent"
LangEntity = "entity"
| 20.625 | 26 | 0.606061 | 14 | 165 | 7.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | 165 | 7 | 27 | 23.571429 | 0.826446 | 0 | 0 | 0 | 0 | 0 | 0.175758 | 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 |
dc3ffef4da2bbfb28cf0dcf278bc3f19b91ad25d | 665 | py | Python | operators.py | lmushkat/astr-119-session-2 | 0822f41e33b253c477559997ea8b10d864e88dfd | [
"MIT"
] | null | null | null | operators.py | lmushkat/astr-119-session-2 | 0822f41e33b253c477559997ea8b10d864e88dfd | [
"MIT"
] | 1 | 2018-10-11T07:35:22.000Z | 2018-10-18T18:52:21.000Z | operators.py | lmushkat/astr-119-session-2 | 0822f41e33b253c477559997ea8b10d864e88dfd | [
"MIT"
] | 1 | 2018-10-18T02:02:25.000Z | 2018-10-18T02:02:25.000Z | x = 9
y = 3 #integers
#arithmetic operators
print(x+y) #addition
print(x-y) #subtraction
print(x*y) #multiplication
print(x/y) #division
print(x%y) #modulus
print(x**y) #exponentiation
x = 9.1918123
print(x//y) #floor division
# Assignment operators
x = 9 #sets x to equal 9
x += 3 # x = x +3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x **= 3
print(x)
#comparison operators
x = 9
y = 3
print(x==y) #True if x=y, false otherwise
print(x!=y) #True is x does not =y. false otherwise
print(x>y) #True if x>y, flase otherwise
print(x<y) #true if x<y, false other
print(x>=y) #true if x>=y, false other
print(x<=y) #true if x<=y, false other | 18.472222 | 51 | 0.654135 | 135 | 665 | 3.222222 | 0.222222 | 0.248276 | 0.209195 | 0.151724 | 0.450575 | 0.450575 | 0.427586 | 0.367816 | 0.245977 | 0.245977 | 0 | 0.038603 | 0.181955 | 665 | 36 | 52 | 18.472222 | 0.761029 | 0.509774 | 0 | 0.366667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.6 | 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 | 0 | 0 | 0 | 1 | 0 | 3 |
dc4b5834a412dba57bbf6ea40f07f9699d77ac51 | 214 | py | Python | talktowebsite.py | Ganesha2282882/ion-vpn | 305448bf5d6cdbab45f8b47659131e6986e2b2cf | [
"Unlicense"
] | null | null | null | talktowebsite.py | Ganesha2282882/ion-vpn | 305448bf5d6cdbab45f8b47659131e6986e2b2cf | [
"Unlicense"
] | null | null | null | talktowebsite.py | Ganesha2282882/ion-vpn | 305448bf5d6cdbab45f8b47659131e6986e2b2cf | [
"Unlicense"
] | null | null | null | # Talk to a website. Hack a website. You can do anything.
import requests as reqs
message, url = input("What do you want to send?\n"), input("Who do you want to send the message?\n")
reqs.post(url, data=message)
| 30.571429 | 100 | 0.714953 | 40 | 214 | 3.825 | 0.6 | 0.104575 | 0.117647 | 0.143791 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172897 | 214 | 6 | 101 | 35.666667 | 0.864407 | 0.257009 | 0 | 0 | 0 | 0 | 0.414013 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
dc57f39de56b2dbe26095df93c81c8c82380995d | 589 | py | Python | learntools/python/luigi_analysis.py | roannav/learntools | 355a5df6a66562de62254b723da1a9389b9acc49 | [
"Apache-2.0"
] | 359 | 2018-03-23T15:57:52.000Z | 2022-03-25T21:56:28.000Z | tensorflow_1_x/7_kaggle/learntools/python/luigi_analysis.py | amitbcp/Scikit_Learn_TensorFlow_Examples | 37dda063e316503d53ac45f3b104a5cf1aaa4d78 | [
"MIT"
] | 84 | 2018-06-14T00:06:52.000Z | 2022-02-08T17:25:54.000Z | tensorflow_1_x/7_kaggle/learntools/python/luigi_analysis.py | amitbcp/Scikit_Learn_TensorFlow_Examples | 37dda063e316503d53ac45f3b104a5cf1aaa4d78 | [
"MIT"
] | 213 | 2018-05-02T19:06:31.000Z | 2022-03-20T15:40:34.000Z | full_dataset = [
{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 3},
{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 1},
{'name': 'Bowser', 'items': ['green shell',], 'finish': 1},
{'name': None, 'items': ['green shell',], 'finish': 2},
{'name': 'Bowser', 'items': ['green shell',], 'finish': 1},
{'name': None, 'items': ['red shell',], 'finish': 1},
{'name': 'Yoshi', 'items': ['banana', 'blue shell', 'banana'], 'finish': 7},
{'name': 'DK', 'items': ['blue shell', 'star',], 'finish': 1},
]
| 53.545455 | 87 | 0.511036 | 67 | 589 | 4.477612 | 0.298507 | 0.233333 | 0.25 | 0.213333 | 0.61 | 0.606667 | 0.606667 | 0.606667 | 0.606667 | 0.3 | 0 | 0.016393 | 0.171477 | 589 | 10 | 88 | 58.9 | 0.598361 | 0 | 0 | 0.2 | 0 | 0 | 0.480475 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
dc6b94de9eae32f1067b3c1d1bb8deca30499505 | 4,345 | py | Python | output_raw/output_input_Lx1Ly5.py | ryuikaneko/itps_contraction | 10816fb6c90d77f5a3b2f804ab22573d1d676eb4 | [
"MIT"
] | 1 | 2019-12-19T05:03:37.000Z | 2019-12-19T05:03:37.000Z | output_raw/output_input_Lx1Ly5.py | ryuikaneko/itps_contraction | 10816fb6c90d77f5a3b2f804ab22573d1d676eb4 | [
"MIT"
] | null | null | null | output_raw/output_input_Lx1Ly5.py | ryuikaneko/itps_contraction | 10816fb6c90d77f5a3b2f804ab22573d1d676eb4 | [
"MIT"
] | null | null | null | def Contract_scalar_1x5(\
t0_6,t1_6,t2_6,\
t0_5,t1_5,t2_5,\
t0_4,t1_4,t2_4,\
t0_3,t1_3,t2_3,\
t0_2,t1_2,t2_2,\
t0_1,t1_1,t2_1,\
t0_0,t1_0,t2_0,\
o1_5,\
o1_4,\
o1_3,\
o1_2,\
o1_1\
):
##############################
# ./input/input_Lx1Ly5.dat
##############################
# (o1_2*(t1_2.conj()*((t0_2*(t0_1*(t1_1.conj()*((o1_1*t1_1)*(t2_1*(t0_0*(t2_0*t1_0)))))))*(t1_2*(t2_2*(t0_3*(t1_3.conj()*((t1_3*o1_3)*(t2_3*(t0_4*(t1_4.conj()*((o1_4*t1_4)*(t2_4*(t0_5*(t1_5.conj()*((o1_5*t1_5)*(t2_5*(t0_6*(t2_6*t1_6)))))))))))))))))))
# cpu_cost= 3.004e+11 memory= 5.0206e+08
# final_bond_order ()
##############################
return np.tensordot(
o1_2, np.tensordot(
t1_2.conj(), np.tensordot(
np.tensordot(
t0_2, np.tensordot(
t0_1, np.tensordot(
t1_1.conj(), np.tensordot(
np.tensordot(
o1_1, t1_1, ([0], [4])
), np.tensordot(
t2_1, np.tensordot(
t0_0, np.tensordot(
t2_0, t1_0, ([1], [0])
), ([0], [1])
), ([1], [1])
), ([3, 4], [1, 4])
), ([2, 3, 4], [4, 6, 0])
), ([0, 2, 3], [5, 2, 0])
), ([0], [0])
), np.tensordot(
t1_2, np.tensordot(
t2_2, np.tensordot(
t0_3, np.tensordot(
t1_3.conj(), np.tensordot(
np.tensordot(
t1_3, o1_3, ([4], [0])
), np.tensordot(
t2_3, np.tensordot(
t0_4, np.tensordot(
t1_4.conj(), np.tensordot(
np.tensordot(
o1_4, t1_4, ([0], [4])
), np.tensordot(
t2_4, np.tensordot(
t0_5, np.tensordot(
t1_5.conj(), np.tensordot(
np.tensordot(
o1_5, t1_5, ([0], [4])
), np.tensordot(
t2_5, np.tensordot(
t0_6, np.tensordot(
t2_6, t1_6, ([0], [1])
), ([1], [1])
), ([0], [1])
), ([2, 3], [4, 1])
), ([1, 2, 4], [6, 4, 0])
), ([1, 2, 3], [5, 2, 0])
), ([0], [3])
), ([2, 3], [5, 1])
), ([1, 2, 4], [6, 4, 0])
), ([1, 2, 3], [5, 2, 0])
), ([0], [3])
), ([1, 2], [5, 1])
), ([1, 2, 4], [6, 4, 2])
), ([1, 2, 3], [5, 2, 0])
), ([0], [3])
), ([1, 2], [5, 1])
), ([0, 1, 4, 5], [5, 0, 1, 3])
), ([0, 1, 2, 3], [0, 4, 3, 1])
), ([0, 1], [1, 0])
)
| 52.349398 | 255 | 0.214269 | 383 | 4,345 | 2.185379 | 0.083551 | 0.394265 | 0.108722 | 0.101553 | 0.379928 | 0.236559 | 0.086022 | 0.054958 | 0.054958 | 0.054958 | 0 | 0.19145 | 0.628539 | 4,345 | 82 | 256 | 52.987805 | 0.327138 | 0.07687 | 0 | 0.32 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013333 | false | 0 | 0 | 0.013333 | 0.026667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dc72009e4d3090bba230f290e94aa736da3a1b4c | 899 | py | Python | api_python/app/controllers/controllerUsers.py | uninassau-2020-2/proj-grupo5 | ea7ca233004860a432f7301c72bde03fccce5f92 | [
"CC0-1.0"
] | null | null | null | api_python/app/controllers/controllerUsers.py | uninassau-2020-2/proj-grupo5 | ea7ca233004860a432f7301c72bde03fccce5f92 | [
"CC0-1.0"
] | null | null | null | api_python/app/controllers/controllerUsers.py | uninassau-2020-2/proj-grupo5 | ea7ca233004860a432f7301c72bde03fccce5f92 | [
"CC0-1.0"
] | null | null | null | from app.models.DAO import DAOUsuario
import pymysql
from app import app
from config import mysql
from flask import jsonify
from flask import flash, request
from werkzeug.security import generate_password_hash, check_password_hash
from app.models.classes_basicas.User import User
def add_user(user):
try:
return DAOUsuario.add_user(user)
except Exception as ex:
print(ex)
def listarUsers():
try:
return DAOUsuario.listarUsers()
except Exception as ex:
print(ex)
def getById(id):
try:
return DAOUsuario.getById(id)
except Exception as ex:
print(ex)
def update_user(user):
try:
return DAOUsuario.update_user(user)
except Exception as ex:
print(ex)
def delete_user(id):
try:
return DAOUsuario.delete_user(id)
except Exception as ex:
print(ex)
| 19.543478 | 73 | 0.667408 | 117 | 899 | 5.034188 | 0.307692 | 0.076401 | 0.16129 | 0.16129 | 0.366723 | 0.275042 | 0.275042 | 0.125637 | 0.125637 | 0 | 0 | 0 | 0.268076 | 899 | 46 | 74 | 19.543478 | 0.895137 | 0 | 0 | 0.454545 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.151515 | false | 0.030303 | 0.242424 | 0 | 0.545455 | 0.151515 | 0 | 0 | 0 | null | 0 | 0 | 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 | 1 | 0 | 0 | 3 |
dc8d5e6f809914d8310e28cfccc52dbc445dad99 | 1,755 | py | Python | tests/handyspark/sql/test_pandas.py | FoundryAI/handyspark | bf23522eb0794cce8af2f036347b34df1a2c7b09 | [
"MIT"
] | null | null | null | tests/handyspark/sql/test_pandas.py | FoundryAI/handyspark | bf23522eb0794cce8af2f036347b34df1a2c7b09 | [
"MIT"
] | null | null | null | tests/handyspark/sql/test_pandas.py | FoundryAI/handyspark | bf23522eb0794cce8af2f036347b34df1a2c7b09 | [
"MIT"
] | null | null | null | import numpy.testing as npt
from handyspark import *
# boolean returns
def test_between(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Age'].between(left=20, right=40))
hres = hdf.cols['newcol'][:20]
res = pdf['Age'].between(left=20, right=40)[:20]
npt.assert_array_equal(hres, res)
def test_isin(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Age'].isin(values=[22, 40]))
hres = hdf.cols['newcol'][:20]
res = pdf['Age'].isin(values=[22, 40])[:20]
npt.assert_array_equal(hres, res)
def test_isna(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Cabin'].isna())
hres = hdf.cols['newcol'][:20]
res = pdf['Cabin'].isna()[:20]
npt.assert_array_equal(hres, res)
def test_notna(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Cabin'].notna())
hres = hdf.cols['newcol'][:20]
res = pdf['Cabin'].notna()[:20]
npt.assert_array_equal(hres, res)
# same type returns
def test_clip(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Age'].clip(lower=5, upper=50))
hres = hdf.cols['newcol'][:20]
res = pdf['Age'].clip(lower=5, upper=50)[:20]
npt.assert_array_equal(hres, res)
def test_replace(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Age'].replace(to_replace=5, value=0))
hres = hdf.cols['newcol'][:20]
res = pdf['Age'].replace(to_replace=5, value=0)[:20]
npt.assert_array_equal(hres, res)
def test_round(sdf, pdf):
hdf = sdf.toHandy()
hdf = hdf.assign(newcol=hdf.pandas['Fare'].round(decimals=0))
hres = hdf.cols['newcol'][:20]
res = pdf['Fare'].round(decimals=0)[:20]
npt.assert_array_equal(hres, res)
| 32.5 | 77 | 0.637607 | 273 | 1,755 | 4.014652 | 0.18315 | 0.044708 | 0.057482 | 0.076642 | 0.841241 | 0.819343 | 0.755474 | 0.689781 | 0.531934 | 0.381387 | 0 | 0.038199 | 0.164672 | 1,755 | 53 | 78 | 33.113208 | 0.709413 | 0.018803 | 0 | 0.477273 | 0 | 0 | 0.054683 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 1 | 0.159091 | false | 0 | 0.045455 | 0 | 0.204545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 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 |
dc8ea1e41ef8da506f15a26a4e5aed16000476ef | 498 | py | Python | devilry/project/common/devilry_test_runner.py | devilry/devilry-django | 9ae28e462dfa4cfee966ebacbca04ade9627e715 | [
"BSD-3-Clause"
] | 29 | 2015-01-18T22:56:23.000Z | 2020-11-10T21:28:27.000Z | devilry/project/common/devilry_test_runner.py | devilry/devilry-django | 9ae28e462dfa4cfee966ebacbca04ade9627e715 | [
"BSD-3-Clause"
] | 786 | 2015-01-06T16:10:18.000Z | 2022-03-16T11:10:50.000Z | devilry/project/common/devilry_test_runner.py | devilry/devilry-django | 9ae28e462dfa4cfee966ebacbca04ade9627e715 | [
"BSD-3-Clause"
] | 15 | 2015-04-06T06:18:43.000Z | 2021-02-24T12:28:30.000Z | import warnings
from django.test.runner import DiscoverRunner
#from django.utils.deprecation import RemovedInDjango20Warning
class DevilryTestRunner(DiscoverRunner):
def setup_test_environment(self, **kwargs):
# warnings.filterwarnings('ignore', category=RemovedInDjango)
super(DevilryTestRunner, self).setup_test_environment(**kwargs)
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=ResourceWarning)
| 38.307692 | 71 | 0.785141 | 45 | 498 | 8.6 | 0.533333 | 0.170543 | 0.217054 | 0.27907 | 0.217054 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004598 | 0.126506 | 498 | 12 | 72 | 41.5 | 0.885057 | 0.242972 | 0 | 0 | 0 | 0 | 0.032 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
dc940bfd51623d999d7bbd6bd6c1425b395e1d9a | 2,125 | py | Python | test/test_contact_all.py | shcherbakova-natalia-olegovna/python_training | 042e4eee53511d727d4977c880362663774de45e | [
"Apache-2.0"
] | null | null | null | test/test_contact_all.py | shcherbakova-natalia-olegovna/python_training | 042e4eee53511d727d4977c880362663774de45e | [
"Apache-2.0"
] | null | null | null | test/test_contact_all.py | shcherbakova-natalia-olegovna/python_training | 042e4eee53511d727d4977c880362663774de45e | [
"Apache-2.0"
] | null | null | null | import re
#from random import randrange
from model.contact import Contact
def test_contact_all(app, db):
ui_list = app.contact.get_contact_list()
def clean(contact):
return Contact(id=contact.id, name=contact.name.strip(), surname=contact.surname.strip(), address=contact.address,
all_emails_from_home_page=merge_emails_like_on_home_page(contact), all_phones_from_home_page=merge_phones_like_on_home_page(contact))
db_list = map(clean, db.get_contact_list())
assert sorted(ui_list, key=Contact.id_or_max) == sorted(db_list, key=Contact.id_or_max)
#def test_contact_all(app):
#old_contacts = app.contact.get_contact_list()
#index = randrange(len(old_contacts))
#contact_from_home_page = app.contact.get_contact_list()[index]
#contact_from_edit_page = app.contact.get_contact_info_from_edit_page(index)
#assert contact_from_home_page.surname == contact_from_edit_page.surname
#assert contact_from_home_page.name == contact_from_edit_page.name
#assert clear_probel(contact_from_home_page.address) == clear_probel(contact_from_edit_page.address)
#assert clear_probel(contact_from_home_page.all_emails_from_home_page) == merge_emails_like_on_home_page(contact_from_edit_page)
#assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit_page)
def clear(s):
return re.sub("[() -]", "", s)
def clear_probel(s):
return re.sub("[ ]", "", s)
def merge_phones_like_on_home_page(contact):
return "\n".join(filter(lambda x: x != "",
map(lambda x: clear(x),
filter(lambda x: x is not None,
[contact.homephone, contact.mobilephone, contact.workphone, contact.secondaryphone]))))
def merge_emails_like_on_home_page(contact):
return "\n".join(filter(lambda x: x != "",
map(lambda x: clear_probel(x),
filter(lambda x: x is not None,
[contact.email, contact.email2, contact.email3]))))
| 44.270833 | 156 | 0.690353 | 295 | 2,125 | 4.586441 | 0.20339 | 0.094605 | 0.088692 | 0.062084 | 0.600887 | 0.477458 | 0.379897 | 0.310421 | 0.292683 | 0.246859 | 0 | 0.001183 | 0.204235 | 2,125 | 47 | 157 | 45.212766 | 0.798936 | 0.351529 | 0 | 0.173913 | 0 | 0 | 0.009517 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 1 | 0.26087 | false | 0 | 0.086957 | 0.217391 | 0.565217 | 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 |
dca8d978a5e2696fb3a19c0c172ec64665a9a29d | 142 | py | Python | src/utils.py | SiddeshSambasivam/Physics-Informed-Neural-Networks | e727af52b901b9ee7419083a52035bf5e29deaed | [
"MIT"
] | 5 | 2021-08-09T09:30:10.000Z | 2022-03-07T06:49:21.000Z | src/utils.py | SiddeshSambasivam/Physics-Informed-Neural-Networks | e727af52b901b9ee7419083a52035bf5e29deaed | [
"MIT"
] | null | null | null | src/utils.py | SiddeshSambasivam/Physics-Informed-Neural-Networks | e727af52b901b9ee7419083a52035bf5e29deaed | [
"MIT"
] | 1 | 2022-02-21T15:02:45.000Z | 2022-02-21T15:02:45.000Z | import json
def read_config(filepath: str) -> dict:
with open(filepath) as file_:
values = json.load(file_)
return values
| 14.2 | 39 | 0.65493 | 19 | 142 | 4.736842 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253521 | 142 | 9 | 40 | 15.777778 | 0.849057 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | 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 |
dcb044fd1d916316ceae1be6748b79c423b2d4ea | 154 | py | Python | Solution1/py_code/gym_no_env_kensaku.py | Delapre/baby-steps-of-rl-ja | a8bd7477d8e191d219a73d5c865bfa943c6b0a70 | [
"Apache-2.0"
] | null | null | null | Solution1/py_code/gym_no_env_kensaku.py | Delapre/baby-steps-of-rl-ja | a8bd7477d8e191d219a73d5c865bfa943c6b0a70 | [
"Apache-2.0"
] | null | null | null | Solution1/py_code/gym_no_env_kensaku.py | Delapre/baby-steps-of-rl-ja | a8bd7477d8e191d219a73d5c865bfa943c6b0a70 | [
"Apache-2.0"
] | null | null | null | from gym import envs
import gym
for spec in envs.registry.all():
try:
env = gym.make(spec.id)
print(spec.id)
except:
pass | 17.111111 | 32 | 0.584416 | 23 | 154 | 3.913043 | 0.695652 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | 154 | 9 | 33 | 17.111111 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.125 | 0.25 | 0 | 0.25 | 0.125 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f49ad90eb26a8978f184e59ebbc68fd810443f16 | 18 | py | Python | tests/core_symbol.py | pokerman9527/eos | 59626f1e6361df3b715e926ee13a9a8e84d177af | [
"MIT"
] | 191 | 2018-05-31T22:56:12.000Z | 2021-12-31T06:59:48.000Z | tests/core_symbol.py | pokerman9527/eos | 59626f1e6361df3b715e926ee13a9a8e84d177af | [
"MIT"
] | 601 | 2018-08-21T11:13:04.000Z | 2019-07-30T03:48:52.000Z | tests/core_symbol.py | pokerman9527/eos | 59626f1e6361df3b715e926ee13a9a8e84d177af | [
"MIT"
] | 95 | 2018-06-01T05:29:19.000Z | 2021-06-18T09:15:40.000Z | CORE_SYMBOL='SYS'
| 9 | 17 | 0.777778 | 3 | 18 | 4.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 18 | 1 | 18 | 18 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 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 |
f4a639b713112f9b536c024ee64449eca00ae287 | 279 | py | Python | backend/apps/iamstudent/migrations/0004_merge_20200330_0152.py | n-hackert/match4healthcare | 761248c27b49e568c545c643a72eac9a040649d7 | [
"MIT"
] | 2 | 2020-03-28T13:56:39.000Z | 2020-03-29T10:16:12.000Z | backend/apps/iamstudent/migrations/0004_merge_20200330_0152.py | n-hackert/match4healthcare | 761248c27b49e568c545c643a72eac9a040649d7 | [
"MIT"
] | 76 | 2020-03-27T21:53:04.000Z | 2020-03-30T20:27:43.000Z | backend/apps/iamstudent/migrations/0004_merge_20200330_0152.py | n-hackert/match4healthcare | 761248c27b49e568c545c643a72eac9a040649d7 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.4 on 2020-03-30 01:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('iamstudent', '0003_auto_20200330_0020'),
('iamstudent', '0003_auto_20200329_1859'),
]
operations = [
]
| 18.6 | 50 | 0.655914 | 33 | 279 | 5.363636 | 0.818182 | 0.158192 | 0.20339 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217593 | 0.225806 | 279 | 14 | 51 | 19.928571 | 0.601852 | 0.16129 | 0 | 0 | 1 | 0 | 0.284483 | 0.198276 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
f4b2b06c1d074c3025f14de7410fc5322b33b9b8 | 6,051 | py | Python | app/plugin/bca/user_db/table_def.py | MU-Software/bca_backend | 282db3908ee0b2c95c5e6bd6d6458077e941f343 | [
"MIT"
] | null | null | null | app/plugin/bca/user_db/table_def.py | MU-Software/bca_backend | 282db3908ee0b2c95c5e6bd6d6458077e941f343 | [
"MIT"
] | null | null | null | app/plugin/bca/user_db/table_def.py | MU-Software/bca_backend | 282db3908ee0b2c95c5e6bd6d6458077e941f343 | [
"MIT"
] | null | null | null | import datetime
import sqlalchemy as sql
import sqlalchemy.types as sqltypes
import sqlalchemy.ext.declarative as sqldec
class UserDBDateTime(sqltypes.TypeDecorator):
impl = sqltypes.Integer
# Python Object to DB
def process_bind_param(self, value: datetime.datetime, dialect):
if value is not None:
if isinstance(value, str):
# Try to parse RFC1123 format time string
time_format = '%a, %d %b %Y %H:%M:%S GMT'
value = datetime.datetime.strptime(value, time_format).replace(tzinfo=datetime.timezone.utc)
elif isinstance(value, (int, float)):
# Treat value as timestamp integer
return int(value)
# value must be a datetime.datetime object.
value = int(value.timestamp())
return value
# DB to Python Object
def process_result_value(self, value: int, dialect):
if value is not None:
value = datetime.datetime.fromtimestamp(value)
return value
def process_literal_value(self, value, dialect):
return super().process_result_value(value, dialect)
class UserDBBoolean(sqltypes.TypeDecorator):
impl = sqltypes.Integer
# Python Object to DB
def process_bind_param(self, value: bool, dialect):
if value is not None:
value = int(value)
return value
# DB to Python Object
def process_result_value(self, value: int, dialect):
if value is not None:
value = bool(value)
return value
def process_literal_value(self, value, dialect):
return super().process_result_value(value, dialect)
class Profile:
__tablename__ = 'TB_PROFILE'
__table_args__ = {
'sqlite_autoincrement': True,
}
column_names = [
'uuid',
'name', 'team_name', 'description', 'data', 'image_url',
'email', 'phone', 'sns', 'address', 'private',
'commit_id', 'created_at', 'modified_at', 'deleted_at', 'why_deleted',
]
uuid = sql.Column(sql.Integer, primary_key=True, nullable=False)
name = sql.Column(sql.TEXT, nullable=False) # Profile name shown in list or card
team_name = sql.Column(sql.TEXT, nullable=True) # Profile's included organization name
description = sql.Column(sql.TEXT, nullable=True) # Profile description
data = sql.Column(sql.TEXT, nullable=False) # Profile data (in json)
image_url = sql.Column(sql.TEXT, nullable=True) # Profile image URL
email = sql.Column(sql.TEXT, nullable=True) # Main email of Profile
phone = sql.Column(sql.TEXT, nullable=True) # Main phone of Profile
sns = sql.Column(sql.TEXT, nullable=True) # Main SNS Account of profile
address = sql.Column(sql.TEXT, nullable=True) # Main address of profile
commit_id = sql.Column(sql.TEXT, nullable=False)
created_at = sql.Column(UserDBDateTime, nullable=False)
modified_at = sql.Column(UserDBDateTime, nullable=False)
deleted_at = sql.Column(UserDBDateTime, nullable=True)
why_deleted = sql.Column(sql.TEXT, nullable=True)
private = sql.Column(UserDBBoolean, nullable=False, default=0)
class ProfileRelation:
__tablename__ = 'TB_PROFILE_RELATION'
__table_args__ = {
'sqlite_autoincrement': True,
}
column_names = [
'uuid',
'from_profile_id', 'to_profile_id', 'status',
'commit_id', 'created_at', 'modified_at',
]
uuid = sql.Column(sql.Integer, primary_key=True, nullable=False)
commit_id = sql.Column(sql.TEXT, nullable=False)
created_at = sql.Column(UserDBDateTime, nullable=False)
modified_at = sql.Column(UserDBDateTime, nullable=False)
status = sql.Column(sql.Integer, nullable=False, default=1)
@sqldec.declared_attr
def from_profile_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_PROFILE.uuid'), nullable=False)
@sqldec.declared_attr
def to_profile_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_PROFILE.uuid'), nullable=False)
class Card:
__tablename__ = 'TB_CARD'
__table_args__ = {
'sqlite_autoincrement': True,
}
column_names = [
'uuid',
'name', 'data', 'preview_url', 'private', 'profile_id',
'commit_id', 'created_at', 'modified_at', 'deleted_at', 'why_deleted',
]
uuid = sql.Column(sql.Integer, primary_key=True, nullable=False)
name = sql.Column(sql.TEXT, nullable=False)
data = sql.Column(sql.TEXT, nullable=False)
preview_url = sql.Column(sql.TEXT, nullable=False, unique=True)
commit_id = sql.Column(sql.TEXT, nullable=False)
created_at = sql.Column(UserDBDateTime, nullable=False)
modified_at = sql.Column(UserDBDateTime, nullable=False)
deleted_at = sql.Column(UserDBDateTime, nullable=True)
why_deleted = sql.Column(sql.TEXT, nullable=True)
private = sql.Column(UserDBBoolean, nullable=False, default=0)
@sqldec.declared_attr
def profile_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_PROFILE.uuid'), nullable=False)
class CardSubscription:
__tablename__ = 'TB_CARD_SUBSCRIPTION'
__table_args__ = {
'sqlite_autoincrement': True,
}
column_names = [
'uuid',
'card_profile_id', 'card_id', 'subscribed_profile_id',
'commit_id', 'created_at', 'modified_at',
]
uuid = sql.Column(sql.Integer, primary_key=True, nullable=False)
commit_id = sql.Column(sql.TEXT, nullable=False)
created_at = sql.Column(UserDBDateTime, nullable=False)
modified_at = sql.Column(UserDBDateTime, nullable=False)
@sqldec.declared_attr
def card_profile_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_PROFILE.uuid'), nullable=False)
@sqldec.declared_attr
def card_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_CARD.uuid'), nullable=False)
@sqldec.declared_attr
def subscribed_profile_id(cls):
return sql.Column(sql.Integer, sql.ForeignKey('TB_PROFILE.uuid'), nullable=False)
| 33.994382 | 108 | 0.674269 | 752 | 6,051 | 5.236702 | 0.167553 | 0.093702 | 0.08837 | 0.073134 | 0.734637 | 0.734637 | 0.718893 | 0.615287 | 0.586846 | 0.560945 | 0 | 0.001471 | 0.213684 | 6,051 | 177 | 109 | 34.186441 | 0.826187 | 0.069906 | 0 | 0.574803 | 0 | 0 | 0.107467 | 0.003743 | 0 | 0 | 0 | 0 | 0 | 1 | 0.094488 | false | 0 | 0.031496 | 0.062992 | 0.661417 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
f4b96239e1293dc6e1b7905128594ecc3a567015 | 142 | py | Python | K64F Python Interfacing Testing/Windows_USB_Devices.py | Marnold212/CamLab-K64F | 20689b4be38aa329990dbfe13eec43d74b3ae27a | [
"Apache-2.0"
] | null | null | null | K64F Python Interfacing Testing/Windows_USB_Devices.py | Marnold212/CamLab-K64F | 20689b4be38aa329990dbfe13eec43d74b3ae27a | [
"Apache-2.0"
] | null | null | null | K64F Python Interfacing Testing/Windows_USB_Devices.py | Marnold212/CamLab-K64F | 20689b4be38aa329990dbfe13eec43d74b3ae27a | [
"Apache-2.0"
] | null | null | null | import win32com.client
wmi = win32com.client.GetObject ("winmgmts:")
for usb in wmi.InstancesOf ("Win32_USBHub"):
print(usb.DeviceID) | 28.4 | 46 | 0.732394 | 18 | 142 | 5.722222 | 0.777778 | 0.271845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04918 | 0.140845 | 142 | 5 | 47 | 28.4 | 0.795082 | 0 | 0 | 0 | 0 | 0 | 0.151079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 |
f4bc3677fe7f3885f241d3ed214ad910954ae2f3 | 329 | py | Python | curriculum/certificate/api.py | ro199/Hoja-de-Vida | 8864467f2998aed6e0a30a9f9767806dcb38ed71 | [
"MIT"
] | null | null | null | curriculum/certificate/api.py | ro199/Hoja-de-Vida | 8864467f2998aed6e0a30a9f9767806dcb38ed71 | [
"MIT"
] | null | null | null | curriculum/certificate/api.py | ro199/Hoja-de-Vida | 8864467f2998aed6e0a30a9f9767806dcb38ed71 | [
"MIT"
] | null | null | null | from rest_framework import viewsets, permissions
from .serializers import CertificateSerializer
from .models import Certificate
class CertificateViewSet(viewsets.ModelViewSet):
queryset = Certificate.objects.all()
permissions_classes = [
permissions.AllowAny
]
serializer_class = CertificateSerializer
| 25.307692 | 48 | 0.787234 | 29 | 329 | 8.827586 | 0.655172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161094 | 329 | 12 | 49 | 27.416667 | 0.927536 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.777778 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f4db709eafdebc9dda8871a7b9e916c308a3a38e | 3,853 | py | Python | cells.py | Singlespot/sse-geo | 19e5b557a1dd94270699e9d6a29eaf99a45b084f | [
"Apache-2.0"
] | null | null | null | cells.py | Singlespot/sse-geo | 19e5b557a1dd94270699e9d6a29eaf99a45b084f | [
"Apache-2.0"
] | null | null | null | cells.py | Singlespot/sse-geo | 19e5b557a1dd94270699e9d6a29eaf99a45b084f | [
"Apache-2.0"
] | null | null | null | import json
import math
import urllib.parse
from area import area as compute_area
from haversine import Unit
from haversine.haversine import get_avg_earth_radius
EARTH_RADIUS = get_avg_earth_radius(Unit.METERS)
EARTH_PERIMETER = 2 * math.pi * EARTH_RADIUS
def latitude_radians_to_meters(radians: float) -> float:
return EARTH_RADIUS * radians
def latitude_meters_to_radians(meters: float) -> float:
return meters / EARTH_RADIUS
def longitude_meters_to_radians(meters: float, latitude_rad: float) -> float:
return meters / (EARTH_RADIUS * math.cos(latitude_rad))
def longitude_radians_to_meters(radians: float, latitude_rad: float) -> float:
return (EARTH_RADIUS * math.cos(latitude_rad)) * radians
def area_from_integral(latitude_rad: float, longitude_span_rad: float) -> float:
return EARTH_RADIUS ** 2 * longitude_span_rad * math.sin(latitude_rad)
def latitude_from_area(area: float, longitude_span_rad: float) -> float:
return math.asin(area / (EARTH_RADIUS ** 2 * longitude_span_rad))
class Cell:
EXPECTED_EDGE_LENGTH_METERS = 30
REFERENCE_LATITUDE_RAD = 0.8177264 # 46.85227151642656°
def __init__(self, lat_index: int, lon_index: int):
self.lat_index = lat_index
self.lon_index = lon_index
latitude_rad = latitude_from_area((self.lat_index + 0.5) * self.expected_area(), self.longitude_rad_increment())
self.latitude_rad_increment = self.compute_latitude_rad_increment(latitude_rad)
@classmethod
def expected_area(cls):
return cls.EXPECTED_EDGE_LENGTH_METERS ** 2
@classmethod
def from_lat_lng(cls, latitude_deg: float, longitude_deg: float):
latitude_rad = math.radians(latitude_deg)
longitude_rad = math.radians(longitude_deg)
lon_index = int(math.floor(longitude_rad / cls.longitude_rad_increment()))
lat_index = int(
math.floor(area_from_integral(latitude_rad, cls.longitude_rad_increment()) / cls.expected_area()))
return cls(lat_index, lon_index)
@classmethod
def compute_latitude_rad_increment(cls, latitude_rad):
# approximation (because sin(lat_i) ~ lat_i and cos(lat_i) ~ 1)
# cls.expected_area() / (EARTH_RADIUS ** 2 * cls.longitude_rad_increment() * math.cos(latitude_rad))
return math.asin(cls.expected_area() / (EARTH_RADIUS ** 2 * cls.longitude_rad_increment()) + math.sin(
latitude_rad)) - latitude_rad
@classmethod
def longitude_rad_increment(cls):
return longitude_meters_to_radians(cls.EXPECTED_EDGE_LENGTH_METERS, cls.REFERENCE_LATITUDE_RAD)
@classmethod
def index_to_point(cls, lat_index, lon_index):
return (
math.degrees(latitude_from_area(lat_index * cls.expected_area(), cls.longitude_rad_increment())),
math.degrees(lon_index * cls.longitude_rad_increment())
)
@property
def min_point(self):
return self.index_to_point(self.lat_index, self.lon_index)
@property
def max_point(self):
return self.index_to_point(self.lat_index + 1, self.lon_index + 1)
@property
def geojson_coordinates(self):
return [
[self.min_point[1], self.min_point[0]],
[self.min_point[1], self.max_point[0]],
[self.max_point[1], self.max_point[0]],
[self.max_point[1], self.min_point[0]],
[self.min_point[1], self.min_point[0]],
]
@property
def geojson_obj(self):
return json.dumps({'type': 'Polygon', 'coordinates': [self.geojson_coordinates]})
def get_geojson_url(self):
data = urllib.parse.quote(json.dumps({'type': 'Polygon', 'coordinates': [self.geojson_coordinates]}))
return f'http://geojson.io/#data=data:application/json,{data}'
@property
def area(self):
return compute_area(self.geojson_obj)
| 36.009346 | 120 | 0.702829 | 517 | 3,853 | 4.914894 | 0.154739 | 0.082251 | 0.066116 | 0.056671 | 0.430146 | 0.284534 | 0.199134 | 0.170012 | 0.121999 | 0.121999 | 0 | 0.015069 | 0.190501 | 3,853 | 106 | 121 | 36.349057 | 0.799295 | 0.046457 | 0 | 0.157895 | 0 | 0 | 0.026158 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.236842 | false | 0 | 0.078947 | 0.197368 | 0.578947 | 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 |
76076fb7d103ae57b89cfaf1e170e07d808f172c | 274 | py | Python | topCoder/srms/400s/srm480/div2/cryptography.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 25 | 2015-01-21T16:39:18.000Z | 2021-05-24T07:01:24.000Z | topCoder/srms/400s/srm480/div2/cryptography.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 2 | 2020-09-30T19:39:36.000Z | 2020-10-01T17:15:16.000Z | topCoder/srms/400s/srm480/div2/cryptography.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 15 | 2015-01-21T16:39:27.000Z | 2020-10-01T17:00:22.000Z | from operator import mul
class Cryptography:
def encrypt(self, numbers):
def d(a, b):
return reduce(mul, a, 1) * reduce(mul, b, 1)
return max(
d(numbers[:i], numbers[i + 1 :]) * (e + 1) for i, e in enumerate(numbers)
)
| 22.833333 | 85 | 0.529197 | 39 | 274 | 3.717949 | 0.564103 | 0.124138 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021978 | 0.335766 | 274 | 11 | 86 | 24.909091 | 0.774725 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
761063ee92bec8f0ff89e3af1806e68f56bd6306 | 119 | py | Python | ch_04/input.py | berchev/python_learning | 5b99065cade53c64b4ede3d0e583c58573ca654c | [
"MIT"
] | null | null | null | ch_04/input.py | berchev/python_learning | 5b99065cade53c64b4ede3d0e583c58573ca654c | [
"MIT"
] | null | null | null | ch_04/input.py | berchev/python_learning | 5b99065cade53c64b4ede3d0e583c58573ca654c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
population = input("Please enter population value: ")
print("You have entered: ", population)
| 17 | 53 | 0.714286 | 15 | 119 | 5.666667 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 119 | 6 | 54 | 19.833333 | 0.833333 | 0.168067 | 0 | 0 | 0 | 0 | 0.510417 | 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 |
761efec9dada53bd1f32f6568ae16d24c7254ef5 | 1,239 | py | Python | sphinxcontrib/autohttp/flask.py | stephenfin/httpdomain | 3c5880774c976aba59b3da5b5d34c4b63faaaf4e | [
"BSD-2-Clause"
] | 53 | 2017-10-22T11:57:38.000Z | 2022-02-24T07:53:06.000Z | sphinxcontrib/autohttp/flask.py | stephenfin/httpdomain | 3c5880774c976aba59b3da5b5d34c4b63faaaf4e | [
"BSD-2-Clause"
] | 44 | 2018-01-08T13:43:53.000Z | 2022-02-21T05:09:46.000Z | sphinxcontrib/autohttp/flask.py | stephenfin/httpdomain | 3c5880774c976aba59b3da5b5d34c4b63faaaf4e | [
"BSD-2-Clause"
] | 40 | 2018-01-09T01:47:44.000Z | 2022-03-23T15:38:14.000Z | """
sphinxcontrib.autohttp.flask
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The sphinx.ext.autodoc-style HTTP API reference builder (from Flask)
for sphinxcontrib.httpdomain.
:copyright: Copyright 2011 by Hong Minhee
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import re
import itertools
import six
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles
from sphinx.util.docstrings import prepare_docstring
from sphinx.pycode import ModuleAnalyzer
from sphinxcontrib import httpdomain
from sphinxcontrib.autohttp.common import http_directive, import_object
from .flask_base import AutoflaskBase
class AutoflaskDirective(AutoflaskBase):
def run(self):
node = nodes.section()
node.document = self.state.document
result = ViewList()
for line in self.make_rst():
result.append(line, '<autoflask>')
nested_parse_with_titles(self.state, result, node)
return node.children
def setup(app):
app.setup_extension('sphinxcontrib.httpdomain')
app.add_directive('autoflask', AutoflaskDirective)
| 26.934783 | 72 | 0.739306 | 145 | 1,239 | 6.193103 | 0.503448 | 0.040089 | 0.03118 | 0.046771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003891 | 0.170299 | 1,239 | 45 | 73 | 27.533333 | 0.86965 | 0.193705 | 0 | 0 | 0 | 0 | 0.045549 | 0.024845 | 0 | 0 | 0 | 0.022222 | 0 | 1 | 0.08 | false | 0 | 0.52 | 0 | 0.68 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5235de0a1aeca80843975386d432d9930bc933ab | 890 | py | Python | images/core/context/free5gc/lib/pfcp/support/cache/tlv_msg_8.py | my5G/OPlaceRAN | cc6fe5223b9b2a32d7963b2304762fe2a0265298 | [
"Apache-2.0"
] | 1 | 2022-02-22T07:19:59.000Z | 2022-02-22T07:19:59.000Z | images/core/context/free5gc/lib/pfcp/support/cache/tlv_msg_8.py | my5G/OPlaceRAN | cc6fe5223b9b2a32d7963b2304762fe2a0265298 | [
"Apache-2.0"
] | 1 | 2022-01-15T20:26:01.000Z | 2022-01-15T20:26:01.000Z | images/core/context/free5gc/lib/pfcp/support/cache/tlv_msg_8.py | my5G/OPlaceRAN | cc6fe5223b9b2a32d7963b2304762fe2a0265298 | [
"Apache-2.0"
] | 1 | 2022-01-07T18:49:10.000Z | 2022-01-07T18:49:10.000Z | ies = []
ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."})
ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "M", "instance" : "0", "comment" : "This IE shall indicate the acceptance or the rejection of the corresponding request message."})
ies.append({ "ie_type" : "UP Function Features", "ie_value" : "UP Function Features", "presence" : "O", "instance" : "0", "comment" : "If present, this IE shall indicate the supported Features when the sending node is the UP function."})
ies.append({ "ie_type" : "CP Function Features", "ie_value" : "CP Function Features", "presence" : "O", "instance" : "0", "comment" : "If present, this IE shall indicate the supported Features when the sending node is the CP function."})
msg_list[key]["ies"] = ies
| 127.142857 | 237 | 0.677528 | 127 | 890 | 4.677165 | 0.322835 | 0.060606 | 0.074074 | 0.10101 | 0.516835 | 0.498317 | 0.498317 | 0.498317 | 0.377104 | 0.377104 | 0 | 0.005298 | 0.151685 | 890 | 6 | 238 | 148.333333 | 0.781457 | 0 | 0 | 0 | 0 | 0 | 0.697753 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
523f06736c76a42d2d78a41e1a369b4a9a0cfc3b | 102 | py | Python | mmlab_api/api_detectron2/apps.py | quantran14/hatdieu-api | 56b63dce14c4010ff81c05f36da9643d571daa54 | [
"MIT"
] | 2 | 2020-01-24T10:38:30.000Z | 2020-07-17T08:20:38.000Z | mmlab_api/api_detectron2/apps.py | quantran14/hatdieu-api | 56b63dce14c4010ff81c05f36da9643d571daa54 | [
"MIT"
] | 14 | 2020-06-05T20:22:33.000Z | 2022-03-12T00:10:39.000Z | mmlab_api/api_detectron2/apps.py | quantran14/hatdieu-api | 56b63dce14c4010ff81c05f36da9643d571daa54 | [
"MIT"
] | 1 | 2020-07-20T01:37:22.000Z | 2020-07-20T01:37:22.000Z | from django.apps import AppConfig
class ApiDetectron2Config(AppConfig):
name = 'api_detectron2'
| 17 | 37 | 0.784314 | 11 | 102 | 7.181818 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022989 | 0.147059 | 102 | 5 | 38 | 20.4 | 0.885057 | 0 | 0 | 0 | 0 | 0 | 0.137255 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 |
5264c41da06346def2f4a07ec9d65fa17f7b5868 | 1,011 | py | Python | apps/users/migrations/0004_auto_20210311_0321.py | felipebarraza6/amamaule | 1da7cd542a7e610bc8fa230684770732a41520c9 | [
"MIT"
] | null | null | null | apps/users/migrations/0004_auto_20210311_0321.py | felipebarraza6/amamaule | 1da7cd542a7e610bc8fa230684770732a41520c9 | [
"MIT"
] | null | null | null | apps/users/migrations/0004_auto_20210311_0321.py | felipebarraza6/amamaule | 1da7cd542a7e610bc8fa230684770732a41520c9 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.7 on 2021-03-11 06:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20210311_0320'),
]
operations = [
migrations.AlterField(
model_name='user',
name='type_user2',
field=models.CharField(blank=True, choices=[('AM', 'Artista / Manager'), ('GE', 'General'), ('R', 'Relator'), ('GES', 'Gestión'), ('PRO', 'Proveedor'), ('RE', 'Representante'), ('PRO', 'Profesional asociado'), ('ADM', 'Administrador de sistema')], max_length=3, null=True),
),
migrations.AlterField(
model_name='user',
name='type_user3',
field=models.CharField(blank=True, choices=[('AM', 'Artista / Manager'), ('GE', 'General'), ('R', 'Relator'), ('GES', 'Gestión'), ('PRO', 'Proveedor'), ('RE', 'Representante'), ('PRO', 'Profesional asociado'), ('ADM', 'Administrador de sistema')], max_length=3, null=True),
),
]
| 42.125 | 285 | 0.58457 | 107 | 1,011 | 5.439252 | 0.560748 | 0.068729 | 0.085911 | 0.099656 | 0.728522 | 0.728522 | 0.728522 | 0.587629 | 0.587629 | 0.587629 | 0 | 0.043915 | 0.211672 | 1,011 | 23 | 286 | 43.956522 | 0.686324 | 0.04451 | 0 | 0.470588 | 1 | 0 | 0.313278 | 0.023859 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
52671a5206d6e923c62c4c40ca053ba70b2fff8c | 75 | py | Python | programacion1/practica2/not_gate.py | AgustinParmisano/tecnicatura_analisis_sistemas | e64a1922eaf3685706652a2fb9414671014118fc | [
"PSF-2.0"
] | 2 | 2019-11-05T22:10:02.000Z | 2019-12-26T22:24:16.000Z | programacion1/practica2/not_gate.py | AgustinParmisano/tecnicatura_analisis_sistemas | e64a1922eaf3685706652a2fb9414671014118fc | [
"PSF-2.0"
] | null | null | null | programacion1/practica2/not_gate.py | AgustinParmisano/tecnicatura_analisis_sistemas | e64a1922eaf3685706652a2fb9414671014118fc | [
"PSF-2.0"
] | null | null | null | #!/usr/bin/python
x = int(raw_input("Ingrese el input1: "))
print(not x)
| 12.5 | 41 | 0.653333 | 13 | 75 | 3.692308 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015625 | 0.146667 | 75 | 5 | 42 | 15 | 0.734375 | 0.213333 | 0 | 0 | 0 | 0 | 0.327586 | 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 |
52946420082e2220bc6f01f572de927fa0c0d905 | 174 | py | Python | LED-control/software/scripts/testHueSlider.py | jeremywrnr/life-of-the-party | b29310a1fcc31d5c0e8b93c18ab0fc91bb316613 | [
"MIT"
] | 1 | 2015-06-29T22:28:58.000Z | 2015-06-29T22:28:58.000Z | LED-control/software/scripts/testHueSlider.py | jeremywrnr/life-of-the-party | b29310a1fcc31d5c0e8b93c18ab0fc91bb316613 | [
"MIT"
] | null | null | null | LED-control/software/scripts/testHueSlider.py | jeremywrnr/life-of-the-party | b29310a1fcc31d5c0e8b93c18ab0fc91bb316613 | [
"MIT"
] | null | null | null | import liblo
from time import sleep
from address import address
for i in range(100):
print i/100.0
liblo.send(address,'/1/fader6',('f', i/100.0))
sleep(.05)
| 17.4 | 49 | 0.655172 | 30 | 174 | 3.8 | 0.6 | 0.070175 | 0.087719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108696 | 0.206897 | 174 | 9 | 50 | 19.333333 | 0.717391 | 0 | 0 | 0 | 0 | 0 | 0.060976 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.428571 | null | null | 0.142857 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
bfe1b4eb9c63b37b6023c3efa13eeb4bc01e6672 | 163 | py | Python | src/uproot_browser/__init__.py | amangoel185/uproot-browser | 8181913ac04d0318b05256923d8980d6d3acaa7f | [
"BSD-3-Clause"
] | 12 | 2022-03-18T11:47:26.000Z | 2022-03-25T13:57:08.000Z | src/uproot_browser/__init__.py | amangoel185/uproot-browser | 8181913ac04d0318b05256923d8980d6d3acaa7f | [
"BSD-3-Clause"
] | 7 | 2022-03-18T11:40:36.000Z | 2022-03-29T22:15:01.000Z | src/uproot_browser/__init__.py | amangoel185/uproot-browser | 8181913ac04d0318b05256923d8980d6d3acaa7f | [
"BSD-3-Clause"
] | 1 | 2022-03-21T14:37:07.000Z | 2022-03-21T14:37:07.000Z | """
This is uproot-browser. There is no user accessible API; only a terminal
interface is provided currently.
"""
from __future__ import annotations
__all__ = ()
| 20.375 | 72 | 0.760736 | 22 | 163 | 5.272727 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159509 | 163 | 7 | 73 | 23.285714 | 0.846715 | 0.644172 | 0 | 0 | 0 | 0 | 0 | 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 |
bfe33dfd144da83849586717b82b65d051ab3717 | 148 | py | Python | models/Node.py | ChrisJBlake/transactions-graph-generator | de45a93a00b48eb7aa802276c94c06ca088d1304 | [
"MIT"
] | 17 | 2017-11-16T16:16:40.000Z | 2021-12-06T21:58:33.000Z | models/Node.py | ChrisJBlake/transactions-graph-generator | de45a93a00b48eb7aa802276c94c06ca088d1304 | [
"MIT"
] | 5 | 2019-12-06T00:10:58.000Z | 2022-03-17T01:15:14.000Z | models/Node.py | ChrisJBlake/transactions-graph-generator | de45a93a00b48eb7aa802276c94c06ca088d1304 | [
"MIT"
] | 10 | 2019-04-12T07:50:15.000Z | 2022-01-21T09:12:14.000Z | import uuid
class Node:
def toRow(self, headers):
row = []
for field in headers: row.append(str(getattr(self, field)))
return '|'.join(row)
| 18.5 | 61 | 0.668919 | 22 | 148 | 4.5 | 0.772727 | 0.20202 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175676 | 148 | 7 | 62 | 21.142857 | 0.811475 | 0 | 0 | 0 | 0 | 0 | 0.006757 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.666667 | 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 |
bfeaef0d34c7fcf9198855fb031c8c27fde192e0 | 435 | py | Python | src/ramstk/views/gtk3/failure_definition/__init__.py | weibullguy/ramstk | 3ec41d7e2933045a7a8028aed6c6b04365495095 | [
"BSD-3-Clause"
] | 4 | 2018-08-26T09:11:36.000Z | 2019-05-24T12:01:02.000Z | src/ramstk/views/gtk3/failure_definition/__init__.py | weibullguy/ramstk | 3ec41d7e2933045a7a8028aed6c6b04365495095 | [
"BSD-3-Clause"
] | 52 | 2018-08-24T12:51:22.000Z | 2020-12-28T04:59:42.000Z | src/ramstk/views/gtk3/failure_definition/__init__.py | weibullguy/ramstk | 3ec41d7e2933045a7a8028aed6c6b04365495095 | [
"BSD-3-Clause"
] | 1 | 2018-10-11T07:57:55.000Z | 2018-10-11T07:57:55.000Z | # pylint: disable=unused-import, wrong-import-position
# -*- coding: utf-8 -*-
#
# ramstk.views.gtk3.failure_definition.__init__.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""GTK3 Failure Definition Package."""
# RAMSTK Local Imports
from .panel import FailureDefinitionTreePanel
from .view import FailureDefinitionWorkView
| 33.461538 | 88 | 0.765517 | 53 | 435 | 6.188679 | 0.792453 | 0.067073 | 0.128049 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018568 | 0.133333 | 435 | 12 | 89 | 36.25 | 0.851459 | 0.74023 | 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 |
870a7348bcff5f23a8442ef4bff862e22d56189b | 23 | py | Python | core/__init__.py | DouglasHSS/operating_system | ed9c3f6af8659fe261c8a5c57831f9edd10be5de | [
"MIT"
] | 4 | 2015-09-19T11:02:56.000Z | 2019-03-27T11:42:12.000Z | core/__init__.py | DouglasHSS/operating_system | ed9c3f6af8659fe261c8a5c57831f9edd10be5de | [
"MIT"
] | null | null | null | core/__init__.py | DouglasHSS/operating_system | ed9c3f6af8659fe261c8a5c57831f9edd10be5de | [
"MIT"
] | 1 | 2020-08-24T04:27:57.000Z | 2020-08-24T04:27:57.000Z | __author__ = 'douglas'
| 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 |
871c7cb405bd1a2f039d9df1dbe89f8ef3845015 | 332 | py | Python | stat-optic-soccer/models/player.py | ClumsyApp/stat-optic | fc9b313ab78f940a459f712616c8d86b9287983f | [
"Apache-2.0"
] | null | null | null | stat-optic-soccer/models/player.py | ClumsyApp/stat-optic | fc9b313ab78f940a459f712616c8d86b9287983f | [
"Apache-2.0"
] | 6 | 2020-06-06T01:41:39.000Z | 2022-02-10T11:26:13.000Z | stat-optic-soccer/models/player.py | ClumsyApp/stat-optic | fc9b313ab78f940a459f712616c8d86b9287983f | [
"Apache-2.0"
] | null | null | null | from django.db import models
class Player(models.Model):
first_name = models.CharField(db_index=True, max_length=512, unique=False, blank=False, null=True)
last_name = models.CharField(db_index=True, max_length=512, unique=False, blank=True, null=True)
number = models.PositiveIntegerField(db_index=True)
#team =
| 36.888889 | 102 | 0.753012 | 48 | 332 | 5.0625 | 0.5 | 0.08642 | 0.135802 | 0.17284 | 0.477366 | 0.477366 | 0.477366 | 0.477366 | 0.477366 | 0.477366 | 0 | 0.020833 | 0.13253 | 332 | 8 | 103 | 41.5 | 0.822917 | 0.018072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
873eb6de4b696f1240de38efcf7c40168581d257 | 1,780 | py | Python | menpo/shape/base.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 311 | 2015-01-01T17:16:18.000Z | 2021-12-20T11:25:23.000Z | menpo/shape/base.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 298 | 2015-01-02T17:30:22.000Z | 2022-01-02T22:12:17.000Z | menpo/shape/base.py | apapaion/menpo | 9834f0437ca3cbe6a972c2a62f7c970ae950cf32 | [
"BSD-3-Clause"
] | 80 | 2015-02-02T14:17:36.000Z | 2021-12-22T10:09:28.000Z | from menpo.base import Vectorizable
from menpo.landmark import Landmarkable
from menpo.transform.base import Transformable
from menpo.visualize import LandmarkableViewable, Viewable
class Shape(Vectorizable, Transformable, Landmarkable, LandmarkableViewable, Viewable):
"""
Abstract representation of shape. Shapes are :map:`Transformable`,
:map:`Vectorizable`, :map:`Landmarkable`, :map:`LandmarkableViewable` and
:map:`Viewable`. This base class handles transforming landmarks when the
shape is transformed. Therefore, implementations of :map:`Shape` have to
implement the abstract :meth:`_transform_self_inplace` method that handles
transforming the :map:`Shape` itself.
"""
def _transform_inplace(self, transform):
"""
Transform the landmarks and the shape itself.
Parameters
----------
transform : `function`
A function to transform the spatial data with.
Returns
-------
self : `type(self)`
A pointer to `self` (the result of :meth:`_transform_self_inplace`).
"""
if self.has_landmarks:
self.landmarks._transform_inplace(transform)
return self._transform_self_inplace(transform)
def _transform_self_inplace(self, transform):
"""
Implement this method to transform the concrete implementation of a
shape. This is then called by the Shape's :meth:`_transform_inplace`
method, which will have updated the landmarks beforehand.
Parameters
----------
transform : `function`
A function to transform the spatial data with.
Returns
-------
self : `type(self)`
A pointer to `self`.
"""
pass
| 34.230769 | 87 | 0.653933 | 188 | 1,780 | 6.090426 | 0.345745 | 0.031441 | 0.069869 | 0.041921 | 0.171179 | 0.171179 | 0.171179 | 0.171179 | 0.171179 | 0.171179 | 0 | 0 | 0.255618 | 1,780 | 51 | 88 | 34.901961 | 0.864151 | 0.565169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.090909 | 0.363636 | 0 | 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 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
875ca2bfbce9a053a3fbe6b54d52599669d8f3f9 | 730 | py | Python | py3/94.py | Triple-Z/LeetCode | e470de54086cdedd4738fe62fe735d89089227dd | [
"MIT"
] | 1 | 2021-05-28T16:46:14.000Z | 2021-05-28T16:46:14.000Z | py3/94.py | Triple-Z/LeetCode | e470de54086cdedd4738fe62fe735d89089227dd | [
"MIT"
] | 12 | 2020-09-17T16:25:24.000Z | 2021-11-16T15:08:44.000Z | py3/94.py | Triple-Z/LeetCode | e470de54086cdedd4738fe62fe735d89089227dd | [
"MIT"
] | 1 | 2021-12-19T07:33:22.000Z | 2021-12-19T07:33:22.000Z | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def __init__(self):
self.rst = list()
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
# Recursive method
self.inorder_traverse(root)
return self.rst
# TODO: Iteration method
def inorder_traverse(self, root):
if root:
self.inorder_traverse(root.left)
if root.val is not None:
self.rst.append(root.val)
self.inorder_traverse(root.right)
| 22.121212 | 45 | 0.524658 | 79 | 730 | 4.696203 | 0.443038 | 0.161725 | 0.153639 | 0.185984 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.380822 | 730 | 32 | 46 | 22.8125 | 0.820796 | 0.313699 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.416667 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5e3fb90a7437692a054d7f609f5873a1ef1bd3c6 | 6,319 | py | Python | src/abaqus/Model/KeywordBlock.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | 7 | 2022-01-21T09:15:45.000Z | 2022-02-15T09:31:58.000Z | src/abaqus/Model/KeywordBlock.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | src/abaqus/Model/KeywordBlock.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | from abaqusConstants import *
class KeywordBlock:
"""The KeywordBlock object contains a representation of its model in the Abaqus input file
format. You may edit the contents of the KeywordBlock to add solver functionality that
is not supported by Abaqus/CAE. As a general rule, edits to the KeywordBlock object
should be made as the last step prior to writing the actual Abaqus input file, thus
avoiding possible conflicts with changes made using other MDB commands. The KeywordBlock
object has no constructor. A KeywordBlock object is created when you create a model
object. A model object contains only one KeywordBlock object.
Attributes
----------
edited: Boolean
A Boolean specifying whether the Keywords Editor has been used to change the model.
lastSynchCount: float
A Float specifying the value of the counter associated with the :py:class:`~abaqus.abaqus.Mdb` object at the most
recent synchronization.
sieBlocks: tuple
A tuple of Strings specifying a sequence of Strings that is identical to the information
written to the Abaqus input file. Each String in the sequence represents an Abaqus input
file keyword along with the parameters and data lines associated with the keyword. A
String can also be a comment in the input file. You initialize this data member by
calling synchVersions. After you initialize the data member, you use calls to replace
and insert to record your edits in the correct location. If the last call to
synchVersions used the argument **storeNodesAndElements=False**, the entry for the
keywords NODE and ELEMENT will contain only the keyword and its parameters, not the data
lines.
Notes
-----
This object can be accessed by:
mdb.models[name].keywordBlock
"""
# A Boolean specifying whether the Keywords Editor has been used to change the model.
edited: Boolean = OFF
# A Float specifying the value of the counter associated with the Mdb object at the most
# recent synchronization.
lastSynchCount: float = None
# A tuple of Strings specifying a sequence of Strings that is identical to the information
# written to the Abaqus input file. Each String in the sequence represents an Abaqus input
# file keyword along with the parameters and data lines associated with the keyword. A
# String can also be a comment in the input file. You initialize this data member by
# calling synchVersions. After you initialize the data member, you use calls to replace
# and insert to record your edits in the correct location. If the last call to
# synchVersions used the argument *storeNodesAndElements*=False, the entry for the
# keywords NODE and ELEMENT will contain only the keyword and its parameters, not the data
# lines.
sieBlocks: tuple = ()
def setValues(self, edited: Boolean = OFF):
"""This method modifies the KeywordBlock object.
Parameters
----------
edited
A Boolean specifying whether this objects *sieBlocks* member has been edited. Setting
edited=False will set the *sieBlocks* member to an empty tuple, thereby discarding all
previous edits.
"""
pass
def insert(self, position: int, text: str):
"""This method inserts a String at a specified position in the *sieBlocks* member.
Parameters
----------
position
An Int specifying the position in the *sieBlocks* member after which the new string will
be inserted.
text
A String specifying the text to be inserted. The text represents an Abaqus input file
keyword and its associated data
Raises
------
IndexError.
"""
pass
def replace(self, position: int, text: str):
"""This method replaces a String at a specified position in the *sieBlocks* member.
Parameters
----------
position
An Int specifying the position of the String to be replaced in the *sieBlocks* member.
text
A String specifying the text to be replaced. The text represents an Abaqus input file
keyword and its associated data.
Raises
------
IndexError.
"""
pass
def synchVersions(self, storeNodesAndElements: Boolean):
"""This method synchronizes, or merges, the edits made in this object with those made in
the model using other scripting commands or the user interface. The synchVersions method
updates the *sieBlocks* member. The *sieBlocks* member is empty prior to the first call
to synchVersions. As a side effect, synchVersions sets *lastSynchCount* to the current
value of the counter associated with the Mdb object, which is used to determine if
synchronization is necessary.
Parameters
----------
storeNodesAndElements
A Boolean specifying whether the nodal coordinates and element connectivities (i.e. the
data lines for the *NODE and *ELEMENT keyword blocks) are to be stored in the
*sieBlocks* member. All other keywords and their data lines are always stored. The
default value is True. If *storeNodesAndElements* is True, the size of the keywordBlock
data will be similar to that of the input file. Since the KeywordBlock is stored in the
Abaqus/CAE database, this will result in a larger database. It will also result in a
slower execution of the synchVersions command. If *storeNodesAndElements* is False, the
data lines are not stored in *sieBlocks*. Consequently, only set
*storeNodesAndElements*=True if you wish to make changes to the *NODE or *ELEMENT data
lines themselves. If your task is limited to reading nodal coordinates and element
connectivities (i.e. not editing this information) then it is generally better to access
this information from other parts of the Mdb.
Raises
------
IndexError.
"""
pass
| 47.871212 | 121 | 0.674949 | 827 | 6,319 | 5.157195 | 0.25393 | 0.016413 | 0.028136 | 0.023447 | 0.491676 | 0.480422 | 0.480422 | 0.429543 | 0.414537 | 0.402345 | 0 | 0 | 0.280266 | 6,319 | 131 | 122 | 48.236641 | 0.937775 | 0.822282 | 0 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.307692 | 0.076923 | 0 | 0.692308 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5e467094f07059c303539b8f382719882e324103 | 276 | py | Python | app.py | xschildw/markdown-it-synapse-lambda | b612aaa1ee08e9fd18b2b5f3be7ef52dcbd623db | [
"MIT"
] | null | null | null | app.py | xschildw/markdown-it-synapse-lambda | b612aaa1ee08e9fd18b2b5f3be7ef52dcbd623db | [
"MIT"
] | 1 | 2021-05-10T08:16:43.000Z | 2021-05-10T08:16:43.000Z | app.py | xschildw/markdown-it-synapse-lambda | b612aaa1ee08e9fd18b2b5f3be7ef52dcbd623db | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from aws_cdk import core
from markdown_it_synapse_lambda.markdown_it_synapse_lambda_stack import MarkdownItSynapseLambdaStack
app = core.App()
MarkdownItSynapseLambdaStack(app, "markdown-it-synapse-lambda", env={'region': 'us-east-1'})
app.synth()
| 23 | 100 | 0.800725 | 37 | 276 | 5.756757 | 0.567568 | 0.140845 | 0.239437 | 0.323944 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007905 | 0.083333 | 276 | 11 | 101 | 25.090909 | 0.833992 | 0.076087 | 0 | 0 | 0 | 0 | 0.161417 | 0.102362 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 |
5e5bd04a5365d6c03c83934c853f06b3f35bb8ef | 300 | py | Python | lab/show_ast.py | nedbat/covcode | 59ce1f44c00b991c64efe8ecb0cf70c13dec5521 | [
"Apache-2.0"
] | null | null | null | lab/show_ast.py | nedbat/covcode | 59ce1f44c00b991c64efe8ecb0cf70c13dec5521 | [
"Apache-2.0"
] | null | null | null | lab/show_ast.py | nedbat/covcode | 59ce1f44c00b991c64efe8ecb0cf70c13dec5521 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Dump the AST of a file."""
import ast
import sys
from coverage.parser import ast_dump
ast_dump(ast.parse(open(sys.argv[1], "rb").read()))
| 25 | 79 | 0.74 | 50 | 300 | 4.4 | 0.76 | 0.081818 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011152 | 0.103333 | 300 | 11 | 80 | 27.272727 | 0.806691 | 0.583333 | 0 | 0 | 0 | 0 | 0.016949 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
5e65dceeaddd0ff6807fab8f8f3dddd1de5cda0e | 8,094 | py | Python | tests/test_parsers.py | mjip/asciimatics | 476159c95c5b6e34a782ea97503785ad95683805 | [
"Apache-2.0"
] | null | null | null | tests/test_parsers.py | mjip/asciimatics | 476159c95c5b6e34a782ea97503785ad95683805 | [
"Apache-2.0"
] | 1 | 2020-07-13T08:13:48.000Z | 2020-09-08T04:05:41.000Z | tests/test_parsers.py | mjip/asciimatics | 476159c95c5b6e34a782ea97503785ad95683805 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from asciimatics.parsers import AsciimaticsParser, AnsiTerminalParser, ControlCodeParser
import asciimatics.constants as constants
class TestParsers(unittest.TestCase):
def test_controlcode_parser(self):
"""
Check ControlCodeParser works as expected
"""
parser = ControlCodeParser()
parser.reset("\0\b\ra[", None)
self.assertEquals(parser.normalize(), "\0\b\ra[")
tokens = parser.parse()
self.assertEquals(next(tokens), ("^@", (None, None, None), 0))
self.assertEquals(next(tokens), ("^H", (None, None, None), 1))
self.assertEquals(next(tokens), ("^M", (None, None, None), 2))
self.assertEquals(next(tokens), ("a", (None, None, None), 3))
self.assertEquals(next(tokens), ("[", (None, None, None), 4))
def test_asciimatics_parser(self):
"""
Check AsciimaticsParser works as expected.
"""
parser = AsciimaticsParser()
parser.reset("a${1}b${2,1}c${3,2,4}de${7}", None)
self.assertEquals(parser.normalize(), "a${1}b${2,1}c${3,2,4}de${7}")
tokens = parser.parse()
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
self.assertEquals(next(tokens), ("b", (1, 0, None), 1))
self.assertEquals(next(tokens), ("c", (2, 1, None), 6))
self.assertEquals(next(tokens), ("d", (3, 2, 4), 13))
self.assertEquals(next(tokens), ("e", (3, 2, 4), 22))
self.assertEquals(next(tokens), (None, (7, 0, None), 23))
with self.assertRaises(StopIteration):
next(tokens)
def test_ansi_terminal_parser_colours(self):
"""
Check AnsiTerminalParser basic colours work as expected.
"""
parser = AnsiTerminalParser()
parser.reset("a\x1B[23ab\x1B[0mc\x1B[1md\x1B[2me\x1B[7mf\x1B[27mg\x1B[31;42mh\x1B[m", None)
tokens = parser.parse()
# Normal text
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
# Unknown escape code
self.assertEquals(next(tokens), ("b", (None, None, None), 1))
# Reset
self.assertEquals(next(tokens), ("c", (7, constants.A_NORMAL, 0), 7))
# Bold
self.assertEquals(next(tokens), ("d", (7, constants.A_BOLD, 0), 12))
# Normal
self.assertEquals(next(tokens), ("e", (7, constants.A_NORMAL, 0), 17))
# Inverse
self.assertEquals(next(tokens), ("f", (7, constants.A_REVERSE, 0), 22))
# Unset inverse
self.assertEquals(next(tokens), ("g", (7, constants.A_NORMAL, 0), 27))
# Standard colours, using multiple parameters
self.assertEquals(next(tokens), ("h", (constants.COLOUR_RED, constants.A_NORMAL, constants.COLOUR_GREEN), 33))
# Final escape sequence with no visible text is returned with no text.
self.assertEquals(next(tokens), (None, (constants.COLOUR_WHITE, constants.A_NORMAL, constants.COLOUR_BLACK), 42))
with self.assertRaises(StopIteration):
next(tokens)
def test_ansi_terminal_parser_palette(self):
"""
Check AnsiTerminalParser colour palettes work as expected.
"""
parser = AnsiTerminalParser()
parser.reset("\x1B[38;1ma\x1B[38;5;17mb\x1B[48;2;1;2;3mc\x1B[48;5;54md\x1B[999me", None)
tokens = parser.parse()
# Bad colour scheme - ignore
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
# Standard colour palette
self.assertEquals(next(tokens), ("b", (17, None, None), 8))
# RGB colour scheme - ignore
self.assertEquals(next(tokens), ("c", (17, None, None), 19))
# Standard colour palette
self.assertEquals(next(tokens), ("d", (17, None, 54), 33))
# Unknown parameter
self.assertEquals(next(tokens), ("e", (17, None, 54), 44))
def test_ansi_terminal_parser_cursor(self):
"""
Check AnsiTerminalParser cursor movement work as expected.
"""
parser = AnsiTerminalParser()
parser.reset("aa\x08b\rc\x1B[Cdd\x1B[De\r", None)
tokens = parser.parse()
# Carriage return and overwrite
self.assertEquals(next(tokens), ("c", (None, None, None), 4))
# Backspace and overwrite.
self.assertEquals(next(tokens), ("b", (None, None, None), 2))
# Move cursor forwards and append.
self.assertEquals(next(tokens), ("d", (None, None, None), 6))
# Move cursor backwards and overwrite.
self.assertEquals(next(tokens), ("e", (None, None, None), 11))
# Normalize returns correct linear form - complete with accurate cursor location.
self.assertEqual(parser.normalize(), "cbde\x1B[4D")
def test_ansi_terminal_parser_delete(self):
"""
Check AnsiTerminalParser delete operations work as expected.
"""
parser = AnsiTerminalParser()
# Delete to end of line
parser.reset("abcde\x08\x08\x08\x1B[K", None)
tokens = parser.parse()
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
self.assertEquals(next(tokens), ("b", (None, None, None), 1))
self.assertEquals(next(tokens), (None, (None, None, None), 5))
with self.assertRaises(StopIteration):
next(tokens)
# Delete to start of line
parser.reset("abcde\x08\x08\x08\x1B[1K", None)
tokens = parser.parse()
self.assertEquals(next(tokens), (" ", (None, None, None), 8))
self.assertEquals(next(tokens), (" ", (None, None, None), 8))
self.assertEquals(next(tokens), ("c", (None, None, None), 2))
self.assertEquals(next(tokens), ("d", (None, None, None), 3))
self.assertEquals(next(tokens), ("e", (None, None, None), 4))
self.assertEquals(next(tokens), (None, (None, None, None), 5))
with self.assertRaises(StopIteration):
next(tokens)
# Delete line
parser.reset("abcde\x08\x08\x08\x1B[2K", None)
tokens = parser.parse()
self.assertEquals(next(tokens), (" ", (None, None, None), 8))
self.assertEquals(next(tokens), (" ", (None, None, None), 8))
self.assertEquals(next(tokens), (None, (None, None, None), 5))
with self.assertRaises(StopIteration):
next(tokens)
# Delete char
parser.reset("abcde\x08\x08\x08\x1B[P", None)
tokens = parser.parse()
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
self.assertEquals(next(tokens), ("b", (None, None, None), 1))
self.assertEquals(next(tokens), ("d", (None, None, None), 3))
self.assertEquals(next(tokens), ("e", (None, None, None), 4))
self.assertEquals(next(tokens), (None, (None, None, None), 5))
with self.assertRaises(StopIteration):
next(tokens)
def test_ansi_terminal_parser_normalization(self):
"""
Check AnsiTerminalParser normalization works as expected.
"""
parser = AnsiTerminalParser()
# SGR0 sets black and white normal text.
parser.reset("\x1B[ma", None)
self.assertEquals(parser.normalize(), "\x1B[38;5;7;2;48;5;0ma")
# SGR1 sets bold and SGR7 reverse video.
parser.reset("\x1B[1ma\x1B[7mb", None)
self.assertEquals(parser.normalize(), "\x1B[1ma\x1B[7mb")
def test_ansi_terminal_parser_errors(self):
"""
Check AnsiTerminalParser handles unsupported encodings gracefully.
"""
parser = AnsiTerminalParser()
parser.reset("a\x1BZb\x07c", None)
tokens = parser.parse()
# Ignore unknown escape and next letter
self.assertEquals(next(tokens), ("a", (None, None, None), 0))
self.assertEquals(next(tokens), ("b", (None, None, None), 1))
# Ignore unknown control char
self.assertEquals(next(tokens), ("c", (None, None, None), 4))
| 39.871921 | 121 | 0.60551 | 967 | 8,094 | 5.008273 | 0.188211 | 0.118935 | 0.202354 | 0.26306 | 0.635556 | 0.498451 | 0.468924 | 0.3981 | 0.334503 | 0.279166 | 0 | 0.035859 | 0.238572 | 8,094 | 202 | 122 | 40.069307 | 0.749959 | 0.147393 | 0 | 0.464286 | 0 | 0.035714 | 0.068172 | 0.049634 | 0 | 0 | 0 | 0 | 0.535714 | 1 | 0.071429 | false | 0 | 0.0625 | 0 | 0.142857 | 0.008929 | 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 |
5e6d2988a45967e10d170bda1c70af3d0a3ba0ab | 218 | py | Python | akdigitalpy/Decimal_Hexadecimal.py | AbhijeetJK/akdigitalpy | 94b0739cff1b37c838b13857b8d08a5a7c5243f9 | [
"MIT"
] | null | null | null | akdigitalpy/Decimal_Hexadecimal.py | AbhijeetJK/akdigitalpy | 94b0739cff1b37c838b13857b8d08a5a7c5243f9 | [
"MIT"
] | null | null | null | akdigitalpy/Decimal_Hexadecimal.py | AbhijeetJK/akdigitalpy | 94b0739cff1b37c838b13857b8d08a5a7c5243f9 | [
"MIT"
] | null | null | null | def DectoHex(n):
if isinstance(n,int) == True:
hexnum = hex(n)[2:]
return hexnum.upper()
else:
intnum = int(n)
hexnum = hex(intnum)[2:]
return hexnum.upper()
| 19.818182 | 34 | 0.490826 | 26 | 218 | 4.115385 | 0.538462 | 0.168224 | 0.242991 | 0.336449 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.366972 | 218 | 10 | 35 | 21.8 | 0.76087 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.375 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 3 |
5e834ed38a22d08540688192a0b9a109f66c6e71 | 995 | py | Python | stac_fastapi/extensions/stac_fastapi/extensions/core/pagination/pagination.py | borism/stac-fastapi | 81015a153c1d9f36d8e12f17a1bf67370396f472 | [
"MIT"
] | 64 | 2021-03-27T19:34:29.000Z | 2022-03-31T07:58:58.000Z | stac_fastapi/extensions/stac_fastapi/extensions/core/pagination/pagination.py | borism/stac-fastapi | 81015a153c1d9f36d8e12f17a1bf67370396f472 | [
"MIT"
] | 218 | 2021-03-27T19:51:54.000Z | 2022-03-28T12:41:56.000Z | stac_fastapi/extensions/stac_fastapi/extensions/core/pagination/pagination.py | borism/stac-fastapi | 81015a153c1d9f36d8e12f17a1bf67370396f472 | [
"MIT"
] | 44 | 2021-04-05T12:06:25.000Z | 2022-03-01T12:06:29.000Z | """Pagination API extension."""
from typing import List, Optional
import attr
from fastapi import FastAPI
from stac_fastapi.api.models import GETPagination, POSTPagination
from stac_fastapi.types.extension import ApiExtension
@attr.s
class PaginationExtension(ApiExtension):
"""Token Pagination.
Though not strictly an extension, the chosen pagination will modify the
form of the request object. By making pagination an extension class, we can
use create_request_model to dynamically add the correct pagination parameter
to the request model for OpenAPI generation.
"""
GET = GETPagination
POST = POSTPagination
conformance_classes: List[str] = attr.ib(factory=list)
schema_href: Optional[str] = attr.ib(default=None)
def register(self, app: FastAPI) -> None:
"""Register the extension with a FastAPI application.
Args:
app: target FastAPI application.
Returns:
None
"""
pass
| 26.184211 | 80 | 0.709548 | 119 | 995 | 5.882353 | 0.579832 | 0.022857 | 0.042857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225126 | 995 | 37 | 81 | 26.891892 | 0.907912 | 0.430151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.076923 | 0.384615 | 0 | 0.846154 | 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 |
5e9bd4b2c2a6b628a1e7cf15d45a9d4874ecad7a | 192 | py | Python | carberretta/utils/__init__.py | TKelsier/Carberretta | 8395bd5d3e45933f73ab1b1717fc80eab3a38ccb | [
"BSD-3-Clause"
] | null | null | null | carberretta/utils/__init__.py | TKelsier/Carberretta | 8395bd5d3e45933f73ab1b1717fc80eab3a38ccb | [
"BSD-3-Clause"
] | null | null | null | carberretta/utils/__init__.py | TKelsier/Carberretta | 8395bd5d3e45933f73ab1b1717fc80eab3a38ccb | [
"BSD-3-Clause"
] | null | null | null | from pathlib import Path
ROOT_DIR = Path(__file__).parent.parent.parent
DEFAULT_EMBED_COLOUR = 0x00CD99
# Dependant on above constants.
from .loc import CodeCounter
from .ready import Ready
| 21.333333 | 46 | 0.8125 | 27 | 192 | 5.518519 | 0.703704 | 0.161074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02994 | 0.130208 | 192 | 8 | 47 | 24 | 0.862275 | 0.151042 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049689 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
5e9d965ec0e648c42b7858dcd55dc6a562d14c96 | 140 | py | Python | DOM/game/item.py | AlexDev-py/CubIC | 7932d2789c0b45ebc9ce631d21f6bed99d3a3a51 | [
"MIT"
] | 2 | 2022-02-05T13:06:28.000Z | 2022-02-09T07:07:11.000Z | DOM/game/item.py | AlexDev-py/CubIC | 7932d2789c0b45ebc9ce631d21f6bed99d3a3a51 | [
"MIT"
] | null | null | null | DOM/game/item.py | AlexDev-py/CubIC | 7932d2789c0b45ebc9ce631d21f6bed99d3a3a51 | [
"MIT"
] | 2 | 2022-01-24T13:42:45.000Z | 2022-02-08T09:18:58.000Z | from dataclasses import dataclass
@dataclass
class Item:
name: str
lvl: int
price: int
icon: str
desc: dict[str, str]
| 12.727273 | 33 | 0.642857 | 19 | 140 | 4.736842 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 140 | 10 | 34 | 14 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.875 | 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 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5ea8dc1e4eca8bb9e1d99cb7c34072e4fa42f3ae | 24 | py | Python | vmthunder/tests/__init__.py | yongquanf/VMThunder | fbaa391611b074827b5b7e55b27a58c0b7942325 | [
"Apache-2.0"
] | 3 | 2019-12-29T09:20:10.000Z | 2020-01-01T13:12:30.000Z | vmthunder/tests/__init__.py | yongquanf/VMThunder | fbaa391611b074827b5b7e55b27a58c0b7942325 | [
"Apache-2.0"
] | null | null | null | vmthunder/tests/__init__.py | yongquanf/VMThunder | fbaa391611b074827b5b7e55b27a58c0b7942325 | [
"Apache-2.0"
] | null | null | null | __author__ = 'anzigly'
| 12 | 23 | 0.708333 | 2 | 24 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 24 | 1 | 24 | 24 | 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 |
5eabeffdbc8e7ea30cd08964dce296490662a6f6 | 544 | py | Python | nCr_DP.py | ishtiaque06/problems_python | 49f998244b6a087117ae470d9a8ffe7eb935837c | [
"MIT"
] | null | null | null | nCr_DP.py | ishtiaque06/problems_python | 49f998244b6a087117ae470d9a8ffe7eb935837c | [
"MIT"
] | null | null | null | nCr_DP.py | ishtiaque06/problems_python | 49f998244b6a087117ae470d9a8ffe7eb935837c | [
"MIT"
] | null | null | null | """
>>> nCr(4, 2)
6
"""
def nCr(n, k):
# C = [[0] * (k+1) for i in range(n+1)]
# for i in range(n+1):
# C[i][0] = 1
# for i in range(1, k+1):
# C[0][i] = 0
# for i in range(1, n+1):
# for j in range(1, k+1):
# C[i][j] = C[i-1][j-1] + C[i-1][j]
# return C
C = [0] * (k+1)
C[0] = 1
for i in range(n):
print(i)
C_backup = C[:]
for j in range(1, k+1):
C[j] += C_backup[j-1]
return C[k]
print(nCr(4, 2))
print(nCr(5, 4))
print(nCr(6, 3)) | 18.758621 | 47 | 0.387868 | 112 | 544 | 1.866071 | 0.178571 | 0.23445 | 0.143541 | 0.263158 | 0.478469 | 0.421053 | 0.272727 | 0.143541 | 0 | 0 | 0 | 0.096491 | 0.371324 | 544 | 29 | 48 | 18.758621 | 0.51462 | 0.430147 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.166667 | 0.333333 | 0 | 0 | 1 | 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 | 0 | 0 | 3 |
5ead385f3dc00df07e1e9f5d6d25110430021c54 | 282 | py | Python | src/python/tools/preprocess/converters/readers/reader.py | ryansun117/marius | c6a81b2ea6b6b468baf5277cf6955f9543b66c82 | [
"Apache-2.0"
] | null | null | null | src/python/tools/preprocess/converters/readers/reader.py | ryansun117/marius | c6a81b2ea6b6b468baf5277cf6955f9543b66c82 | [
"Apache-2.0"
] | null | null | null | src/python/tools/preprocess/converters/readers/reader.py | ryansun117/marius | c6a81b2ea6b6b468baf5277cf6955f9543b66c82 | [
"Apache-2.0"
] | null | null | null | from abc import ABC, abstractmethod
class Reader(ABC):
def __init__(self):
pass
@abstractmethod
def read(self):
"""
This function reads a set of input data and converts it to either torch tensors or pyspark dataframes
"""
pass
| 20.142857 | 109 | 0.624113 | 35 | 282 | 4.914286 | 0.828571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.315603 | 282 | 13 | 110 | 21.692308 | 0.891192 | 0.358156 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0.142857 | 0 | 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 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
5ead6901e61510c853701dfde475551db815da14 | 1,415 | py | Python | src/LiteCore/parse/config_fleece.py | lore-coolshop/couchbase-lite-net | e2f5fcf964078bac6831fd229df6f96002e01226 | [
"Apache-2.0"
] | null | null | null | src/LiteCore/parse/config_fleece.py | lore-coolshop/couchbase-lite-net | e2f5fcf964078bac6831fd229df6f96002e01226 | [
"Apache-2.0"
] | null | null | null | src/LiteCore/parse/config_fleece.py | lore-coolshop/couchbase-lite-net | e2f5fcf964078bac6831fd229df6f96002e01226 | [
"Apache-2.0"
] | null | null | null | skip_files = ["Fleece+CoreFoundation.h"]
excluded = ["FLStr","operatorslice","operatorFLSlice","FLMutableArray_Retain","FLMutableArray_Release","FLMutableDict_Retain","FLMutableDict_Release","FLEncoder_NewWritingToFile","FLSliceResult_Free"]
default_param_name = {"FLValue":"value","FLSliceResult":"slice","FLSlice":"slice","FLArray":"array","FLArrayIterator*":"i","FLDictIterator*":"i","FLDict":"dict","FLDictKey":"key","FLKeyPath":"keyPath","FLDictKey*":"dictKey","FLSharedKeys":"shared","FLEncoder":"encoder","long":"l","ulong":"u","bool":"b","float":"f","double":"d","FLError*":"outError","int64_t":"l","uint64_t":"u","FLString":"str","FLStringResult":"str"}
param_bridge_types = ["FLSlice", "FLString", "size_t", "size_t*"]
force_no_bridge = ["FLSlice_Compare", "FLSlice_Equal","FLSliceResult_Retain","FLSliceResult_Release","FLSlice_Copy","FLDoc_FromResultData"]
return_bridge_types = ["FLSliceResult", "FLSlice", "size_t", "FLString", "FLStringResult"]
type_map = {"int32_t":"int","uint32_t":"uint","int64_t":"long","uint64_t":"ulong","size_t":"UIntPtr","size_t*":"UIntPtr*","unsigned":"uint","FLValue":"FLValue*","FLDict":"FLDict*","FLArray":"FLArray*","FLEncoder":"FLEncoder*","FLSharedKeys":"FLSharedKeys*","FLKeyPath":"FLKeyPath*","FLDoc":"FLDoc*","FLDeepIterator":"FLDeepIterator*"}
literals = {"FLSlice_Compare":".nobridge .int FLSlice_Compare FLSlice:left FLSlice:right"}
reserved = ["string","base"]
| 141.5 | 420 | 0.726502 | 155 | 1,415 | 6.406452 | 0.541935 | 0.025176 | 0.042296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008721 | 0.027562 | 1,415 | 9 | 421 | 157.222222 | 0.712936 | 0 | 0 | 0 | 0 | 0 | 0.665018 | 0.0947 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5eb472a4f4185a2c8b31523460cdd8f0c4b447e8 | 1,040 | py | Python | tools/esp_app_trace/pylibelf/util/__init__.py | ghsecuritylab/esp_alexa_idf | e132e8b960af6d576ce2fca4f6b2994be2f42e56 | [
"Apache-2.0"
] | 104 | 2017-05-04T09:55:08.000Z | 2022-03-22T11:29:05.000Z | tools/esp_app_trace/pylibelf/util/__init__.py | Wangrenai/esp-idf | abea9e4c02bb17e86298aec4e299780399e4789f | [
"Apache-2.0"
] | 59 | 2019-12-04T00:06:45.000Z | 2022-03-30T20:04:03.000Z | tools/esp_app_trace/pylibelf/util/__init__.py | Wangrenai/esp-idf | abea9e4c02bb17e86298aec4e299780399e4789f | [
"Apache-2.0"
] | 59 | 2016-11-15T06:07:56.000Z | 2022-02-05T17:03:32.000Z | from .. import *
from ..types import *
from ..constants import *
from ctypes import *
import os
def _class(elf): return ord(elf_getident(elf, None).contents[EI_CLASS])
def is32(elf): return _class(elf) == ELFCLASS32
def is64(elf): return _class(elf) == ELFCLASS64
def select(elf, fname):
if is32(elf):
return globals()['elf32_' + fname]
else:
return globals()['elf64_' + fname]
def section_name(elfP, secP):
shstrndx = c_size_t()
r = elf_getshstrndx(elfP, byref(shstrndx))
shdr = select(elfP, 'getshdr')(secP)
return elf_strptr(elfP, shstrndx, shdr.contents.sh_name)
def section_type(elfP, secP):
return select(elfP, 'getshdr')(secP).contents.sh_type
def section_link(elfP, secP):
return select(elfP, 'getshdr')(secP).contents.sh_link
def section_hdr(elfP, secP):
return select(elfP, 'getshdr')(secP).contents
def open_elf(fname):
fd = os.open(fname, os.O_RDONLY)
return elf_begin(fd, ELF_C_READ, None)
def sym_name(elf, scn, sym):
return elf_strptr(elf, section_link(elf, scn), sym.st_name)
| 26.666667 | 72 | 0.711538 | 157 | 1,040 | 4.541401 | 0.33758 | 0.050491 | 0.095372 | 0.117812 | 0.186536 | 0.186536 | 0.186536 | 0.186536 | 0.126227 | 0 | 0 | 0.015766 | 0.146154 | 1,040 | 38 | 73 | 27.368421 | 0.787162 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.344828 | false | 0 | 0.172414 | 0.241379 | 0.793103 | 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 |
5eb83d8ead6996a41476f1f369d0ab1b0c42d236 | 1,066 | py | Python | webdjango/serializers/CoreSerializer.py | myog-io/WebDjangular | 73d3c40aa449eec5acc59d4493ee94059bddabbd | [
"MIT"
] | 1 | 2018-09-14T15:17:19.000Z | 2018-09-14T15:17:19.000Z | webdjango/serializers/CoreSerializer.py | MyOwnGamesLLC/WebDjangular | 73d3c40aa449eec5acc59d4493ee94059bddabbd | [
"MIT"
] | 41 | 2018-12-16T16:58:54.000Z | 2019-02-22T20:08:58.000Z | webdjango/serializers/CoreSerializer.py | MyOwnGamesLLC/WebDjangular | 73d3c40aa449eec5acc59d4493ee94059bddabbd | [
"MIT"
] | 1 | 2018-10-02T16:45:46.000Z | 2018-10-02T16:45:46.000Z | from rest_framework.serializers import ValidationError
from webdjango.serializers.WebDjangoSerializer import WebDjangoSerializer
from webdjango.models.Core import Author, Theme, Plugin, CoreConfig, Website
class WebsiteSerializer(WebDjangoSerializer):
"""
The serializer for Websites
"""
class Meta:
model = Website
fields = '__all__'
class CoreConfigSerializer(WebDjangoSerializer):
"""
The serializer for CoreConfigs
"""
class Meta:
model = CoreConfig
fields = '__all__'
class AuthorSerializer(WebDjangoSerializer):
"""
The serializer for Authors
"""
class Meta:
model = Author
fields = '__all__'
class PluginSerializer(WebDjangoSerializer):
"""
The serializer for Plugins
"""
class Meta:
model = Plugin
fields = '__all__'
class ThemeSerializer(WebDjangoSerializer):
"""
The serializer for Themes
"""
class Meta:
model = Theme
fields = '__all__'
| 21.755102 | 77 | 0.631332 | 87 | 1,066 | 7.494253 | 0.37931 | 0.168712 | 0.245399 | 0.268405 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.294559 | 1,066 | 48 | 78 | 22.208333 | 0.867021 | 0.129456 | 0 | 0.434783 | 0 | 0 | 0.043532 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.130435 | 0 | 0.565217 | 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 | 0 | 0 | 1 | 0 | 0 | 3 |
5ec5f937b80d2700e6b6a4e5c4fb8b61e592e8fd | 336 | py | Python | src/bindings/python/DocStrings/GroupTransform.py | leekerley/OpenColorIO | b6c7152a20b68b4fa9b54bc3493bba7d812c8724 | [
"BSD-3-Clause"
] | 1 | 2019-11-18T21:49:25.000Z | 2019-11-18T21:49:25.000Z | src/bindings/python/DocStrings/GroupTransform.py | leekerley/OpenColorIO | b6c7152a20b68b4fa9b54bc3493bba7d812c8724 | [
"BSD-3-Clause"
] | 1 | 2020-06-12T19:10:09.000Z | 2020-06-12T19:10:09.000Z | src/bindings/python/DocStrings/GroupTransform.py | leekerley/OpenColorIO | b6c7152a20b68b4fa9b54bc3493bba7d812c8724 | [
"BSD-3-Clause"
] | null | null | null | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
class GroupTransform:
"""
GroupTransform
"""
def __init__(self):
pass
def getTransform(self, index):
pass
def getNumTransforms(self):
pass
def appendTransform(self, transform):
pass
| 21 | 52 | 0.645833 | 33 | 336 | 6.454545 | 0.69697 | 0.098592 | 0.103286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004065 | 0.267857 | 336 | 15 | 53 | 22.4 | 0.861789 | 0.309524 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0.444444 | 0 | 0 | 0.555556 | 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 |
5ec67339fb3c8faad168fa483350d19d28db812a | 563 | py | Python | accounting/clusterlogs/data_preparation.py | PanDAWMS/harvester_monitoring | 85d4ce57eab97ad20f146ad1068325ce7a596667 | [
"Apache-2.0"
] | null | null | null | accounting/clusterlogs/data_preparation.py | PanDAWMS/harvester_monitoring | 85d4ce57eab97ad20f146ad1068325ce7a596667 | [
"Apache-2.0"
] | null | null | null | accounting/clusterlogs/data_preparation.py | PanDAWMS/harvester_monitoring | 85d4ce57eab97ad20f146ad1068325ce7a596667 | [
"Apache-2.0"
] | 1 | 2019-02-20T17:36:48.000Z | 2019-02-20T17:36:48.000Z | import re
class Regex(object):
def __init__(self, messages):
self.messages = messages
self.messages_cleaned = None
def process(self):
"""
:return:
"""
self.messages_cleaned = [0] * len(self.messages)
for idx, item in enumerate(self.messages):
item = re.sub(r'([a-zA-Z_.|:;-]*\d+[a-zA-Z_.|:;-]*)+', ' ', item)
item = re.sub(r'[^\w\s]', ' ', item)
item = re.sub(' +', ' ', item)
self.messages_cleaned[idx] = item
return self.messages_cleaned
| 28.15 | 77 | 0.509769 | 66 | 563 | 4.19697 | 0.424242 | 0.34657 | 0.274368 | 0.180505 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002577 | 0.310835 | 563 | 19 | 78 | 29.631579 | 0.71134 | 0.01421 | 0 | 0 | 0 | 0 | 0.090395 | 0.067797 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.076923 | 0 | 0.384615 | 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 |
0d5b4603ca7e742f87d893130ecb1cafb4491ba2 | 70 | py | Python | src/lib/imaplib.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 10 | 2015-11-13T17:02:40.000Z | 2021-02-09T23:21:05.000Z | src/lib/imaplib.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 43 | 2015-06-03T17:59:23.000Z | 2021-09-17T10:45:21.000Z | src/lib/imaplib.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 13 | 2017-07-02T03:16:46.000Z | 2021-07-05T14:53:56.000Z | raise NotImplementedError("imaplib is not yet implemented in Skulpt")
| 35 | 69 | 0.828571 | 9 | 70 | 6.444444 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 70 | 1 | 70 | 70 | 0.935484 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 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 |
0db07a16a412bf91b2537a0995da162f7e045e8e | 1,034 | py | Python | effect/dispatcher.py | tomprince/effect | 56ec44525f1ff74f9d3f8d9489a93285e2f52cd5 | [
"Unlicense",
"MIT"
] | null | null | null | effect/dispatcher.py | tomprince/effect | 56ec44525f1ff74f9d3f8d9489a93285e2f52cd5 | [
"Unlicense",
"MIT"
] | null | null | null | effect/dispatcher.py | tomprince/effect | 56ec44525f1ff74f9d3f8d9489a93285e2f52cd5 | [
"Unlicense",
"MIT"
] | null | null | null | """
Dispatcher!
"""
from itertools import ifilter
from characteristic import attributes
@attributes(['mapping'], apply_with_init=False)
class TypeDispatcher(object):
"""
An Effect dispatcher which looks up the performer to use by type.
"""
def __init__(self, mapping):
"""
:param collections.Mapping mapping: A mapping of intent type to
performer.
"""
self.mapping = mapping
def __call__(self, intent):
return self.mapping.get(type(intent))
@attributes(['dispatchers'], apply_with_init=False)
class ComposedDispatcher(object):
"""
A dispatcher which composes other dispatchers.
The dispatchers given will be searched in order until a performer is found.
"""
def __init__(self, dispatchers):
"""
:param collections.Iterable dispatchers: Dispatchers to search.
"""
self.dispatchers = dispatchers
def __call__(self, intent):
return next(ifilter(None, (d(intent) for d in self.dispatchers)), None)
| 25.85 | 79 | 0.666344 | 116 | 1,034 | 5.767241 | 0.474138 | 0.049327 | 0.038864 | 0.053812 | 0.137519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234043 | 1,034 | 39 | 80 | 26.512821 | 0.844697 | 0.32882 | 0 | 0.142857 | 0 | 0 | 0.0301 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.142857 | 0.714286 | 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 |
0db0d0df3f15806a16bad78ce99750ccf6557301 | 1,478 | py | Python | polls/models.py | SpereShelde/Eat-or-Not | 40df3ebcd197484d192aeaef788a9a36908b1a65 | [
"MIT"
] | null | null | null | polls/models.py | SpereShelde/Eat-or-Not | 40df3ebcd197484d192aeaef788a9a36908b1a65 | [
"MIT"
] | null | null | null | polls/models.py | SpereShelde/Eat-or-Not | 40df3ebcd197484d192aeaef788a9a36908b1a65 | [
"MIT"
] | null | null | null | import datetime
from django.utils import timezone
from django.db import models
class QuestionTuple(models.Model):
tuple_name = models.CharField(max_length=100)
# questions = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.tuple_name
def was_published_recently(self):
now = timezone.now()
return now - datetime.timedelta(days=1) <= self.pub_date <= now
def get_id(self):
return self.id
class Question(models.Model):
tuple = models.ForeignKey(QuestionTuple, on_delete=models.CASCADE)
question_text = models.CharField(max_length=200)
type = models.CharField(max_length=10)
# 1 for radio; 2 for checkbox
def __str__(self):
return self.question_text
def get_id(self):
return self.id
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
status = models.CharField(max_length=10)
# 1 for show; 2 for hide
def __str__(self):
return self.choice_text
class User(models.Model):
account = models.CharField(max_length=30)
name = models.CharField(max_length=30, default='')
def __str__(self):
return self.account + ": " + self.name
def get_account(self):
return self.account
def get_name(self):
return self.name
| 25.482759 | 71 | 0.689445 | 194 | 1,478 | 5.046392 | 0.298969 | 0.122574 | 0.147089 | 0.196118 | 0.378958 | 0.183861 | 0.120531 | 0.059244 | 0 | 0 | 0 | 0.022298 | 0.211096 | 1,478 | 57 | 72 | 25.929825 | 0.817324 | 0.064276 | 0 | 0.216216 | 0 | 0 | 0.011628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.243243 | false | 0 | 0.081081 | 0.216216 | 0.972973 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
0db47bee7f1df7822a0e6098eee3aaadd5df2f97 | 140 | py | Python | tools/python/descriptions/exceptions.py | kudlav/organicmaps | 390236365749e0525b9229684132c2888d11369d | [
"Apache-2.0"
] | 4,879 | 2015-09-30T10:56:36.000Z | 2022-03-31T18:43:03.000Z | tools/python/descriptions/exceptions.py | mbrukman/omim | d22fe2b6e0beee697f096e931df97a64f9db9dc1 | [
"Apache-2.0"
] | 7,549 | 2015-09-30T10:52:53.000Z | 2022-03-31T22:04:22.000Z | tools/python/descriptions/exceptions.py | mbrukman/omim | d22fe2b6e0beee697f096e931df97a64f9db9dc1 | [
"Apache-2.0"
] | 1,493 | 2015-09-30T10:43:06.000Z | 2022-03-21T09:16:49.000Z | class DescriptionError(Exception):
pass
class ParseError(DescriptionError):
pass
class GettingError(DescriptionError):
pass
| 12.727273 | 37 | 0.757143 | 12 | 140 | 8.833333 | 0.5 | 0.169811 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 140 | 10 | 38 | 14 | 0.921739 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
0dcb1abf8985265fd000adb16d44b7a20935ce9a | 635 | py | Python | pynessus/models/nessusobject.py | maaren/pynessus | 21afdab52c309610c82e8e69e41dc67e7938b17c | [
"Apache-2.0"
] | null | null | null | pynessus/models/nessusobject.py | maaren/pynessus | 21afdab52c309610c82e8e69e41dc67e7938b17c | [
"Apache-2.0"
] | null | null | null | pynessus/models/nessusobject.py | maaren/pynessus | 21afdab52c309610c82e8e69e41dc67e7938b17c | [
"Apache-2.0"
] | null | null | null | class NessusObject(object):
def __init__(self, server):
self._id = None
self._server = server
def save(self):
if self._id is None:
return getattr(self._server, "create_%s" % self.__class__.__name__.lower())(self)
else:
return getattr(self._server, "update_%s" % self.__class__.__name__.lower())(self)
def delete(self):
if self._id is not None:
return getattr(self._server, "delete_%s" % self.__class__.__name__.lower())(self)
@property
def id(self):
return self._id
@id.setter
def id(self, _id):
self._id = _id | 27.608696 | 93 | 0.59685 | 80 | 635 | 4.2125 | 0.3 | 0.106825 | 0.151335 | 0.204748 | 0.448071 | 0.204748 | 0 | 0 | 0 | 0 | 0 | 0 | 0.277165 | 635 | 23 | 94 | 27.608696 | 0.734205 | 0 | 0 | 0 | 0 | 0 | 0.042453 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0 | 0.055556 | 0.555556 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0dd6433c3d94b63cee0ac68e8218e2fd75a48ee2 | 519 | py | Python | tools/tensorpack/tensorpack/tfutils/__init__.py | laceyg/ternarynet | b17744c2aba3aba7e7e72decb3b8a02792d33b54 | [
"Apache-2.0"
] | 2 | 2017-03-16T17:16:37.000Z | 2020-07-17T04:27:45.000Z | tools/tensorpack/tensorpack/tfutils/__init__.py | laceyg/ternarynet | b17744c2aba3aba7e7e72decb3b8a02792d33b54 | [
"Apache-2.0"
] | null | null | null | tools/tensorpack/tensorpack/tfutils/__init__.py | laceyg/ternarynet | b17744c2aba3aba7e7e72decb3b8a02792d33b54 | [
"Apache-2.0"
] | null | null | null | # -*- coding: UTF-8 -*-
# File: __init__.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
from pkgutil import walk_packages
import os
def _global_import(name):
p = __import__(name, globals(), None, level=1)
lst = p.__all__ if '__all__' in dir(p) else dir(p)
if name in ['common', 'argscope']:
del globals()[name]
for k in lst:
globals()[k] = p.__dict__[k]
_global_import('sessinit')
_global_import('common')
_global_import('gradproc')
_global_import('argscope')
_global_import('tower')
| 23.590909 | 54 | 0.666667 | 73 | 519 | 4.287671 | 0.561644 | 0.230032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004706 | 0.181118 | 519 | 21 | 55 | 24.714286 | 0.731765 | 0.152216 | 0 | 0 | 0 | 0 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.642857 | 0 | 0.714286 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0de7602762657ba07b8b675a546bc39dd4871985 | 116 | py | Python | setup.py | libratom/ratom-notebooks | c30f2ebcfb47ed6ee1a287dc5e6cee4b080b56e7 | [
"MIT"
] | 4 | 2019-07-12T04:45:45.000Z | 2021-10-16T02:12:40.000Z | setup.py | libratom/ratom-notebooks | c30f2ebcfb47ed6ee1a287dc5e6cee4b080b56e7 | [
"MIT"
] | 233 | 2019-07-10T17:02:29.000Z | 2022-03-28T21:08:41.000Z | setup.py | libratom/ratom-notebooks | c30f2ebcfb47ed6ee1a287dc5e6cee4b080b56e7 | [
"MIT"
] | null | null | null | from distutils.core import setup
setup(name='notebook-helpers',
version='0.1',
packages=['helpers'],
)
| 16.571429 | 32 | 0.655172 | 14 | 116 | 5.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021053 | 0.181034 | 116 | 6 | 33 | 19.333333 | 0.778947 | 0 | 0 | 0 | 0 | 0 | 0.224138 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 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 |
0de828c40907a5f4dafd26139e9b0685870657be | 558 | py | Python | src/genie/libs/parser/iosxe/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 204 | 2018-06-27T00:55:27.000Z | 2022-03-06T21:12:18.000Z | src/genie/libs/parser/iosxe/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 468 | 2018-06-19T00:33:18.000Z | 2022-03-31T23:23:35.000Z | src/genie/libs/parser/iosxe/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 309 | 2019-01-16T20:21:07.000Z | 2022-03-30T12:56:41.000Z | expected_output = {
"interface": {
"GigabitEthernet1/0/1": {
"out": {
"mcast_pkts": 188396,
"bcast_pkts": 0,
"ucast_pkts": 124435064,
"name": "GigabitEthernet1/0/1",
"octets": 24884341205,
},
"in": {
"mcast_pkts": 214513,
"bcast_pkts": 0,
"ucast_pkts": 15716712,
"name": "GigabitEthernet1/0/1",
"octets": 3161931167,
},
}
}
}
| 26.571429 | 47 | 0.385305 | 38 | 558 | 5.473684 | 0.526316 | 0.245192 | 0.259615 | 0.144231 | 0.451923 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210345 | 0.480287 | 558 | 20 | 48 | 27.9 | 0.506897 | 0 | 0 | 0.2 | 0 | 0 | 0.275986 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
0dea7a825247a326b9b3437f2d128230fc29790b | 412 | py | Python | codes_/1071_Greatest_Common_Divisor_of_Strings.py | SaitoTsutomu/leetcode | 4656d66ab721a5c7bc59890db9a2331c6823b2bf | [
"MIT"
] | null | null | null | codes_/1071_Greatest_Common_Divisor_of_Strings.py | SaitoTsutomu/leetcode | 4656d66ab721a5c7bc59890db9a2331c6823b2bf | [
"MIT"
] | null | null | null | codes_/1071_Greatest_Common_Divisor_of_Strings.py | SaitoTsutomu/leetcode | 4656d66ab721a5c7bc59890db9a2331c6823b2bf | [
"MIT"
] | null | null | null | # %% [1071. Greatest Common Divisor of Strings](https://leetcode.com/problems/greatest-common-divisor-of-strings/)
# 問題:str1とstr2を分割する文字列を返せ(存在しないときは空文字列)。s = t * nのときtはsを分割する
# 解法:math.gcdを用いる
class Solution:
def gcdOfStrings(self, str1: str, str2: str) -> str:
n = math.gcd(n1 := len(str1), n2 := len(str2))
s = str1[:n]
return s * (s * (n1 // n) == str1 and s * (n2 // n) == str2)
| 45.777778 | 114 | 0.621359 | 57 | 412 | 4.491228 | 0.596491 | 0.109375 | 0.164063 | 0.179688 | 0.234375 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051672 | 0.201456 | 412 | 8 | 115 | 51.5 | 0.726444 | 0.453884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.6 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
0dec14aacd1025155171a5ff3e1dde9b178de7ac | 213 | py | Python | tfLego/model/NeuralNetwork.py | FrancescoSaverioZuppichini/tfLego | 485653eff6d3b8c6677b600a4e0d3623c844749f | [
"MIT"
] | null | null | null | tfLego/model/NeuralNetwork.py | FrancescoSaverioZuppichini/tfLego | 485653eff6d3b8c6677b600a4e0d3623c844749f | [
"MIT"
] | null | null | null | tfLego/model/NeuralNetwork.py | FrancescoSaverioZuppichini/tfLego | 485653eff6d3b8c6677b600a4e0d3623c844749f | [
"MIT"
] | null | null | null | import tensorflow as tf
from tfLego.model.Model import Model
class NeuralNetwork(Model):
def __init__(self, *args, **kwargs):
super().__init__(loss=tf.losses.mean_squared_error, *args, **kwargs)
| 17.75 | 76 | 0.713615 | 28 | 213 | 5.071429 | 0.714286 | 0.140845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164319 | 213 | 11 | 77 | 19.363636 | 0.797753 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0df14483e685b6f0ef7cbdc7577189f83c47a85e | 355 | py | Python | zmqrpc/service/IService.py | brgirgis/pyzmqrpc3 | a93339f98686e7f695f7c8a19dac198e4fc56aab | [
"MIT"
] | null | null | null | zmqrpc/service/IService.py | brgirgis/pyzmqrpc3 | a93339f98686e7f695f7c8a19dac198e4fc56aab | [
"MIT"
] | null | null | null | zmqrpc/service/IService.py | brgirgis/pyzmqrpc3 | a93339f98686e7f695f7c8a19dac198e4fc56aab | [
"MIT"
] | null | null | null |
'''
Created on Oct 2020
@author: Bassem Girgis
@copyright: MIT license, see http://opensource.org/licenses/MIT
'''
from abc import ABCMeta, abstractmethod
from typing import Optional
from ..command import ICommand
class IService(metaclass=ABCMeta):
@abstractmethod
def __call__(self, command: ICommand) -> Optional[object]:
pass
| 15.434783 | 63 | 0.726761 | 42 | 355 | 6.047619 | 0.761905 | 0.165354 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.177465 | 355 | 22 | 64 | 16.136364 | 0.856164 | 0.304225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.428571 | 0 | 0.714286 | 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 |
21746bed8bce5b4cf41a0d2229711cab6375c2e1 | 313 | py | Python | curso POO uber/Python/UberBlack.py | kev1991/Platzi_POO | 1ba445eb4f0a4472a2cbb37cc6745244930fd989 | [
"MIT"
] | null | null | null | curso POO uber/Python/UberBlack.py | kev1991/Platzi_POO | 1ba445eb4f0a4472a2cbb37cc6745244930fd989 | [
"MIT"
] | null | null | null | curso POO uber/Python/UberBlack.py | kev1991/Platzi_POO | 1ba445eb4f0a4472a2cbb37cc6745244930fd989 | [
"MIT"
] | null | null | null | from car import Car
class UberBlack(Car):
typeCarAccepted = []
seatsMaterials = []
def __init__(self, lincense, driver, typeCarAccepted, seatsMaterials):
super().__init__(lincense, driver)
self.typeCarAccepted = typeCarAccepted
self.seatsMaterials = seatsMaterials | 28.454545 | 74 | 0.680511 | 26 | 313 | 7.884615 | 0.5 | 0.282927 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.236422 | 313 | 11 | 75 | 28.454545 | 0.857741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.625 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
217897a0b1c106ed05a1a06ad8c16d827e3adf82 | 143 | py | Python | custom_components/echonet_lite/const.py | aureole999/echonet_lite_hass | 2a49efc501a0cd0c4ec25e552b2ec8ac2eec267c | [
"MIT"
] | null | null | null | custom_components/echonet_lite/const.py | aureole999/echonet_lite_hass | 2a49efc501a0cd0c4ec25e552b2ec8ac2eec267c | [
"MIT"
] | null | null | null | custom_components/echonet_lite/const.py | aureole999/echonet_lite_hass | 2a49efc501a0cd0c4ec25e552b2ec8ac2eec267c | [
"MIT"
] | null | null | null | DOMAIN = "echonet_lite"
MANUFACTURER = {
0x0B: "Panasonic",
0x69: "Toshiba",
0x2f: "AIPHONE",
}
CONF_STATE_CLASS = "state_class"
| 14.3 | 32 | 0.643357 | 15 | 143 | 5.866667 | 0.866667 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.061947 | 0.20979 | 143 | 9 | 33 | 15.888889 | 0.716814 | 0 | 0 | 0 | 0 | 0 | 0.321678 | 0 | 0 | 0 | 0.083916 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
21a81878ec04c1fce65de237aaa55988ee65b38b | 301 | py | Python | P1/src/ToneMapping.py | eosW/CMPE264 | 66be544856f8e097049f2c1bee604abaddf79b37 | [
"MIT"
] | null | null | null | P1/src/ToneMapping.py | eosW/CMPE264 | 66be544856f8e097049f2c1bee604abaddf79b37 | [
"MIT"
] | null | null | null | P1/src/ToneMapping.py | eosW/CMPE264 | 66be544856f8e097049f2c1bee604abaddf79b37 | [
"MIT"
] | null | null | null | import cv2
import numpy as np
from Calibration import Calibration
class ToneMapping:
def __init__(self):
self.tome_mapper = cv2.createTonemapDurand(gamma=2.2)
def map(self, img):
img2 = self.tome_mapper.process(img)
return np.clip(img2*255, 0, 255).astype('uint8')
| 21.5 | 61 | 0.687708 | 42 | 301 | 4.785714 | 0.642857 | 0.079602 | 0.139303 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058824 | 0.209302 | 301 | 13 | 62 | 23.153846 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0.016667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.777778 | 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 |
21dccfcbb049e25c2f73ddf56c916b3c96f066e8 | 379 | py | Python | aiomatrix/dispatcher/storage/internal_data/base.py | Forden/aiomatrix | d258076bae8eb776495b92be46ee9f4baec8d9a6 | [
"MIT"
] | 2 | 2021-10-29T18:07:08.000Z | 2021-11-19T00:25:43.000Z | aiomatrix/dispatcher/storage/internal_data/base.py | Forden/aiomatrix | d258076bae8eb776495b92be46ee9f4baec8d9a6 | [
"MIT"
] | 1 | 2022-03-06T11:17:43.000Z | 2022-03-06T11:17:43.000Z | aiomatrix/dispatcher/storage/internal_data/base.py | Forden/aiomatrix | d258076bae8eb776495b92be46ee9f4baec8d9a6 | [
"MIT"
] | null | null | null | from typing import Optional
from . import models
class BaseInternalDataStorage:
async def setup(self):
raise NotImplementedError
async def get_last_sync_token(self, account_id: str) -> Optional[models.InternalDataPair]:
raise NotImplementedError
async def set_last_sync_token(self, account_id: str, token: str):
raise NotImplementedError
| 25.266667 | 94 | 0.746702 | 44 | 379 | 6.25 | 0.5 | 0.087273 | 0.210909 | 0.232727 | 0.210909 | 0.210909 | 0.210909 | 0 | 0 | 0 | 0 | 0 | 0.195251 | 379 | 14 | 95 | 27.071429 | 0.901639 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.333333 | 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 |
0dff8e92f0782f0e8acc6e8ea5cc9ba461c7be88 | 234 | py | Python | tests/scripts/prepare_stanza.py | souvikg10/rasa-nlu-examples | 553a6461949f57232601e778fccdff74a488e0cd | [
"Apache-2.0"
] | 129 | 2020-06-26T10:41:24.000Z | 2022-03-31T17:00:29.000Z | tests/scripts/prepare_stanza.py | souvikg10/rasa-nlu-examples | 553a6461949f57232601e778fccdff74a488e0cd | [
"Apache-2.0"
] | 109 | 2020-06-22T09:32:18.000Z | 2022-03-31T06:00:03.000Z | tests/scripts/prepare_stanza.py | souvikg10/rasa-nlu-examples | 553a6461949f57232601e778fccdff74a488e0cd | [
"Apache-2.0"
] | 59 | 2020-06-21T16:23:22.000Z | 2022-03-31T17:00:31.000Z | import stanza
if __name__ == "__main__":
# This part of the script will download a stanza model.
# If there's a more lightweight way of doing this I'd love to hear it.
stanza.download("en", model_dir="tests/data/stanza")
| 33.428571 | 74 | 0.705128 | 39 | 234 | 4 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.200855 | 234 | 6 | 75 | 39 | 0.834225 | 0.521368 | 0 | 0 | 0 | 0 | 0.247706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
df065de2524684d40eddbc37f34c84ad6d916ef9 | 88 | py | Python | myblog/apps.py | HaibaraAi123/DjangoBlog-chenfeng123.cn | ca5a90a4ad91e383a5ff25131488527f5733e216 | [
"MIT"
] | 1 | 2020-08-06T05:50:26.000Z | 2020-08-06T05:50:26.000Z | myblog/apps.py | HaibaraAi123/DjangoBlog-chenfeng123.cn | ca5a90a4ad91e383a5ff25131488527f5733e216 | [
"MIT"
] | null | null | null | myblog/apps.py | HaibaraAi123/DjangoBlog-chenfeng123.cn | ca5a90a4ad91e383a5ff25131488527f5733e216 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class Newapp1Config(AppConfig):
name = 'myblog'
| 14.666667 | 33 | 0.75 | 10 | 88 | 6.6 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.170455 | 88 | 5 | 34 | 17.6 | 0.890411 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 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 |
df3c37feddc6af3f693b8696214d49d10b0397e4 | 489 | py | Python | tests/app/timeout_test.py | paraguz1/voila | 9cd9b52574197740c5bcaaee8c3b1e154c49dbbc | [
"BSD-3-Clause"
] | null | null | null | tests/app/timeout_test.py | paraguz1/voila | 9cd9b52574197740c5bcaaee8c3b1e154c49dbbc | [
"BSD-3-Clause"
] | null | null | null | tests/app/timeout_test.py | paraguz1/voila | 9cd9b52574197740c5bcaaee8c3b1e154c49dbbc | [
"BSD-3-Clause"
] | null | null | null | import pytest
import os
@pytest.fixture
def voila_notebook(notebook_directory):
return os.path.join(notebook_directory, 'sleep.ipynb')
@pytest.fixture
def voila_args_extra():
return ['--VoilaExecutePreprocessor.timeout=1', '--KernelManager.shutdown_wait_time=0.1']
@pytest.mark.gen_test
def test_timeout(http_client, base_url):
response = yield http_client.fetch(base_url)
html_text = response.body.decode('utf-8')
assert 'Cell execution timed out' in html_text
| 23.285714 | 93 | 0.762781 | 68 | 489 | 5.264706 | 0.661765 | 0.072626 | 0.089385 | 0.117318 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009346 | 0.124744 | 489 | 20 | 94 | 24.45 | 0.827103 | 0 | 0 | 0.153846 | 0 | 0 | 0.233129 | 0.151329 | 0 | 0 | 0 | 0 | 0.076923 | 1 | 0.230769 | false | 0 | 0.153846 | 0.153846 | 0.538462 | 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 |
df3cf4539122751fb8aad6ffb65f01fd5e599b9d | 1,145 | py | Python | constraint.py | mbillingr/unification | 39de64c7636cf9acd1b831aade3c5d90e2d0bb11 | [
"MIT"
] | null | null | null | constraint.py | mbillingr/unification | 39de64c7636cf9acd1b831aade3c5d90e2d0bb11 | [
"MIT"
] | null | null | null | constraint.py | mbillingr/unification | 39de64c7636cf9acd1b831aade3c5d90e2d0bb11 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from core import occurs_dispatch, unify_dispatch, extend_substitution, Term, Mismatch
from variable import Var
from typing import Any, Optional
# For now, assume constraints can't contain variables.
# We can say things like >0 or >10 & <20, but not <X.
class Constraint(ABC):
@abstractmethod
def check(self, value: Term) -> bool:
pass
@abstractmethod
def combine(self, other) -> Optional["Constraint"]:
pass
@unify_dispatch.register(swap=True)
def unify_constraints(u: Constraint, v: Any, s):
if u.check(v):
return s
raise Mismatch(u, v)
@unify_dispatch.register()
def unify_constraints(u: Constraint, v: Var, s):
# It's tricky...
# after walking, a variable associated with a constraint is replaced by the constraint.
# so how can we update the constraint here?
raise NotImplementedError()
@unify_dispatch.register()
def unify_constraints(u: Constraint, v: Constraint, s):
if not u.combine(v):
raise Mismatch(u, v)
return s
@occurs_dispatch.register
def occurs_constraint(v: Constraint, x, s):
return False
| 24.891304 | 93 | 0.70131 | 158 | 1,145 | 5.012658 | 0.455696 | 0.065657 | 0.079545 | 0.075758 | 0.170455 | 0.170455 | 0.131313 | 0.131313 | 0.131313 | 0 | 0 | 0.005488 | 0.204367 | 1,145 | 45 | 94 | 25.444444 | 0.863886 | 0.219214 | 0 | 0.37037 | 0 | 0 | 0.011261 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.074074 | 0.148148 | 0.037037 | 0.518519 | 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 |
df5790944e96238fbf07285f76a3e3bbdcb160f6 | 8,943 | py | Python | supervised/robot2.py | gthd/supervised_learning | 183c6b67031a506bb130a2ca5b091225aaa26112 | [
"MIT"
] | null | null | null | supervised/robot2.py | gthd/supervised_learning | 183c6b67031a506bb130a2ca5b091225aaa26112 | [
"MIT"
] | null | null | null | supervised/robot2.py | gthd/supervised_learning | 183c6b67031a506bb130a2ca5b091225aaa26112 | [
"MIT"
] | null | null | null | import numpy as np
import vrep
import buffer
class Script:
def __init__(self, my_robot):
self.robot = my_robot
self.buffer = buffer.ReplayMemory(100)
self.client_id = self.robot.client_id
self.states = []
self.object_position = None
self.euler_angles2 = None
self.pickup_position = None
self.pickup_orientation = None
self.image = None
global COUNTER
COUNTER = 0
global COUNTER1
COUNTER1 = 0
def success_rate(self, label):
global COUNTER
global COUNTER1
COUNTER += 1
if label:
COUNTER1 += 1
if COUNTER % 100 == 0:
print('success ratio is: ', (float(COUNTER1)/float(COUNTER)))
def get_sawyer_position(self):
_, sawyer_target_position = vrep.simxGetObjectPosition(self.robot.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
return sawyer_target_position
def get_sawyer_orientation(self):
_, sawyer_target_orientation = vrep.simxGetObjectOrientation(self.robot.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
return sawyer_target_orientation
def get_object_position(self):
_, object_position = vrep.simxGetObjectPosition(self.robot.client_id, \
self.robot.object_handle[0], -1, vrep.simx_opmode_blocking)
return object_position
def get_object_orientation(self):
_, object_orientation = vrep.simxGetObjectOrientation(self.robot.client_id, \
self.robot.object_handle[0], -1, vrep.simx_opmode_blocking)
return object_orientation
def new_episode(self, label):
self.buffer.push(label, self.pickup_position[0], self.pickup_position[1], \
self.pickup_orientation[1], self.image)
self.buffer.store_at_disk()
self.success_rate(label)
def pick_position(self, exploit=True):
_, self.object_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.object_handle[0], -1, vrep.simx_opmode_blocking)
_, sawyer_target_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
if exploit == bool(1):
self.pickup_position = np.array([self.object_position[0], self.object_position[1], \
sawyer_target_position[2]])
else:
# random = np.random.normal(0,0.05,3)
# self.pickup_position = np.array([self.object_position[0] + random[0]
# self.object_position[1] + random[1], sawyer_target_position[2]])
action_x = np.random.uniform(low=1.028, high=1.242, size=1)[0]
action_y = np.random.uniform(low=1.1, high=1.278, size=1)[0]
self.pickup_position = np.array([action_x, action_y, sawyer_target_position[2]])
def pick_orientation(self, exploit=True):
_, euler_angles = vrep.simxGetObjectOrientation(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
_, self.euler_angles2 = vrep.simxGetObjectOrientation(self.client_id, \
self.robot.object_handle[0], -1, vrep.simx_opmode_blocking)
if exploit == bool(1):
self.pickup_orientation = np.array([euler_angles[0], self.euler_angles2[1], \
euler_angles[2]])
else:
ori = np.random.uniform(0.017, 1.553, 1)[0]
self.pickup_orientation = np.array([euler_angles[0], ori, euler_angles[2]])
def set_gripper_position(self):
_, sawyer_target_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
self.image = self.robot.get_image()
move_direction = np.asarray([self.pickup_position[0] - sawyer_target_position[0], \
self.pickup_position[1] - sawyer_target_position[1], self.pickup_position[2] - \
sawyer_target_position[2]])
move_magnitude = np.linalg.norm(move_direction)
move_step = 0.03*move_direction/move_magnitude
num_move_steps = int(np.floor(move_magnitude/0.03))
remaining_magnitude = -num_move_steps * 0.03 + move_magnitude
remaining_distance = remaining_magnitude * move_direction/move_magnitude
for step_iter in range(num_move_steps): #selects action and executes action
vrep.simxSetObjectPosition(self.client_id, self.robot.sawyer_target_handle, -1, \
(sawyer_target_position[0] + move_step[0], sawyer_target_position[1] + \
move_step[1], sawyer_target_position[2] + move_step[2]), vrep.simx_opmode_blocking)
_, sawyer_target_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
vrep.simxSetObjectPosition(self.robot.client_id, self.robot.sawyer_target_handle, -1, \
(sawyer_target_position[0] + remaining_distance[0], sawyer_target_position[1] + \
remaining_distance[1], sawyer_target_position[2]+ remaining_distance[2]), \
vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
def set_gripper_orientation(self):
_, sawyer_orientation = vrep.simxGetObjectOrientation(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
rotation_step = 0.3 if (self.pickup_orientation[1] - sawyer_orientation[1] > 0) \
else -0.3
num_rotation_steps = int(np.floor((self.pickup_orientation[1] - \
sawyer_orientation[1])/rotation_step))
for step_iter in range(num_rotation_steps):
vrep.simxSetObjectOrientation(self.robot.client_id, \
self.robot.sawyer_target_handle, -1, (sawyer_orientation[0], \
sawyer_orientation[1] + rotation_step, sawyer_orientation[2]), \
vrep.simx_opmode_blocking)
_, sawyer_orientation = vrep.simxGetObjectOrientation(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
vrep.simxSetObjectOrientation(self.robot.client_id, self.robot.sawyer_target_handle, \
-1, (sawyer_orientation[0], self.pickup_orientation[1], sawyer_orientation[2]), \
vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
def move_down(self): #3 time-steps
_, object_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.object_handle[0], -1, vrep.simx_opmode_blocking)
_, sawyer_target_position = vrep.simxGetObjectPosition(self.client_id, \
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
move_direction = np.asarray([self.pickup_position[0] - sawyer_target_position[0], \
self.pickup_position[1] - sawyer_target_position[1], object_position[2] + 0.01 \
- sawyer_target_position[2]])
move_magnitude = np.linalg.norm(move_direction)
move_step = 0.03*move_direction/move_magnitude
num_move_steps = int(np.floor(move_magnitude/0.03))
remaining_magnitude = -num_move_steps * 0.03 + move_magnitude
remaining_distance = remaining_magnitude * move_direction/move_magnitude
for step_iter in range(num_move_steps):
vrep.simxSetObjectPosition(self.client_id, self.robot.sawyer_target_handle,\
-1, (sawyer_target_position[0] + move_step[0], sawyer_target_position[1] \
+ move_step[1], sawyer_target_position[2] + move_step[2]), \
vrep.simx_opmode_blocking)
_, sawyer_target_position = vrep.simxGetObjectPosition(self.client_id,\
self.robot.sawyer_target_handle, -1, vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
vrep.simxSetObjectPosition(self.robot.client_id, self.robot.sawyer_target_handle, \
-1, (sawyer_target_position[0] + remaining_distance[0], sawyer_target_position[1] \
+ remaining_distance[1], sawyer_target_position[2]+ remaining_distance[2]), \
vrep.simx_opmode_blocking)
vrep.simxSynchronousTrigger(self.client_id)
vrep.simxGetPingTime(self.client_id)
def open_hand(self):
self.robot.open_hand()
def close_hand(self):
self.robot.close_hand()
def lift_arm(self):
self.robot.lift_arm()
def successful_grasp(self):
label = self.robot.successful_grasp()
return label
| 48.603261 | 99 | 0.67673 | 1,085 | 8,943 | 5.269124 | 0.108756 | 0.096554 | 0.097953 | 0.065419 | 0.770684 | 0.732202 | 0.717334 | 0.688473 | 0.669932 | 0.6311 | 0 | 0.024418 | 0.221514 | 8,943 | 183 | 100 | 48.868852 | 0.796754 | 0.024041 | 0 | 0.409091 | 0 | 0 | 0.002064 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.103896 | false | 0 | 0.019481 | 0 | 0.175325 | 0.006494 | 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 |
df62c3b6ca83de043ecd2af9e5e0ffa2f4415947 | 163 | py | Python | notebooks/_solutions/case-sea-surface-temperature12.py | jorisvandenbossche/DS-python-geospatial | 893a12edc5c203a75815f6dcb5f1e18c577c8cd5 | [
"BSD-3-Clause"
] | 58 | 2020-10-09T10:10:59.000Z | 2022-03-07T14:58:07.000Z | notebooks/_solutions/case-sea-surface-temperature12.py | amitkb3/DS-python-geospatial | 5f156ebff67e06d59b2a7ef446d1fed746ce0650 | [
"BSD-3-Clause"
] | 24 | 2020-09-30T19:57:14.000Z | 2021-10-05T07:21:09.000Z | notebooks/_solutions/case-sea-surface-temperature12.py | amitkb3/DS-python-geospatial | 5f156ebff67e06d59b2a7ef446d1fed746ce0650 | [
"BSD-3-Clause"
] | 19 | 2020-10-05T09:32:18.000Z | 2022-03-20T00:09:14.000Z | # alternative using transpose instead of defining the x and y in the plot function
ds_mm.mean(dim='lon').transpose().plot.imshow(vmin=-2, vmax=30, cmap="coolwarm") | 81.5 | 82 | 0.760736 | 28 | 163 | 4.392857 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020548 | 0.104294 | 163 | 2 | 83 | 81.5 | 0.821918 | 0.490798 | 0 | 0 | 0 | 0 | 0.134146 | 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 |
10c3dc00c34ec7b95179d16c207e353ab925372f | 275 | py | Python | detention/signals.py | luismasuelli/django-detention | 6c96645aa71f0a3c40c390f4e7f0158ff4848b1e | [
"Unlicense"
] | 1 | 2015-10-24T23:58:48.000Z | 2015-10-24T23:58:48.000Z | detention/signals.py | luismasuelli/django-detention | 6c96645aa71f0a3c40c390f4e7f0158ff4848b1e | [
"Unlicense"
] | null | null | null | detention/signals.py | luismasuelli/django-detention | 6c96645aa71f0a3c40c390f4e7f0158ff4848b1e | [
"Unlicense"
] | null | null | null | __author__ = 'Luis'
from django.core import signals
#the sender will be the banned user
ban_applied = signals.Signal(providing_args=["new_ban"])
ban_terminated = signals.Signal(providing_args=["ban"])
bans_expired = signals.Signal(providing_args=["current_ban", "ban_list"]) | 39.285714 | 73 | 0.785455 | 39 | 275 | 5.205128 | 0.615385 | 0.192118 | 0.325123 | 0.384236 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087273 | 275 | 7 | 73 | 39.285714 | 0.808765 | 0.123636 | 0 | 0 | 0 | 0 | 0.136929 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 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 |
10c4ca8794a29edf2fd1e49bc6a347311853a9aa | 520 | py | Python | ampel/model/operator/AllOf.py | AmpelProject/Ampel-interface | 3c272565c6817555e5a350f12c7d0e11f7d46bb9 | [
"BSD-3-Clause"
] | null | null | null | ampel/model/operator/AllOf.py | AmpelProject/Ampel-interface | 3c272565c6817555e5a350f12c7d0e11f7d46bb9 | [
"BSD-3-Clause"
] | 8 | 2019-12-26T22:44:41.000Z | 2021-12-15T12:06:42.000Z | ampel/model/operator/AllOf.py | AmpelProject/Ampel-interface | 3c272565c6817555e5a350f12c7d0e11f7d46bb9 | [
"BSD-3-Clause"
] | 1 | 2020-01-20T14:01:38.000Z | 2020-01-20T14:01:38.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : Ampel-interface/ampel/model/operator/AllOf.py
# License : BSD-3-Clause
# Author : vb <vbrinnel@physik.hu-berlin.de>
# Date : 15.10.2018
# Last Modified Date: 18.03.2021
# Last Modified By : vb <vbrinnel@physik.hu-berlin.de>
from pydantic.generics import GenericModel
from typing import List, Generic
from ampel.types import T
class AllOf(GenericModel, Generic[T]):
#: Select items by logical AND
all_of: List[T]
| 28.888889 | 67 | 0.659615 | 74 | 520 | 4.621622 | 0.702703 | 0.05848 | 0.093567 | 0.105263 | 0.152047 | 0.152047 | 0 | 0 | 0 | 0 | 0 | 0.044226 | 0.217308 | 520 | 17 | 68 | 30.588235 | 0.796069 | 0.653846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.6 | 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 |
10c57a816f61fcd30b063d3f6afdc9e7577cb940 | 1,043 | py | Python | speedproject/speed/migrations/0001_initial.py | Dev-maker/SpeedTes | 6efc6e82d2af11a3d89339699aad06607e2a443e | [
"MIT"
] | null | null | null | speedproject/speed/migrations/0001_initial.py | Dev-maker/SpeedTes | 6efc6e82d2af11a3d89339699aad06607e2a443e | [
"MIT"
] | null | null | null | speedproject/speed/migrations/0001_initial.py | Dev-maker/SpeedTes | 6efc6e82d2af11a3d89339699aad06607e2a443e | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2019-12-25 11:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Data',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField(max_length=100)),
('IpAddress', models.CharField(max_length=20)),
('city', models.CharField(max_length=20)),
('post', models.CharField(max_length=5)),
('location', models.CharField(max_length=50)),
('hostname', models.CharField(max_length=50)),
('upload', models.CharField(max_length=100)),
('download', models.CharField(max_length=100)),
('ping', models.CharField(max_length=100)),
('organisation', models.CharField(max_length=100)),
],
),
]
| 33.645161 | 114 | 0.560882 | 104 | 1,043 | 5.5 | 0.5 | 0.157343 | 0.283217 | 0.377622 | 0.370629 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051842 | 0.29722 | 1,043 | 30 | 115 | 34.766667 | 0.728513 | 0.041227 | 0 | 0 | 1 | 0 | 0.07515 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.217391 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
10d9051829ca5a8c0a7af6b75b39b93800e19c80 | 959 | py | Python | dataStructure/linkedList/__init__.py | bigfoolliu/liu_aistuff | aa661d37c05c257ee293285dd0868fb7e8227628 | [
"MIT"
] | 1 | 2019-11-25T07:23:42.000Z | 2019-11-25T07:23:42.000Z | dataStructure/linkedList/__init__.py | bigfoolliu/liu_aistuff | aa661d37c05c257ee293285dd0868fb7e8227628 | [
"MIT"
] | 13 | 2020-01-07T16:09:47.000Z | 2022-03-02T12:51:44.000Z | dataStructure/linkedList/__init__.py | bigfoolliu/liu_aistuff | aa661d37c05c257ee293285dd0868fb7e8227628 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
链表
一个原则,两种题型,三个注意,四个技巧:
一个原则:
- 画图
两种题型:
- 指针的修改
- 链表的拼接
三个注意:
- 出现环,造成死循环
- 分不清边界,导致边界条件出错
- 不懂递归的做法
四个技巧:
- 虚拟头,将头节点变成中间节点,简化判断;在合适的时候断开连接返回链表的中间节点
- 快慢指针,比如求中间节点,快指针一次走两步,慢指针一次走一步,当块指针到达末尾则慢指针在中间;求倒数第二个节点,快指针开始比慢指针快一步
- 穿针引线,主要用于拼接链表
- 先穿再排后判空
"""
from typing import Any
class Node(object):
"""链表节点"""
def __init__(self, item: Any, next: Any) -> None:
self.item = item
self.next = next
class LinkedList(object):
"""基本的链表"""
def __init__(self) -> None:
self.head = None # 链表的头
self.size = 0 # 链表的节点数量
def is_empty(self) -> bool:
"""判断链表是否为空"""
return self.head is None
def add(self, item: Any) -> None:
"""添加一个尾节点"""
self.head = Node(item, self.head) # 以当前头节点为next节点,并重新定义头节点
self.size += 1
def remove(self) -> Any:
pass
| 17.125 | 74 | 0.577685 | 112 | 959 | 4.866071 | 0.616071 | 0.058716 | 0.040367 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005806 | 0.281543 | 959 | 55 | 75 | 17.436364 | 0.785196 | 0.4317 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0.0625 | 0.0625 | 0 | 0.5625 | 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 |
10fce719dceebc8489b2068aa02fea702ca890bb | 1,371 | py | Python | engage/blog/views.py | NewsNerdsAtCoJMC/ProjectTicoTeam1 | e6419c495f05765db235ce49fabbd2f568897f08 | [
"MIT"
] | null | null | null | engage/blog/views.py | NewsNerdsAtCoJMC/ProjectTicoTeam1 | e6419c495f05765db235ce49fabbd2f568897f08 | [
"MIT"
] | null | null | null | engage/blog/views.py | NewsNerdsAtCoJMC/ProjectTicoTeam1 | e6419c495f05765db235ce49fabbd2f568897f08 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.http import HttpResponse
from blog.models import Author, Post
def index(request):
posts = Post.objects.all()
authors = Author.objects.all()
context = {'posts': posts, 'authors': authors}
return render(request, 'blog/index.html', context)
def blog(request):
posts = Post.objects.all()
context = {'posts': posts}
return render(request, 'blog/blog.html', context)
def blog_detail(request, pk):
post = Post.objects.get(id=pk)
context = {'post': post}
return render(request, 'blog/blog_detail.html', context)
def housing(request):
context = {}
return render(request, 'blog/housing.html', context)
def transportation(request):
posts = Post.objects.filter(tag__tag_slug="transportation")
context = {'posts': posts}
return render(request, 'blog/transportation.html', context)
def food(request):
posts = Post.objects.filter(tag__tag_slug="food")
context = {'posts': posts}
return render(request, 'blog/food.html', context)
def entertainment(request):
posts = Post.objects.filter(tag__tag_slug="entertainment")
context = {'posts': posts}
return render(request, 'blog/entertainment.html', context)
def team(request):
members = Author.objects.all()
context = {'members': members}
return render(request, 'blog/team.html', context)
| 30.466667 | 63 | 0.696572 | 169 | 1,371 | 5.585799 | 0.201183 | 0.101695 | 0.161017 | 0.194915 | 0.409958 | 0.293432 | 0.293432 | 0.123941 | 0 | 0 | 0 | 0 | 0.163384 | 1,371 | 44 | 64 | 31.159091 | 0.823017 | 0 | 0 | 0.171429 | 0 | 0 | 0.157549 | 0.049599 | 0 | 0 | 0 | 0 | 0 | 1 | 0.228571 | false | 0 | 0.085714 | 0 | 0.542857 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
802a069af11fd96715643cc5967d1420b3f11724 | 494 | py | Python | Time Complexity/frog_jump.py | Jeans212/codility-dev-training | 9c5118c6433ea210d1485a6127712a92496e2bc2 | [
"MIT"
] | null | null | null | Time Complexity/frog_jump.py | Jeans212/codility-dev-training | 9c5118c6433ea210d1485a6127712a92496e2bc2 | [
"MIT"
] | null | null | null | Time Complexity/frog_jump.py | Jeans212/codility-dev-training | 9c5118c6433ea210d1485a6127712a92496e2bc2 | [
"MIT"
] | null | null | null | '''
Task:
Count minimal number of jumps from position X to Y.
Approach:
Subtract position X from position Y to get the distance between them.
Return the smallest integer greater than or equal to the result obtained from dividing the distance (Y-X) by jump distance D.
'''
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import math
def solution(X, Y, D):
# write your code in Python 3.6
return math.ceil((Y-X) / D)
| 27.444444 | 129 | 0.688259 | 82 | 494 | 4.146341 | 0.695122 | 0.070588 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005305 | 0.236842 | 494 | 17 | 130 | 29.058824 | 0.896552 | 0.773279 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 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 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
802c6431b8687e361db39fdd2b13d412705f82f2 | 3,344 | py | Python | desihigh/legacy_blend/dat/py/brick_list.py | AlbertoRosado1/desihigh | a9f9d78c0c7605a704ae8008633f7aa9f641f7e4 | [
"BSD-3-Clause"
] | 22 | 2021-01-29T05:34:05.000Z | 2022-03-19T19:02:07.000Z | desihigh/legacy_blend/dat/py/brick_list.py | AlbertoRosado1/desihigh | a9f9d78c0c7605a704ae8008633f7aa9f641f7e4 | [
"BSD-3-Clause"
] | 34 | 2021-01-18T02:22:52.000Z | 2022-02-18T15:17:42.000Z | desihigh/legacy_blend/dat/py/brick_list.py | AlbertoRosado1/desihigh | a9f9d78c0c7605a704ae8008633f7aa9f641f7e4 | [
"BSD-3-Clause"
] | 28 | 2021-02-01T02:02:25.000Z | 2022-02-25T18:15:00.000Z | import numpy as np
import healpy as hp
from desitarget.geomask import brick_names_touch_hp
from desiutil import depend, brick
nside = 32
# items = brick_names_touch_hp(nside=nside, numproc=16)
# list of names of bricks that touch HEALPixel 0.
# print(items[0])
# nside = 32
items = ['0436p000', '0438p000', '0441p000', '0443p000', '0446p000', '0448p000', '0451p000', '0453p000', '0456p000', '0458p000', '0461p000', '0463p000', '0436p002', '0438p002', '0441p002', '0443p002', '0446p002', '0448p002', '0451p002', '0453p002', '0456p002', '0458p002', '0461p002', '0463p002', '0436p005', '0438p005', '0441p005', '0443p005', '0446p005', '0448p005', '0451p005', '0453p005', '0456p005', '0458p005', '0461p005', '0463p005', '0436p007', '0438p007', '0441p007', '0443p007', '0446p007', '0448p007', '0451p007', '0453p007', '0456p007', '0458p007', '0461p007', '0463p007', '0436p010', '0438p010', '0441p010', '0443p010', '0446p010', '0448p010', '0451p010', '0453p010', '0456p010', '0458p010', '0461p010', '0463p010', '0436p012', '0438p012', '0441p012', '0443p012', '0446p012', '0448p012', '0451p012', '0453p012', '0456p012', '0458p012', '0461p012', '0463p012', '0436p015', '0438p015', '0441p015', '0443p015', '0446p015', '0448p015', '0451p015', '0453p015', '0456p015', '0458p015', '0461p015', '0463p015', '0436p017', '0438p017', '0441p017', '0443p017', '0446p017', '0448p017', '0451p017', '0453p017', '0456p017', '0458p017', '0461p017', '0463p017', '0436p020', '0438p020', '0441p020', '0443p020', '0446p020', '0448p020', '0451p020', '0453p020', '0456p020', '0458p020', '0461p020', '0463p020', '0436p022', '0438p022', '0441p022', '0443p022', '0446p022', '0448p022', '0451p022', '0453p022', '0456p022', '0458p022', '0461p022', '0463p022', '0436p025', '0438p025', '0441p025', '0443p025', '0446p025', '0448p025', '0451p025', '0453p025', '0456p025', '0458p025', '0461p025', '0463p025']
# nside = 64.
# items = ['0443p000', '0446p000', '0448p000', '0451p000', '0453p000', '0456p000', '0443p002', '0446p002', '0448p002', '0451p002', '0453p002', '0456p002', '0443p005', '0446p005', '0448p005', '0451p005', '0453p005', '0456p005', '0443p007', '0446p007', '0448p007', '0451p007', '0453p007', '0456p007', '0443p010', '0446p010', '0448p010', '0451p010', '0453p010', '0456p010', '0443p012', '0446p012', '0448p012', '0451p012', '0453p012', '0456p012']
area = len(items) * 0.25 * 0.25
print(area, hp.pixelfunc.nside2pixarea(nside, degrees=True))
bricktable = brick.Bricks(bricksize=0.25).to_table()
bricktable['A'] = ['{:04d}'.format(x) for x in np.array(bricktable['RA1'] * 10.).astype(np.int)]
bricktable['B'] = ['{:04d}'.format(x) for x in np.array(bricktable['DEC1'] * 10.).astype(np.int)]
bricktable['C'] = ['{:04d}'.format(x) for x in np.array(bricktable['RA2'] * 10.).astype(np.int)]
bricktable['D'] = ['{:04d}'.format(x) for x in np.array(bricktable['DEC2'] * 10.).astype(np.int)]
bricktable['B'] = [x.replace('-', 'm') if '-' in x else 'p' + x[1:] for x in bricktable['B']]
bricktable['D'] = [x.replace('-', 'm') if '-' in x else 'p' + x[1:] for x in bricktable['B']]
bricktable['EXT'] = [' '] * len(bricktable)
for i, _ in enumerate(bricktable['EXT']):
bricktable['EXT'][i] = bricktable['A'][i] + bricktable['B'][i] + '-' + bricktable['C'][i] + bricktable['D'][i]
print(bricktable)
| 77.767442 | 1,592 | 0.644438 | 366 | 3,344 | 5.86612 | 0.535519 | 0.011178 | 0.016768 | 0.02422 | 0.418258 | 0.396833 | 0.106195 | 0.106195 | 0.106195 | 0.044714 | 0 | 0.414145 | 0.120514 | 3,344 | 42 | 1,593 | 79.619048 | 0.315879 | 0.173744 | 0 | 0 | 0 | 0 | 0.4209 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.210526 | 0 | 0.210526 | 0.105263 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
802e93434636e7290f37f60815ba8edb8cc17f9a | 1,335 | py | Python | little_finger/router/signal.py | yromeMfOtuO/little-finger | 6474366e6f8f9072584aa7f113a7f425544a7708 | [
"Apache-2.0"
] | null | null | null | little_finger/router/signal.py | yromeMfOtuO/little-finger | 6474366e6f8f9072584aa7f113a7f425544a7708 | [
"Apache-2.0"
] | null | null | null | little_finger/router/signal.py | yromeMfOtuO/little-finger | 6474366e6f8f9072584aa7f113a7f425544a7708 | [
"Apache-2.0"
] | null | null | null | """
用于减少编码中的多个简单条件if分支,
实现类似 java spring 中通过 application context 生命周期回调实现的工厂路由
实例见下方test
"""
import functools
from blinker import Signal
def dispatch(func):
"""
入口方法装饰器
:param func: 入口方法
:return: 装饰后的方法
"""
# 路由表
signal_ = Signal()
@functools.wraps(func)
def wrapper(arg0, *args, **kwargs):
"""获取分支方法,获取失败则使用入口方法做兜底"""
if signal_.receivers and signal_.has_receivers_for(arg0):
# hard code。。
return signal_.send(arg0, *args, **kwargs)[0][1]
return func(arg0, *args, **kwargs)
def mapping(key):
def wrap(branch_func):
@signal_.connect_via(key)
def do_branch_func(arg0, *args, **kwargs):
return branch_func(arg0, *args, **kwargs)
return do_branch_func
return wrap
wrapper.mapping = mapping
return wrapper
if __name__ == '__main__':
# pylint: disable = E, W, R, C
@dispatch
def fun(key):
raise ValueError(f'key error, key: {key}')
@fun.mapping(1)
def __fun1(key):
return 1 + key
@fun.mapping(2)
def __fun2(key):
return 2 + key
@fun.mapping(3)
@fun.mapping(4)
def __fun34(key):
return 3 + key
print(f'result:{fun(1)}')
print(f'result:{fun(3)}')
print(f'result:{fun(5)}')
| 18.802817 | 65 | 0.577528 | 161 | 1,335 | 4.614907 | 0.428571 | 0.053836 | 0.094213 | 0.072678 | 0.080754 | 0.080754 | 0 | 0 | 0 | 0 | 0 | 0.023256 | 0.291386 | 1,335 | 70 | 66 | 19.071429 | 0.762156 | 0.146067 | 0 | 0 | 0 | 0 | 0.067151 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257143 | false | 0 | 0.057143 | 0.114286 | 0.571429 | 0.085714 | 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 |
8032152686e4862cc8e04cba90e9a33e824e1fef | 336 | py | Python | Modules/PlotFunctions/__init__.py | ArdenB/WinterSchool2018 | 6e6d9f5657d216be87daa8a2f968c6bb973c9c16 | [
"MIT"
] | null | null | null | Modules/PlotFunctions/__init__.py | ArdenB/WinterSchool2018 | 6e6d9f5657d216be87daa8a2f968c6bb973c9c16 | [
"MIT"
] | null | null | null | Modules/PlotFunctions/__init__.py | ArdenB/WinterSchool2018 | 6e6d9f5657d216be87daa8a2f968c6bb973c9c16 | [
"MIT"
] | null | null | null | from MapMaker import mapmaker
from MappingClass import mapclass
# from ReplaceColor import ReplaceColor
# from GitMetadata import gitmetadata
# from HistogramMaker import histmaker
# from ReplaceHexColors import ReplaceHexColor
__all__ = ['mapmaker', 'mapclass'] #, 'ReplaceColor', 'gitmetadata', 'histmaker', "ReplaceHexColor"] | 42 | 100 | 0.791667 | 31 | 336 | 8.451613 | 0.387097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130952 | 336 | 8 | 100 | 42 | 0.89726 | 0.651786 | 0 | 0 | 0 | 0 | 0.152381 | 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 | 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 |
8052d20a37af05d7d771170062bb2f093ab8880e | 28 | py | Python | dende/platereader/plates/nunc96/__init__.py | dende/platereader | 36b9660bff6ef37990e5925284cbe37ee5093163 | [
"MIT"
] | 3 | 2021-04-20T11:50:34.000Z | 2022-03-04T08:15:37.000Z | dende/platereader/plates/nunc96/__init__.py | dende/platereader | 36b9660bff6ef37990e5925284cbe37ee5093163 | [
"MIT"
] | null | null | null | dende/platereader/plates/nunc96/__init__.py | dende/platereader | 36b9660bff6ef37990e5925284cbe37ee5093163 | [
"MIT"
] | null | null | null | WELL_PLATE_NAME = "NUNC 96"
| 14 | 27 | 0.75 | 5 | 28 | 3.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0.142857 | 28 | 1 | 28 | 28 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0.25 | 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 |
337f77ccbd333b2659332d90cf9c854dce5ec9eb | 222 | py | Python | tests/unit/pydantic_behaviour/test_condition.py | etta-trust/PolicyGlass | 72157189a9af3172e6efbdcc2050969796cfa99f | [
"MIT"
] | 49 | 2021-12-21T23:15:55.000Z | 2022-03-28T09:38:30.000Z | tests/unit/pydantic_behaviour/test_condition.py | etta-trust/PolicyGlass | 72157189a9af3172e6efbdcc2050969796cfa99f | [
"MIT"
] | 3 | 2021-12-23T22:02:02.000Z | 2022-01-10T14:16:24.000Z | tests/unit/pydantic_behaviour/test_condition.py | etta-trust/PolicyGlass | 72157189a9af3172e6efbdcc2050969796cfa99f | [
"MIT"
] | 1 | 2022-02-22T11:03:27.000Z | 2022-02-22T11:03:27.000Z | import json
from policyglass import Condition
def test_json():
subject = Condition("Key", "Operator", ["Value"])
assert subject.json() == json.dumps({"key": "Key", "operator": "Operator", "values": ["Value"]})
| 22.2 | 100 | 0.644144 | 25 | 222 | 5.68 | 0.56 | 0.15493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153153 | 222 | 9 | 101 | 24.666667 | 0.755319 | 0 | 0 | 0 | 0 | 0 | 0.220721 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.2 | false | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
33a7e0dc4854bf724a88e83c3de2342c250236a8 | 1,232 | py | Python | tests/data/meta_content_intros.py | Lexparency/lexref | bcd241bd98f40486934684956a7499fd0874a841 | [
"MIT"
] | null | null | null | tests/data/meta_content_intros.py | Lexparency/lexref | bcd241bd98f40486934684956a7499fd0874a841 | [
"MIT"
] | null | null | null | tests/data/meta_content_intros.py | Lexparency/lexref | bcd241bd98f40486934684956a7499fd0874a841 | [
"MIT"
] | null | null | null | """Meta Content presentation"""
amendment_header = [
"Amendment of Directive 85/611/EEC",
"Amendment of Directive 93/6/EEC",
"Amendment of Directive 2000/12/EC"
]
test_presentations = [
"Article 8 is replaced by the following:",
"In Article 7, paragraphs 1 and 2 are "
"replaced by the following:",
"Article 6 is amended as follows:",
"Article 2 is replaced by the following:",
"Article 1 is replaced by the following:",
"In Article 49, the following subparagraph is added "
"at the end of paragraph 2:",
"In Article 37, the following point (c) is added:",
"The following Chapter 5a is inserted after Article 72:",
"Article 73 is amended as follows:",
"(a) the title is replaced by the following:",
"(b) paragraphs 1, 2, 3 and 4 are replaced by the following:",
"In Part Two, Title I, the title of Chapter 6 is replaced by the "
"following:",
"in Article 11(15), point (b) is deleted;",
"in Article 89, the following paragraph is inserted:",
"the following Chapter is added in Title IV:",
"In Article 5 of Directive 85/611/EEC, paragraph 4 shall "
"be replaced by the following:",
"Article 2(2) shall be replaced by the following:"
]
| 38.5 | 70 | 0.669643 | 186 | 1,232 | 4.424731 | 0.349462 | 0.204131 | 0.142163 | 0.240583 | 0.383961 | 0.190765 | 0.120292 | 0 | 0 | 0 | 0 | 0.053684 | 0.228896 | 1,232 | 31 | 71 | 39.741935 | 0.812632 | 0.020292 | 0 | 0 | 0 | 0 | 0.802664 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
33bbcae0f690c0230db292a0f96061e0df1ab564 | 52 | py | Python | handlers/filters/__init__.py | bbt-t/bot-pet-project | 6b0d7862b14fe739be52d87ff8c8610a3f4548e1 | [
"Apache-2.0"
] | null | null | null | handlers/filters/__init__.py | bbt-t/bot-pet-project | 6b0d7862b14fe739be52d87ff8c8610a3f4548e1 | [
"Apache-2.0"
] | null | null | null | handlers/filters/__init__.py | bbt-t/bot-pet-project | 6b0d7862b14fe739be52d87ff8c8610a3f4548e1 | [
"Apache-2.0"
] | null | null | null | from .send_quote_filter import dp
__all__ = ['dp']
| 13 | 33 | 0.730769 | 8 | 52 | 4 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 52 | 3 | 34 | 17.333333 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0.038462 | 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 |
33be3c89ce189a5c28379cf8247dd2db7b8f1251 | 155 | py | Python | flea/db/connect.py | qianxiaoqi/crawler-flea | e241c6b3d96070ae8fd183c89cbb21ba577e3c28 | [
"MIT"
] | null | null | null | flea/db/connect.py | qianxiaoqi/crawler-flea | e241c6b3d96070ae8fd183c89cbb21ba577e3c28 | [
"MIT"
] | null | null | null | flea/db/connect.py | qianxiaoqi/crawler-flea | e241c6b3d96070ae8fd183c89cbb21ba577e3c28 | [
"MIT"
] | null | null | null | MYSQL_HOST = 'localhost'
MYSQL_DBNAME = 'spider'
MYSQL_USER = 'root'
MYSQL_PASSWD = '123456'
MYSQL_PORT = 3306
MYSQL_CHARSET = 'utf8'
MYSQL_UNICODE = True
| 19.375 | 24 | 0.754839 | 21 | 155 | 5.238095 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08209 | 0.135484 | 155 | 7 | 25 | 22.142857 | 0.738806 | 0 | 0 | 0 | 0 | 0 | 0.187097 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.142857 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
33d60144fb48af9ecdd0ce8948694ea6b96bbee0 | 31 | py | Python | magicdice/constants.py | emre/magicdice | 326512696b766248cfb8998aec5b0bd8bff393ba | [
"MIT"
] | 5 | 2019-02-26T21:59:21.000Z | 2019-05-28T06:32:06.000Z | magicdice/constants.py | emre/magicdice | 326512696b766248cfb8998aec5b0bd8bff393ba | [
"MIT"
] | null | null | null | magicdice/constants.py | emre/magicdice | 326512696b766248cfb8998aec5b0bd8bff393ba | [
"MIT"
] | null | null | null | MAGICDICE_ACCOUNT = "magicdice" | 31 | 31 | 0.83871 | 3 | 31 | 8.333333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.064516 | 31 | 1 | 31 | 31 | 0.862069 | 0 | 0 | 0 | 0 | 0 | 0.28125 | 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 |
33deb5ccf5f378fbeddd2da90859499ff23e5ae7 | 294 | py | Python | notto/notto/settings/secret.py | renatoliveira/notto | da0fb1d71aa1fc16c97f2a444380db17f7d0ef4c | [
"MIT"
] | 28 | 2017-12-05T12:14:27.000Z | 2021-11-02T02:27:16.000Z | notto/notto/settings/secret.py | renatoliveira/notto | da0fb1d71aa1fc16c97f2a444380db17f7d0ef4c | [
"MIT"
] | 29 | 2017-12-05T11:55:21.000Z | 2018-07-23T17:00:47.000Z | notto/notto/settings/secret.py | renatoliveira/notto | da0fb1d71aa1fc16c97f2a444380db17f7d0ef4c | [
"MIT"
] | 15 | 2017-12-07T09:17:18.000Z | 2020-11-24T21:15:04.000Z | """
Generates a random key.
"""
import string
import random
def generate():
"""
Generates the key.
"""
uni = string.ascii_letters + string.digits + string.punctuation
key = ''.join([random.SystemRandom().choice(uni) for i in range(random.randint(45, 50))])
return key
| 19.6 | 93 | 0.64966 | 37 | 294 | 5.135135 | 0.675676 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017094 | 0.204082 | 294 | 14 | 94 | 21 | 0.794872 | 0.142857 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
33ef6cf535e87185e368bac4565d586e35c7d1ef | 430 | py | Python | saleor/graphql/core/fields.py | probablysalty/bonsai | 06e74acd890ac53e9332aef13a8b47b88e13723c | [
"BSD-3-Clause"
] | 1 | 2018-07-15T18:52:31.000Z | 2018-07-15T18:52:31.000Z | saleor/graphql/core/fields.py | probablysalty/bonsai | 06e74acd890ac53e9332aef13a8b47b88e13723c | [
"BSD-3-Clause"
] | 3 | 2020-03-24T16:14:11.000Z | 2021-02-02T21:55:00.000Z | saleor/graphql/core/fields.py | probablysalty/bonsai | 06e74acd890ac53e9332aef13a8b47b88e13723c | [
"BSD-3-Clause"
] | null | null | null | import graphene
from django_prices.models import MoneyField, TaxedMoneyField
from graphene_django.converter import convert_django_field
from .types import Money, TaxedMoney
@convert_django_field.register(TaxedMoneyField)
def convert_field_tax(field, registry=None):
return graphene.Field(TaxedMoney)
@convert_django_field.register(MoneyField)
def convert_field_tax(field, registry=None):
return graphene.Field(Money)
| 26.875 | 60 | 0.837209 | 54 | 430 | 6.444444 | 0.37037 | 0.112069 | 0.155172 | 0.16092 | 0.517241 | 0.310345 | 0.310345 | 0.310345 | 0.310345 | 0.310345 | 0 | 0 | 0.095349 | 430 | 15 | 61 | 28.666667 | 0.894602 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 0.8 | 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 | 1 | 0 | 0 | 0 | 3 |
33fe74deab41475d03a00437f7cfbe54412b49fc | 264 | py | Python | messenger/helper/messaging/postback.py | gellowmellow/python-messenger-bot | 01aaba569add8a6ed1349fc4774e3c7e64439dc0 | [
"MIT"
] | null | null | null | messenger/helper/messaging/postback.py | gellowmellow/python-messenger-bot | 01aaba569add8a6ed1349fc4774e3c7e64439dc0 | [
"MIT"
] | null | null | null | messenger/helper/messaging/postback.py | gellowmellow/python-messenger-bot | 01aaba569add8a6ed1349fc4774e3c7e64439dc0 | [
"MIT"
] | null | null | null | class Postback:
def __init__(self, **kwargs):
self.title = ''
self.payload = ''
return super().__init__(**kwargs)
def json_to_message(self, json):
self.title = json['title']
self.payload = json['payload'] | 24 | 41 | 0.549242 | 29 | 264 | 4.689655 | 0.482759 | 0.132353 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.30303 | 264 | 11 | 42 | 24 | 0.733696 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d507881483661959ba89bed48e141e1d536e8d3d | 298 | py | Python | ModelFormsDemo/modelforms/models.py | KiralyTamas/Django | d0df4bcffa499c25602e2672c230226440879f6d | [
"MIT"
] | null | null | null | ModelFormsDemo/modelforms/models.py | KiralyTamas/Django | d0df4bcffa499c25602e2672c230226440879f6d | [
"MIT"
] | null | null | null | ModelFormsDemo/modelforms/models.py | KiralyTamas/Django | d0df4bcffa499c25602e2672c230226440879f6d | [
"MIT"
] | null | null | null | from django.db import models
class Project(models.Model):
startDate=models.DateField()
endDate=models.DateField()
name=models.CharField(max_length=80)
assignedTo=models.CharField(max_length=80)
priority=models.IntegerField()
def __str__(self):
return self.name | 27.090909 | 46 | 0.721477 | 36 | 298 | 5.805556 | 0.638889 | 0.143541 | 0.172249 | 0.229665 | 0.248804 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01626 | 0.174497 | 298 | 11 | 47 | 27.090909 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.111111 | 0.111111 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
1d1d488b653cf16e6da5a3a18587ef6ce7411759 | 318 | py | Python | exe1102_city_functions.py | juniorpedroso/Curso-Intensivo-de-Python | 4357e313660e77f5e43bb516c1b19fd979de5070 | [
"MIT"
] | null | null | null | exe1102_city_functions.py | juniorpedroso/Curso-Intensivo-de-Python | 4357e313660e77f5e43bb516c1b19fd979de5070 | [
"MIT"
] | null | null | null | exe1102_city_functions.py | juniorpedroso/Curso-Intensivo-de-Python | 4357e313660e77f5e43bb516c1b19fd979de5070 | [
"MIT"
] | null | null | null | def nome_cidade_pais(cidade, pais, populacao=''):
"""[Junta o nome de uma cidade e o de um país de forma elegante]
"""
if populacao:
cidade_pais = f'{cidade.title()}, {pais.title()} - população {populacao}'
else:
cidade_pais = f'{cidade.title()}, {pais.title()}'
return cidade_pais
| 35.333333 | 81 | 0.622642 | 43 | 318 | 4.488372 | 0.465116 | 0.259067 | 0.11399 | 0.176166 | 0.321244 | 0.321244 | 0.321244 | 0 | 0 | 0 | 0 | 0 | 0.22327 | 318 | 8 | 82 | 39.75 | 0.781377 | 0.191824 | 0 | 0 | 0 | 0 | 0.357724 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 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 |
1d579f36ccb816d80c4352a9d8476fe192161790 | 135 | py | Python | output/models/sun_data/elem_decl/type_def/type_def00203m/type_def00203m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/sun_data/elem_decl/type_def/type_def00203m/type_def00203m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/sun_data/elem_decl/type_def/type_def00203m/type_def00203m_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.sun_data.elem_decl.type_def.type_def00203m.type_def00203m_xsd.type_def00203m import Root
__all__ = [
"Root",
]
| 22.5 | 107 | 0.8 | 20 | 135 | 4.85 | 0.7 | 0.402062 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123967 | 0.103704 | 135 | 5 | 108 | 27 | 0.677686 | 0 | 0 | 0 | 0 | 0 | 0.02963 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 |
1d62e0e8806f2d13d1b0f0888a172a4c656e0247 | 374 | py | Python | qunetsim/objects/__init__.py | HalcyonicFalconX/QuNetSim | 24239c3881f1d14c6a10e466c2f833b3dc0bd35f | [
"MIT"
] | null | null | null | qunetsim/objects/__init__.py | HalcyonicFalconX/QuNetSim | 24239c3881f1d14c6a10e466c2f833b3dc0bd35f | [
"MIT"
] | null | null | null | qunetsim/objects/__init__.py | HalcyonicFalconX/QuNetSim | 24239c3881f1d14c6a10e466c2f833b3dc0bd35f | [
"MIT"
] | 1 | 2020-09-17T15:43:34.000Z | 2020-09-17T15:43:34.000Z | from .classical_storage import ClassicalStorage
from .logger import Logger
from .message import Message
from .packet import Packet
from .quantum_storage import QuantumStorage
from .qubit import Qubit
from .quantum_connection import Q_Connection
from .classical_connection import C_Connection
from .routing_packet import RoutingPacket
from .daemon_thread import DaemonThread
| 34 | 47 | 0.86631 | 48 | 374 | 6.583333 | 0.395833 | 0.082278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106952 | 374 | 10 | 48 | 37.4 | 0.946108 | 0 | 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 |
1d9414d4396be0335f5a2becaf3d1555e6f1d229 | 2,483 | py | Python | test/solution_tests/CHK2/test_chk2.py | DPNT-Sourcecode/CHK-qoml01 | 226d9845aebf44918998179172dc76527ddb9a3c | [
"Apache-2.0"
] | null | null | null | test/solution_tests/CHK2/test_chk2.py | DPNT-Sourcecode/CHK-qoml01 | 226d9845aebf44918998179172dc76527ddb9a3c | [
"Apache-2.0"
] | null | null | null | test/solution_tests/CHK2/test_chk2.py | DPNT-Sourcecode/CHK-qoml01 | 226d9845aebf44918998179172dc76527ddb9a3c | [
"Apache-2.0"
] | null | null | null | import unittest
from solutions.CHK import checkout_solution
class TestCHK(unittest.TestCase):
def test_removal_of_freebie(self):
free = [(2, 'B', 1)]
self.assertEquals(checkout_solution.remove_freebies_test("AAAAAEEBAAABB", 'E', free), "AAAAAEEAAABB")
def test_check_mix_free(self):
self.assertEquals(checkout_solution.checkout("AAAAAEEBAAABB"), 455)
def test_check_product_list(self):
self.assertEquals(checkout_solution.checkout("HHHHHHHHHHHH"), 100)
def test_check_product_list_freebies(self):
# 3 N's get you a free M
self.assertEquals(checkout_solution.checkout("NNNM"), 120)
def test_check_product_list_freebies_and_offers(self):
# 3 N's get you a free M
# P worth 50, and 5 for 200 (so 6 = 250)
self.assertEquals(checkout_solution.checkout("NNNMPPPPPP"), 370)
def test_check_product_list_no_offers_no_freebies(self):
# a J is worth 60
self.assertEquals(checkout_solution.checkout("J"), 60)
def test_remove_group_discount_priority(self):
self.assertEquals(checkout_solution.remove_products_with_priority("STXYZ", "ZYTSX", 1), "STXY")
def test_remove_group_discount_priority_multiple(self):
self.assertEquals(checkout_solution.remove_products_with_priority("ZSTXYZ", "ZYTSX", 2), "STXY")
def test_remove_group_discount_priority_limit(self):
self.assertEquals(checkout_solution.remove_products_with_priority("ZSTXYZABC", "ZYTSX", 8), "ABC")
def test_check_special_group_offers(self):
sgo = ("STXYZ", 3, 45)
self.assertEquals(checkout_solution.remove_special_group("STXYZ", sgo), (45, "YZ"))
def test_check_special_group_offers_mult(self):
sgo = ("ZYTSX", 3, 45)
self.assertEquals(checkout_solution.remove_special_group("ZZAZYYBYTTCT", sgo), (135, "ABC"))
def test_checkout_with_group_discount(self):
self.assertEquals(checkout_solution.checkout("ZZAZYYBYTTCT"), 235)
def test_checkout_with_group_discount_long(self):
self.assertEquals(checkout_solution.checkout("ABCDEFGHIJKLMNOPQRSTUVW"), 795)
def test_checkout_with_group_discount_updates(self):
self.assertEquals(checkout_solution.checkout("KK"), 120)
def test_checkout_with_group_discount_updates(self):
self.assertEquals(checkout_solution.checkout("KKK"), 190)
if __name__ == '__main__':
unittest.main()
| 40.048387 | 110 | 0.711639 | 305 | 2,483 | 5.442623 | 0.298361 | 0.154217 | 0.216867 | 0.289157 | 0.706024 | 0.583133 | 0.344578 | 0.298795 | 0.298795 | 0.1 | 0 | 0.0276 | 0.182843 | 2,483 | 61 | 111 | 40.704918 | 0.790537 | 0.040274 | 0 | 0.052632 | 0 | 0 | 0.083297 | 0.009927 | 0 | 0 | 0 | 0 | 0.394737 | 1 | 0.394737 | false | 0 | 0.052632 | 0 | 0.473684 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1d97f330d75c30625b6f2f6b5c9822b9c155112d | 874 | py | Python | radiuslib/httpclient.py | online2311/Radiuslib | 0160bde250457b18bd82deefc808e4d3119d362f | [
"MIT"
] | null | null | null | radiuslib/httpclient.py | online2311/Radiuslib | 0160bde250457b18bd82deefc808e4d3119d362f | [
"MIT"
] | null | null | null | radiuslib/httpclient.py | online2311/Radiuslib | 0160bde250457b18bd82deefc808e4d3119d362f | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#coding=utf-8
import treq
from twisted.internet import reactor
from twisted.internet import defer
from twisted.web.iweb import IBodyProducer
from zope.interface import implements
from twisted.web.client import HTTPConnectionPool
pool = HTTPConnectionPool(reactor)
class StringProducer(object):
implements(IBodyProducer)
def __init__(self, body):
self.body = body
self.length = len(body)
def startProducing(self, consumer):
consumer.write(self.body)
return defer.succeed(None)
def pauseProducing(self):
pass
def stopProducing(self):
pass
def get(url,**kwargs):
return treq.get(url, pool=pool,data_to_body_producer=StringProducer,**kwargs)
def post(url,data=None,**kwargs):
return treq.post(url, data=data, pool=pool,data_to_body_producer=StringProducer,**kwargs)
| 21.85 | 93 | 0.726545 | 111 | 874 | 5.630631 | 0.432432 | 0.0704 | 0.0608 | 0.08 | 0.1472 | 0.1472 | 0.1472 | 0.1472 | 0 | 0 | 0 | 0.001387 | 0.175057 | 874 | 39 | 94 | 22.410256 | 0.865465 | 0.036613 | 0 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0.086957 | 0.26087 | 0.086957 | 0.695652 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.