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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12d8d16ec657f0f0816c8c741ba8c778984ccd1c | 291 | py | Python | BitSrunLogin/encryption/srun_md5.py | qingchenkanlu/BIT-srun-login | 3423253da75b6acb46f34df2633c6be1d51b262c | [
"MIT"
] | 85 | 2020-04-15T02:59:57.000Z | 2022-03-30T15:27:48.000Z | BitSrunLogin/encryption/srun_md5.py | qingchenkanlu/BIT-srun-login | 3423253da75b6acb46f34df2633c6be1d51b262c | [
"MIT"
] | 6 | 2020-08-01T02:32:23.000Z | 2021-09-28T13:30:49.000Z | BitSrunLogin/encryption/srun_md5.py | qingchenkanlu/BIT-srun-login | 3423253da75b6acb46f34df2633c6be1d51b262c | [
"MIT"
] | 40 | 2020-10-09T13:53:40.000Z | 2022-03-30T07:25:42.000Z | import hmac
import hashlib
def get_md5(password,token):
return hmac.new(token.encode(), password.encode(), hashlib.md5).hexdigest()
if __name__ == '__main__':
password="15879684798qq"
token="711ab370231392679fe06523b119a8fe096f5ed9bd206b4de8d7b5b994bbc3e5"
print(get_md5(password,token)) | 36.375 | 76 | 0.810997 | 31 | 291 | 7.290323 | 0.580645 | 0.053097 | 0.123894 | 0.168142 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202952 | 0.068729 | 291 | 8 | 77 | 36.375 | 0.630996 | 0 | 0 | 0 | 0 | 0 | 0.291096 | 0.219178 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.5 | 0.25 | 0.125 | 0.5 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 5 |
12e36698015a4e3eeb719e7be00cddaf4038ca2e | 2,525 | py | Python | tests/cppmodel/test_types.py | FFIG/ffig | b45060d5835292a74661678872427e3eb5a89d0c | [
"MIT"
] | 31 | 2017-02-03T20:12:11.000Z | 2021-04-14T17:39:56.000Z | tests/cppmodel/test_types.py | FFIG/ffig | b45060d5835292a74661678872427e3eb5a89d0c | [
"MIT"
] | 246 | 2017-02-03T17:51:24.000Z | 2019-02-14T10:30:19.000Z | tests/cppmodel/test_types.py | FFIG/ffig | b45060d5835292a74661678872427e3eb5a89d0c | [
"MIT"
] | 9 | 2017-03-05T20:28:37.000Z | 2019-08-28T19:48:22.000Z | from util import get_tu
import ffig.cppmodel
from ffig.clang.cindex import TypeKind
from nose.tools import assert_equals
def test_pointer_type():
source = "double* pd();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
f = model.functions[0]
assert f.return_type.kind == TypeKind.POINTER
assert not f.return_type.is_const
assert f.return_type.pointee.kind == TypeKind.DOUBLE
assert not f.return_type.pointee.is_const
def test_const_pointer_to_double_type():
source = "double* const cpd();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
f = model.functions[0]
assert f.return_type.kind == TypeKind.POINTER
assert f.return_type.is_const
assert f.return_type.pointee.kind == TypeKind.DOUBLE
assert not f.return_type.pointee.is_const
def test_const_pointer_to_const_double_type():
source = "const double* const cpcd();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
functions = model.functions
f = model.functions[0]
assert f.return_type.kind == TypeKind.POINTER
assert f.return_type.is_const
assert f.return_type.pointee.kind == TypeKind.DOUBLE
assert f.return_type.pointee.is_const
def test_pointer_to_pointer_type():
source = "double** ppd();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
f = model.functions[0]
assert f.return_type.kind == TypeKind.POINTER
assert f.return_type.is_pointer
assert f.return_type.pointee.kind == TypeKind.POINTER
assert f.return_type.pointee.is_pointer
assert f.return_type.pointee.pointee.kind == TypeKind.DOUBLE
def test_pointer_to_record_type():
source = "class A{}; A* pA();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
f = model.functions[0]
assert f.return_type.kind == TypeKind.POINTER
assert f.return_type.is_pointer
assert f.return_type.pointee.kind == TypeKind.RECORD
def test_reference_to_record_type():
source = "class A{}; A& pA();"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
f = model.functions[0]
assert f.return_type.kind == TypeKind.LVALUEREFERENCE
assert not f.return_type.is_pointer
assert f.return_type.is_reference
assert f.return_type.pointee.kind == TypeKind.RECORD
def test_string_representation():
source = "class A{};"
tu = get_tu(source, 'cpp')
model = ffig.cppmodel.Model(tu)
c = model.classes[0]
assert_equals(str(c), "<cppmodel.Class A>")
| 26.861702 | 64 | 0.700198 | 370 | 2,525 | 4.583784 | 0.127027 | 0.099057 | 0.15566 | 0.200472 | 0.758255 | 0.758255 | 0.745873 | 0.712264 | 0.693396 | 0.67158 | 0 | 0.003391 | 0.182574 | 2,525 | 93 | 65 | 27.150538 | 0.818314 | 0 | 0 | 0.553846 | 0 | 0 | 0.064158 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.107692 | false | 0 | 0.061538 | 0 | 0.169231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 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 | 5 |
12e8118d0a35978d5b3fd4f24c9e50d5ae62cd23 | 50 | py | Python | firewall/__init__.py | search5/sech-firewall | 7ec599562dc54fbf79fc4cf6502ca726ce1863b1 | [
"MIT"
] | 2 | 2015-07-29T15:13:52.000Z | 2016-12-28T14:49:27.000Z | sech-firewall.py | search5/minafw | 7ec599562dc54fbf79fc4cf6502ca726ce1863b1 | [
"MIT"
] | null | null | null | sech-firewall.py | search5/minafw | 7ec599562dc54fbf79fc4cf6502ca726ce1863b1 | [
"MIT"
] | null | null | null | # Hello world python program
print "Hello World!"; | 25 | 28 | 0.76 | 7 | 50 | 5.428571 | 0.714286 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14 | 50 | 2 | 29 | 25 | 0.883721 | 0.52 | 0 | 0 | 0 | 0 | 0.521739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
4201cb33a9e5f5290589490002614be1d946a4ec | 5,700 | py | Python | MDAF/TestFunctions/Leon.py | ejeanboris/MDAF_COMPLETE | e99c9762ea7304acc0a6795d33a55449a9800d89 | [
"CC0-1.0"
] | 1 | 2020-12-30T23:04:51.000Z | 2020-12-30T23:04:51.000Z | MDAF/TestFunctions/Leon.py | ejeanboris/MDAF_COMPLETE | e99c9762ea7304acc0a6795d33a55449a9800d89 | [
"CC0-1.0"
] | null | null | null | MDAF/TestFunctions/Leon.py | ejeanboris/MDAF_COMPLETE | e99c9762ea7304acc0a6795d33a55449a9800d89 | [
"CC0-1.0"
] | null | null | null | #Import math library
def main(args):
'''
>>> (main([1,1]) + 0) < 0.001
True
#_# dimmensions: 2
#_# upper: 1.2
#_# lower: -1.2
#_# minimum: [1, 1]
#_# opti: 0
#_# cm_angle: array([[2.10542603e-01], [2.72828609e-02], [2.13436119e-01], [2.65579669e-02], [1.51992391e+02], [2.94589423e+01], [1.70644204e-01], [1.20347799e-01], [0.00000000e+00], [4.30000000e-02]])
#_# cm_conv: array([[0.15384615], [0.03846154], [0.96153846], [0.03846154], [0. ], [0.015 ]])
#_# cm_grad: array([[0.61595303], [0.18604517], [0. ], [0.028 ]])
#_# ela_conv: array([[ 1.00000000e+00], [ 0.00000000e+00], [-3.22804188e+01], [ 3.22804188e+01], [ 1.00000000e+03], [ 5.10000000e-02]])
#_# ela_curv: array([[1.78279061e+00], [1.16451891e+02], [2.52239097e+02], [2.38088464e+02], [3.62255731e+02], [6.55510933e+02], [1.67106250e+02], [0.00000000e+00], [1.00002731e+00], [1.00459719e+00], [1.20212429e+00], [1.01160307e+00], [1.02140902e+00], [2.03164862e+01], [1.54951271e+00], [0.00000000e+00], [4.68926193e+01], [4.01827782e+02], [3.98899501e+02], [4.02008357e+02], [4.02157224e+02], [4.22544636e+02], [2.68456809e+01], [0.00000000e+00], [8.40000000e+03], [3.89000000e-01]])
#_# ela_distr: array([[ 1.52929351], [ 1.74544029], [12. ], [ 0. ], [ 0.029 ]])
#_# ela_local: array([[9.00000000e+01], [9.00000000e-01], [2.99314186e-10], [4.70682836e-02], [1.10000000e-01], [1.00000000e-02], [1.00000000e-02], [4.50000000e+01], [5.50000000e+01], [5.84500000e+01], [6.00000000e+01], [6.00000000e+01], [9.00000000e+01], [5.80382145e+00], [5.93500000e+03], [1.44000000e-01]])
#_# ela_meta: array([[-5.56482247e-03], [ 9.54844057e+01], [ 2.98215620e-01], [ 3.66171877e+00], [ 1.22787625e+01], [ 7.03397803e-01], [ 2.63864648e-01], [ 1.04934975e+00], [ 1.00000000e+00], [ 0.00000000e+00], [ 6.00000000e-03]])
#_# basic: array([[ 2.00000000e+00], [ 5.00000000e+02], [-1.20000000e+00], [-1.20000000e+00], [ 1.20000000e+00], [ 1.20000000e+00], [ 1.49779966e-02], [ 5.36822922e+02], [ 6.00000000e+00], [ 6.00000000e+00], [ 3.60000000e+01], [ 3.60000000e+01], [ 1.00000000e+00], [ 0.00000000e+00], [ 0.00000000e+00]])
#_# disp: array([[ 0.37953991], [ 0.53302129], [ 0.70960306], [ 0.87624411], [ 0.34748594], [ 0.46859688], [ 0.63333187], [ 0.78061069], [-0.77797041], [-0.58552617], [-0.36411726], [-0.15517262], [-0.80323673], [-0.65415066], [-0.45136393], [-0.27006553], [ 0. ], [ 0.009 ]])
#_# limo: array([[ 2.39839104e+00], [ 1.01208570e-01], [ 2.21689468e+02], [ 1.62392144e+02], [-9.99739218e-01], [-9.27939037e-01], [ 1.14453736e+00], [ 3.45698635e-01], [ 1.00869209e+00], [ 1.01966929e+00], [ 1.96104882e+02], [ 7.13420999e-01], [ 0.00000000e+00], [ 2.50000000e-02]])
#_# nbc: array([[ 0.6833929 ], [ 0.91742318], [ 0.47692233], [ 0.13387147], [-0.1520694 ], [ 0. ], [ 0.026 ]])
#_# pca: array([[1. ], [1. ], [0.33333333], [1. ], [0.51039485], [0.51039466], [0.99992363], [0.3439774 ], [0. ], [0.002 ]])
#_# gcm: array([[1. ], [0.02777778], [0.97222222], [0. ], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [0.02777778], [0. ], [0.02 ], [2. ], [0.05555556], [0.94444444], [0.83333333], [0.48352763], [0.5 ], [0.5 ], [0.51647237], [0.02329546], [0.08333333], [0.08333333], [0.08333333], [0.08333333], [0. ], [0.16666667], [0.44444444], [0.5 ], [0.5 ], [0.55555556], [0.07856742], [1. ], [0.48352763], [0.02777778], [0. ], [0.02 ], [1. ], [0.02777778], [0.97222222], [0. ], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [1. ], [1. ], [1. ], [ nan], [1. ], [1. ], [0.02777778], [0. ], [0.022 ]])
#_# ic: array([[ 0.63092359], [ 2.72772773], [38.59993618], [ 2.02702703], [ 0.33935743], [ 0. ], [ 0.147 ]])
#_# Represented: 1
'''
for x in args:
if x < -1.2 or x > 1.2:
return 0
return (100*(args[1]-args[0])**2)+(1-args[0])**2
if __name__ == "__main__":
import doctest
doctest.testmod() | 132.55814 | 1,511 | 0.388947 | 599 | 5,700 | 3.639399 | 0.307179 | 0.022936 | 0.019266 | 0.014679 | 0.161009 | 0.122936 | 0.089908 | 0.072936 | 0.072936 | 0.072936 | 0 | 0.513173 | 0.400702 | 5,700 | 43 | 1,512 | 132.55814 | 0.125 | 0.970526 | 0 | 0 | 0 | 0 | 0.03653 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
4241ac929e82553e62d1aefd10eb74ac3dc2ef91 | 153 | py | Python | rime/util/__init__.py | matsu7874/rime | f6fd81a65dd4128d0385b0e1a11b7f7f03b342eb | [
"MIT"
] | 31 | 2017-02-20T05:04:06.000Z | 2022-01-21T09:05:17.000Z | rime/util/__init__.py | matsu7874/rime | f6fd81a65dd4128d0385b0e1a11b7f7f03b342eb | [
"MIT"
] | 62 | 2017-02-14T10:10:06.000Z | 2021-05-17T00:00:01.000Z | rime/util/__init__.py | matsu7874/rime | f6fd81a65dd4128d0385b0e1a11b7f7f03b342eb | [
"MIT"
] | 21 | 2017-02-13T16:41:42.000Z | 2021-08-19T00:34:49.000Z | #!/usr/bin/python
"""Provides utility modules of Rime.
Util package contains utility modules not specific to Rime and reusable in
other softwares.
"""
| 19.125 | 74 | 0.764706 | 22 | 153 | 5.318182 | 0.863636 | 0.239316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150327 | 153 | 7 | 75 | 21.857143 | 0.9 | 0.934641 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
425f4f6cfac9454b8909ee6b5bc3282837130a34 | 89 | py | Python | ermaket/api/erd/rd_entities/__init__.py | SqrtMinusOne/ERMaket_Experiment | c4a7b61651edd15a619d9b690e2aaeaab4de282d | [
"Apache-2.0"
] | null | null | null | ermaket/api/erd/rd_entities/__init__.py | SqrtMinusOne/ERMaket_Experiment | c4a7b61651edd15a619d9b690e2aaeaab4de282d | [
"Apache-2.0"
] | null | null | null | ermaket/api/erd/rd_entities/__init__.py | SqrtMinusOne/ERMaket_Experiment | c4a7b61651edd15a619d9b690e2aaeaab4de282d | [
"Apache-2.0"
] | null | null | null | from .column import *
from .table import *
from .fk import *
from .relationship import *
| 17.8 | 27 | 0.730337 | 12 | 89 | 5.416667 | 0.5 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179775 | 89 | 4 | 28 | 22.25 | 0.890411 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
42794bbf39225c3a5b383508fcbe8eeee61b9f46 | 110 | py | Python | oreilly/count_inversions.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | oreilly/count_inversions.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | oreilly/count_inversions.py | NigrumAquila/py_checkio | df437c2c3ad325d84714665000e3299a70e91f32 | [
"MIT"
] | null | null | null | def count_inversion(sequence):
return sum(sum(m<n for m in sequence[i+1:]) for i,n in enumerate(sequence)) | 55 | 79 | 0.727273 | 21 | 110 | 3.761905 | 0.619048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010526 | 0.136364 | 110 | 2 | 79 | 55 | 0.821053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
429731211ca345c3b5f0ccaf1619e76ea0eb70c7 | 57 | py | Python | wikitweets/__init__.py | iguanaonmystack/wikitweets | 4fc97b34cc9204ca78bf34173801e7d7f81f3018 | [
"MIT"
] | 3 | 2016-02-02T15:51:14.000Z | 2019-07-06T21:05:13.000Z | wikitweets/__init__.py | flexo/wikitweets | 4fc97b34cc9204ca78bf34173801e7d7f81f3018 | [
"MIT"
] | null | null | null | wikitweets/__init__.py | flexo/wikitweets | 4fc97b34cc9204ca78bf34173801e7d7f81f3018 | [
"MIT"
] | 1 | 2020-11-12T17:27:44.000Z | 2020-11-12T17:27:44.000Z | "wikitweets - post edited wikipedia articles to twitter"
| 28.5 | 56 | 0.807018 | 7 | 57 | 6.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140351 | 57 | 1 | 57 | 57 | 0.938776 | 0.947368 | 0 | 0 | 0 | 0 | 0.947368 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
429a861d6ec47604670a07b26dbd2818f2226b0c | 204 | py | Python | figma_export/figma/__init__.py | RomanAliyev/figma-export | 2c61f2e0c72b42e40a50a31c71422f24a1bca317 | [
"MIT"
] | 23 | 2019-01-04T06:48:06.000Z | 2022-03-25T08:12:03.000Z | figma_export/figma/__init__.py | RomanAliyev/figma-export | 2c61f2e0c72b42e40a50a31c71422f24a1bca317 | [
"MIT"
] | 2 | 2019-04-16T18:33:56.000Z | 2021-05-08T19:35:19.000Z | figma_export/figma/__init__.py | RomanAliyev/figma-export | 2c61f2e0c72b42e40a50a31c71422f24a1bca317 | [
"MIT"
] | 1 | 2020-11-30T18:10:15.000Z | 2020-11-30T18:10:15.000Z | from .FigmaClient import FigmaClient
from .FigmaService import FigmaService
from .FigmaDocument import FigmaDocument
from .FigmaNode import FigmaNode
from .FigmaRenderingResult import FigmaRenderingResult | 40.8 | 54 | 0.882353 | 20 | 204 | 9 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093137 | 204 | 5 | 54 | 40.8 | 0.972973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
429a9d56a3ae51dbadf3ef7b1ead78a2b08a1604 | 207 | py | Python | Modules/train/_pl/tools.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | Modules/train/_pl/tools.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | Modules/train/_pl/tools.py | iheb-brini/fitness-lab | 2d82d7a2ecba27f535cda880865e6d9ed446eac5 | [
"MIT"
] | null | null | null | import pytorch_lightning as pl
from .constants import TRAINER_PARAMS
def train(net,train_iter,test_iter,params=TRAINER_PARAMS):
trainer = pl.Trainer(**params)
trainer.fit(net, train_iter, test_iter) | 34.5 | 58 | 0.792271 | 31 | 207 | 5.064516 | 0.483871 | 0.248408 | 0.152866 | 0.203822 | 0.254777 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115942 | 207 | 6 | 59 | 34.5 | 0.857924 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
42b06fda4e24cb8076704fc1a4885f20cee71da8 | 239 | py | Python | tests/integration/modules/test_state_jinja_filters.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 9,425 | 2015-01-01T05:59:24.000Z | 2022-03-31T20:44:05.000Z | tests/integration/modules/test_state_jinja_filters.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 33,507 | 2015-01-01T00:19:56.000Z | 2022-03-31T23:48:20.000Z | tests/integration/modules/test_state_jinja_filters.py | markgras/salt | d66cd3c935533c63870b83228b978ce43e0ef70d | [
"Apache-2.0"
] | 5,810 | 2015-01-01T19:11:45.000Z | 2022-03-31T02:37:20.000Z | from tests.support.case import ModuleCase
from tests.support.jinja_filters import JinjaFiltersTest
class StateModuleJinjaFiltersTest(ModuleCase, JinjaFiltersTest):
"""
testing Jinja filters are available via state system
"""
| 26.555556 | 64 | 0.794979 | 25 | 239 | 7.56 | 0.68 | 0.095238 | 0.169312 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146444 | 239 | 8 | 65 | 29.875 | 0.926471 | 0.217573 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
35fe97ee341a5c5c3ee55335159dd6646b2e2f04 | 91 | py | Python | Knight-Rank/DAY-6/118B.py | rohansaini886/Peer-Programming-Hub-CP-Winter_Camp | d27fb6aa7e726e6d2cb95270c9e644d38d64dd1c | [
"MIT"
] | 2 | 2021-12-09T18:07:46.000Z | 2022-01-26T16:51:18.000Z | Knight-Rank/DAY-6/118B.py | rohansaini886/Peer-Programming-Hub-CP-Winter_Camp | d27fb6aa7e726e6d2cb95270c9e644d38d64dd1c | [
"MIT"
] | null | null | null | Knight-Rank/DAY-6/118B.py | rohansaini886/Peer-Programming-Hub-CP-Winter_Camp | d27fb6aa7e726e6d2cb95270c9e644d38d64dd1c | [
"MIT"
] | null | null | null | r=range;N=int(input())
for i in[*r(N),*r(N,-1,-1)]:print(*' '*(N-i),*r(i+1),*r(i-1,-1,-1))
| 30.333333 | 67 | 0.461538 | 25 | 91 | 1.68 | 0.4 | 0.142857 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0.054945 | 91 | 2 | 68 | 45.5 | 0.418605 | 0 | 0 | 0 | 0 | 0 | 0.010989 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
c42376b3e309858cc9254caa7013998094061ad4 | 44,269 | py | Python | tests/test_indexcreator_exec.py | nickmasster/codernitydb3 | 0799ae0a1e9c08613d8400ca6a9d8709a0ed27c1 | [
"Apache-2.0"
] | 7 | 2020-08-13T01:04:43.000Z | 2022-01-16T21:56:36.000Z | tests/test_indexcreator_exec.py | nickmasster/codernitydb3 | 0799ae0a1e9c08613d8400ca6a9d8709a0ed27c1 | [
"Apache-2.0"
] | null | null | null | tests/test_indexcreator_exec.py | nickmasster/codernitydb3 | 0799ae0a1e9c08613d8400ca6a9d8709a0ed27c1 | [
"Apache-2.0"
] | 5 | 2020-10-17T21:55:35.000Z | 2022-02-28T22:55:15.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011-2013 Codernity (http://codernity.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This test are for checking Parser only, using simple exec isn't exactly what database does with simple index code,
# they are used only because they allow handy check of correctness of
# generated code
import os
import uuid
from hashlib import md5
from py.test import raises
from pytest import fixture
from codernitydb3.indexcreator import Parser, IndexCreatorValueException, IndexCreatorFunctionException
from codernitydb3.database import Database, RecordNotFound
from codernitydb3.hash_index import HashIndex
from codernitydb3.tree_index import TreeBasedIndex
from codernitydb3.tree_index import MultiTreeBasedIndex
from codernitydb3.hash_index import MultiHashIndex
@fixture
def p(request):
p = Parser()
return p
def simple_compare(s, args_mkv, args_mk):
p = Parser()
n = "_" + uuid.uuid4().hex
exec(p.parse(s, n)[1], globals())
# n2 = p.parse(s)
# exec n2 in globals()
# n2 = n2.splitlines()[1][2:]
for a, o in args_mkv:
assert globals()[n]('test', 'test').make_key_value(a) == o
# assert globals()[n2]('test','test').make_key_value(a) == o
for a, o in args_mk:
assert globals()[n]('test', 'test').make_key(a) == o
# assert globals()[n2]('test','test').make_key(a) == o
# special comparator for comparing lists
def simple_compare_without_order(s, args_mkv, args_mk):
p = Parser()
n = "_" + uuid.uuid4().hex
exec(p.parse(s, n)[1], globals())
for a, o in args_mkv:
a, b = globals()[n]('test', 'test').make_key_value(a)
if a is not None:
a = sorted(a)
if b is not None:
b = sorted(b)
assert (a, b) == o
for a, o in args_mk:
assert globals()[n]('test', 'test').make_key(a) == o
class TestIndexCreatorRightInput:
def test_2nd_arg_of_mkv(self, p):
s = """
name = "s"
type = 'HashIndex'
key_format = I
hash_lim = 1
make_key_value:
md5(a),{'a':a}
make_key:
md5(a)"""
s2 = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key:
md5(a)
make_key_value:
a,{'a':a}
"""
s3 = """
name = s3
type = HashIndex
key_format = I
hash_lim = 1
make_key:
md5(a)
make_key_value:
a,a"""
s4 = """
name = s4
type = HashIndex
key_format = I
hash_lim = 1
make_key:
md5(a)
make_key_value:
md5(b),a"""
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), {
'a': b'a'
})), ({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), {
'a': b'qwerty'
}))], [({
'a': b'e'
}, md5(b'e').digest()), ({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s2, [({
'a': 'a'
}, ('a', {
'a': 'a'
})), ({
'a': 'qwerty'
}, ('qwerty', {
'a': 'qwerty'
}))], [({
'a': b'e'
}, md5(b'e').digest()), ({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s3, [({
'a': 'a',
'b': 'b'
}, ('a', 'a')), ({
'a': 'qwerty',
'b': 'b'
}, ('qwerty', 'qwerty'))], [({
'a': b'e'
}, md5(b'e').digest()), ({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s4, [({
'a': 'a',
'b': b'b'
}, (md5(b'b').digest(), 'a')),
({
'a': 'qwerty',
'b': b'b'
}, (md5(b'b').digest(), 'qwerty'))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
def test_name_or_type_as_string(self):
s = """
name = "s"
type = 'HashIndex'
key_format = I
hash_lim = 1
make_key_value:
md5(a),None
make_key:
md5(a)"""
s2 = """
name = \"\"\"s\"\"\"
type = 'HashIndex'
key_format = I
hash_lim = 1
make_key:
md5(a)
make_key_value:
md5(a),None
"""
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s2, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, (md5(b'e').digest())),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest()))])
def test_fliped_definitions(self):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
md5(a),None
make_key:
md5(a)"""
s2 = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key:
md5(a)
make_key_value:
md5(a),None
"""
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s2, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
def test_None_equivalents(self):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
null
make_key:
none"""
simple_compare(s, [({
'a': 'a'
}, None), ({
'a': 'qwerty'
}, None)], [({
'a': 'e'
}, None), ({
'a': 'qwerty'
}, None)])
def test_assign_prop_equivalents(self):
s = """
name : s
type : HashIndex
key_format : I
hash_lim : 1
make_key_value:
md5(a),None
make_key:
md5(a)"""
s2 = """
name:s
type:HashIndex
key_format:'I'
hash_lim:1
make_key:
md5(a)
make_key_value:
md5(a),None
"""
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
simple_compare(s2, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))],
[({
'a': b'e'
}, md5(b'e').digest()),
({
'a': b'qwerty'
}, md5(b'qwerty').digest())])
def test_automatic_generated_class_name(self, p):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
md5(a),None
make_key:
a"""
_, r = p.parse(s)
rs = r.splitlines()
assert rs[0] == "# s"
assert rs[1][2:] == rs[2][6:39]
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))], [({
'a': 'e'
}, 'e')])
def test_md5(self):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
md5(a),None
make_key:
a != 'e' : md5(a)
a"""
simple_compare(s, [({
'a': b'a'
}, (md5(b'a').digest(), None)),
({
'a': b'qwerty'
}, (md5(b'qwerty').digest(), None))], [({
'a': 'e'
}, 'e'), ({
'a': b'eeee'
}, md5(b'eeee').digest())])
s2 = """
name = s2
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
md5(a+b'aaa')+b'a',None
make_key:
a != 'e' : md5(a)+a
a"""
simple_compare(s2, [({
'a': b'a'
}, (md5(b'aaaa').digest() + b'a', None)),
({
'a': b'qwerty'
}, (md5(b'qwertyaaa').digest() + b'a', None))],
[({
'a': 'e'
}, 'e'),
({
'a': b'eeee'
}, md5(b'eeee').digest() + b'eeee')])
def test_no_conditionals_return_dicts(self):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
data
make_key:
key"""
simple_compare(s, [({
'test': 'a',
'b': 'e'
}, {
'test': 'a',
'b': 'e'
}), ({}, {})], [({
'test': 'a',
'b': 'e'
}, {
'test': 'a',
'b': 'e'
}), ({}, {})])
s2 = """
name = s2
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
{'t' : 'a','e' : 1}
make_key:
key"""
simple_compare(s2, [({}, {
't': 'a',
'e': 1
})], [({
'e': 2,
't': 'b'
}, {
'e': 2,
't': 'b'
})])
s3 = """
type = HashIndex
name = s3
key_format = I
hash_lim = 1
make_key_value:
"::::::",None
make_key:
"::::::":'a'"""
simple_compare(s3, [({}, ("::::::", None))], [({}, "a")])
def test_simple_conditionals(self):
s = """
name = s
type = HashIndex
key_format = I
hash_lim = 1
make_key_value:
test > 5 : 1,None
0,None
make_key:
test < 1: 1
key"""
simple_compare(s, [({
'test': 4
}, (0, None)), ({
'test': 6
}, (1, None))], [({
'test': 1
}, {
'test': 1
}), ({
'test': 0
}, 1)])
s2 = """
type = HashIndex
name = s2
key_format = I
hash_lim = 1
make_key_value:
test > 5 : 1,None
test-1 == 3 : 3,None
0,None
make_key:
test < 1: 1
key"""
simple_compare(s2, [({
'test': 4
}, (3, None)), ({
'test': 6
}, (1, None)), ({
'test': 3
}, (0, None))], [({
'test': 1
}, {
'test': 1
}), ({
'test': 0
}, 1)])
# unfortunately tokenize seems to not parse - sign in right way (it doesn't set its type to token.MINUS :/)
# added a hack to indexcreator
s3 = """
type = HashIndex
name = s3
key_format = I
hash_lim = 1
make_key_value:
(a > 5 or a < -1) and (b > 15 and b > 16): 1,None
(a-1)*5 == 25 : 3,None
0,None
make_key:
a-1-1-1-1-9*4 > 0: 1
key"""
simple_compare(s3, [({
'a': 6,
'b': 17
}, (1, None)), ({
'a': 6,
'b': 3
}, (3, None)), ({
'a': 3,
'b': 17
}, (0, None))], [({
'a': 41
}, 1), ({
'a': 40
}, {
'a': 40
})])
def test_or_and_in_conditionals(self):
s = """
type = HashIndex
name = s
key_format = I
hash_lim = 1
make_key_value:
a > 5 or b<3 and 5==3 : 8,None
a > 5 or b<3 : 7,None
a in [4,3,5]: 'c',None
b,None
make_key:
key<1 and key>-3: 'a'
key in [1,3]: 'c'
'b'"""
simple_compare(s, [({
'a': 5,
'b': 2
}, (7, None)), ({
'a': 6,
'b': 4
}, (8, None)), ({
'a': 6,
'b': 2
}, (8, None)), ({
'a': 1,
'b': 2
}, (7, None)), ({
'a': 1,
'b': 4
}, (4, None)), ({
'b': 3,
'a': 4
}, ('c', None))], [(-2, 'a'), (2, 'b'), (1, 'c')])
s2 = """
type = HashIndex
name = s2
key_format = I
hash_lim = 1
make_key_value:
a && b: 1 ,None
0,None
make_key:
key & 6
"""
simple_compare(s2, [({
'a': True,
'b': True
}, (1, None)), ({
'a': False,
'b': True
}, (0, None)), ({
'a': False,
'b': False
}, (0, None)), ({
'a': True,
'b': False
}, (0, None))], [(5, 4)])
s3 = """
type = HashIndex
key_format = I
name = s3
hash_lim = 1
make_key_value:
a || b: 1,None
0,None
make_key:
key | 6
"""
simple_compare(s3, [
({
'a': True,
'b': True
}, (1, None)),
({
'a': False,
'b': True
}, (1, None)),
({
'a': False,
'b': False
}, (0, None)),
({
'a': True,
'b': False
}, (1, None)),
], [(5, 7)])
def test_props(self, p):
s = """
type = HashIndex
key_format = 32s
name = s
hash_lim = 1
make_key_value:
0,None
make_key:
0"""
_, n = p.parse(s)
exec(n, globals())
n = n.splitlines()[1][2:]
assert globals()[n]('test', 'test').hash_lim == 1
assert globals()[n]('test', 'test').entry_struct.format[4:7] == '32s'
s2 = """
type = HashIndex
key_format=32s
hash_lim=30 * (15+5) - 0
name = s2
make_key_value:
0,None
make_key:
0"""
_, n2 = p.parse(s2)
exec(n2, globals())
n2 = n2.splitlines()[1][2:]
assert globals()[n2]('test', 'test').hash_lim == 600
assert globals()[n2]('test', 'test').entry_struct.format[4:7] == '32s'
s3 = """
name = s3
type = HashIndex
key_format = 'I'
hash_lim = 2/2
make_key_value:
0,None
make_key:
0"""
_, n3 = p.parse(s3)
exec(n3, globals())
n3 = n3.splitlines()[1][2:]
assert globals()[n3]('test', 'test').hash_lim == 1
assert globals()[n3]('test', 'test').entry_struct.format[4] == 'I'
s4 = """
name = s4
type = TreeBasedIndex
key_format = I
make_key_value:
0,None
make_key:
0"""
_, n4 = p.parse(s4)
exec(n4, globals())
n4 = n4.splitlines()[1][2:]
assert globals()[n4]('test', 'test').key_format == 'I'
def test_no_make_key(self):
s = """
name = s
type = HashIndex
key_format = 32s
hash_lim = 1
make_key_value:
0,None
"""
simple_compare(s, [({
'a': 3,
'b': 4
}, (0, None))], [(5, 5), ("aaa", "aaa"),
({
'a': 3,
'b': 4
}, {
'a': 3,
'b': 4
})])
def test_functions(self, p):
s = """
name = s
type = HashIndex
key_format = 32s
hash_lim = 1
make_key_value:
md5(md5(a)),None
"""
simple_compare(s, [({
'a': b'a',
'b': 4
}, (md5(md5(b'a').digest()).digest(), None))], [(5, 5), ("aaa", "aaa"),
({
'a': 3,
'b': 4
}, {
'a': 3,
'b': 4
})])
s2 = """
name = s2
type = HashIndex
key_format = 32s
hash_lim = 1
make_key_value:
b == bytes(1): md5(b),None
len(a) > 2: md5(a),None
a,None
"""
simple_compare(s2, [({
'a': b'a',
'b': bytes(1)
}, (md5(bytes(1)).digest(), None)),
({
'a': b'a',
'b': bytes(4)
}, (b'a', None)),
({
'a': b'eee',
'b': bytes(1)
}, (md5(bytes(1)).digest(), None)),
({
'a': b'eee',
'b': bytes(3)
}, (md5(b'eee').digest(), None))], [(5, 5),
("aaa", "aaa"),
({
'a': 3,
'b': 4
}, {
'a': 3,
'b': 4
})])
s3 = """
name = s
type = HashIndex
key_format = 32s
hash_lim = 1
make_key_value:
fix_r(a,5),None
"""
simple_compare(s3, [({
'a': 'aaaa',
'b': 4
}, (b'_aaaa', None)), ({
'a': 'aaaaaa',
'b': 4
}, (b'aaaaa', None)), ({
'a': '',
'b': 4
}, (b'_____', None)), ({
'a': 'aaaaa',
'b': 4
}, (b'aaaaa', None))], [(5, 5), ("aaa", "aaa"),
({
'a': 3,
'b': 4
}, {
'a': 3,
'b': 4
})])
def test_enclosures(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=="'aa":1,None
make_key:
1"""
simple_compare(s, [({'a': "'aa", 'b': 4}, (1, None))], [(5, 1)])
s1 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=="a)a":1,None
make_key:
1"""
simple_compare(s1, [({
'a': "a)a",
'b': 4
}, (1, None)), ({
'a': "a}a",
'b': 4
}, None)], [(5, 1)])
s2 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
2==(a+({'a' : 1}['a'])):1,None
make_key:
1"""
simple_compare(s2, [({
'a': 2,
'b': 4
}, None), ({
'a': 1,
'b': 4
}, (1, None))], [(5, 1)])
class TestIndexCreatorExceptions():
def test_no_properity(self, p):
s = """
make_key_value:
a
b
c
"""
with raises(IndexCreatorValueException):
p.parse(s)
def test_wrong_properity_assingment(self, p):
s = """
name = eeee
type = HashIndex
aa aa a222a$ 2 * "eee" aa bb
cc 33 1
make_key_value:
a
"""
s2 = """
name eeee
type = HashIndex
make_key_value:
a
"""
s3 = """
name = sss
type = 2
make_key_value:
a
"""
s4 = """
name = sss
type = HashIndex,
make_key_value:
a
"""
s5 = """
name = sss
type = HashIndex
a : a, b
make_key_value:
a
"""
s6 = """
name = sss
type = HashIndex
2a : a
make_key_value:
a
"""
s7 = """
name = sss
type = HashIndex
22 : a
make_key_value:
a
"""
with raises(IndexCreatorValueException):
p.parse(s)
with raises(IndexCreatorValueException):
p.parse(s2)
with raises(IndexCreatorValueException):
p.parse(s3)
with raises(IndexCreatorValueException):
p.parse(s4)
with raises(IndexCreatorValueException):
p.parse(s5)
with raises(IndexCreatorValueException):
p.parse(s6)
with raises(IndexCreatorValueException):
p.parse(s7)
def test_empty_function(self, p):
s = """
type = HashIndex
name = s
key_format = 32s
hash_lim = 1
make_key_value:
make_key:
"""
s2 = """
type = HashIndex
name = s2
key_format = 32s
hash_lim = 1
make_key_value:
0
make_key:
"""
s3 = """
type = HashIndex
name = s3
key_format = 32s
hash_lim = 1
make_key_value:
make_key:
0
"""
with raises(IndexCreatorFunctionException):
p.parse(s, 'TestIndex')
with raises(IndexCreatorFunctionException):
p.parse(s2, 'TestIndex')
with raises(IndexCreatorFunctionException):
p.parse(s3, 'TestIndex')
def test_no_type(self, p):
s = """
key_format = 32s
name = s
hash_lim = 1
make_key_value:
0,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
def test_no_make_key_value(self, p):
s = """
name = s
key_format = 32s
hash_lim = 1
make_key:
0
"""
s2 = """
key_format = 32s
name = s2
hash_lim = 1
"""
with raises(IndexCreatorFunctionException):
p.parse(s, 'TestIndex')
with raises(IndexCreatorFunctionException):
p.parse(s2, 'TestIndex')
def test_no_name(self, p):
s = """
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
0,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
def test_no_2nd_arg_and_1st_isnt_enough_for_mkv(self, p):
s = """
name = s
key_format = 16s
type = HashIndex
hash_lim = 1
make_key_value:
0
"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
s2 = """
name = s
key_format = 16s
type = HashIndex
hash_lim = 1
make_key_value:
"aaa"
"""
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 16s
type = HashIndex
hash_lim = 1
make_key_value:
md5(a)
"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
def test_wrong_2nd_ret_arg_of_mkv(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
md5(a),a
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
s2 = """
name = s2
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
md5(a),"aaa"
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s2)
s3 = """
name = s3
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
md5(a),3
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s3)
def test_empty_return_with_condition(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3:
md5(a),None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
s2 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3:
md5(a),None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key:
a > 3:
0
make_key_value:
md5(a),a
"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
s4 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
md5(a),None
make_key:
a>2:"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
def test_wrong_nr_of_args_to_ret(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3: a,None,
md5(a),None
make_key:
0
"""
with raises(IndexCreatorFunctionException):
p.parse(s, 'TestIndex')
s2 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3: a,None
md5(a),None,
make_key:
0
"""
with raises(IndexCreatorFunctionException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3: a,None
md5(a),None
make_key:
0,
"""
with raises(IndexCreatorFunctionException):
p.parse(s3, 'TestIndex')
s4 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a > 3: a,None
md5(a),None
make_key:
,
"""
with raises(IndexCreatorFunctionException):
p.parse(s4, 'TestIndex')
s5 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1,
md5(a),None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s5, 'TestIndex')
def test_wrong_comp_operators(self, p):
s3 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
'a'==1:1,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
s4 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1>='a':1,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s4, 'TestIndex')
s5 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
'a'<="b":1,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s5, 'TestIndex')
s6 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
<=1:1,None
make_key:
0
"""
with raises(IndexCreatorValueException):
p.parse(s6, 'TestIndex')
s7 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
1=="""
with raises(IndexCreatorValueException):
p.parse(s7, 'TestIndex')
s8 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key:
1==
make_key_value:
1<=2:1,None
"""
with raises(IndexCreatorValueException):
p.parse(s8, 'TestIndex')
def test_no_operator_between(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a b"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
s2 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a 'b'"""
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
'a' b"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
s4 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
a>=1:a b,None
make_key:
a + b"""
with raises(IndexCreatorValueException):
p.parse(s4, 'TestIndex')
s5 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
'a' 'b'"""
with raises(IndexCreatorValueException):
p.parse(s5, 'TestIndex')
s6 = """
name = s
key_format = aa ee
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
1"""
with raises(IndexCreatorValueException):
p.parse(s6, 'TestIndex')
def test_too_much_colons(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1:1,None
make_key:
1"""
with raises(IndexCreatorFunctionException):
p.parse(s, 'TestIndex')
s2 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a>1::"""
with raises(IndexCreatorFunctionException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = : 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
def test_name_or_type_set_twice(self, p):
s = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
type = HashIndex
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s, 'TestIndex')
s2 = """
type = TreeBasedIndex
name = s
key_format = : 32s
type = HashIndex
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
type = HashIndex
hash_lim = 1
name: a
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
s4 = """
name = s
key_format = 32s
type = HashIndex
name = s
hash_lim = 1
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s4, 'TestIndex')
def test_wrong_enclosures(self, p):
s1 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
1<=(2)):1,None
make_key:
a>1:1"""
s2 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=="aa("):1,None
make_key:
1"""
s3 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=={"aa"):1,None
make_key:
1"""
s4 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=={"aa":1,None
make_key:
1"""
s5 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a==""aa":1,None
make_key:
1"""
s7 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a==":1,None
make_key:
1"""
s8 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
a=="aa:1,None
make_key:
1"""
with raises(IndexCreatorValueException):
p.parse(s1, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s4, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s5, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s7, 'TestIndex')
with raises(IndexCreatorValueException):
p.parse(s8, 'TestIndex')
def test_excessive_return(self, p):
s1 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
1<=2:1,None
1,None
2,None
make_key:
a>1:1"""
with raises(IndexCreatorFunctionException):
p.parse(s1, 'TestIndex')
s2 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
1<=2:1,None
1,None
1>3:2,None
make_key:
a>1:1"""
with raises(IndexCreatorFunctionException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
type = HashIndex
make_key_value:
1<=2:1,None
1>3:2,None
make_key:
1
2"""
with raises(IndexCreatorFunctionException):
p.parse(s3, 'TestIndex')
def test_wrong_properities(self, p):
s1 = """
name = s
key_format = 32s
node_capacity=100
type = HashIndex
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s1, 'TestIndex')
s2 = """
name = s
key_format = 32s
hash_lim=3
type = TreeBasedIndex
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s2, 'TestIndex')
s3 = """
name = s
key_format = 32s
aaa=100
type = HashIndex
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s3, 'TestIndex')
def test_duplicate_props(self, p):
s1 = """
name = s
key_format = 32s
key_format: 8
type = HashIndex
make_key_value:
1<=2:1,None
make_key:
a>1:1"""
with raises(IndexCreatorValueException):
p.parse(s1, 'TestIndex')
class TestMultiIndexCreator:
def test_prefix(self):
s = """
name = s
type = MultiTreeBasedIndex
make_key_value:
prefix(a,2,3,3),None
"""
simple_compare_without_order(s, [({
'a': 'abcd',
'b': 4
}, (sorted([b"_ab", b"abc"]), None)),
({
'a': 'ab',
'b': 4
}, (sorted([b"_ab"]), None)),
({
'a': 'a',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': '',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': 'abc',
'b': 4
}, (sorted([b"_ab", b"abc"]), None))],
[])
s2 = """
name = s2
type = MultiTreeBasedIndex
make_key_value:
prefix(a,0,20,5),None
"""
simple_compare_without_order(
s2, [({
'a': 'abcd',
'b': 4
}, (sorted([b"___ab", b"__abc", b"_abcd", b"____a"]), None)),
({
'a': 'ab',
'b': 4
}, (sorted([b"___ab", b"____a"]), None)),
({
'a': 'a',
'b': 'abcd'
}, (sorted([b"____a"]), None)),
({
'a': '',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': 'abc',
'b': 4
}, (sorted([b"___ab", b"__abc", b"____a"]), None))], [])
def test_suffix(self):
s = """
name = s
type = MultiTreeBasedIndex
make_key_value:
suffix(a,2,3,4),None
"""
simple_compare_without_order(s,
[({
'a': 'abcd',
'b': 4
}, (sorted([b"__cd", b"_bcd"]), None)),
({
'a': 'ab',
'b': 4
}, (sorted([b"__ab"]), None)),
({
'a': 'a',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': '',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': 'abc',
'b': 4
}, (sorted([b"__bc", b"_abc"]), None))],
[])
s2 = """
name = s2
type = MultiTreeBasedIndex
make_key_value:
suffix(a,0,20,5),None
"""
simple_compare_without_order(
s2, [({
'a': 'abcd',
'b': 4
}, (sorted([b"___cd", b"__bcd", b"_abcd", b"____d"]), None)),
({
'a': 'ab',
'b': 4
}, (sorted([b"___ab", b"____b"]), None)),
({
'a': 'a',
'b': 'abcd'
}, (sorted([b"____a"]), None)),
({
'a': '',
'b': 'abcd'
}, (sorted([]), None)),
({
'a': 'abc',
'b': 4
}, (sorted([b"___bc", b"__abc", b"____c"]), None))], [])
| 24.444506 | 116 | 0.369062 | 4,256 | 44,269 | 3.673872 | 0.065789 | 0.084165 | 0.079048 | 0.050652 | 0.811908 | 0.772256 | 0.72704 | 0.69001 | 0.657329 | 0.617677 | 0 | 0.042473 | 0.497933 | 44,269 | 1,810 | 117 | 24.458011 | 0.661028 | 0.026339 | 0 | 0.818182 | 0 | 0.000636 | 0.418655 | 0.001509 | 0 | 0 | 0 | 0 | 0.008264 | 1 | 0.023522 | false | 0 | 0.006993 | 0 | 0.033058 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
c428e0ca275cdfbe0afe375b0bb759d7ddebed42 | 192 | py | Python | scripts/patches/iam.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | null | null | null | scripts/patches/iam.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | null | null | null | scripts/patches/iam.py | compose-x/troposphere | 9a94a8fafd8b4da1cd1f4239be0e7aa0681fd8d4 | [
"BSD-2-Clause"
] | null | null | null | patches = [
# backward compatibility
{
"op": "move",
"from": "/ResourceTypes/AWS::IAM::Policy",
"path": "/ResourceTypes/AWS::IAM::PolicyType::Policy",
},
]
| 21.333333 | 62 | 0.53125 | 16 | 192 | 6.375 | 0.75 | 0.313725 | 0.372549 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.265625 | 192 | 8 | 63 | 24 | 0.723404 | 0.114583 | 0 | 0 | 0 | 0 | 0.52381 | 0.440476 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
c447717f7d6765230abffe8b4f16875ef9cc78f9 | 44 | py | Python | python/leetCode/to_lower_case/to_lower_case.py | beasleyDOTcom/data-structures-and-algorithms | 2915ed9d9ad5f2e8c983d0711c9e2b52e0ed14ff | [
"MIT"
] | 1 | 2021-09-01T01:39:22.000Z | 2021-09-01T01:39:22.000Z | python/leetCode/to_lower_case/to_lower_case.py | beasleyDOTcom/data-structures-and-algorithms | 2915ed9d9ad5f2e8c983d0711c9e2b52e0ed14ff | [
"MIT"
] | 47 | 2020-07-13T21:56:44.000Z | 2021-03-06T03:53:25.000Z | python/leetCode/to_lower_case/to_lower_case.py | beasleyDOTcom/data-structures-and-algorithms | 2915ed9d9ad5f2e8c983d0711c9e2b52e0ed14ff | [
"MIT"
] | null | null | null | def toLowerCase(str):
return str.lower() | 22 | 22 | 0.704545 | 6 | 44 | 5.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 44 | 2 | 22 | 22 | 0.837838 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 5 |
c45a43ccb4f70c91a3da83634aa411c45f51363a | 80 | py | Python | train/__init__.py | jameswind/neuralCT | 969829459570c808cceafec665931eb411fff5e2 | [
"Apache-2.0"
] | 27 | 2019-10-01T22:59:26.000Z | 2020-12-10T14:07:33.000Z | train/__init__.py | jameswind/neuralCT | 969829459570c808cceafec665931eb411fff5e2 | [
"Apache-2.0"
] | 1 | 2020-03-08T12:11:35.000Z | 2020-03-09T08:58:30.000Z | train/__init__.py | jameswind/neuralCT | 969829459570c808cceafec665931eb411fff5e2 | [
"Apache-2.0"
] | 4 | 2019-10-02T08:13:39.000Z | 2021-04-02T14:50:26.000Z | from .learn import learn, reversedKLD
from .kld import forwardLearn, forwardKLD | 26.666667 | 41 | 0.825 | 10 | 80 | 6.6 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 80 | 3 | 41 | 26.666667 | 0.942857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
c461c567e2a4a7f4c869eb9633a93a63e66aadd7 | 80 | py | Python | tests/Field.test.py | muradkhan101/media-site-scraper | 251e72612bb9c0dc333ba3274d3c93bfb2abc2ce | [
"MIT"
] | null | null | null | tests/Field.test.py | muradkhan101/media-site-scraper | 251e72612bb9c0dc333ba3274d3c93bfb2abc2ce | [
"MIT"
] | null | null | null | tests/Field.test.py | muradkhan101/media-site-scraper | 251e72612bb9c0dc333ba3274d3c93bfb2abc2ce | [
"MIT"
] | null | null | null | import sys
sys.path.insert(0,'../src')
import unittest
from Field import Field
| 13.333333 | 27 | 0.75 | 13 | 80 | 4.615385 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014286 | 0.125 | 80 | 5 | 28 | 16 | 0.842857 | 0 | 0 | 0 | 0 | 0 | 0.075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
c4754e091128a66722571e9a44ccaf3559124dcd | 146 | py | Python | seafarer/__init__.py | maasglobal/seafarer | 643afd6d855d67aea166bf5cb00ec9c832d89548 | [
"MIT"
] | 1 | 2019-12-20T12:18:05.000Z | 2019-12-20T12:18:05.000Z | seafarer/__init__.py | MarkusShepherd/seafarer | 643afd6d855d67aea166bf5cb00ec9c832d89548 | [
"MIT"
] | 4 | 2020-03-24T18:17:50.000Z | 2021-06-02T01:13:55.000Z | seafarer/__init__.py | MarkusShepherd/seafarer | 643afd6d855d67aea166bf5cb00ec9c832d89548 | [
"MIT"
] | 1 | 2019-12-20T12:49:43.000Z | 2019-12-20T12:49:43.000Z | # -*- coding: utf-8 -*-
"""Taxicab metric on the sphere!"""
from .__version__ import VERSION, __version__
from .distance import seafarer_metric
| 20.857143 | 45 | 0.726027 | 18 | 146 | 5.388889 | 0.722222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008 | 0.143836 | 146 | 6 | 46 | 24.333333 | 0.768 | 0.356164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
c47e3780c8a8719526077a1fc7347b00d616ffbf | 137 | py | Python | umu-python/app/service/tosca/vo/protobuf/input_message.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umu-python/app/service/tosca/vo/protobuf/input_message.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umu-python/app/service/tosca/vo/protobuf/input_message.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | class InputMessage(dict):
def __init__(self, inputMessageName=None):
dict.__init__(self, inputMessageName=inputMessageName)
| 27.4 | 62 | 0.759124 | 13 | 137 | 7.384615 | 0.615385 | 0.166667 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145985 | 137 | 4 | 63 | 34.25 | 0.820513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
67162c1e10084cb489535f73d9812ecd3d02a9c4 | 2,633 | py | Python | src/vector/_compute/spatial/__init__.py | pfackeldey/vector | 87e9e942f2a9ae09a3e250e12f37505eb22e25ea | [
"BSD-3-Clause"
] | 40 | 2020-03-26T13:28:36.000Z | 2022-03-23T22:14:35.000Z | src/vector/_compute/spatial/__init__.py | pfackeldey/vector | 87e9e942f2a9ae09a3e250e12f37505eb22e25ea | [
"BSD-3-Clause"
] | 66 | 2020-02-14T13:32:18.000Z | 2022-03-29T14:35:31.000Z | src/vector/_compute/spatial/__init__.py | pfackeldey/vector | 87e9e942f2a9ae09a3e250e12f37505eb22e25ea | [
"BSD-3-Clause"
] | 14 | 2020-01-29T22:03:33.000Z | 2022-03-16T02:46:25.000Z | # Copyright (c) 2019-2021, Jonas Eschle, Jim Pivarski, Eduardo Rodrigues, and Henry Schreiner.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/vector for details.
"""
Compute functions for spatial vectors, which is to say 3D and 4D.
Each function is a module with variants for each coordinate system (or combination
of coordinate systems) as functions within the module.
Each module has a ``dispatch_map`` (dict) that maps coordinate types to the
appropriate function and its return type(s), and a ``dispatch`` (function) uses
this information to call the right function and return the right type.
The compute functions themselves are restricted to a minimum of Python features:
no statements other than assignments and one return, no assumptions about data
types. In particular, if statements and loops are not allowed. The
tests/test_compute_features.py suite ensures that these rules are followed (though
that set of allowed features can be expanded if it doesn't prevent the addition
of new backends).
"""
import vector._compute.spatial.add # noqa: F401
import vector._compute.spatial.costheta # noqa: F401
import vector._compute.spatial.cottheta # noqa: F401
import vector._compute.spatial.cross # noqa: F401
import vector._compute.spatial.deltaangle # noqa: F401
import vector._compute.spatial.deltaeta # noqa: F401
import vector._compute.spatial.deltaR # noqa: F401
import vector._compute.spatial.deltaR2 # noqa: F401
import vector._compute.spatial.dot # noqa: F401
import vector._compute.spatial.equal # noqa: F401
import vector._compute.spatial.eta # noqa: F401
import vector._compute.spatial.is_antiparallel # noqa: F401
import vector._compute.spatial.is_parallel # noqa: F401
import vector._compute.spatial.is_perpendicular # noqa: F401
import vector._compute.spatial.isclose # noqa: F401
import vector._compute.spatial.mag # noqa: F401
import vector._compute.spatial.mag2 # noqa: F401
import vector._compute.spatial.not_equal # noqa: F401
import vector._compute.spatial.rotate_axis # noqa: F401
import vector._compute.spatial.rotate_euler # noqa: F401
import vector._compute.spatial.rotate_quaternion # noqa: F401
import vector._compute.spatial.rotateX # noqa: F401
import vector._compute.spatial.rotateY # noqa: F401
import vector._compute.spatial.scale # noqa: F401
import vector._compute.spatial.subtract # noqa: F401
import vector._compute.spatial.theta # noqa: F401
import vector._compute.spatial.transform3D # noqa: F401
import vector._compute.spatial.unit # noqa: F401
import vector._compute.spatial.z # noqa: F401
| 49.679245 | 94 | 0.793012 | 379 | 2,633 | 5.406332 | 0.382586 | 0.169839 | 0.268912 | 0.367984 | 0.48121 | 0.48121 | 0.132748 | 0 | 0 | 0 | 0 | 0.044047 | 0.12913 | 2,633 | 52 | 95 | 50.634615 | 0.849542 | 0.524497 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
6735ac317aa38c6eed419e8f2ccb62d02f0ed71f | 219 | py | Python | veides/sdk/stream_hub/__init__.py | Veides/veides-sdk-python | 0a146f2ac0e9432359524189f6b992d315d2621b | [
"MIT"
] | null | null | null | veides/sdk/stream_hub/__init__.py | Veides/veides-sdk-python | 0a146f2ac0e9432359524189f6b992d315d2621b | [
"MIT"
] | null | null | null | veides/sdk/stream_hub/__init__.py | Veides/veides-sdk-python | 0a146f2ac0e9432359524189f6b992d315d2621b | [
"MIT"
] | null | null | null | __version__ = '0.2.0'
from veides.sdk.stream_hub.client import StreamHubClient
from veides.sdk.stream_hub.base_client import BaseClient
from veides.sdk.stream_hub.properties import AuthProperties, ConnectionProperties
| 36.5 | 81 | 0.853881 | 30 | 219 | 5.966667 | 0.533333 | 0.167598 | 0.217877 | 0.318436 | 0.368715 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014851 | 0.077626 | 219 | 5 | 82 | 43.8 | 0.871287 | 0 | 0 | 0 | 0 | 0 | 0.022831 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
67691a08bafedd4c554f4e4c3a9ec86501fd657e | 278 | py | Python | modules/python-codes/modules/oop/src/testing_capitalize.py | drigols/Studies | 9c293156935b491ded24be6b511daac67fd43538 | [
"MIT"
] | 1 | 2020-09-06T22:17:19.000Z | 2020-09-06T22:17:19.000Z | modules/python-codes/modules/oop/src/testing_capitalize.py | drigols/Studies | 9c293156935b491ded24be6b511daac67fd43538 | [
"MIT"
] | null | null | null | modules/python-codes/modules/oop/src/testing_capitalize.py | drigols/Studies | 9c293156935b491ded24be6b511daac67fd43538 | [
"MIT"
] | null | null | null | ########################################################
# Rodrigo Leite - drigols #
# Last update: 07/11/2021 #
########################################################
name = "rodrigo leite"
print(name.capitalize())
| 30.888889 | 56 | 0.258993 | 14 | 278 | 5.142857 | 0.785714 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0.280576 | 278 | 8 | 57 | 34.75 | 0.32 | 0.276978 | 0 | 0 | 0 | 0 | 0.240741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
67776366efbbe27cb3cc10719b6a40bc15d5cb85 | 224 | py | Python | python_inject_practice/core/database.py | neetjn/python-inject-practice | 404cdca5e475577c2fa2ce1ba4bb6cd120f18934 | [
"MIT"
] | null | null | null | python_inject_practice/core/database.py | neetjn/python-inject-practice | 404cdca5e475577c2fa2ce1ba4bb6cd120f18934 | [
"MIT"
] | null | null | null | python_inject_practice/core/database.py | neetjn/python-inject-practice | 404cdca5e475577c2fa2ce1ba4bb6cd120f18934 | [
"MIT"
] | null | null | null | class Database:
"""Some theoretical database provider."""
data = {}
def get(self, key: str):
return self.data.get(key)
def save(self, key: str, value: all):
self.data.setdefault(key, value)
| 22.4 | 45 | 0.602679 | 29 | 224 | 4.655172 | 0.551724 | 0.103704 | 0.148148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.254464 | 224 | 9 | 46 | 24.888889 | 0.808383 | 0.15625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.833333 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
67a8862a1cfbed80a18459e27044072fddf296f0 | 21 | py | Python | hello_user.py | nskprotiv/learn-python | 9e1090109bb91b081b68d13ab122b4bcbe27e740 | [
"MIT"
] | 1 | 2021-01-07T05:27:33.000Z | 2021-01-07T05:27:33.000Z | hello_user.py | nskprotiv/learn-python | 9e1090109bb91b081b68d13ab122b4bcbe27e740 | [
"MIT"
] | null | null | null | hello_user.py | nskprotiv/learn-python | 9e1090109bb91b081b68d13ab122b4bcbe27e740 | [
"MIT"
] | null | null | null | print("Hello, User") | 21 | 21 | 0.666667 | 3 | 21 | 4.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 21 | 1 | 21 | 21 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
67aafe592d2a4e65033bd5c54c7c094ddae14238 | 68 | py | Python | pyapr/numerics/filter/__init__.py | mosaic-group/PyLibAPR | 4b5af50c26b4770c460460f9491bd840af2537da | [
"Apache-2.0"
] | 7 | 2021-07-02T11:08:30.000Z | 2022-03-07T20:54:33.000Z | pyapr/numerics/filter/__init__.py | mosaic-group/PyLibAPR | 4b5af50c26b4770c460460f9491bd840af2537da | [
"Apache-2.0"
] | 19 | 2020-12-17T09:32:09.000Z | 2022-01-08T20:22:16.000Z | pyapr/numerics/filter/__init__.py | mosaic-group/PyLibAPR | 4b5af50c26b4770c460460f9491bd840af2537da | [
"Apache-2.0"
] | 1 | 2021-01-19T14:23:36.000Z | 2021-01-19T14:23:36.000Z | from _pyaprwrapper.numerics.filter import *
from .stencils import *
| 22.666667 | 43 | 0.808824 | 8 | 68 | 6.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 68 | 2 | 44 | 34 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
67d4a10f2cd872a8db6f5efd38479888ea37a52c | 60 | py | Python | sandbox/apps/shipping/models.py | rodolfotorres02/django-oscar-paypal | 8272b33f86e189f9c82f484881b75de1615ebe59 | [
"BSD-3-Clause"
] | 149 | 2015-01-09T18:36:57.000Z | 2022-01-19T05:22:11.000Z | sandbox/apps/shipping/models.py | rodolfotorres02/django-oscar-paypal | 8272b33f86e189f9c82f484881b75de1615ebe59 | [
"BSD-3-Clause"
] | 181 | 2015-01-09T23:57:01.000Z | 2022-01-26T19:45:52.000Z | sandbox/apps/shipping/models.py | rodolfotorres02/django-oscar-paypal | 8272b33f86e189f9c82f484881b75de1615ebe59 | [
"BSD-3-Clause"
] | 191 | 2015-01-12T18:29:58.000Z | 2022-03-07T04:44:34.000Z | from oscar.apps.shipping.models import * # noqa isort:skip
| 30 | 59 | 0.766667 | 9 | 60 | 5.111111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 60 | 1 | 60 | 60 | 0.884615 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
67e75efc70458d03d6caec16916c2e7b9560f317 | 329 | py | Python | tasks_helper/packager/base.py | thinow/aws-kinesis-consumer | 94aaa88bd91ff8e7dd8a6716083a95d303281a0f | [
"MIT"
] | 29 | 2021-02-19T18:35:20.000Z | 2022-03-16T13:15:25.000Z | tasks_helper/packager/base.py | thinow/aws-kinesis-consumer | 94aaa88bd91ff8e7dd8a6716083a95d303281a0f | [
"MIT"
] | 1 | 2021-03-23T20:57:11.000Z | 2021-03-23T20:57:11.000Z | tasks_helper/packager/base.py | thinow/aws-kinesis-consumer | 94aaa88bd91ff8e7dd8a6716083a95d303281a0f | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
import invoke
class Packager(ABC):
@abstractmethod
def get_name(self) -> str:
pass
@abstractmethod
def build(self, runner: invoke.Runner) -> None:
pass
@abstractmethod
def deploy(self, runner: invoke.Runner, destination: str) -> None:
pass
| 18.277778 | 70 | 0.647416 | 37 | 329 | 5.72973 | 0.486486 | 0.240566 | 0.198113 | 0.207547 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.261398 | 329 | 17 | 71 | 19.352941 | 0.872428 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.166667 | 0 | 0.5 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
db2d179f2703d19cdfe4a258bb9df25e8a7bc781 | 875 | py | Python | build/wheeled_robot_kinematics/cmake/wheeled_robot_kinematics-genmsg-context.py | anurag-b/project_2_cmsc498F | 736626e0144cf45ebeddd341cfcb4fcdac679c3f | [
"MIT"
] | null | null | null | build/wheeled_robot_kinematics/cmake/wheeled_robot_kinematics-genmsg-context.py | anurag-b/project_2_cmsc498F | 736626e0144cf45ebeddd341cfcb4fcdac679c3f | [
"MIT"
] | null | null | null | build/wheeled_robot_kinematics/cmake/wheeled_robot_kinematics-genmsg-context.py | anurag-b/project_2_cmsc498F | 736626e0144cf45ebeddd341cfcb4fcdac679c3f | [
"MIT"
] | null | null | null | # generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/anuragb/ros_prac/catkin_ws_p10/src/wheeled_robot_kinematics/msg/DiffDriveAction.msg"
services_str = "/home/anuragb/ros_prac/catkin_ws_p10/src/wheeled_robot_kinematics/srv/DiffDriveFK.srv;/home/anuragb/ros_prac/catkin_ws_p10/src/wheeled_robot_kinematics/srv/DiffDriveIK.srv"
pkg_name = "wheeled_robot_kinematics"
dependencies_str = "geometry_msgs"
langs = "gencpp;genlisp;genpy"
dep_include_paths_str = "wheeled_robot_kinematics;/home/anuragb/ros_prac/catkin_ws_p10/src/wheeled_robot_kinematics/msg;geometry_msgs;/opt/ros/indigo/share/geometry_msgs/cmake/../msg;std_msgs;/opt/ros/indigo/share/std_msgs/cmake/../msg"
PYTHON_EXECUTABLE = "/usr/bin/python"
package_has_static_sources = '' == 'TRUE'
genmsg_check_deps_script = "/opt/ros/indigo/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
| 72.916667 | 236 | 0.822857 | 132 | 875 | 5.113636 | 0.416667 | 0.106667 | 0.195556 | 0.106667 | 0.408889 | 0.346667 | 0.346667 | 0.346667 | 0.346667 | 0.346667 | 0 | 0.009512 | 0.038857 | 875 | 11 | 237 | 79.545455 | 0.793103 | 0.056 | 0 | 0 | 1 | 0.222222 | 0.753641 | 0.690534 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
e1e4180d247bedf312a3b7cf6ced184d64872c57 | 83 | py | Python | hub/admin.py | iver56/useat-api | f0f241c584cbb05990ee4afb5bb1b2fd6d5fdb44 | [
"MIT"
] | null | null | null | hub/admin.py | iver56/useat-api | f0f241c584cbb05990ee4afb5bb1b2fd6d5fdb44 | [
"MIT"
] | null | null | null | hub/admin.py | iver56/useat-api | f0f241c584cbb05990ee4afb5bb1b2fd6d5fdb44 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Hub
admin.site.register(Hub)
| 16.6 | 32 | 0.807229 | 13 | 83 | 5.153846 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120482 | 83 | 4 | 33 | 20.75 | 0.917808 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
e1f8af463860de36b46c0bf1924cf5bf496aa1bf | 103 | py | Python | streamTest.py | alabecki/Strong-Equivalence-Solver | 50afda36db67988b20892a9e47f34d1763542ccc | [
"MIT"
] | null | null | null | streamTest.py | alabecki/Strong-Equivalence-Solver | 50afda36db67988b20892a9e47f34d1763542ccc | [
"MIT"
] | null | null | null | streamTest.py | alabecki/Strong-Equivalence-Solver | 50afda36db67988b20892a9e47f34d1763542ccc | [
"MIT"
] | null | null | null | import sys
import se_main
if sys.stdin.isatty():
data = sys.stdin.readlines()
else: | 11.444444 | 31 | 0.61165 | 14 | 103 | 4.428571 | 0.714286 | 0.258065 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.281553 | 103 | 9 | 32 | 11.444444 | 0.837838 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.4 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c01e595e6afe61e07f62508916826b2c69852278 | 258 | py | Python | opendeep/models/single_layer/__init__.py | vitruvianscience/OpenDeep | e96efc449101094354b615cf15afe6d03644fc36 | [
"Apache-2.0"
] | 252 | 2015-03-13T21:55:22.000Z | 2021-09-06T21:37:38.000Z | opendeep/models/single_layer/__init__.py | afcarl/OpenDeep | e96efc449101094354b615cf15afe6d03644fc36 | [
"Apache-2.0"
] | 16 | 2015-03-14T06:47:04.000Z | 2016-09-23T19:13:35.000Z | opendeep/models/single_layer/__init__.py | afcarl/OpenDeep | e96efc449101094354b615cf15afe6d03644fc36 | [
"Apache-2.0"
] | 68 | 2015-03-14T00:05:53.000Z | 2020-06-04T13:36:13.000Z | from __future__ import division, absolute_import, print_function
# from .autoencoder import *
from .basic import *
from .convolutional import *
from .restricted_boltzmann_machine import *
from .gru import GRU
from .lstm import LSTM
from .recurrent import *
| 25.8 | 64 | 0.802326 | 33 | 258 | 6.030303 | 0.484848 | 0.201005 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 258 | 9 | 65 | 28.666667 | 0.896396 | 0.100775 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0.142857 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
fbf20c01ad1606a5277d4e9c531384bdf266da8d | 120 | py | Python | apps/continiousauth/admin.py | larserikgk/mobiauth-server | fa7a645132432ff0d69d47c57c266f58efb8daab | [
"MIT"
] | null | null | null | apps/continiousauth/admin.py | larserikgk/mobiauth-server | fa7a645132432ff0d69d47c57c266f58efb8daab | [
"MIT"
] | null | null | null | apps/continiousauth/admin.py | larserikgk/mobiauth-server | fa7a645132432ff0d69d47c57c266f58efb8daab | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import AuthenticationSession
admin.site.register(AuthenticationSession)
| 20 | 42 | 0.858333 | 13 | 120 | 7.923077 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091667 | 120 | 5 | 43 | 24 | 0.944954 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
22326a7b06c112af9d3b1d5fde4f850aae78e66e | 71 | py | Python | whois/__init__.py | jlowe77/Eris-Cogs | 2ade8f82db3477527af3cff3b48ebb281e1a6987 | [
"Apache-2.0"
] | 6 | 2020-05-13T20:43:53.000Z | 2021-06-23T16:10:13.000Z | whois/__init__.py | jlowe77/Eris-Cogs | 2ade8f82db3477527af3cff3b48ebb281e1a6987 | [
"Apache-2.0"
] | 12 | 2019-04-02T13:29:10.000Z | 2020-03-27T18:07:16.000Z | whois/__init__.py | jlowe77/Eris-Cogs | 2ade8f82db3477527af3cff3b48ebb281e1a6987 | [
"Apache-2.0"
] | 9 | 2020-06-07T21:46:54.000Z | 2022-03-01T22:49:02.000Z | from .whois import WhoIs
def setup(bot):
bot.add_cog(WhoIs(bot))
| 11.833333 | 27 | 0.690141 | 12 | 71 | 4 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183099 | 71 | 5 | 28 | 14.2 | 0.827586 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
224e3f248d0a53f07e99a2a25c63ee4dfe49fe9d | 5,991 | py | Python | tests/integration_tests/test_shap.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 1,300 | 2018-12-03T06:11:11.000Z | 2019-11-15T01:28:25.000Z | tests/integration_tests/test_shap.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 274 | 2018-12-04T09:54:07.000Z | 2019-11-15T02:23:18.000Z | tests/integration_tests/test_shap.py | masap/optuna | f56cea87c4771d53b39f441e727d733dd1785557 | [
"MIT"
] | 148 | 2018-12-03T10:48:50.000Z | 2019-11-11T16:37:51.000Z | from typing import Tuple
import pytest
from optuna import create_study
from optuna import Trial
from optuna.distributions import FloatDistribution
from optuna.integration.shap import ShapleyImportanceEvaluator
from optuna.samplers import RandomSampler
from optuna.trial import create_trial
def objective(trial: Trial) -> float:
x1 = trial.suggest_float("x1", 0.1, 3)
x2 = trial.suggest_float("x2", 0.1, 3, log=True)
x3 = trial.suggest_float("x3", 2, 4, log=True)
return x1 + x2 * x3
def test_mean_abs_shap_importance_evaluator_n_trees() -> None:
# Assumes that `seed` can be fixed to reproduce identical results.
study = create_study(sampler=RandomSampler(seed=0))
study.optimize(objective, n_trials=3)
evaluator = ShapleyImportanceEvaluator(n_trees=10, seed=0)
param_importance = evaluator.evaluate(study)
evaluator = ShapleyImportanceEvaluator(n_trees=20, seed=0)
param_importance_different_n_trees = evaluator.evaluate(study)
assert param_importance != param_importance_different_n_trees
def test_mean_abs_shap_importance_evaluator_max_depth() -> None:
# Assumes that `seed` can be fixed to reproduce identical results.
study = create_study(sampler=RandomSampler(seed=0))
study.optimize(objective, n_trials=3)
evaluator = ShapleyImportanceEvaluator(max_depth=1, seed=0)
param_importance = evaluator.evaluate(study)
evaluator = ShapleyImportanceEvaluator(max_depth=2, seed=0)
param_importance_different_max_depth = evaluator.evaluate(study)
assert param_importance != param_importance_different_max_depth
def test_mean_abs_shap_importance_evaluator_seed() -> None:
study = create_study(sampler=RandomSampler(seed=0))
study.optimize(objective, n_trials=3)
evaluator = ShapleyImportanceEvaluator(seed=2)
param_importance = evaluator.evaluate(study)
evaluator = ShapleyImportanceEvaluator(seed=2)
param_importance_same_seed = evaluator.evaluate(study)
assert param_importance == param_importance_same_seed
evaluator = ShapleyImportanceEvaluator(seed=3)
param_importance_different_seed = evaluator.evaluate(study)
assert param_importance != param_importance_different_seed
def test_mean_abs_shap_importance_evaluator_with_target() -> None:
# Assumes that `seed` can be fixed to reproduce identical results.
study = create_study(sampler=RandomSampler(seed=0))
study.optimize(objective, n_trials=3)
evaluator = ShapleyImportanceEvaluator(seed=0)
param_importance = evaluator.evaluate(study)
param_importance_with_target = evaluator.evaluate(
study,
target=lambda t: t.params["x1"] + t.params["x2"],
)
assert param_importance != param_importance_with_target
@pytest.mark.parametrize("inf_value", [float("inf"), -float("inf")])
def test_shap_importance_evaluator_with_infinite(inf_value: float) -> None:
# The test ensures that trials with infinite values are ignored to calculate importance scores.
n_trial = 10
seed = 13
# Importance scores are calculated without a trial with an inf value.
study = create_study(sampler=RandomSampler(seed=seed))
study.optimize(objective, n_trials=n_trial)
evaluator = ShapleyImportanceEvaluator(seed=seed)
param_importance_without_inf = evaluator.evaluate(study)
# A trial with an inf value is added into the study manually.
study.add_trial(
create_trial(
value=inf_value,
params={"x1": 1.0, "x2": 1.0, "x3": 3.0},
distributions={
"x1": FloatDistribution(low=0.1, high=3),
"x2": FloatDistribution(low=0.1, high=3, log=True),
"x3": FloatDistribution(low=2, high=4, log=True),
},
)
)
# Importance scores are calculated with a trial with an inf value.
param_importance_with_inf = evaluator.evaluate(study)
# Obtained importance scores should be the same between with inf and without inf,
# because the last trial whose objective value is an inf is ignored.
assert param_importance_with_inf == param_importance_without_inf
@pytest.mark.parametrize("target_idx", [0, 1])
@pytest.mark.parametrize("inf_value", [float("inf"), -float("inf")])
def test_multi_objective_shap_importance_evaluator_with_infinite(
target_idx: int, inf_value: float
) -> None:
def multi_objective_function(trial: Trial) -> Tuple[float, float]:
x1 = trial.suggest_float("x1", 0.1, 3)
x2 = trial.suggest_float("x2", 0.1, 3, log=True)
x3 = trial.suggest_float("x3", 2, 4, log=True)
return x1, x2 * x3
# The test ensures that trials with infinite values are ignored to calculate importance scores.
n_trial = 10
seed = 13
# Importance scores are calculated without a trial with an inf value.
study = create_study(directions=["minimize", "minimize"], sampler=RandomSampler(seed=seed))
study.optimize(multi_objective_function, n_trials=n_trial)
evaluator = ShapleyImportanceEvaluator(seed=seed)
param_importance_without_inf = evaluator.evaluate(study, target=lambda t: t.values[target_idx])
# A trial with an inf value is added into the study manually.
study.add_trial(
create_trial(
values=[inf_value, inf_value],
params={"x1": 1.0, "x2": 1.0, "x3": 3.0},
distributions={
"x1": FloatDistribution(low=0.1, high=3),
"x2": FloatDistribution(low=0.1, high=3, log=True),
"x3": FloatDistribution(low=2, high=4, log=True),
},
)
)
# Importance scores are calculated with a trial with an inf value.
param_importance_with_inf = evaluator.evaluate(study, target=lambda t: t.values[target_idx])
# Obtained importance scores should be the same between with inf and without inf,
# because the last trial whose objective value is an inf is ignored.
assert param_importance_with_inf == param_importance_without_inf
| 38.651613 | 99 | 0.719579 | 778 | 5,991 | 5.344473 | 0.132391 | 0.097403 | 0.068783 | 0.017316 | 0.844637 | 0.791246 | 0.766474 | 0.695767 | 0.695767 | 0.594517 | 0 | 0.022181 | 0.187281 | 5,991 | 154 | 100 | 38.902597 | 0.831793 | 0.177266 | 0 | 0.44 | 0 | 0 | 0.01954 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0.08 | false | 0 | 0.44 | 0 | 0.54 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
226b998e4c8765b26d726b26d53496c6d0694b0e | 235 | py | Python | yt_arch/core/api_client.py | nailgun/youtube-playlist-archiver | 69727075e0151d03259c373647278312b11f0299 | [
"MIT"
] | null | null | null | yt_arch/core/api_client.py | nailgun/youtube-playlist-archiver | 69727075e0151d03259c373647278312b11f0299 | [
"MIT"
] | null | null | null | yt_arch/core/api_client.py | nailgun/youtube-playlist-archiver | 69727075e0151d03259c373647278312b11f0299 | [
"MIT"
] | 1 | 2021-05-10T12:47:25.000Z | 2021-05-10T12:47:25.000Z | import httpapiclient
from httpapiclient.mixins import JsonResponseMixin, HelperMethodsMixin
class ApiClient(JsonResponseMixin, HelperMethodsMixin, httpapiclient.BaseApiClient):
base_url = 'https://www.googleapis.com/youtube/v3/'
| 33.571429 | 84 | 0.834043 | 22 | 235 | 8.863636 | 0.772727 | 0.358974 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004651 | 0.085106 | 235 | 6 | 85 | 39.166667 | 0.902326 | 0 | 0 | 0 | 0 | 0 | 0.161702 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
227a1bdd855e2eb371c90643872c522b58e01b44 | 190 | py | Python | Infosys Assignments/44.py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | Infosys Assignments/44.py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | Infosys Assignments/44.py | DivyaMaddipudi/Infosyscc | 8792cb89df36efc42bdd335c7be6079fcea95be7 | [
"MIT"
] | null | null | null | import time
print(time.time())
print(time.localtime())
print(time.localtime(time.time()))
print(time.asctime())
mytime = (2019,2,5,19,10,20,0,0,0)
print(time.localtime(time.mktime(mytime))) | 23.75 | 42 | 0.726316 | 32 | 190 | 4.3125 | 0.4375 | 0.326087 | 0.282609 | 0.246377 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0.052632 | 190 | 8 | 42 | 23.75 | 0.683333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.714286 | 0 | 0 | 0 | null | 1 | 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 | 1 | 0 | 5 |
97d410c7606e126729099fe43d7ae44d47209ca2 | 415 | py | Python | paypal/__init__.py | denisroldan/paypal-python | 2bfd8b5204a0befd76f0c1baec30d39f2c82c3ed | [
"Apache-2.0"
] | 1 | 2016-01-20T14:12:31.000Z | 2016-01-20T14:12:31.000Z | paypal/__init__.py | mcordes/paypal-python | 86512481b5cd3700e13a601f193bb574b9338a43 | [
"Apache-2.0"
] | null | null | null | paypal/__init__.py | mcordes/paypal-python | 86512481b5cd3700e13a601f193bb574b9338a43 | [
"Apache-2.0"
] | 1 | 2019-07-16T15:31:52.000Z | 2019-07-16T15:31:52.000Z | # coding=utf-8
#noinspection PyUnresolvedReferences
from paypal.interface import PayPalInterface
#noinspection PyUnresolvedReferences
from paypal.settings import PayPalConfig
#noinspection PyUnresolvedReferences
from paypal.exceptions import PayPalError, PayPalConfigError, PayPalAPIResponseError
#noinspection PyUnresolvedReferences
import paypal.countries
import logging
logging.basicConfig()
VERSION = '1.2.0'
| 27.666667 | 84 | 0.86747 | 39 | 415 | 9.230769 | 0.589744 | 0.377778 | 0.316667 | 0.366667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010499 | 0.081928 | 415 | 14 | 85 | 29.642857 | 0.934383 | 0.366265 | 0 | 0 | 0 | 0 | 0.019455 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.714286 | 0 | 0.714286 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
97f50d958f79452a07edd66716f91b3fe2ffbdd3 | 139 | py | Python | Python/find-common-characters.py | coolryze/LeetCode | 03876232521a20d32f8fa4e7d6d19cf208739a79 | [
"MIT"
] | 2 | 2018-07-18T01:33:07.000Z | 2018-11-16T03:17:03.000Z | Python/find-common-characters.py | coolryze/LeetCode | 03876232521a20d32f8fa4e7d6d19cf208739a79 | [
"MIT"
] | null | null | null | Python/find-common-characters.py | coolryze/LeetCode | 03876232521a20d32f8fa4e7d6d19cf208739a79 | [
"MIT"
] | null | null | null | class Solution(object):
def commonChars(self, A):
"""
:type A: List[str]
:rtype: List[str]
"""
| 19.857143 | 29 | 0.446043 | 14 | 139 | 4.428571 | 0.785714 | 0.225806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.402878 | 139 | 7 | 30 | 19.857143 | 0.746988 | 0.258993 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
3f188b2f51ccccb561ff87b128e6198d00f6cf3b | 54 | py | Python | astraviso/demo/__init__.py | bradsease/test2 | 0925f1a170b2e1d7c09902cd8550dc844b7d7764 | [
"MIT"
] | null | null | null | astraviso/demo/__init__.py | bradsease/test2 | 0925f1a170b2e1d7c09902cd8550dc844b7d7764 | [
"MIT"
] | 44 | 2017-02-22T23:38:52.000Z | 2017-03-02T03:27:11.000Z | astraviso/demo/__init__.py | bradsease/test | 0925f1a170b2e1d7c09902cd8550dc844b7d7764 | [
"MIT"
] | null | null | null | """
Astra Viso demo scripts.
"""
from .demo import *
| 9 | 24 | 0.62963 | 7 | 54 | 4.857143 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203704 | 54 | 5 | 25 | 10.8 | 0.790698 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3f3b45d76ba923c3e0e39ec057a31b530ae254e1 | 269 | py | Python | sktracker/tracker/cost_function/tests/test_gap_close_cost_function.py | bnoi/scikit-tracker | 8771006a3a682ab299e4446c800c05f36a027df7 | [
"BSD-3-Clause"
] | 6 | 2016-03-03T12:45:32.000Z | 2018-07-06T18:51:46.000Z | sktracker/tracker/cost_function/tests/test_gap_close_cost_function.py | bnoi/scikit-tracker | 8771006a3a682ab299e4446c800c05f36a027df7 | [
"BSD-3-Clause"
] | 1 | 2021-05-12T07:54:20.000Z | 2021-05-12T07:54:20.000Z | sktracker/tracker/cost_function/tests/test_gap_close_cost_function.py | bnoi/scikit-tracker | 8771006a3a682ab299e4446c800c05f36a027df7 | [
"BSD-3-Clause"
] | 2 | 2017-11-27T13:40:43.000Z | 2020-12-12T18:31:11.000Z |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from sktracker.tracker.cost_function.gap_close import AbstractGapCloseCostFunction
# TODO
| 19.214286 | 82 | 0.828996 | 32 | 269 | 6.3125 | 0.59375 | 0.19802 | 0.316832 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004237 | 0.122677 | 269 | 13 | 83 | 20.692308 | 0.851695 | 0.096654 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0.2 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
3f3d9fb0ae46584fa15345b0c69475257d127e1e | 57 | py | Python | scene_packager/python/scene_packager/__main__.py | evil-g/scene_packager | 4bd55a4c47e09870b5a112e8ec534196f3e631a8 | [
"MIT"
] | null | null | null | scene_packager/python/scene_packager/__main__.py | evil-g/scene_packager | 4bd55a4c47e09870b5a112e8ec534196f3e631a8 | [
"MIT"
] | null | null | null | scene_packager/python/scene_packager/__main__.py | evil-g/scene_packager | 4bd55a4c47e09870b5a112e8ec534196f3e631a8 | [
"MIT"
] | null | null | null | import sys
from . import cli
sys.exit(cli.main())
| 9.5 | 21 | 0.631579 | 9 | 57 | 4 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.245614 | 57 | 5 | 22 | 11.4 | 0.837209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
3f61a2711fbe905299284976b4c709d54ba226a7 | 170 | py | Python | models.py | gabimachado/cooktop-IoT | 120776ec580cd5a8166672cfd25c65b746401af1 | [
"MIT"
] | 2 | 2016-12-23T22:18:57.000Z | 2017-02-20T08:49:32.000Z | models.py | gabimachado/cooktop-IoT | 120776ec580cd5a8166672cfd25c65b746401af1 | [
"MIT"
] | null | null | null | models.py | gabimachado/cooktop-IoT | 120776ec580cd5a8166672cfd25c65b746401af1 | [
"MIT"
] | 1 | 2021-05-28T16:16:17.000Z | 2021-05-28T16:16:17.000Z | from django.db import models
class Mode(models.Model):
name = models.CharField(max_length=50)
class State(models.Model):
name = models.CharField(max_length=50)
| 21.25 | 42 | 0.747059 | 25 | 170 | 5 | 0.56 | 0.176 | 0.24 | 0.336 | 0.656 | 0.656 | 0.656 | 0.656 | 0 | 0 | 0 | 0.027397 | 0.141176 | 170 | 7 | 43 | 24.285714 | 0.828767 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 5 |
3f731874f470ffddccddf044357effa058b8e311 | 8,785 | py | Python | tests/test_e2e.py | mlspec/mlspeclib-action-docker | 2709ff39d4defc4ece07c2b3f36b5b571bab4bd2 | [
"MIT"
] | null | null | null | tests/test_e2e.py | mlspec/mlspeclib-action-docker | 2709ff39d4defc4ece07c2b3f36b5b571bab4bd2 | [
"MIT"
] | null | null | null | tests/test_e2e.py | mlspec/mlspeclib-action-docker | 2709ff39d4defc4ece07c2b3f36b5b571bab4bd2 | [
"MIT"
] | null | null | null | import os
import sys
import io
import unittest
import logging
import pathlib
from pathlib import Path
from unittest.mock import patch, MagicMock
import yaml as YAML
import gremlin_python
from gremlin_python.driver import client
import mlspeclib.experimental.metastore
from mlspeclib import MLObject, MLSchema
from collections import namedtuple
from unittest import mock
from unittest.mock import Mock
from box import Box
import base64
from marshmallow.class_registry import RegistryError
from random import random, randint, randrange
import datetime
import uuid
if Path("src").exists():
sys.path.append(str(Path("src")))
sys.path.append(str(Path.cwd()))
sys.path.append(str(Path.cwd().parent))
from main import (
main,
convert_environment_variables_to_dict,
verify_parameters_folder_and_file_exist,
load_metastore_connection,
load_workflow_object,
load_contract_object,
execute_step,
load_parameters,
)
from utils.utils import ( # noqa E402
report_found_params,
setupLogger,
KnownException,
verify_result_contract,
)
from step_execution import StepExecution # noqa E402
class test_e2e(unittest.TestCase):
"""Main test cases."""
input_parameters = {
# Put sample required input parameters here
}
execution_parameters = {
# Put sample required execution parameters here
}
def setUp(self):
(self.rootLogger, self._buffer) = setupLogger().get_loggers()
MLSchema.populate_registry()
MLSchema.append_schema_to_registry(Path.cwd() / "tests" / "schemas_for_test")
def test_process_data(self):
"""
Full E2E of Process Data
"""
# THESE SHOULD BE THE ONLY SETTINGS FOR THIS FILE
step_name = "process_data"
expected_results_schema_type = "data_result" # MUST BE A LOADED SCHEMA
expected_results_schema_version = "9999.0.1" # MUST BE A SEMVER
results_ml_object = MLObject()
results_ml_object.set_type(
schema_type=expected_results_schema_type,
schema_version=expected_results_schema_version,
)
# Should error due to missing fields
with self.assertRaises(ValueError) as context:
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
self.assertTrue(
f"Error verifying result object for '{step_name}.output'"
in str(context.exception)
)
results_ml_object = MLObject()
result_ml_object_schema_type = expected_results_schema_type
result_ml_object_schema_version = expected_results_schema_version
exec(
(Path("tests") / "sample_process_data_execution.py").read_text(),
globals(),
locals(),
)
results_ml_object.run_date = datetime.datetime.now()
results_ml_object.step_id = str(uuid.uuid4())
results_ml_object.run_id = str(uuid.uuid4())
results_ml_object.execution_profile.system_memory_utilization = random()
results_ml_object.execution_profile.network_traffic_in_bytes = randint(
7e9, 9e10
)
results_ml_object.execution_profile.gpu_temperature = randint(70, 130)
results_ml_object.execution_profile.disk_io_utilization = random()
results_ml_object.execution_profile.gpu_percent_of_time_accessing_memory = (
random()
)
results_ml_object.execution_profile.cpu_utilization = random()
results_ml_object.execution_profile.gpu_utilization = random()
results_ml_object.execution_profile.gpu_memory_allocation = random()
self.assertTrue(
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
)
def test_train(self):
step_name = "train"
expected_results_schema_type = "training_results" # MUST BE A LOADED SCHEMA
expected_results_schema_version = "9999.0.1" # MUST BE A SEMVER
step_execution_object = StepExecution(
self.input_parameters, self.execution_parameters
)
results_ml_object = MLObject()
results_ml_object.set_type(
schema_type=expected_results_schema_type,
schema_version=expected_results_schema_version,
)
# Should error due to missing fields
with self.assertRaises(ValueError) as context:
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
self.assertTrue(
f"Error verifying result object for '{step_name}.output'"
in str(context.exception)
)
result_ml_object_schema_type = expected_results_schema_type
result_ml_object_schema_version = expected_results_schema_version
exec(
(Path("tests") / "sample_train_execution.py").read_text(),
globals(),
locals(),
)
results_ml_object.run_date = datetime.datetime.now()
results_ml_object.step_id = uuid.uuid4()
results_ml_object.run_id = uuid.uuid4()
results_ml_object.execution_profile.system_memory_utilization = random()
results_ml_object.execution_profile.network_traffic_in_bytes = randint(
7e9, 9e10
)
results_ml_object.execution_profile.gpu_temperature = randint(70, 130)
results_ml_object.execution_profile.disk_io_utilization = random()
results_ml_object.execution_profile.gpu_percent_of_time_accessing_memory = (
random()
)
results_ml_object.execution_profile.cpu_utilization = random()
results_ml_object.execution_profile.gpu_utilization = random()
results_ml_object.execution_profile.gpu_memory_allocation = random()
self.assertTrue(
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
)
def test_package(self):
step_name = "train"
expected_results_schema_type = "package_results" # MUST BE A LOADED SCHEMA
expected_results_schema_version = "9999.0.1" # MUST BE A SEMVER
step_execution_object = StepExecution(
self.input_parameters, self.execution_parameters
)
results_ml_object = MLObject()
results_ml_object.set_type(
schema_type=expected_results_schema_type,
schema_version=expected_results_schema_version,
)
# Should error due to missing fields
with self.assertRaises(ValueError) as context:
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
self.assertTrue(
f"Error verifying result object for '{step_name}.output'"
in str(context.exception)
)
result_ml_object_schema_type = expected_results_schema_type
result_ml_object_schema_version = expected_results_schema_version
exec(
(Path("tests") / "sample_package_execution.py").read_text(),
globals(),
locals(),
)
results_ml_object.run_date = datetime.datetime.now()
results_ml_object.step_id = uuid.uuid4()
results_ml_object.run_id = uuid.uuid4()
results_ml_object.execution_profile.system_memory_utilization = random()
results_ml_object.execution_profile.network_traffic_in_bytes = randint(
7e9, 9e10
)
results_ml_object.execution_profile.gpu_temperature = randint(70, 130)
results_ml_object.execution_profile.disk_io_utilization = random()
results_ml_object.execution_profile.gpu_percent_of_time_accessing_memory = (
random()
)
results_ml_object.execution_profile.cpu_utilization = random()
results_ml_object.execution_profile.gpu_utilization = random()
results_ml_object.execution_profile.gpu_memory_allocation = random()
self.assertTrue(
verify_result_contract(
results_ml_object,
expected_results_schema_type,
expected_results_schema_version,
step_name,
)
)
if __name__ == "__main__":
unittest.main()
# unittest.load_tests()
| 33.150943 | 85 | 0.664883 | 967 | 8,785 | 5.632885 | 0.171665 | 0.076372 | 0.126675 | 0.105746 | 0.753809 | 0.750138 | 0.741693 | 0.735267 | 0.719846 | 0.719846 | 0 | 0.009966 | 0.268981 | 8,785 | 264 | 86 | 33.276515 | 0.838212 | 0.050996 | 0 | 0.563981 | 0 | 0 | 0.046299 | 0.010128 | 0 | 0 | 0 | 0 | 0.042654 | 1 | 0.018957 | false | 0 | 0.118483 | 0 | 0.151659 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
58b103a5ffc89b0f021065cc47c20ed47a2bad2f | 56 | py | Python | main.py | Th3Shadowbroker/tic-tac-toe-ai | 78208fcf16a863dd449cc783c36fb025a28ae288 | [
"MIT"
] | null | null | null | main.py | Th3Shadowbroker/tic-tac-toe-ai | 78208fcf16a863dd449cc783c36fb025a28ae288 | [
"MIT"
] | null | null | null | main.py | Th3Shadowbroker/tic-tac-toe-ai | 78208fcf16a863dd449cc783c36fb025a28ae288 | [
"MIT"
] | null | null | null | from tictactoe import Game
game = Game()
game.start()
| 9.333333 | 26 | 0.714286 | 8 | 56 | 5 | 0.625 | 0.6 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 56 | 5 | 27 | 11.2 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
58bbbfdb7fa166fdd6b967ee041f51f34238e5d1 | 71 | py | Python | ezpadova/__init__.py | ktfm2/Kai_updates | f731922d3e140c1f16ea9b4b45f39232fe19a1ba | [
"MIT"
] | 1 | 2020-03-30T02:33:45.000Z | 2020-03-30T02:33:45.000Z | ezpadova/__init__.py | ktfm2/Kai_updates | f731922d3e140c1f16ea9b4b45f39232fe19a1ba | [
"MIT"
] | null | null | null | ezpadova/__init__.py | ktfm2/Kai_updates | f731922d3e140c1f16ea9b4b45f39232fe19a1ba | [
"MIT"
] | 2 | 2018-09-26T05:15:33.000Z | 2020-09-27T21:10:11.000Z | from .cmd import get_Z_isochrones, get_one_isochrone, get_t_isochrones
| 35.5 | 70 | 0.873239 | 12 | 71 | 4.666667 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084507 | 71 | 1 | 71 | 71 | 0.861538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
58c69742147c304e56fc64fc2768fd4bf5d62a99 | 32 | py | Python | PiCN/Layers/NFNLayer/NFNExecutor/test/__init__.py | NikolaiRutz/PiCN | 7775c61caae506a88af2e4ec34349e8bd9098459 | [
"BSD-3-Clause"
] | null | null | null | PiCN/Layers/NFNLayer/NFNExecutor/test/__init__.py | NikolaiRutz/PiCN | 7775c61caae506a88af2e4ec34349e8bd9098459 | [
"BSD-3-Clause"
] | 5 | 2020-07-15T09:01:42.000Z | 2020-09-28T08:45:21.000Z | PiCN/Layers/NFNLayer/NFNExecutor/test/__init__.py | NikolaiRutz/PiCN | 7775c61caae506a88af2e4ec34349e8bd9098459 | [
"BSD-3-Clause"
] | null | null | null | """Tests of the NFN Executors""" | 32 | 32 | 0.6875 | 5 | 32 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 32 | 1 | 32 | 32 | 0.785714 | 0.8125 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
45189b29be58a540e1218e2460e169d7b27f4e5d | 30 | py | Python | probvis/__init__.py | psanch21/prob-visualize | c0a2fdf3ad334e1178d1aada069ea93c796ac355 | [
"MIT"
] | 3 | 2020-06-24T13:31:41.000Z | 2021-04-01T08:23:37.000Z | probvis/__init__.py | psanch21/prob-visualize | c0a2fdf3ad334e1178d1aada069ea93c796ac355 | [
"MIT"
] | null | null | null | probvis/__init__.py | psanch21/prob-visualize | c0a2fdf3ad334e1178d1aada069ea93c796ac355 | [
"MIT"
] | null | null | null | # import probvis.distributions | 30 | 30 | 0.866667 | 3 | 30 | 8.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 30 | 1 | 30 | 30 | 0.928571 | 0.933333 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
452c319f57f8e4bc459bcfd988ec9eb20065a768 | 121 | py | Python | tests/conftest.py | p1c2u/galaxy-swift | 1d0a5926b129e499d6051de2d5167284b5295f79 | [
"Apache-2.0"
] | 2 | 2019-08-01T04:40:20.000Z | 2019-11-21T22:28:31.000Z | tests/conftest.py | p1c2u/galaxy-swift | 1d0a5926b129e499d6051de2d5167284b5295f79 | [
"Apache-2.0"
] | null | null | null | tests/conftest.py | p1c2u/galaxy-swift | 1d0a5926b129e499d6051de2d5167284b5295f79 | [
"Apache-2.0"
] | null | null | null | import logging
import pytest
@pytest.fixture(autouse=True)
def my_caplog(caplog):
caplog.set_level(logging.DEBUG)
| 13.444444 | 35 | 0.77686 | 17 | 121 | 5.411765 | 0.705882 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123967 | 121 | 8 | 36 | 15.125 | 0.867925 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.6 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
4541eb59f787c0fe0def9078ef9118bb16782a34 | 52,269 | py | Python | tests/unit/lib/intrinsic_resolver/test_intrinsic_resolver.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | 1 | 2019-05-01T08:27:35.000Z | 2019-05-01T08:27:35.000Z | tests/unit/lib/intrinsic_resolver/test_intrinsic_resolver.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | 2 | 2020-06-18T06:24:28.000Z | 2020-10-06T14:52:35.000Z | tests/unit/lib/intrinsic_resolver/test_intrinsic_resolver.py | G4brym/aws-sam-cli | 0601140f031f5b325b1861b298a6a589cf9c072b | [
"BSD-2-Clause",
"Apache-2.0"
] | 1 | 2020-06-17T11:55:28.000Z | 2020-06-17T11:55:28.000Z | import json
from collections import OrderedDict
from copy import deepcopy
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
from parameterized import parameterized
from samcli.lib.intrinsic_resolver.intrinsic_property_resolver import IntrinsicResolver
from samcli.lib.intrinsic_resolver.intrinsics_symbol_table import IntrinsicsSymbolTable
from samcli.lib.intrinsic_resolver.invalid_intrinsic_exception import InvalidIntrinsicException
class TestIntrinsicFnJoinResolver(TestCase):
def setUp(self):
self.resolver = IntrinsicResolver(template={}, symbol_resolver=IntrinsicsSymbolTable())
def test_basic_fn_join(self):
intrinsic = {"Fn::Join": [",", ["a", "b", "c", "d"]]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "a,b,c,d")
def test_nested_fn_join(self):
intrinsic_base_1 = {"Fn::Join": [",", ["a", "b", "c", "d"]]}
intrinsic_base_2 = {"Fn::Join": [";", ["g", "h", "i", intrinsic_base_1]]}
intrinsic = {"Fn::Join": [":", [intrinsic_base_1, "e", "f", intrinsic_base_2]]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "a,b,c,d:e:f:g;h;i;a,b,c,d")
@parameterized.expand(
[
("Fn::Join should fail for values that are not lists: {}".format(item), item)
for item in [True, False, "Test", {}, 42, None]
]
)
def test_fn_join_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Join": intrinsic}, True)
@parameterized.expand(
[
("Fn::Join should fail if the first argument does not resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_join_delimiter_invalid_type(self, name, delimiter):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Join": [delimiter, []]}, True)
@parameterized.expand(
[
("Fn::Join should fail if the list_of_objects is not a valid list: {}".format(item), item)
for item in [True, False, {}, 42, "t", None]
]
)
def test_fn_list_of_objects_invalid_type(self, name, list_of_objects):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Join": ["", list_of_objects]}, True)
@parameterized.expand(
[
("Fn::Join should require that all items in the list_of_objects resolve to string: {}".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_join_items_all_str(self, name, single_obj):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Join": ["", ["test", single_obj, "abcd"]]}, True)
class TestIntrinsicFnSplitResolver(TestCase):
def setUp(self):
self.resolver = IntrinsicResolver(template={}, symbol_resolver=IntrinsicsSymbolTable())
def test_basic_fn_split(self):
intrinsic = {"Fn::Split": ["|", "a|b|c"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, ["a", "b", "c"])
def test_nested_fn_split(self):
intrinsic_base_1 = {"Fn::Split": [";", {"Fn::Join": [";", ["a", "b", "c"]]}]}
intrinsic_base_2 = {"Fn::Join": [",", intrinsic_base_1]}
intrinsic = {"Fn::Split": [",", {"Fn::Join": [",", [intrinsic_base_2, ",e", ",f,", intrinsic_base_2]]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, ["a", "b", "c", "", "e", "", "f", "", "a", "b", "c"])
@parameterized.expand(
[
("Fn::Split should fail for values that are not lists: {}".format(item), item)
for item in [True, False, "Test", {}, 42]
]
)
def test_fn_split_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Split": intrinsic}, True)
@parameterized.expand(
[
("Fn::Split should fail if the first argument does not resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42]
]
)
def test_fn_split_delimiter_invalid_type(self, name, delimiter):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Split": [delimiter, []]}, True)
@parameterized.expand(
[
("Fn::Split should fail if the second argument does not resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42]
]
)
def test_fn_split_source_string_invalid_type(self, name, source_string):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Split": ["", source_string]}, True)
class TestIntrinsicFnBase64Resolver(TestCase):
def setUp(self):
self.resolver = IntrinsicResolver(template={}, symbol_resolver=IntrinsicsSymbolTable())
def test_basic_fn_split(self):
intrinsic = {"Fn::Base64": "AWS CloudFormation"}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "QVdTIENsb3VkRm9ybWF0aW9u")
def test_nested_fn_base64(self):
intrinsic_base_1 = {"Fn::Base64": "AWS CloudFormation"}
intrinsic_base_2 = {"Fn::Base64": intrinsic_base_1}
intrinsic = {"Fn::Base64": {"Fn::Join": [",", [intrinsic_base_2, ",e", ",f,", intrinsic_base_2]]}}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(
result,
"VVZaa1ZFbEZUbk5pTTFaclVtMDVlV0pYUmpCaFZ6bDEsLGUsLGYsLFVWWmtWRWxGVG5OaU0xWnJ" "VbTA1ZVdKWFJqQmhWemwx",
)
@parameterized.expand(
[
("Fn::Base64 must have a value that resolves to a string: {}".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_base64_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Base64": intrinsic}, True)
class TestIntrinsicFnSelectResolver(TestCase):
def setUp(self):
self.resolver = IntrinsicResolver(template={}, symbol_resolver=IntrinsicsSymbolTable())
def test_basic_fn_select(self):
intrinsic = {"Fn::Select": [2, ["a", "b", "c", "d"]]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "c")
def test_nested_fn_select(self):
intrinsic_base_1 = {"Fn::Select": [0, ["a", "b", "c", "d"]]}
intrinsic_base_2 = {"Fn::Join": [";", ["g", "h", "i", intrinsic_base_1]]}
intrinsic = {"Fn::Select": [3, [intrinsic_base_2, "e", "f", intrinsic_base_2]]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "g;h;i;a")
@parameterized.expand(
[
("Fn::Select should fail for values that are not lists: {}".format(item), item)
for item in [True, False, "Test", {}, 42, None]
]
)
def test_fn_select_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Select": intrinsic}, True)
@parameterized.expand(
[
("Fn::Select should fail if the first argument does not resolve to a int: {}".format(item), item)
for item in [True, False, {}, "3", None]
]
)
def test_fn_select_index_invalid_index_type(self, name, index):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Select": [index, [0]]}, True)
@parameterized.expand(
[("Fn::Select should fail if the index is out of bounds: {}".format(number), number) for number in [-2, 7]]
)
def test_fn_select_out_of_bounds(self, name, index):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Select": [index, []]}, True)
@parameterized.expand(
[
("Fn::Select should fail if the second argument does not resolve to a list: {}".format(item), item)
for item in [True, False, {}, "3", 33, None]
]
)
def test_fn_select_second_argument_invalid_type(self, name, argument):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Select": [0, argument]}, True)
class TestIntrinsicFnFindInMapResolver(TestCase):
def setUp(self):
template = {
"Mappings": {
"Basic": {"Test": {"key": "value"}},
"value": {"anotherkey": {"key": "result"}},
"result": {"value": {"key": "final"}},
}
}
self.resolver = IntrinsicResolver(symbol_resolver=IntrinsicsSymbolTable(), template=template)
def test_basic_find_in_map(self):
intrinsic = {"Fn::FindInMap": ["Basic", "Test", "key"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "value")
def test_nested_find_in_map(self):
intrinsic_base_1 = {"Fn::FindInMap": ["Basic", "Test", "key"]}
intrinsic_base_2 = {"Fn::FindInMap": [intrinsic_base_1, "anotherkey", "key"]}
intrinsic = {"Fn::FindInMap": [intrinsic_base_2, intrinsic_base_1, "key"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "final")
@parameterized.expand(
[
("Fn::FindInMap should fail if the list does not resolve to a string: {}".format(item), item)
for item in [True, False, "Test", {}, 42, None]
]
)
def test_fn_find_in_map_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::FindInMap": intrinsic}, True)
@parameterized.expand(
[
("Fn::FindInMap should fail if there isn't 3 arguments in the list: {}".format(item), item)
for item in [[""] * i for i in [0, 1, 2, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_find_in_map_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::FindInMap": intrinsic}, True)
@parameterized.expand(
[
("The arguments in Fn::FindInMap must fail if the arguments are not in the mappings".format(item), item)
for item in [
["<UNKOWN_VALUE>", "Test", "key"],
["Basic", "<UNKOWN_VALUE>", "key"],
["Basic", "Test", "<UNKOWN_VALUE>"],
]
]
)
def test_fn_find_in_map_invalid_key_entries(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::FindInMap": intrinsic}, True)
class TestIntrinsicFnAzsResolver(TestCase):
def setUp(self):
logical_id_translator = {"AWS::Region": "us-east-1"}
self.resolver = IntrinsicResolver(
template={}, symbol_resolver=IntrinsicsSymbolTable(logical_id_translator=logical_id_translator)
)
def test_basic_azs(self):
intrinsic = {"Ref": "AWS::Region"}
result = self.resolver.intrinsic_property_resolver({"Fn::GetAZs": intrinsic}, True)
self.assertEqual(result, ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f"])
def test_default_get_azs(self):
result = self.resolver.intrinsic_property_resolver({"Fn::GetAZs": ""}, True)
self.assertEqual(result, ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f"])
@parameterized.expand(
[
("Fn::GetAZs should fail if it not given a string type".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_azs_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::GetAZs": intrinsic}, True)
def test_fn_azs_invalid_region(self):
intrinsic = "UNKOWN REGION"
with self.assertRaises(InvalidIntrinsicException, msg="FN::GetAzs should fail for unknown region"):
self.resolver.intrinsic_property_resolver({"Fn::GetAZs": intrinsic}, True)
class TestFnTransform(TestCase):
def setUp(self):
logical_id_translator = {"AWS::Region": "us-east-1"}
self.resolver = IntrinsicResolver(
template={}, symbol_resolver=IntrinsicsSymbolTable(logical_id_translator=logical_id_translator)
)
@patch("samcli.lib.intrinsic_resolver.intrinsic_property_resolver.get_template_data")
def test_basic_fn_transform(self, get_template_data_patch):
intrinsic = {"Fn::Transform": {"Name": "AWS::Include", "Parameters": {"Location": "test"}}}
get_template_data_patch.return_value = {"data": "test"}
self.resolver.intrinsic_property_resolver(intrinsic, True)
get_template_data_patch.assert_called_once_with("test")
def test_fn_transform_unsupported_macro(self):
intrinsic = {"Fn::Transform": {"Name": "UNKNOWN", "Parameters": {"Location": "test"}}}
with self.assertRaises(InvalidIntrinsicException, msg="FN::Transform should fail for unknown region"):
self.resolver.intrinsic_property_resolver(intrinsic, True)
class TestIntrinsicFnRefResolver(TestCase):
def setUp(self):
logical_id_translator = {"RestApi": {"Ref": "NewRestApi"}, "AWS::StackId": "12301230123"}
resources = {"RestApi": {"Type": "AWS::ApiGateway::RestApi", "Properties": {}}}
template = {"Resources": resources}
self.resolver = IntrinsicResolver(
symbol_resolver=IntrinsicsSymbolTable(logical_id_translator=logical_id_translator, template=template),
template=template,
)
def test_basic_ref_translation(self):
intrinsic = {"Ref": "RestApi"}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "NewRestApi")
def test_default_ref_translation(self):
intrinsic = {"Ref": "UnknownApi"}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "UnknownApi")
@parameterized.expand(
[
("Ref must have arguments that resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42, None, []]
]
)
def test_ref_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Ref": intrinsic}, True)
class TestIntrinsicFnGetAttResolver(TestCase):
def setUp(self):
logical_id_translator = {
"RestApi": {"Ref": "NewRestApi"},
"LambdaFunction": {
"Arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east"
"-1:123456789012:LambdaFunction/invocations"
},
"AWS::StackId": "12301230123",
"AWS::Region": "us-east-1",
"AWS::AccountId": "406033500479",
}
resources = {
"RestApi": {"Type": "AWS::ApiGateway::RestApi", "Properties": {}},
"HelloHandler2E4FBA4D": {"Type": "AWS::Lambda::Function", "Properties": {"handler": "main.handle"}},
"LambdaFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Uri": {
"Fn::Join": [
"",
[
"arn:",
{"Ref": "AWS::Partition"},
":apigateway:",
{"Ref": "AWS::Region"},
":lambda:path/2015-03-31/functions/",
{"Fn::GetAtt": ["HelloHandler2E4FBA4D", "Arn"]},
"/invocations",
],
]
}
},
},
"LambdaFunctionWithFunctionName": {
"Type": "AWS::Lambda::Function",
"Properties": {"FunctionName": "lambda-function-with-function-name", "handler": "main.handle"},
},
"ReferencingLambdaFunctionWithFunctionName": {
"Type": "AWS::Lambda::Function",
"Properties": {"Uri": {"Fn::GetAtt": ["LambdaFunctionWithFunctionName", "Arn"]}},
},
}
template = {"Resources": resources}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=logical_id_translator)
self.resources = resources
self.resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
def test_fn_getatt_basic_translation(self):
intrinsic = {"Fn::GetAtt": ["RestApi", "RootResourceId"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "/")
def test_fn_getatt_logical_id_translated(self):
intrinsic = {"Fn::GetAtt": ["LambdaFunction", "Arn"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(
result,
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east"
"-1:123456789012:LambdaFunction/invocations",
)
def test_fn_getatt_with_fn_join(self):
intrinsic = self.resources.get("LambdaFunction").get("Properties").get("Uri")
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(
result,
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us"
"-east-1:406033500479:function:HelloHandler2E4FBA4D/invocations",
)
def test_fn_getatt_with_lambda_function_with_function_name(self):
intrinsic = self.resources.get("ReferencingLambdaFunctionWithFunctionName").get("Properties").get("Uri")
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(result, "arn:aws:lambda:us-east-1:406033500479:function:lambda-function-with-function-name")
@parameterized.expand(
[
("Fn::GetAtt must fail if the argument does not resolve to a list: {}".format(item), item)
for item in [True, False, {}, "test", 42, None]
]
)
def test_fn_getatt_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::GetAtt": intrinsic}, True)
@parameterized.expand(
[
("Fn::GetAtt should fail if it doesn't have exactly 2 arguments: {}".format(item), item)
for item in [[""] * i for i in [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_getatt_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::GetAtt": intrinsic}, True)
@parameterized.expand(
[
("Fn::GetAtt first argument must resolve to a valid string: {}".format(item), item)
for item in [True, False, {}, [], 42, None]
]
)
def test_fn_getatt_first_arguments_invalid(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::GetAtt": [intrinsic, IntrinsicResolver.REF]}, True)
@parameterized.expand(
[
("Fn::GetAtt second argument must resolve to a string:{}".format(item), item)
for item in [True, False, {}, [], 42, None]
]
)
def test_fn_getatt_second_arguments_invalid(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::GetAtt": ["some logical Id", intrinsic]}, True)
class TestIntrinsicFnSubResolver(TestCase):
def setUp(self):
logical_id_translator = {"AWS::Region": "us-east-1", "AWS::AccountId": "123456789012"}
resources = {"LambdaFunction": {"Type": "AWS::ApiGateway::RestApi", "Properties": {"Uri": "test"}}}
template = {"Resources": resources}
self.resolver = IntrinsicResolver(
template=template,
symbol_resolver=IntrinsicsSymbolTable(logical_id_translator=logical_id_translator, template=template),
)
def test_fn_sub_basic_uri(self):
intrinsic = {
"Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(
result,
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1"
":123456789012:function:LambdaFunction/invocations",
)
def test_fn_sub_uri_arguments(self):
intrinsic = {
"Fn::Sub": [
"arn:aws:apigateway:${MyItem}:lambda:path/2015-03-31/functions/${MyOtherItem}/invocations",
{"MyItem": {"Ref": "AWS::Region"}, "MyOtherItem": "LambdaFunction.Arn"},
]
}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertEqual(
result,
"arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east"
"-1:123456789012:function:LambdaFunction/invocations",
)
@parameterized.expand(
[
("Fn::Sub arguments must either resolve to a string or a list".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_sub_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Sub": intrinsic}, True)
@parameterized.expand(
[
("If Fn::Sub is a list, first argument must resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42, None]
]
)
def test_fn_sub_first_argument_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Sub": [intrinsic, {}]}, True)
@parameterized.expand(
[
("If Fn::Sub is a list, second argument must resolve to a dictionary".format(item), item)
for item in [True, False, "Another str", [], 42, None]
]
)
def test_fn_sub_second_argument_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Sub": ["some str", intrinsic]}, True)
@parameterized.expand(
[
("If Fn::Sub is a list, it should only have 2 arguments".format(item), item)
for item in [[""] * i for i in [0, 2, 3, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_sub_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Sub": ["test"] + intrinsic}, True)
class TestIntrinsicFnImportValueResolver(TestCase):
def setUp(self):
self.resolver = IntrinsicResolver(template={}, symbol_resolver=IntrinsicsSymbolTable())
def test_fn_import_value_unsupported(self):
with self.assertRaises(InvalidIntrinsicException, msg="Fn::ImportValue should be unsupported"):
self.resolver.intrinsic_property_resolver({"Fn::ImportValue": ""}, True)
class TestIntrinsicFnEqualsResolver(TestCase):
def setUp(self):
logical_id_translator = {"EnvironmentType": "prod", "AWS::AccountId": "123456789012"}
self.resolver = IntrinsicResolver(
template={}, symbol_resolver=IntrinsicsSymbolTable(logical_id_translator=logical_id_translator)
)
def test_fn_equals_basic_true(self):
intrinsic = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_equals_basic_false(self):
intrinsic = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "NotProd"]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_equals_nested_true(self):
intrinsic_base_1 = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic_base_2 = {"Fn::Equals": [{"Ref": "AWS::AccountId"}, "123456789012"]}
intrinsic = {"Fn::Equals": [intrinsic_base_1, intrinsic_base_2]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_equals_nested_false(self):
intrinsic_base_1 = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic_base_2 = {"Fn::Equals": [{"Ref": "AWS::AccountId"}, "NOT_A_VALID_ACCOUNT_ID"]}
intrinsic = {"Fn::Equals": [intrinsic_base_1, intrinsic_base_2]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
@parameterized.expand(
[
("Fn::Equals must have arguments that resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42, None, "test"]
]
)
def test_fn_equals_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Equals": intrinsic}, True)
@parameterized.expand(
[
("Fn::Equals must have exactly two arguments: {}".format(item), item)
for item in [["t"] * i for i in [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_equals_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Equals": intrinsic}, True)
class TestIntrinsicFnNotResolver(TestCase):
def setUp(self):
logical_id_translator = {"EnvironmentType": "prod", "AWS::AccountId": "123456789012"}
conditions = {
"TestCondition": {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]},
"NotTestCondition": {"Fn::Not": [{"Condition": "TestCondition"}]},
}
template = {"Conditions": conditions}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=logical_id_translator)
self.resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
def test_fn_not_basic_false(self):
intrinsic = {"Fn::Not": [{"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_not_basic_true(self):
intrinsic = {"Fn::Not": [{"Fn::Equals": [{"Ref": "EnvironmentType"}, "NotProd"]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_not_nested_true(self):
intrinsic_base_1 = {"Fn::Not": [{"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}]}
intrinsic_base_2 = {"Fn::Equals": [{"Ref": "AWS::AccountId"}, "123456789012"]}
# !(True && True)
intrinsic = {"Fn::Not": [{"Fn::Equals": [intrinsic_base_1, intrinsic_base_2]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_not_nested_false(self):
intrinsic_base_1 = {"Fn::Not": [{"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}]}
intrinsic_base_2 = {"Fn::Not": [{"Fn::Equals": [{"Ref": "AWS::AccountId"}, "123456789012"]}]}
intrinsic = {"Fn::Not": [{"Fn::Equals": [intrinsic_base_1, intrinsic_base_2]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_not_condition_false(self):
intrinsic = {"Fn::Not": [{"Condition": "TestCondition"}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_not_condition_true(self):
intrinsic = {"Fn::Not": [{"Condition": "NotTestCondition"}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
@parameterized.expand(
[
("Fn::Not must have an argument that resolves to a list: {}".format(item), item)
for item in [True, False, {}, 42, None, "test"]
]
)
def test_fn_not_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Not": intrinsic}, True)
@parameterized.expand(
[
("Fn::Not items in the list must resolve to booleans: {}".format(item), item)
for item in [{}, 42, None, "test"]
]
)
def test_fn_not_first_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Not": [intrinsic]}, True)
@parameterized.expand(
[
("Fn::Not must have exactly 1 argument: {}".format(item), item)
for item in [[True] * i for i in [0, 2, 3, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_not_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Not": intrinsic}, True)
def test_fn_not_invalid_condition(self):
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Condition"):
self.resolver.intrinsic_property_resolver({"Fn::Not": [{"Condition": "NOT_VALID_CONDITION"}]}, True)
class TestIntrinsicFnAndResolver(TestCase):
def setUp(self):
logical_id_translator = {"EnvironmentType": "prod", "AWS::AccountId": "123456789012"}
conditions = {
"TestCondition": {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]},
"NotTestCondition": {"Fn::Not": [{"Condition": "TestCondition"}]},
}
template = {"Conditions": conditions}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=logical_id_translator)
self.resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
def test_fn_and_basic_true(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic = {"Fn::And": [prod_fn_equals, {"Condition": "TestCondition"}, prod_fn_equals]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_and_basic_false(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic = {"Fn::And": [prod_fn_equals, {"Condition": "NotTestCondition"}, prod_fn_equals]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_and_nested_true(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic_base = {"Fn::And": [prod_fn_equals, {"Condition": "TestCondition"}, prod_fn_equals]}
fn_not_intrinsic = {"Fn::Not": [{"Condition": "NotTestCondition"}]}
intrinsic = {"Fn::And": [intrinsic_base, fn_not_intrinsic, prod_fn_equals]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_and_nested_false(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
prod_fn_not_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "NOT_EQUAL"]}
intrinsic_base = {"Fn::And": [prod_fn_equals, {"Condition": "NotTestCondition"}, prod_fn_equals]}
intrinsic = {"Fn::And": [{"Fn::Not": [intrinsic_base]}, prod_fn_not_equals]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
@parameterized.expand(
[
("Fn::And must have value that resolves to a list: {}".format(item), item)
for item in [True, False, {}, 42, None, "test"]
]
)
def test_fn_and_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::And": intrinsic}, True)
@parameterized.expand(
[
("Fn:And must have all arguments that resolves to booleans".format(item), item)
for item in [{}, 42, None, "test"]
]
)
def test_fn_and_all_arguments_bool(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::And": [intrinsic, intrinsic, intrinsic]}, True)
def test_fn_and_invalid_condition(self):
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Condition"):
self.resolver.intrinsic_property_resolver({"Fn::And": [{"Condition": "NOT_VALID_CONDITION"}]}, True)
class TestIntrinsicFnOrResolver(TestCase):
def setUp(self):
logical_id_translator = {"EnvironmentType": "prod", "AWS::AccountId": "123456789012"}
conditions = {
"TestCondition": {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]},
"NotTestCondition": {"Fn::Not": [{"Condition": "TestCondition"}]},
}
template = {"Conditions": conditions}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=logical_id_translator)
self.resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
def test_fn_or_basic_true(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic = {"Fn::Or": [prod_fn_equals, {"Condition": "TestCondition"}, prod_fn_equals]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_or_basic_single_true(self):
intrinsic = {"Fn::Or": [False, False, {"Condition": "TestCondition"}, False]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_or_basic_false(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
intrinsic = {
"Fn::Or": [{"Fn::Not": [prod_fn_equals]}, {"Condition": "NotTestCondition"}, {"Fn::Not": [prod_fn_equals]}]
}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_fn_or_nested_true(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
failed_intrinsic_or = {
"Fn::Or": [{"Fn::Not": [prod_fn_equals]}, {"Condition": "NotTestCondition"}, {"Fn::Not": [prod_fn_equals]}]
}
intrinsic_base = {"Fn::Or": [prod_fn_equals, {"Condition": "TestCondition"}, prod_fn_equals]}
fn_not_intrinsic = {"Fn::Not": [{"Condition": "NotTestCondition"}]}
intrinsic = {"Fn::Or": [failed_intrinsic_or, intrinsic_base, fn_not_intrinsic, fn_not_intrinsic]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_or_nested_false(self):
prod_fn_equals = {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]}
failed_intrinsic_or = {
"Fn::Or": [{"Fn::Not": [prod_fn_equals]}, {"Condition": "NotTestCondition"}, {"Fn::Not": [prod_fn_equals]}]
}
intrinsic_base = {"Fn::Or": [prod_fn_equals, {"Condition": "TestCondition"}, prod_fn_equals]}
intrinsic = {"Fn::Or": [failed_intrinsic_or, {"Fn::Not": [intrinsic_base]}]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
@parameterized.expand(
[
("Fn::Or must have an argument that resolves to a list: {}".format(item), item)
for item in [True, False, {}, 42, None, "test"]
]
)
def test_fn_or_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Or": intrinsic}, True)
@parameterized.expand(
[
("Fn::Or must have all arguments resolve to booleans: {}".format(item), item)
for item in [{}, 42, None, "test"]
]
)
def test_fn_or_all_arguments_bool(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Or": [intrinsic, intrinsic, intrinsic]}, True)
def test_fn_or_invalid_condition(self):
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Condition"):
self.resolver.intrinsic_property_resolver({"Fn::Or": [{"Condition": "NOT_VALID_CONDITION"}]}, True)
class TestIntrinsicFnIfResolver(TestCase):
def setUp(self):
logical_id_translator = {"EnvironmentType": "prod", "AWS::AccountId": "123456789012"}
conditions = {
"TestCondition": {"Fn::Equals": [{"Ref": "EnvironmentType"}, "prod"]},
"NotTestCondition": {"Fn::Not": [{"Condition": "TestCondition"}]},
"InvalidCondition": ["random items"],
}
template = {"Conditions": conditions}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=logical_id_translator)
self.resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
def test_fn_if_basic_true(self):
intrinsic = {"Fn::If": ["TestCondition", True, False]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_fn_if_basic_false(self):
intrinsic = {"Fn::If": ["NotTestCondition", True, False]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
def test_nested_fn_if_true(self):
intrinsic_base_1 = {"Fn::If": ["NotTestCondition", True, False]}
intrinsic_base_2 = {"Fn::If": ["TestCondition", True, False]}
intrinsic = {"Fn::If": ["TestCondition", intrinsic_base_2, intrinsic_base_1]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertTrue(result)
def test_nested_fn_if_false(self):
intrinsic_base_1 = {"Fn::If": ["NotTestCondition", True, False]}
intrinsic_base_2 = {"Fn::If": ["TestCondition", True, False]}
intrinsic = {"Fn::If": ["TestCondition", intrinsic_base_1, intrinsic_base_2]}
result = self.resolver.intrinsic_property_resolver(intrinsic, True)
self.assertFalse(result)
@parameterized.expand(
[
("Fn::If must an argument that resolves to a list: {}".format(item), item)
for item in [True, False, {}, 42, None, "test"]
]
)
def test_fn_if_arguments_invalid_formats(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::If": intrinsic}, True)
@parameterized.expand(
[
("Fn::If must have the argument resolve to a string: {}".format(item), item)
for item in [True, False, {}, 42, None, "test", []]
]
)
def test_fn_if_condition_arguments_invalid_type(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::If": [intrinsic, True, False]}, True)
def test_fn_if_invalid_condition(self):
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Condition"):
self.resolver.intrinsic_property_resolver({"Fn::If": ["NOT_VALID_CONDITION", "test", "test"]}, True)
@parameterized.expand(
[
("Fn::If must have exactly 3 arguments: {}".format(item), item)
for item in [[True] * i for i in [0, 1, 3, 4, 5, 6, 7, 8, 9, 10]]
]
)
def test_fn_if_invalid_number_arguments(self, name, intrinsic):
with self.assertRaises(InvalidIntrinsicException, msg=name):
self.resolver.intrinsic_property_resolver({"Fn::Not": ["TestCondition"] + intrinsic}, True)
def test_fn_if_condition_not_bool_fail(self):
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Condition"):
self.resolver.intrinsic_property_resolver({"Fn::If": ["InvalidCondition", "test", "test"]}, True)
class TestIntrinsicAttribteResolution(TestCase):
def setUp(self):
self.maxDiff = None
logical_id_translator = {
"RestApi": "NewRestApi",
"LambdaFunction": {
"Arn": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east"
"-1:123456789012:LambdaFunction/invocations"
},
"AWS::StackId": "12301230123",
"AWS::Region": "us-east-1",
"AWS::AccountId": "406033500479",
"RestApi.Deployment": {"Ref": "RestApi"},
}
self.logical_id_translator = logical_id_translator
integration_path = str(
Path(__file__).resolve().parents[0].joinpath("test_data", "inputs/test_intrinsic_template_resolution.json")
)
with open(integration_path) as f:
template = json.load(f)
self.template = template
self.resources = template.get("Resources")
self.conditions = template.get("Conditions")
self.mappings = template.get("Mappings")
symbol_resolver = IntrinsicsSymbolTable(
template=self.template, logical_id_translator=self.logical_id_translator
)
self.resolver = IntrinsicResolver(template=self.template, symbol_resolver=symbol_resolver)
def test_basic_attribte_resolution(self):
resolved_template = self.resolver.resolve_attribute(self.resources, ignore_errors=False)
expected_resources = {
"HelloHandler2E4FBA4D": {"Properties": {"handler": "main.handle"}, "Type": "AWS::Lambda::Function"},
"LambdaFunction": {
"Properties": {
"Uri": "arn:aws:apigateway:us-east-1a:lambda:path/2015-03-31/functions/arn:aws"
":lambda:us-east-1:406033500479:function:HelloHandler2E4FBA4D/invocations"
},
"Type": "AWS::Lambda::Function",
},
"ReferenceLambdaLayerVersionLambdaFunction": {
"Properties": {
"Handler": "layer-main.custom_layer_handler",
"Runtime": "python3.6",
"CodeUri": ".",
"Layers": [{"Ref": "MyCustomLambdaLayer"}],
},
"Type": "AWS::Serverless::Function",
},
"MyCustomLambdaLayer": {"Type": "AWS::Lambda::LayerVersion", "Properties": {"Content": "custom_layer/"}},
"RestApi": {
"Properties": {"Body": "YTtlO2Y7ZA==", "BodyS3Location": "https://s3location/"},
"Type": "AWS::ApiGateway::RestApi",
},
"RestApiResource": {"Properties": {"PathPart": "{proxy+}", "RestApiId": "RestApi", "parentId": "/"}},
}
self.assertEqual(dict(resolved_template), expected_resources)
def test_template_fail_errors(self):
resources = deepcopy(self.resources)
resources["RestApi.Deployment"]["Properties"]["BodyS3Location"] = {"Fn::FindInMap": []}
template = {"Mappings": self.mappings, "Conditions": self.conditions, "Resources": resources}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=self.logical_id_translator)
resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
with self.assertRaises(InvalidIntrinsicException, msg="Invalid Find In Map"):
resolver.resolve_attribute(resources, ignore_errors=False)
def test_template_ignore_errors(self):
resources = deepcopy(self.resources)
resources["RestApi.Deployment"]["Properties"]["BodyS3Location"] = {"Fn::FindInMap": []}
template = {"Mappings": self.mappings, "Conditions": self.conditions, "Resources": resources}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator=self.logical_id_translator)
resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
result = resolver.resolve_attribute(resources, ignore_errors=True)
expected_template = {
"HelloHandler2E4FBA4D": {"Properties": {"handler": "main.handle"}, "Type": "AWS::Lambda::Function"},
"ReferenceLambdaLayerVersionLambdaFunction": {
"Properties": {
"Handler": "layer-main.custom_layer_handler",
"Runtime": "python3.6",
"CodeUri": ".",
"Layers": [{"Ref": "MyCustomLambdaLayer"}],
},
"Type": "AWS::Serverless::Function",
},
"MyCustomLambdaLayer": {"Type": "AWS::Lambda::LayerVersion", "Properties": {"Content": "custom_layer/"}},
"LambdaFunction": {
"Properties": {
"Uri": "arn:aws:apigateway:us-east-1a:lambda:path/2015-03-31"
"/functions/arn:aws:lambda:us-east-1:406033500479"
":function:HelloHandler2E4FBA4D/invocations"
},
"Type": "AWS::Lambda::Function",
},
"RestApi": {
"Properties": {"Body": "YTtlO2Y7ZA==", "BodyS3Location": {"Fn::FindInMap": []}},
"Type": "AWS::ApiGateway::RestApi",
},
"RestApiResource": {"Properties": {"PathPart": "{proxy+}", "RestApiId": "RestApi", "parentId": "/"}},
}
self.assertEqual(expected_template, dict(result))
class TestResolveTemplate(TestCase):
def test_parameter_not_resolved(self):
template = {
"Parameters": {"TestStageName": {"Default": "test", "Type": "string"}},
"Resources": {
"Test": {"Type": "AWS::ApiGateway::RestApi", "Parameters": {"StageName": {"Ref": "TestStageName"}}}
},
}
expected_template = {
"Parameters": {"TestStageName": {"Default": "test", "Type": "string"}},
"Resources": OrderedDict(
{"Test": {"Type": "AWS::ApiGateway::RestApi", "Parameters": {"StageName": "test"}}}
),
}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator={})
resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
self.assertEqual(resolver.resolve_template(), expected_template)
def test_mappings_directory_resolved(self):
template = {
"Mappings": {"TestStageName": {"TestKey": {"key": "StageName"}}},
"Resources": {
"Test": {
"Type": "AWS::ApiGateway::RestApi",
"Parameters": {"StageName": {"Fn::FindInMap": ["TestStageName", "TestKey", "key"]}},
}
},
}
expected_template = {
"Mappings": {"TestStageName": {"TestKey": {"key": "StageName"}}},
"Resources": OrderedDict(
{"Test": {"Type": "AWS::ApiGateway::RestApi", "Parameters": {"StageName": "StageName"}}}
),
}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator={})
resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
self.assertEqual(resolver.resolve_template(), expected_template)
def test_output_resolved(self):
template = {
"Parameters": {"StageRef": {"Default": "StageName"}},
"Outputs": {"TestStageName": {"Ref": "Test"}, "ParameterRef": {"Ref": "StageRef"}},
"Resources": {
"Test": {"Type": "AWS::ApiGateway::RestApi", "Parameters": {"StageName": {"Ref": "StageRef"}}}
},
}
expected_template = {
"Parameters": {"StageRef": {"Default": "StageName"}},
"Resources": OrderedDict(
{"Test": {"Type": "AWS::ApiGateway::RestApi", "Parameters": {"StageName": "StageName"}}}
),
"Outputs": OrderedDict({"TestStageName": "Test", "ParameterRef": "StageName"}),
}
symbol_resolver = IntrinsicsSymbolTable(template=template, logical_id_translator={})
resolver = IntrinsicResolver(template=template, symbol_resolver=symbol_resolver)
self.assertEqual(resolver.resolve_template(), expected_template)
def load_test_data(self, template_path):
integration_path = str(Path(__file__).resolve().parents[0].joinpath("test_data", template_path))
with open(integration_path) as f:
template = json.load(f)
return template
@parameterized.expand(
[
(
"inputs/test_intrinsic_template_resolution.json",
"outputs/output_test_intrinsic_template_resolution.json",
),
("inputs/test_layers_resolution.json", "outputs/outputs_test_layers_resolution.json"),
("inputs/test_methods_resource_resolution.json", "outputs/outputs_methods_resource_resolution.json"),
]
)
def test_intrinsic_sample_inputs_outputs(self, input, output):
input_template = self.load_test_data(input)
symbol_resolver = IntrinsicsSymbolTable(template=input_template, logical_id_translator={})
resolver = IntrinsicResolver(template=input_template, symbol_resolver=symbol_resolver)
processed_template = resolver.resolve_template()
processed_template = json.loads(json.dumps(processed_template)) # Removes formatting of ordered dicts
expected_template = self.load_test_data(output)
self.assertEqual(processed_template, expected_template)
class TestIntrinsicResolverInitialization(TestCase):
def test_conditional_key_function_map(self):
resolver = IntrinsicResolver(None, None)
def lambda_func(x):
return True
resolver.set_conditional_function_map({"key": lambda_func})
self.assertTrue(resolver.conditional_key_function_map.get("key") == lambda_func)
def test_set_intrinsic_key_function_map(self):
resolver = IntrinsicResolver(None, None)
def lambda_func(x):
return True
resolver.set_intrinsic_key_function_map({"key": lambda_func})
self.assertTrue(resolver.intrinsic_key_function_map.get("key") == lambda_func)
| 46.752236 | 125 | 0.631751 | 5,400 | 52,269 | 5.914259 | 0.058333 | 0.07186 | 0.071234 | 0.094029 | 0.830573 | 0.778877 | 0.737765 | 0.705514 | 0.687228 | 0.663995 | 0 | 0.015965 | 0.227056 | 52,269 | 1,117 | 126 | 46.794091 | 0.774535 | 0.000976 | 0 | 0.424084 | 0 | 0.012565 | 0.215972 | 0.053337 | 0 | 0 | 0 | 0 | 0.102618 | 1 | 0.12356 | false | 0 | 0.01466 | 0.002094 | 0.161257 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
188f5877214204458c4960d2deaa543d5d4bccd2 | 57 | py | Python | scr/agents/__init__.py | whklwhkl/KCFpy | 308344d78415150fc16e69d23cb3432d565f23a2 | [
"MIT"
] | null | null | null | scr/agents/__init__.py | whklwhkl/KCFpy | 308344d78415150fc16e69d23cb3432d565f23a2 | [
"MIT"
] | null | null | null | scr/agents/__init__.py | whklwhkl/KCFpy | 308344d78415150fc16e69d23cb3432d565f23a2 | [
"MIT"
] | null | null | null | from .agent import Agent
from .person import PersonAgent
| 19 | 31 | 0.824561 | 8 | 57 | 5.875 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140351 | 57 | 2 | 32 | 28.5 | 0.959184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
18cf43133bca6a19e7eb6554c1bc2a1c95293dd7 | 19 | py | Python | cowait/version.py | backtick-se/cowa | 760ddb3ded1b3995bc68f4b74cf28af0c094481f | [
"Apache-2.0"
] | 51 | 2020-06-04T06:08:14.000Z | 2022-03-28T06:59:53.000Z | cowait/version.py | backtick-se/cowa | 760ddb3ded1b3995bc68f4b74cf28af0c094481f | [
"Apache-2.0"
] | 121 | 2020-06-01T12:09:32.000Z | 2022-03-31T20:47:57.000Z | cowait/version.py | backtick-se/cowa | 760ddb3ded1b3995bc68f4b74cf28af0c094481f | [
"Apache-2.0"
] | 6 | 2020-06-11T16:05:20.000Z | 2022-03-23T06:30:17.000Z | version = "0.4.31"
| 9.5 | 18 | 0.578947 | 4 | 19 | 2.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0.157895 | 19 | 1 | 19 | 19 | 0.4375 | 0 | 0 | 0 | 0 | 0 | 0.315789 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
18d01c4415cf415bc6d2ca0e5eeebf987cd89e5a | 47 | py | Python | pyhtools.py | dmdhrumilmistry/network_scanner | 36758fc938dfa6e4363830ad9f472acdf287aa51 | [
"MIT"
] | 50 | 2021-07-15T23:56:24.000Z | 2022-03-09T11:20:46.000Z | pyhtools.py | dmdhrumilmistry/network_scanner | 36758fc938dfa6e4363830ad9f472acdf287aa51 | [
"MIT"
] | null | null | null | pyhtools.py | dmdhrumilmistry/network_scanner | 36758fc938dfa6e4363830ad9f472acdf287aa51 | [
"MIT"
] | 18 | 2021-07-15T21:51:16.000Z | 2022-02-24T18:32:53.000Z | import UI.functions as UI
UI.banner()
UI.run() | 11.75 | 25 | 0.723404 | 9 | 47 | 3.777778 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12766 | 47 | 4 | 26 | 11.75 | 0.829268 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
18e5d2bc79b49e34cb8a0869da32392bf453cd46 | 282 | py | Python | finbyz_dashboard/finbyz_dashboard/dashboard_overrides/after_install.py | finbyz/finbyz_dashboard | 9c58ab7bccf589bc010d0e5bf95b20cadd4d71f0 | [
"MIT"
] | 1 | 2021-11-19T05:27:11.000Z | 2021-11-19T05:27:11.000Z | finbyz_dashboard/finbyz_dashboard/dashboard_overrides/after_install.py | finbyz/finbyz_dashboard | 9c58ab7bccf589bc010d0e5bf95b20cadd4d71f0 | [
"MIT"
] | null | null | null | finbyz_dashboard/finbyz_dashboard/dashboard_overrides/after_install.py | finbyz/finbyz_dashboard | 9c58ab7bccf589bc010d0e5bf95b20cadd4d71f0 | [
"MIT"
] | 2 | 2021-08-21T10:41:38.000Z | 2021-11-19T05:27:13.000Z | import frappe
@frappe.whitelist()
def after_install():
from finbyz_dashboard.patches.property_setter.property_setter import execute
execute()
from finbyz_dashboard.finbyz_dashboard.dashboard_overrides.dashboard_utils import sync_dashboards
sync_dashboards('finbyz_dashboard')
| 28.2 | 98 | 0.858156 | 34 | 282 | 6.794118 | 0.5 | 0.25974 | 0.164502 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074468 | 282 | 9 | 99 | 31.333333 | 0.885057 | 0 | 0 | 0 | 0 | 0 | 0.056738 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0 | 0.428571 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
18eeb73c9b602fde57854220520cbb4e4eac8841 | 64 | py | Python | tests/test_nobreak.py | aroberge/nonstandard | b415e4b5360a44ee2e1927a2b5b45c4d74ca9803 | [
"MIT"
] | 2 | 2017-04-30T23:27:06.000Z | 2017-05-01T18:30:54.000Z | tests/test_nobreak.py | aroberge/nonstandard | b415e4b5360a44ee2e1927a2b5b45c4d74ca9803 | [
"MIT"
] | null | null | null | tests/test_nobreak.py | aroberge/nonstandard | b415e4b5360a44ee2e1927a2b5b45c4d74ca9803 | [
"MIT"
] | null | null | null | from .common import nonstandard
from .nobreak_testfile import *
| 21.333333 | 31 | 0.828125 | 8 | 64 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 64 | 2 | 32 | 32 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
7a1d6a0abec56cbb25e8f4e00b4cd1509a7bc960 | 249 | py | Python | python_fishc/14.1.py | iisdd/Courses | a47d202e0d7e1ba85a38c6fe3dd9619eceb1045c | [
"MIT"
] | 1 | 2020-11-29T14:42:01.000Z | 2020-11-29T14:42:01.000Z | python_fishc/14.1.py | iisdd/Courses | a47d202e0d7e1ba85a38c6fe3dd9619eceb1045c | [
"MIT"
] | null | null | null | python_fishc/14.1.py | iisdd/Courses | a47d202e0d7e1ba85a38c6fe3dd9619eceb1045c | [
"MIT"
] | null | null | null | '''
1.据说只有智商高于150的鱼油才能解开这个字符串(还原为有意义的字符串):
str1 = 'i2sl54ovvvb4e3bferi32s56h;$c43.sfc67o0cm99'
'''
str1 = 'i2sl54ovvvb4e3bferi32s56h;$c43.sfc67o0cm99'
str2 = ''
for i in range(len(str1)):
if i % 3 == 0 :
str2 += str1[i]
print (str2)
| 22.636364 | 53 | 0.662651 | 27 | 249 | 6.111111 | 0.62963 | 0.351515 | 0.387879 | 0.521212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219512 | 0.176707 | 249 | 10 | 54 | 24.9 | 0.585366 | 0.361446 | 0 | 0 | 0 | 0 | 0.304348 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0 | 0 | null | 1 | 1 | 1 | 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 | 5 |
e1547a0764714cf205713c6eeef2ae3a6d1cd464 | 628 | py | Python | cat_data.py | MarvinQuevedo/ozone_api | a8d319c9ff2cbaed4fbe24e62dfdb0e129184be0 | [
"MIT"
] | null | null | null | cat_data.py | MarvinQuevedo/ozone_api | a8d319c9ff2cbaed4fbe24e62dfdb0e129184be0 | [
"MIT"
] | null | null | null | cat_data.py | MarvinQuevedo/ozone_api | a8d319c9ff2cbaed4fbe24e62dfdb0e129184be0 | [
"MIT"
] | null | null | null | from typing import Optional
from pydantic import BaseModel
class CatData(BaseModel):
hash: Optional[str] = None
code: Optional[str] = None
name: Optional[str] = None
category: Optional[str] = None
description: Optional[str] = None
multiplier: Optional[int] = None
supply: Optional[int] = None
hashgreen_price: Optional[float] = None
hashgreen_marketcap: Optional[int] = None
clvm: Optional[str] = None
chialisp: Optional[str] = None
logo_url: Optional[str] = None
website_url: Optional[str] = None
discord_url: Optional[str] = None
twitter_url : Optional[str] = None | 31.4 | 45 | 0.68949 | 77 | 628 | 5.545455 | 0.376623 | 0.283372 | 0.386417 | 0.168618 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.210191 | 628 | 20 | 46 | 31.4 | 0.860887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
e1984b1dba032b0cfce3d118fe3f7d2c8773abc4 | 329 | py | Python | MapasDeCampos_by_hidromod/src/__main__.py | RBCanelas/MOHID_python_tools | debddbba4fed0e1eae042eedc1554094bb78a63d | [
"MIT"
] | null | null | null | MapasDeCampos_by_hidromod/src/__main__.py | RBCanelas/MOHID_python_tools | debddbba4fed0e1eae042eedc1554094bb78a63d | [
"MIT"
] | null | null | null | MapasDeCampos_by_hidromod/src/__main__.py | RBCanelas/MOHID_python_tools | debddbba4fed0e1eae042eedc1554094bb78a63d | [
"MIT"
] | null | null | null | import PythonImageGenerator
import ModuloMaps
import ModuloTimeSeriesPlot
import ModuloGeneralReadOptions
import ModuloMapsBasemaps
import ModuloMapsDraw
import ModuloMapsFunctions
import ModuloMapsLonLat2Center
import ModuloMapsValidation
import ModuloTimeSerieReader
import ModuloTimeSeriesFunctions
import ModuloTimeSeriesDraw | 27.416667 | 32 | 0.930091 | 24 | 329 | 12.75 | 0.541667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003268 | 0.069909 | 329 | 12 | 33 | 27.416667 | 0.996732 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
bed8747531b5a487b355635af249af12e7adfe23 | 4,819 | py | Python | stream_registry_python_client/restclient.py | homeaway/stream-registry-python-client | 1683ab66941ac0a02d1ef9646f55a013088323c1 | [
"Apache-2.0"
] | 1 | 2019-01-29T20:19:53.000Z | 2019-01-29T20:19:53.000Z | stream_registry_python_client/restclient.py | homeaway/stream-registry-python-client | 1683ab66941ac0a02d1ef9646f55a013088323c1 | [
"Apache-2.0"
] | 1 | 2019-01-31T16:36:59.000Z | 2019-01-31T16:36:59.000Z | stream_registry_python_client/restclient.py | eleduardo/stream-registry-python-client | 1683ab66941ac0a02d1ef9646f55a013088323c1 | [
"Apache-2.0"
] | 1 | 2019-01-31T16:24:29.000Z | 2019-01-31T16:24:29.000Z | # Copyright (c) 2018 Expedia Group.
# All rights reserved. http://www.homeaway.com
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from logzero import logger
import requests
from typing import Dict
def register_consumer(registry_config: Dict[str, str], stream_name: str):
"""
Invoke this function to register a consumer to a stream. Under this cover this function
invokes the `stream registry api <https://homeaway.github.io/stream-registry/>`_ to
subscribe the consumer and to receive the subscription metadata which can then be used
to create the actual consumer.
:param dict registry_config: Config parameters containing the following
{ 'base_url' : The base URL to the stream service http://streamregistry.org
'region' : The string that represents the region where a consumer application is running
'app_name': The name of the application that is consuming
}
:param stream_name: The name of the stream to consume from
:return: a dict object that contains the subscription and configuration binding including the underlying topic names
"""
__validate_input(registry_config)
url = registry_config.get("base_url")
region = registry_config.get("region")
appname = registry_config.get("app_name")
if not stream_name:
logger.error("The name of the stream name is requred")
raise ValueError("The name of the stream name is requred")
request_url = "{}/v0/streams/{}/consumers/{}/regions/{}".format(url, stream_name, appname, region)
response = requests.put(request_url)
if not response.ok:
logger.error("Unable to register consumer into the stream registry {} with {}".format(
response.status_code, response.text))
return None
return response.json()
def register_producer(registry_config: Dict[str, str], stream_name: str):
"""
Invoke this function to register a producer to a stream. Under this cover this function
invokes the `stream registry api <https://homeaway.github.io/stream-registry/>`_ to
subscribe the producer and to receive the subscription metadata which can then be used
to create the actual producer.
:param dict registry_config: Config parameters containing the following
{ 'base_url' : The base URL to the stream service http://streamregistry.org
'region' : The string that represents the region where a producing application is running
'app_name': The name of the application that is producing
}
:param stream_name: The name of the stream to produce to
:return: a dict object that contains the subscription and configuration binding including the underlying topic name
"""
__validate_input(registry_config)
url = registry_config.get("base_url")
region = registry_config.get("region")
appname = registry_config.get("app_name")
if not stream_name:
logger.error("The name of the stream name is requred")
raise ValueError("The name of the stream name is requred")
request_url = "{}/v0/streams/{}/producers/{}/regions/{}".format(url, stream_name, appname, region)
response = requests.put(request_url)
if not response.ok:
logger.error("Unable to register consumer into the stream registry {} with {}".format(
response.status_code, response.text))
return None
return response.json()
def __validate_input(registry_config: Dict[str, str]):
url = registry_config.get("base_url")
if url is None or not url:
logger.error("A base_url configuration parameter is required to consume a stream")
raise ValueError("A base_url configuration parameter is required to consume a stream")
region = registry_config.get("region")
if region is None or not region:
logger.error("The current running region needs to be identified for starting a consumer")
raise ValueError("The current running region needs to be identified for starting a consumer")
appname = registry_config.get("app_name")
if appname is None or not appname:
logger.error("The name of the consuming application needs to be defined in the configuration")
raise ValueError("The current running region needs to be identified for starting a consumer") | 50.197917 | 120 | 0.719859 | 669 | 4,819 | 5.103139 | 0.246637 | 0.065612 | 0.023726 | 0.031634 | 0.744581 | 0.729057 | 0.714411 | 0.704745 | 0.704745 | 0.684241 | 0 | 0.002615 | 0.206474 | 4,819 | 96 | 121 | 50.197917 | 0.890167 | 0.456941 | 0 | 0.673913 | 0 | 0 | 0.34161 | 0.032038 | 0 | 0 | 0 | 0 | 0 | 1 | 0.065217 | false | 0 | 0.065217 | 0 | 0.217391 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
befff2c46153fcf6a3d0b8ff454b8419fd29277b | 41 | py | Python | django_crontab/models.py | martn/django-crontab | 978a26d547f1004ee286d08e31625bfbcee28811 | [
"MIT-0"
] | 783 | 2015-01-02T22:51:19.000Z | 2022-03-29T10:14:57.000Z | django_crontab/models.py | martn/django-crontab | 978a26d547f1004ee286d08e31625bfbcee28811 | [
"MIT-0"
] | 103 | 2015-03-26T05:42:05.000Z | 2022-03-29T08:59:00.000Z | django_crontab/models.py | martn/django-crontab | 978a26d547f1004ee286d08e31625bfbcee28811 | [
"MIT-0"
] | 135 | 2015-01-07T09:29:55.000Z | 2022-03-17T06:57:41.000Z | # Move along folks, nothing to see here!
| 20.5 | 40 | 0.731707 | 7 | 41 | 4.285714 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 41 | 1 | 41 | 41 | 0.909091 | 0.926829 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
83158ee8d55f589e4de190e0b1991b35aad52a5f | 236 | py | Python | trainer/__init__.py | densechen/DIP | 957de1d3e4e8b663ce305e896c7a82a0bd044301 | [
"MIT"
] | 5 | 2020-12-27T03:02:37.000Z | 2022-03-30T06:59:14.000Z | trainer/__init__.py | densechen/DIP | 957de1d3e4e8b663ce305e896c7a82a0bd044301 | [
"MIT"
] | null | null | null | trainer/__init__.py | densechen/DIP | 957de1d3e4e8b663ce305e896c7a82a0bd044301 | [
"MIT"
] | null | null | null | '''
Descripttion: densechen@foxmail.com
version: 0.0
Author: Dense Chen
Date: 1970-01-01 08:00:00
LastEditors: Dense Chen
LastEditTime: 2020-08-12 20:45:23
'''
from .irl_trainer import *
from .rl_trainer import *
from .trainer import *
| 19.666667 | 35 | 0.75 | 38 | 236 | 4.605263 | 0.684211 | 0.222857 | 0.194286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145631 | 0.127119 | 236 | 11 | 36 | 21.454545 | 0.703884 | 0.639831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
8339454d00560c0001c56a7bfd34ed2dcd14c250 | 11,352 | py | Python | quidel/tests/test_data_tools.py | benjaminysmith/covidcast-indicators | b1474cd68a1497166fefe4beffd4d5ff867b9a61 | [
"MIT"
] | null | null | null | quidel/tests/test_data_tools.py | benjaminysmith/covidcast-indicators | b1474cd68a1497166fefe4beffd4d5ff867b9a61 | [
"MIT"
] | null | null | null | quidel/tests/test_data_tools.py | benjaminysmith/covidcast-indicators | b1474cd68a1497166fefe4beffd4d5ff867b9a61 | [
"MIT"
] | null | null | null | from datetime import date
import numpy as np
import pandas as pd
import pytest
from delphi_quidel import data_tools
class TestDataTools:
@pytest.mark.parametrize("p,n,expected", [
# 0 cases
(0, 8, 0),
(1, 6, 0),
# nonzero cases
(0.5, 2, 0.125),
(0.4, 6, 0.04),
])
def test__prop_var(self, p, n, expected):
assert data_tools._prop_var(p, n) == expected
# test div/0 case
with pytest.raises(ZeroDivisionError):
data_tools._prop_var(0.1, 0)
@pytest.mark.parametrize("input_df, first, last, expected", [
# do nothing case
(pd.DataFrame([1., 2], index=[date(2020, 1, 2), date(2020, 1, 3)]),
date(2020, 1, 2),
date(2020, 1, 3),
pd.DataFrame([1., 2], index=[date(2020, 1, 2), date(2020, 1, 3)])),
# add to end case
(pd.DataFrame([1, 2], index=[date(2020, 1, 2), date(2020, 1, 3)]),
date(2020, 1, 2),
date(2020, 1, 4),
pd.DataFrame([1., 2., 0.], index=[date(2020, 1, 2), date(2020, 1, 3), date(2020, 1, 4)])),
# add to start case
(pd.DataFrame([1, 2], index=[date(2020, 1, 2), date(2020, 1, 4)]),
date(2020, 1, 2),
date(2020, 1, 4),
pd.DataFrame([1, 0, 2], index=[date(2020, 1, 2), date(2020, 1, 3), date(2020, 1, 4)])),
# fill middle case
(pd.DataFrame([1, 2], index=[date(2020, 1, 2), date(2020, 1, 3)]),
date(2020, 1, 1),
date(2020, 1, 3),
pd.DataFrame([0., 1., 2.], index=[date(2020, 1, 1), date(2020, 1, 2), date(2020, 1, 3)])),
# add both sides case
(pd.DataFrame([1.], index=[date(2020, 1, 2)]),
date(2020, 1, 1),
date(2020, 1, 3),
pd.DataFrame([0., 1., 0.], index=[date(2020, 1, 1), date(2020, 1, 2), date(2020, 1, 3)])),
# nan case + fill both sides
(pd.DataFrame([np.nan], index=[date(2020, 1, 2)]),
date(2020, 1, 1),
date(2020, 1, 3),
pd.DataFrame([0., 0., 0.], index=[date(2020, 1, 1), date(2020, 1, 2), date(2020, 1, 3)]))
])
def test_fill_dates(self, input_df, first, last, expected):
assert data_tools.fill_dates(input_df, first, last).equals(expected)
@pytest.mark.parametrize("k, expected", [
# check all k from 1 to n+1
(1, np.array([1, 2, 3, 4])),
(2, np.array([1, 3, 5, 7])),
(3, np.array([1, 3, 6, 9])),
(4, np.array([1, 3, 6, 10])),
(5, np.array([1, 3, 6, 10])),
])
def test__slide_window_sum(self, k, expected):
arr = np.array([1, 2, 3, 4])
assert np.array_equal(data_tools._slide_window_sum(arr, k), expected)
# non int case
with pytest.raises(ValueError):
data_tools._slide_window_sum(np.array([1]), 'abc')
@pytest.mark.parametrize("min_obs, max_borrow_obs, expected", [
(1, 1, np.array([0, 0, 0, 0])),
(2, 1, np.array([1/2, 0, 0, 0])),
(8, 8, np.array([1, 1, 5/6, 4/8])),
(8, 2, np.array([1, 2/4, 2/6, 2/8]))
])
def test__geographical_pooling(self, min_obs, max_borrow_obs, expected):
tpooled_tests = np.array([1, 2, 3, 4])
tpooled_ptests = np.array([2, 4, 6, 8])
assert np.array_equal(
data_tools._geographical_pooling(tpooled_tests, tpooled_ptests, min_obs, max_borrow_obs),
expected)
# nan case
with pytest.raises(ValueError):
data_tools._geographical_pooling(np.array([np.nan]), np.array([1]), 1, 1)
@pytest.mark.parametrize("min_obs, expected_pos_prop, expected_se, expected_sample_sz", [
(3, # one case of tests < min_obs
np.array([np.nan, 1/2, 1/2, 4/10]),
np.array([np.nan, np.sqrt(0.25/4), np.sqrt(0.25/6), np.sqrt(0.24/10)]),
np.array([np.nan, 4, 6, 10])),
(1, # no cases of tests < min_obs
np.array([1/2, 2/4, 3/6, 4/10]),
np.array([np.sqrt(0.25/2), np.sqrt(0.25/4), np.sqrt(0.25/6), np.sqrt(0.24/10)]),
np.array([2, 4, 6, 10])),
])
def test_raw_positive_prop(self, min_obs, expected_pos_prop, expected_se, expected_sample_sz):
positives = np.array([1, 2, 3, 4])
tests = np.array([2, 4, 6, 10])
output = data_tools.raw_positive_prop(positives, tests, min_obs)
# np.array_equal() doesn't compare nan's
assert np.allclose(output[0], expected_pos_prop, equal_nan=True)
assert np.allclose(output[1], expected_se, equal_nan=True)
assert np.allclose(output[2], expected_sample_sz, equal_nan=True)
# nan case
with pytest.raises(ValueError):
data_tools.raw_positive_prop(np.array([np.nan]), np.array([1]), 3)
# positives > tests case
with pytest.raises(ValueError):
data_tools.raw_positive_prop(np.array([3]), np.array([1]), 3)
# min obs <= 0 case
with pytest.raises(ValueError):
data_tools.raw_positive_prop(np.array([1]), np.array([1]), 0)
@pytest.mark.parametrize("min_obs, max_borrow_obs, pool_days, parent_positives, parent_tests,"
"expected_prop, expected_se, expected_sample_sz", [
(3, # no parents case
3,
2,
None,
None,
np.array([np.nan, 1/2, 1/2, 7/16]),
np.array([np.nan, np.sqrt(0.25/6), np.sqrt(0.25/10), np.sqrt(63/256/16)]),
np.array([np.nan, 6, 10, 16]),
),
(3, # parents case
3,
2,
np.array([3, 7, 9, 11]),
np.array([5, 10, 15, 20]),
np.array([1.6/3, 1/2, 1/2, 7/16]),
np.array([np.sqrt(56/225/3), np.sqrt(0.25/6), np.sqrt(0.25/10), np.sqrt(63/256/16)]),
np.array([3, 6, 10, 16]),
),
])
def test_smoothed_positive_prop(self, min_obs, max_borrow_obs, pool_days, parent_positives,
parent_tests, expected_prop, expected_se, expected_sample_sz):
positives = np.array([1, 2, 3, 4])
tests = np.array([2, 4, 6, 10])
output = data_tools.smoothed_positive_prop(positives, tests, min_obs, max_borrow_obs, pool_days,
parent_positives, parent_tests)
assert np.allclose(output[0], expected_prop, equal_nan=True)
assert np.allclose(output[1], expected_se, equal_nan=True)
assert np.allclose(output[2], expected_sample_sz, equal_nan=True)
# nan case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([np.nan]), np.array([1]), 1, 1, 1)
# positives > tests case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([2]), np.array([1]), 1, 1, 1)
# nan case with parent
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 1, 1, 1,
np.array([np.nan]), np.array([np.nan]))
# positives > tests case with parent
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 1, 1, 1,
np.array([3]), np.array([1]))
# min obs <= 0 case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 0, 1, 1)
# pool_days <= 0 case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 1, 1, 0)
# pool_days non int case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 1, 1, 1.5)
# max_borrow_obs > min_obs case
with pytest.raises(ValueError):
data_tools.smoothed_positive_prop(np.array([1]), np.array([1]), 1, 2, 1.5)
@pytest.mark.parametrize("min_obs, expected_tests_per_device, expected_sample_sz", [
(3, # one case of tests < min_obs
np.array([np.nan, 2, 1/2, 10/4]),
np.array([np.nan, 4, 3, 10])),
(1, # no cases of tests < min_obs
np.array([2, 2, 1/2, 10/4]),
np.array([2, 4, 3, 10])),
])
def test_raw_tests_per_device(self, min_obs, expected_tests_per_device, expected_sample_sz):
devices = np.array([1, 2, 6, 4])
tests = np.array([2, 4, 3, 10])
output = data_tools.raw_tests_per_device(devices, tests, min_obs)
assert np.allclose(output[0], expected_tests_per_device, equal_nan=True)
assert np.allclose(output[1], np.repeat(np.nan, len(devices)), equal_nan=True)
assert np.allclose(output[2], expected_sample_sz, equal_nan=True)
# nan case
with pytest.raises(ValueError):
data_tools.raw_tests_per_device(np.array([np.nan]), np.array([1]), 3)
# min obs <= 0 case
with pytest.raises(ValueError):
data_tools.raw_tests_per_device(np.array([1]), np.array([1]), 0)
@pytest.mark.parametrize("min_obs, max_borrow_obs, pool_days, parent_devices, parent_tests,"
"expected_prop, expected_se, expected_sample_sz", [
(3, # no parents case
3,
2,
None,
None,
np.array([np.nan, 2, 5/6, 8/7]),
np.repeat(np.nan, 4),
np.array([np.nan, 6, 10, 16]),
),
(3, # no parents case
3,
2,
np.array([3, 7, 25, 11]),
np.array([5, 10, 15, 20]),
np.array([3/1.6, 2, 5/6, 8/7]),
np.repeat(np.nan, 4),
np.array([3, 6, 10, 16]),
),
])
def test_smoothed_tests_per_device(self, min_obs, max_borrow_obs, pool_days, parent_devices, parent_tests,
expected_prop, expected_se, expected_sample_sz):
devices = np.array([1, 2, 10, 4])
tests = np.array([2, 4, 6, 10])
output = data_tools.smoothed_tests_per_device(devices, tests, min_obs, max_borrow_obs,
pool_days, parent_devices, parent_tests)
assert np.allclose(output[0], expected_prop, equal_nan=True)
assert np.allclose(output[1], expected_se, equal_nan=True)
assert np.allclose(output[2], expected_sample_sz, equal_nan=True)
# nan case
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([np.nan]), np.array([1]), 1, 1, 1)
# nan case with parent
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([1]), np.array([1]), 1, 1, 1,
np.array([np.nan]), np.array([np.nan]))
# min obs <= 0 case
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([1]), np.array([1]), 0, 0, 1)
# pool_days <= 0 case
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([1]), np.array([1]), 1, 1, 0)
# pool_days non int case
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([1]), np.array([1]), 1, 1, 1.5)
# max_borrow_obs > min_obs case
with pytest.raises(ValueError):
data_tools.smoothed_tests_per_device(np.array([1]), np.array([1]), 1, 3, 1.5) | 45.408 | 110 | 0.557875 | 1,699 | 11,352 | 3.56857 | 0.075338 | 0.108527 | 0.067293 | 0.090054 | 0.854033 | 0.817087 | 0.748309 | 0.73528 | 0.696355 | 0.642751 | 0 | 0.086919 | 0.279422 | 11,352 | 250 | 111 | 45.408 | 0.654279 | 0.069415 | 0 | 0.46798 | 0 | 0 | 0.040574 | 0.002471 | 0 | 0 | 0 | 0 | 0.078818 | 1 | 0.039409 | false | 0 | 0.024631 | 0 | 0.068966 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
8360beace34225df6b4f880e7ba6561c523e8b21 | 1,389 | py | Python | quantipy/__init__.py | kaitumisuuringute-keskus/quantipy3 | 4066f22d1bda38a7082fb055d8a35bef8a7cd786 | [
"MIT"
] | null | null | null | quantipy/__init__.py | kaitumisuuringute-keskus/quantipy3 | 4066f22d1bda38a7082fb055d8a35bef8a7cd786 | [
"MIT"
] | null | null | null | quantipy/__init__.py | kaitumisuuringute-keskus/quantipy3 | 4066f22d1bda38a7082fb055d8a35bef8a7cd786 | [
"MIT"
] | null | null | null |
from quantipy.core.options import set_option, OPTIONS
from quantipy.core.dataset import DataSet
from quantipy.core.batch import Batch
from quantipy.core.link import Link
from quantipy.core.view import View
from quantipy.core.chain import Chain
from quantipy.core.stack import Stack
from quantipy.core.cluster import Cluster
from quantipy.core.weights.rim import Rim
from quantipy.core.weights.weight_engine import WeightEngine
from quantipy.core.view_generators.view_mapper import ViewMapper
from quantipy.core.view_generators.view_maps import QuantipyViews
from quantipy.core.view_generators.view_specs import (net, calc, ViewManager)
from quantipy.core.helpers.functions import parrot
import quantipy.core.helpers.functions as helpers
import quantipy.core.tools.dp as dp
import quantipy.core.tools.view as v
from quantipy.core.pandas_utility import dataframe_fix_string_types
# from quantipy.sandbox import sandbox
from quantipy.core.tools.dp.io import (
read_quantipy, write_quantipy,
read_ascribe,
read_decipher,
read_dimensions,write_dimensions,
read_spss, write_spss)
from quantipy.core.quantify.engine import Quantity, Test
from quantipy.core.builds.excel.excel_painter import ExcelPainter
from quantipy.core.builds.powerpoint.pptx_painter import PowerPointPainter
from quantipy.version import version as __version__
| 36.552632 | 78 | 0.817855 | 193 | 1,389 | 5.751295 | 0.310881 | 0.237838 | 0.273874 | 0.072072 | 0.091892 | 0.091892 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12599 | 1,389 | 37 | 79 | 37.540541 | 0.914333 | 0.025918 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.821429 | 0 | 0.821429 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
836b04ad2a635e1b290a58fd34b9a93e1b1fefb0 | 56 | py | Python | greet.py | Ashokkommi0001/my_packages | 28e99345c5abdbb9fabb80b1977e6631af713db7 | [
"MIT"
] | null | null | null | greet.py | Ashokkommi0001/my_packages | 28e99345c5abdbb9fabb80b1977e6631af713db7 | [
"MIT"
] | null | null | null | greet.py | Ashokkommi0001/my_packages | 28e99345c5abdbb9fabb80b1977e6631af713db7 | [
"MIT"
] | null | null | null | def SayHello(name):
return "Hello, Hi " + str(name)
| 18.666667 | 35 | 0.625 | 8 | 56 | 4.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | 56 | 2 | 36 | 28 | 0.795455 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
55ceb60c15cd678f3538bcaf3004938b722e8e9c | 207 | py | Python | gym_connect_four/__init__.py | nicolas-chan-42/COMP-3359-Project-Deep-Q-RL | 6e9098e6d55b8a813b27efc871f179ffeb2cfa9c | [
"MIT"
] | null | null | null | gym_connect_four/__init__.py | nicolas-chan-42/COMP-3359-Project-Deep-Q-RL | 6e9098e6d55b8a813b27efc871f179ffeb2cfa9c | [
"MIT"
] | 1 | 2020-05-02T15:24:23.000Z | 2020-05-02T15:24:23.000Z | gym_connect_four/__init__.py | nicolas-chan-42/COMP-3359-Project-Deep-Q-RL | 6e9098e6d55b8a813b27efc871f179ffeb2cfa9c | [
"MIT"
] | null | null | null | from gym.envs.registration import register
from gym_connect_four.envs import ConnectFourEnv, ResultType, Reward
register(
id='ConnectFour-v1',
entry_point='gym_connect_four.envs:ConnectFourEnv',
)
| 23 | 68 | 0.797101 | 26 | 207 | 6.153846 | 0.615385 | 0.0875 | 0.175 | 0.225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.115942 | 207 | 8 | 69 | 25.875 | 0.868852 | 0 | 0 | 0 | 0 | 0 | 0.241546 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
55e9ba08c5454e7783f72af4d624457859009db4 | 55 | py | Python | ide/crossviper-master/check.py | crazysuryaa/Deeplearning_PlayGround | 94ddc3ddba157e3eb7cde4514e8824fe2c428551 | [
"MIT"
] | null | null | null | ide/crossviper-master/check.py | crazysuryaa/Deeplearning_PlayGround | 94ddc3ddba157e3eb7cde4514e8824fe2c428551 | [
"MIT"
] | null | null | null | ide/crossviper-master/check.py | crazysuryaa/Deeplearning_PlayGround | 94ddc3ddba157e3eb7cde4514e8824fe2c428551 | [
"MIT"
] | null | null | null | import tensorflow as tf
print("love is blind say hau") | 18.333333 | 30 | 0.763636 | 10 | 55 | 4.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163636 | 55 | 3 | 30 | 18.333333 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
55f80ef937f67dd0ba9d6e1b6d96aef8aad70b19 | 3,865 | py | Python | dags/segmentation_op.py | seung-lab/seuron | 81e462f8ef71f2e28b4c2ad4c835b27b251ae25a | [
"MIT"
] | null | null | null | dags/segmentation_op.py | seung-lab/seuron | 81e462f8ef71f2e28b4c2ad4c835b27b251ae25a | [
"MIT"
] | null | null | null | dags/segmentation_op.py | seung-lab/seuron | 81e462f8ef71f2e28b4c2ad4c835b27b251ae25a | [
"MIT"
] | 3 | 2018-12-20T16:46:38.000Z | 2022-03-02T18:49:39.000Z | from custom.docker_custom import DockerWithVariablesOperator
from airflow.utils.weight_rule import WeightRule
from datetime import timedelta
from param_default import default_args, cmd_proto, default_mount_path, default_seg_workspace, check_worker_image_labels
from slack_message import task_retry_alert
import os
def composite_chunks_wrap_op(img, dag, config_mounts, queue, tag, stage, op, params):
workspace_path = params.get("WORKSPACE_PATH", default_seg_workspace)
overlap = 0
overlap_mode = params.get("OVERLAP_MODE", False)
if overlap_mode:
overlap_mip = params.get("OVERLAP_MIP", params.get("BATCH_MIP", 3))
overlap = 2 if int(tag.split("_")[0]) > overlap_mip else 1
cmdlist = f'export OVERLAP={overlap} && export STAGE={stage} && {os.path.join(workspace_path, "scripts/run_wrapper.sh")} . composite_chunk_{op} {tag}'
return DockerWithVariablesOperator(
config_mounts,
mount_point=params.get("MOUNT_PATH", default_mount_path),
task_id='composite_chunk_{}_{}'.format(stage, tag),
command=cmd_proto.format(cmdlist),
default_args=default_args,
image=img,
on_retry_callback=task_retry_alert,
weight_rule=WeightRule.ABSOLUTE,
execution_timeout=timedelta(minutes=params.get("HIGH_MIP_TIMEOUT", 600)),
force_pull=True,
queue=queue,
dag=dag
)
def composite_chunks_overlap_op(img, dag, config_mounts, queue, tag, params):
workspace_path = params.get("WORKSPACE_PATH", default_seg_workspace)
cmdlist = f'export STAGE=agg && {os.path.join(workspace_path, "scripts/run_wrapper.sh")} . composite_chunk_overlap {tag}'
return DockerWithVariablesOperator(
config_mounts,
mount_point=params.get("MOUNT_PATH", default_mount_path),
task_id='composite_chunk_overlap_{}'.format(tag),
command=cmd_proto.format(cmdlist),
default_args=default_args,
image=img,
on_retry_callback=task_retry_alert,
weight_rule=WeightRule.ABSOLUTE,
execution_timeout=timedelta(minutes=params.get("OVERLAP_TIMEOUT", 240)),
force_pull=True,
queue=queue,
dag=dag
)
def composite_chunks_batch_op(img, dag, config_mounts, queue, mip, tag, stage, op, params):
workspace_path = params.get("WORKSPACE_PATH", default_seg_workspace)
overlap = 1 if params.get("OVERLAP_MODE", False) else 0
cmdlist = f'export OVERLAP={overlap} && export STAGE={stage} && {os.path.join(workspace_path, "scripts/run_batch.sh")} {op} {mip} {tag}'
return DockerWithVariablesOperator(
config_mounts,
mount_point=params.get("MOUNT_PATH", default_mount_path),
task_id='batch_chunk_{}_{}'.format(stage, tag),
command=cmd_proto.format(cmdlist),
default_args=default_args,
image=img,
on_retry_callback=task_retry_alert,
weight_rule=WeightRule.ABSOLUTE,
execution_timeout=timedelta(minutes=params.get("BATCH_MIP_TIMEOUT", 120)),
force_pull=True,
queue=queue,
dag=dag
)
def remap_chunks_batch_op(img, dag, config_mounts, queue, mip, tag, stage, op, params):
workspace_path = params.get("WORKSPACE_PATH", "/root/seg")
cmdlist = f'export STAGE={stage} && {os.path.join(workspace_path, "scripts/remap_batch.sh")} {stage} {mip} {tag}'
return DockerWithVariablesOperator(
config_mounts,
mount_point=params.get("MOUNT_PATH", "/root/.cloudvolume/secrets"),
task_id='remap_chunk_{}_{}'.format(stage, tag),
command=cmd_proto.format(cmdlist),
default_args=default_args,
image=img,
on_retry_callback=task_retry_alert,
weight_rule=WeightRule.ABSOLUTE,
execution_timeout=timedelta(minutes=params.get("REMAP_TIMEOUT", 120)),
force_pull=True,
queue=queue,
dag=dag
)
| 42.01087 | 154 | 0.701164 | 485 | 3,865 | 5.286598 | 0.185567 | 0.056162 | 0.027301 | 0.035881 | 0.771061 | 0.75156 | 0.75156 | 0.730889 | 0.729719 | 0.681357 | 0 | 0.006036 | 0.185511 | 3,865 | 91 | 155 | 42.472527 | 0.80845 | 0 | 0 | 0.575 | 0 | 0.05 | 0.203364 | 0.081242 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.075 | 0 | 0.175 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
36065d5e10a8766c4fa56e09e9364a9b6cbbe8c5 | 43 | py | Python | Python/printhello.py | PushpneetSingh/Hello-world | def0f44737e02fb40063cd347e93e456658e2532 | [
"MIT"
] | 1,428 | 2018-10-03T15:15:17.000Z | 2019-03-31T18:38:36.000Z | Python/printhello.py | PushpneetSingh/Hello-world | def0f44737e02fb40063cd347e93e456658e2532 | [
"MIT"
] | 1,162 | 2018-10-03T15:05:49.000Z | 2018-10-18T14:17:52.000Z | Python/printhello.py | PushpneetSingh/Hello-world | def0f44737e02fb40063cd347e93e456658e2532 | [
"MIT"
] | 3,909 | 2018-10-03T15:07:19.000Z | 2019-03-31T18:39:08.000Z | #rajitha gunathilake
print("hellow world!") | 21.5 | 22 | 0.790698 | 5 | 43 | 6.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 43 | 2 | 22 | 21.5 | 0.85 | 0.44186 | 0 | 0 | 0 | 0 | 0.541667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
3621b940a075ced97f1d050c760c5163b55223f9 | 233 | py | Python | src/unitmeasure/__init__.py | gabock/unitmeasure | 440ee256d91794317345b9aff102e3e7416363d9 | [
"MIT"
] | null | null | null | src/unitmeasure/__init__.py | gabock/unitmeasure | 440ee256d91794317345b9aff102e3e7416363d9 | [
"MIT"
] | null | null | null | src/unitmeasure/__init__.py | gabock/unitmeasure | 440ee256d91794317345b9aff102e3e7416363d9 | [
"MIT"
] | null | null | null | from unitmeasure import converters
from unitmeasure.dimension import Dimension
from unitmeasure.measurement import Measurement
from unitmeasure.serialization import *
from unitmeasure.unit import Unit
from unitmeasure.units import *
| 33.285714 | 47 | 0.866953 | 27 | 233 | 7.481481 | 0.333333 | 0.445545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103004 | 233 | 6 | 48 | 38.833333 | 0.966507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
362b3609db39249ead72af780b006116f08c7566 | 164 | py | Python | web/talks/managers.py | vtalks/vtalks.net | 80fb19ff9684e0854c6abe5f0eef73e80ec326a6 | [
"Apache-2.0"
] | 1 | 2017-11-28T03:17:23.000Z | 2017-11-28T03:17:23.000Z | web/talks/managers.py | vtalks/vtalks.net | 80fb19ff9684e0854c6abe5f0eef73e80ec326a6 | [
"Apache-2.0"
] | 56 | 2018-01-14T18:03:03.000Z | 2018-06-25T17:59:02.000Z | web/talks/managers.py | vtalks/vtalks.net | 80fb19ff9684e0854c6abe5f0eef73e80ec326a6 | [
"Apache-2.0"
] | null | null | null | from django.db import models
class PublishedTalkManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(published=True)
| 23.428571 | 60 | 0.75 | 20 | 164 | 6.05 | 0.85 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 164 | 6 | 61 | 27.333333 | 0.864286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
363ad08c16d61b41aba2ea5a56cf42fc8601e633 | 63 | py | Python | keras_contrib/backend/cntk_backend.py | arodiss/keras-contrib | 8ec9c77382120ac0cbd5ea55c6efda48d27af33a | [
"MIT"
] | null | null | null | keras_contrib/backend/cntk_backend.py | arodiss/keras-contrib | 8ec9c77382120ac0cbd5ea55c6efda48d27af33a | [
"MIT"
] | null | null | null | keras_contrib/backend/cntk_backend.py | arodiss/keras-contrib | 8ec9c77382120ac0cbd5ea55c6efda48d27af33a | [
"MIT"
] | 1 | 2019-01-24T05:12:26.000Z | 2019-01-24T05:12:26.000Z | from keras.backend import cntk_backend as KCN
import cntk as C
| 21 | 45 | 0.825397 | 12 | 63 | 4.25 | 0.666667 | 0.392157 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15873 | 63 | 2 | 46 | 31.5 | 0.962264 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
366ca682fe26219ee02525f99c6472e46f0a1cb1 | 696 | py | Python | compiler_test.py | gsedometov/KR580-compiler | 29383b40c02f07d12414421151f45c3feccbd49b | [
"MIT"
] | null | null | null | compiler_test.py | gsedometov/KR580-compiler | 29383b40c02f07d12414421151f45c3feccbd49b | [
"MIT"
] | null | null | null | compiler_test.py | gsedometov/KR580-compiler | 29383b40c02f07d12414421151f45c3feccbd49b | [
"MIT"
] | null | null | null | from compiler import parser
def test_labels():
assert parser.parse('LABEL0:\nJMP LABEL0\nMOV A, M\nLABEL1:\nMOV A, M\nJMP LABEL1') == [0xC3, 0x00, 0x00, 0x7E, 0x7E, 0xC3, 0x04, 0x00]
def test_nullar():
assert parser.parse('NOP') == 0x00
assert parser.parse('STC') == 0x37
assert parser.parse('RC') == 0xD8
def test_two_rg():
assert parser.parse('MOV M, A') == 0x77
assert parser.parse('MOV C, L') == 0x4D
def test_one_num():
assert parser.parse('CMA 09') == [0x2F, 0x09]
def test_address():
assert parser.parse('CALL 0830') == [0xCD, 0x30, 0x08]
def test_multiline():
assert parser.parse('STA 1918\nMOV A, M\nMOV A, M') == [0x32, 0x18, 0x19, 0x7E, 0x7E]
| 30.26087 | 139 | 0.650862 | 107 | 696 | 4.158879 | 0.476636 | 0.242697 | 0.34382 | 0.089888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126095 | 0.179598 | 696 | 22 | 140 | 31.636364 | 0.65324 | 0 | 0 | 0 | 0 | 0 | 0.182471 | 0 | 0 | 0 | 0.132184 | 0 | 0.5625 | 1 | 0.375 | true | 0 | 0.0625 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
36af5f32dbb615bc8a2e88e87a377674adb51245 | 153 | py | Python | pyIOT/__init__.py | dhrone/pyIOT | 653f47e568033111dc9073c8bd2f7812bec05fb6 | [
"MIT"
] | null | null | null | pyIOT/__init__.py | dhrone/pyIOT | 653f47e568033111dc9073c8bd2f7812bec05fb6 | [
"MIT"
] | null | null | null | pyIOT/__init__.py | dhrone/pyIOT | 653f47e568033111dc9073c8bd2f7812bec05fb6 | [
"MIT"
] | 1 | 2019-04-28T12:48:51.000Z | 2019-04-28T12:48:51.000Z |
import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())
from pyIOT.Thing import Thing
from pyIOT.Component import Component
| 21.857143 | 62 | 0.803922 | 18 | 153 | 6.611111 | 0.555556 | 0.151261 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124183 | 153 | 6 | 63 | 25.5 | 0.88806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
36d65a12fc2c08546dfaef2f960ff7e7ea2ea02b | 148 | py | Python | Interview_problems_solutions/DP/dp_multiply.py | filip-michalsky/Algorithms_and_Data_Structures | ca3a004ecd86224c6c15274a6002c59d6e50c71b | [
"MIT"
] | null | null | null | Interview_problems_solutions/DP/dp_multiply.py | filip-michalsky/Algorithms_and_Data_Structures | ca3a004ecd86224c6c15274a6002c59d6e50c71b | [
"MIT"
] | null | null | null | Interview_problems_solutions/DP/dp_multiply.py | filip-michalsky/Algorithms_and_Data_Structures | ca3a004ecd86224c6c15274a6002c59d6e50c71b | [
"MIT"
] | null | null | null |
def dp_multiply(num1,num2):
if num1 ==0 or num2 == 0:
return 0
if num2 == 1:
return num1
else:
return num1 + dp_multiply(num1,num2-1)
| 11.384615 | 40 | 0.635135 | 26 | 148 | 3.538462 | 0.423077 | 0.217391 | 0.304348 | 0.391304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 0.243243 | 148 | 12 | 41 | 12.333333 | 0.696429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.571429 | 0 | 1 | 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 | 1 | 0 | 0 | 5 |
36fb045ce8f2f664b143106fe28e682ee5455458 | 3,872 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/5-webcache.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/5-webcache.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/5-webcache.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | import urllib.request
import datetime
"""
- create a web client, that on the first iteration of fetching a url it then caches the url and response in a hash table
- on subsequent calls the web response is pulled from the cache
- URL -> KEY
- PAGE DATA -> VALUE
"""
# # first pass
# # let's make a class to hold a cache entry
# # store the url
# # store the data
# class CacheEntry:
# def __init__(self, url, data):
# self.url = url
# self.data = data
# # hold a cache
# cache = {}
# # let's plan out how we will approach this
# # loop
# while True:
# # take input from user set it to url
# url = input("Enter a URL: ")
# # some data store
# data = None
# # check if the key is in the cache
# if url in cache:
# # if it is then set the cache at the url to an entry
# entry = cache[url]
# # set our data to the entry / the data that was returned
# data = entry.data
# # print getting from cache
# print("Getting data from cache...")
# # if our data is still none
# if data is None:
# # print getting from server
# print("Getting data from server...")
# # then get the data from the server
# # call to urlopen passing in the url
# # save the response
# resp = urllib.request.urlopen(url)
# # take the response data and put it in the data variable
# data = resp.read()
# # store the data in the cache
# cache[url] = CacheEntry(url, data)
# # close connection
# resp.close()
# second pass
# let's make a class to hold a cache entry
# store the url
# store the data
# store a timestamp
# some expiry time
# let's plan out how we will approach this
# keep looping
# take input from user set it to url
# some data store
# check if the key is in the cache
# if it is then set the cache at the url to an entry
# has our cache timeout expired
# if it has not expired
# set our data to the entry / the data that was returned
# print getting from cache
# if our data is still none
# then get the data from the server
# call to urlopen passing in the url
# save the response
# take the response data and put it in the data variable
# print getting from server
# store the data in the cache
# create a cache entry object and store that in the cache
# close connection
# let's make a class to hold a cache entry
# store the url
# store the data
# store a timestamp
CACHE_EXPIRY_SECONDS = 10
class CacheEntry:
def __init__(self, url, data):
self.url = url
self.data = data
self.timestamp = datetime.datetime.now().timestamp()
# hold a cache
cache = {}
# let's plan out how we will approach this
# loop
while True:
# take input from user set it to url
url = input("Enter a URL: ")
# some data store
data = None
# check if the key is in the cache
if url in cache:
cur_time = datetime.datetime.now().timestamp()
# if it is then set the cache at the url to an entry
entry = cache[url]
# if it has not expired
if cur_time - entry.timestamp < CACHE_EXPIRY_SECONDS:
# set our data to the entry / the data that was returned
data = entry.data
# print getting from cache
print("Getting data from cache...")
# if our data is still none
if data is None:
# print getting from server
print("Getting data from server...")
# then get the data from the server
# call to urlopen passing in the url
# save the response
resp = urllib.request.urlopen(url)
# take the response data and put it in the data variable
data = resp.read()
# store the data in the cache
cache[url] = CacheEntry(url, data)
# close connection
resp.close()
| 24.506329 | 120 | 0.626291 | 596 | 3,872 | 4.045302 | 0.169463 | 0.04355 | 0.029034 | 0.033181 | 0.791788 | 0.777686 | 0.768561 | 0.768561 | 0.745334 | 0.723766 | 0 | 0.000741 | 0.302944 | 3,872 | 157 | 121 | 24.66242 | 0.892553 | 0.660124 | 0 | 0 | 0 | 0 | 0.067347 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.083333 | 0 | 0.166667 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
7fd1484bcd16f3d6f80882389e7c146465a3b8e0 | 122 | py | Python | main.py | appletime81/machine_data_excel_processing | 04f992bf0ce81f37b5536ab26756732f555a2c6a | [
"MIT"
] | null | null | null | main.py | appletime81/machine_data_excel_processing | 04f992bf0ce81f37b5536ab26756732f555a2c6a | [
"MIT"
] | null | null | null | main.py | appletime81/machine_data_excel_processing | 04f992bf0ce81f37b5536ab26756732f555a2c6a | [
"MIT"
] | null | null | null | from utils import *
import time
from pprint import pprint
def main():
pass
if __name__ == '__main__':
main()
| 9.384615 | 26 | 0.655738 | 16 | 122 | 4.5 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.254098 | 122 | 12 | 27 | 10.166667 | 0.791209 | 0 | 0 | 0 | 0 | 0 | 0.065574 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0.142857 | 0.428571 | 0 | 0.571429 | 0.142857 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
7ff9a7633726b16fb2190c01631363f8b4749bd0 | 38 | py | Python | 02_Functions/resolver/__init__.py | MANOJPATRA1991/Python-Beyond-the-Basics | aed7bfd35e33c2b1759b48e1c89314aa149c56d0 | [
"MIT"
] | null | null | null | 02_Functions/resolver/__init__.py | MANOJPATRA1991/Python-Beyond-the-Basics | aed7bfd35e33c2b1759b48e1c89314aa149c56d0 | [
"MIT"
] | null | null | null | 02_Functions/resolver/__init__.py | MANOJPATRA1991/Python-Beyond-the-Basics | aed7bfd35e33c2b1759b48e1c89314aa149c56d0 | [
"MIT"
] | null | null | null | from resolver.resolver import Resolver | 38 | 38 | 0.894737 | 5 | 38 | 6.8 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 38 | 1 | 38 | 38 | 0.971429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
3d1e93ebc6d6cf7e8729bd6a5949e1b8f9ecd69f | 734 | py | Python | webfront/exceptions.py | ProteinsWebTeam/project-skeleton | 7aeb971ba2d9bfe272e0590bd4484afb61336b96 | [
"Apache-2.0"
] | 6 | 2020-05-25T17:35:52.000Z | 2022-03-26T00:45:55.000Z | webfront/exceptions.py | ProteinsWebTeam/project-skeleton | 7aeb971ba2d9bfe272e0590bd4484afb61336b96 | [
"Apache-2.0"
] | 76 | 2016-07-29T09:22:34.000Z | 2022-03-15T07:57:17.000Z | webfront/exceptions.py | ProteinsWebTeam/project-skeleton | 7aeb971ba2d9bfe272e0590bd4484afb61336b96 | [
"Apache-2.0"
] | 1 | 2017-04-09T20:08:30.000Z | 2017-04-09T20:08:30.000Z | class DeletedEntryError(Exception):
def __init__(self, accession, date, message, history):
self.accession = accession
self.message = message
self.date = date
self.history = history
class EmptyQuerysetError(Exception):
def __init__(self, message):
self.message = message
class ExpectedUniqueError(Exception):
def __init__(self, message):
self.message = message
class HmmerWebError(Exception):
def __init__(self, message):
self.message = message
class BadURLParameterError(Exception):
def __init__(self, message):
self.message = message
class InvalidOperationRequest(Exception):
def __init__(self, message):
self.message = message | 27.185185 | 58 | 0.689373 | 72 | 734 | 6.694444 | 0.208333 | 0.251037 | 0.19917 | 0.248963 | 0.508299 | 0.508299 | 0.508299 | 0.508299 | 0.414938 | 0 | 0 | 0 | 0.224796 | 734 | 27 | 59 | 27.185185 | 0.8471 | 0 | 0 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 5 |
e9f862316edf460397ffbab6a9bac45c43e80e08 | 10,552 | py | Python | tests/test_extensions/test_highlight.py | mlclmj/pymdown-extensions | a39b0e99dc7971e16740b04de4fe4f63324be0dd | [
"MIT"
] | null | null | null | tests/test_extensions/test_highlight.py | mlclmj/pymdown-extensions | a39b0e99dc7971e16740b04de4fe4f63324be0dd | [
"MIT"
] | null | null | null | tests/test_extensions/test_highlight.py | mlclmj/pymdown-extensions | a39b0e99dc7971e16740b04de4fe4f63324be0dd | [
"MIT"
] | null | null | null | """Test cases for Highlight."""
from .. import util
class TestHighlightInline(util.MdCase):
"""Test highlight inline."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'linenums_style': 'pymdownx-inline'
}
}
def test_pymdownx_inline(self):
"""Test new inline mode."""
self.check_markdown(
r'''
```python linenums="1"
import test
test.test()
```
''',
r'''
<div class="highlight"><pre><span></span><code><span class="lineno" data-linenos="1 "></span><span class="kn">import</span> <span class="nn">test</span>
<span class="lineno" data-linenos="2 "></span><span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
class TestNoClass(util.MdCase):
"""Test no class."""
extension = ['pymdownx.highlight', 'pymdownx.superfences', 'markdown.extensions.attr_list']
extension_configs = {
'pymdownx.highlight': {
'css_class': ''
}
}
def test_no_class(self):
"""Test with no class."""
self.check_markdown(
r'''
```python
import test
test.test()
```
''',
r'''
<div><pre><span></span><code><span class="kn">import</span> <span class="nn">test</span>
<span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
def test_no_class_and_user_class(self):
"""Test with no class and user class."""
self.check_markdown(
r'''
```{.python .more}
import test
test.test()
```
''',
r'''
<div class="more"><pre><span></span><code><span class="kn">import</span> <span class="nn">test</span>
<span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
def test_no_class_and_user_class_linenums(self):
"""Test with no class and user class and table format."""
self.check_markdown(
r'''
```{.python .more linenums="1"}
import test
test.test()
```
''',
r'''
<table class="more table"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1
2</pre></div></td><td class="code"><div class="more "><pre><span></span><code><span class="kn">import</span> <span class="nn">test</span>
<span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
</td></tr></table>
''', # noqa: E501
True
)
class TestNoClassNoPygments(util.MdCase):
"""Test no class."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'css_class': '',
'use_pygments': False
}
}
def test_no_class_no_pygments(self):
"""Test with no class and no Pygments."""
self.check_markdown(
r'''
```python
import test
test.test()
```
''',
r'''
<pre><code class="language-python">import test
test.test()</code></pre>
''', # noqa: E501
True
)
class TestCustomLangPrefixNoPygments(util.MdCase):
"""Test custom language prefix."""
extension = ['pymdownx.highlight', 'pymdownx.superfences', 'pymdownx.inlinehilite']
extension_configs = {
'pymdownx.highlight': {
'language_prefix': 'lang-',
'use_pygments': False
}
}
def test_custom_prefix_no_pygments(self):
"""Test with custom prefix and no Pygments."""
self.check_markdown(
r'''
```python
import test
test.test()
```
''',
r'''
<pre class="highlight"><code class="lang-python">import test
test.test()</code></pre>
''', # noqa: E501
True
)
def test_custom_prefix_no_pygments_inline(self):
"""Test with custom prefix and no Pygments with inline code."""
self.check_markdown(
'`#!python import test`',
'<p><code class="lang-python highlight">import test</code></p>'
)
class TestNoPygments(util.MdCase):
"""Test no Pygments."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'use_pygments': False
}
}
def test_no_pygments(self):
"""Test with no Pygments."""
self.check_markdown(
r'''
```python
import test
test.test()
```
''',
r'''
<pre class="highlight"><code class="language-python">import test
test.test()</code></pre>
''',
True
)
def test_no_pygments_linenums(self):
"""Test with no Pygments and line numbers."""
self.check_markdown(
r'''
```python linenums="1"
import test
test.test()
```
''',
r'''
<p><code>python linenums="1"
import test
test.test()</code></p>
''',
True
)
class TestNoPygmentsCustomLineClass(util.MdCase):
"""Test no Pygments with custom line number class."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'use_pygments': False,
'linenums_class': 'line-numbers',
'linenums': True
}
}
def test_no_pygments_linenums_custom_class(self):
"""Test with no Pygments and line numbers."""
self.check_markdown(
r'''
Text
import test
test.test()
Text
''',
r'''
<p>Text</p>
<pre class="highlight"><code>import test
test.test()
</code></pre>
<p>Text</p>
''',
True
)
def test_no_pygments_linenums_custom_class_fences(self):
"""Test with no Pygments and line numbers in fences."""
self.check_markdown(
r'''
```python
import test
test.test()
```
''',
r'''
<pre class="highlight"><code class="language-python">import test
test.test()</code></pre>
''',
True
)
class TestHighlightSpecial(util.MdCase):
"""Test highlight global special."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'linenums_style': 'pymdownx-inline',
'linenums_special': 2
}
}
def test_special(self):
"""Test global special mode."""
self.check_markdown(
r'''
```python linenums="1"
import test
test.test()
```
''',
r'''
<div class="highlight"><pre><span></span><code><span class="lineno" data-linenos="1 "></span><span class="kn">import</span> <span class="nn">test</span>
<span class="lineno special" data-linenos="2 "></span><span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
def test_special_override(self):
"""Test global special mode override."""
self.check_markdown(
r'''
```python linenums="1 1 1"
import test
test.test()
```
''',
r'''
<div class="highlight"><pre><span></span><code><span class="lineno special" data-linenos="1 "></span><span class="kn">import</span> <span class="nn">test</span>
<span class="lineno special" data-linenos="2 "></span><span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
class TestDisabledLinenums(util.MdCase):
"""Test with line numbers globally disabled."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'linenums': False
}
}
def test_global_disable(self):
"""Test with line numbers globally disabled."""
self.check_markdown(
r'''
```python linenums="1"
import test
test.test()
```
''',
r'''
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">test</span>
<span class="n">test</span><span class="o">.</span><span class="n">test</span><span class="p">()</span>
</code></pre></div>
''', # noqa: E501
True
)
class TestDisabledLinenumsNoPygments(util.MdCase):
"""Test with line numbers globally disabled with no Pygments."""
extension = ['pymdownx.highlight', 'pymdownx.superfences']
extension_configs = {
'pymdownx.highlight': {
'linenums': False,
'use_pygments': False
}
}
def test_global_disable(self):
"""Test with line numbers globally disabled and no Pygments."""
self.check_markdown(
r'''
```python linenums="1"
import test
test.test()
```
''',
r'''
<p><code>python linenums="1"
import test
test.test()</code></p>
''', # noqa: E501
True
)
| 28.442049 | 172 | 0.488059 | 1,043 | 10,552 | 4.853308 | 0.080537 | 0.07744 | 0.105294 | 0.074674 | 0.816871 | 0.784473 | 0.719281 | 0.703477 | 0.635915 | 0.635915 | 0 | 0.007292 | 0.350171 | 10,552 | 370 | 173 | 28.518919 | 0.730932 | 0.0942 | 0 | 0.553459 | 0 | 0 | 0.192213 | 0.011188 | 0 | 0 | 0 | 0 | 0 | 1 | 0.09434 | false | 0 | 0.018868 | 0 | 0.283019 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
1823e4151bfcd2a992bb3de1d07dd50256323e3c | 154 | py | Python | Parts/__init__.py | ragreenburg/postgres_odbc | a210e36a162bdbcb9cc55319c38fe9660638f4ed | [
"MIT"
] | null | null | null | Parts/__init__.py | ragreenburg/postgres_odbc | a210e36a162bdbcb9cc55319c38fe9660638f4ed | [
"MIT"
] | 2 | 2020-10-16T16:51:53.000Z | 2020-10-27T21:36:26.000Z | Parts/__init__.py | ragreenburg/postgres_odbc | a210e36a162bdbcb9cc55319c38fe9660638f4ed | [
"MIT"
] | null | null | null | #__init__.py
from .edit import editing, editdb, edit_autofill
from .parts import parts_db
from .condenser import cond_db
from .compressor import comp_db
| 22 | 48 | 0.818182 | 24 | 154 | 4.916667 | 0.583333 | 0.101695 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12987 | 154 | 6 | 49 | 25.666667 | 0.880597 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
184e94ed9ef324ddd4d4df15e0b4642b85d5af5f | 5,645 | py | Python | ASSIGN-2/assignment_2/Environments/environments/envs/random_maze.py | ShivenTripathi/CS698-Deep-Reinforcement-Learning | 184f7887cea3065d2bfa4ba05bfb249838c3dab4 | [
"MIT"
] | null | null | null | ASSIGN-2/assignment_2/Environments/environments/envs/random_maze.py | ShivenTripathi/CS698-Deep-Reinforcement-Learning | 184f7887cea3065d2bfa4ba05bfb249838c3dab4 | [
"MIT"
] | null | null | null | ASSIGN-2/assignment_2/Environments/environments/envs/random_maze.py | ShivenTripathi/CS698-Deep-Reinforcement-Learning | 184f7887cea3065d2bfa4ba05bfb249838c3dab4 | [
"MIT"
] | null | null | null | import gym
from gym import spaces
from gym.spaces import Discrete
from gym.utils import seeding
import numpy as np
from os import path
import math
from typing import Tuple
class InValidActionException (Exception):
pass
class RandomMaze(gym.Env):
'''Constructor. Takes number of states as a parameter.
States are:
0 1 2 3(Goal)
4 5(Wall) 6 7(Hole)
8(Start) 9 10 11
Action space :
0 -> LEFT
1 -> UP
2 -> RIGHT
3 -> DOWN
Allocate the Reward:
If Goal state: +1
If Hole state: -1
Otherwise: -0.04
'''
def __init__(self):
self.start_state = int(8)
self.goal = int(3)
self.hole = int(7)
self.state = int(8)
self.transition_matrix = {
0: {
0: [(0.8, 0, -0.04, False), (0.1, 0, -0.04, False), (0.1, 4, -0.04, False)],
1: [(0.8, 0, -0.04, False), (0.1, 0, -0.04, False), (0.1, 1, -0.04, False)],
2: [(0.8, 1, -0.04, False), (0.1, 0, -0.04, False), (0.1, 4, -0.04, False)],
3: [(0.8, 4, -0.04, False), (0.1, 0, -0.04, False), (0.1, 1, -0.04, False)],
},
1: {
0: [(0.8, 0, -0.04, False), (0.1, 1, -0.04, False), (0.1, 1, -0.04, False)],
1: [(0.8, 1, -0.04, False), (0.1, 0, -0.04, False), (0.1, 2, -0.04, False)],
2: [(0.8, 2, -0.04, False), (0.1, 1, -0.04, False), (0.1, 1, -0.04, False)],
3: [(0.8, 1, -0.04, False), (0.1, 0, -0.04, False), (0.1, 2, -0.04, False)],
},
2: {
0: [(0.8, 1, -0.04, False), (0.1, 2, -0.04, False), (0.1, 6, -0.04, False)],
1: [(0.8, 2, -0.04, False), (0.1, 1, -0.04, False), (0.1, 3, +1, True)],
2: [(0.8, 3, +1, True), (0.1, 2, -0.04, False), (0.1, 6, -0.04, False)],
3: [(0.8, 6, -0.04, False), (0.1, 1, -0.04, False), (0.1, 3, +1, True)],
},
3: {
0: [(0.8, 3, 0, True), (0.1, 3, 0, True), (0.1, 3, 0, True)],
1: [(0.8, 3, 0, True), (0.1, 3, 0, True), (0.1, 3, 0, True)],
2: [(0.8, 3, 0, True), (0.1, 3, 0, True), (0.1, 3, 0, True)],
3: [(0.8, 3, 0, True), (0.1, 3, 0, True), (0.1, 3, 0, True)],
},
4: {
0: [(0.8, 4, -0.04, False), (0.1, 0, -0.04, False), (0.1, 8, -0.04, False)],
1: [(0.8, 0, -0.04, False), (0.1, 4, -0.04, False), (0.1, 4, -0.04, False)],
2: [(0.8, 4, -0.04, False), (0.1, 0, -0.04, False), (0.1, 8, -0.04, False)],
3: [(0.8, 8, -0.04, False), (0.1, 4, -0.04, False), (0.1, 4, -0.04, False)],
},
6: {
0: [(0.8, 6, -0.04, False), (0.1, 2, -0.04, False), (0.1, 10, -0.04, False)],
1: [(0.8, 2, -0.04, False), (0.1, 6, -0.04, False), (0.1, 7, -1, True)],
2: [(0.8, 7, -1, True), (0.1, 2, -0.04, False), (0.1, 10, -0.04, False)],
3: [(0.8, 10, -0.04, False), (0.1, 6, -0.04, False), (0.1, 7, -1, True)],
},
7: {
0: [(0.8, 7, 0, True), (0.1, 7, 0, True), (0.1, 7, 0, True)],
1: [(0.8, 7, 0, True), (0.1, 7, 0, True), (0.1, 7, 0, True)],
2: [(0.8, 7, 0, True), (0.1, 7, 0, True), (0.1, 7, 0, True)],
3: [(0.8, 7, 0, True), (0.1, 7, 0, True), (0.1, 7, 0, True)],
},
8: {
0: [(0.8, 8, -0.04, False), (0.1, 8, -0.04, False), (0.1, 4, -0.04, False)],
1: [(0.8, 4, -0.04, False), (0.1, 8, -0.04, False), (0.1, 9, -0.04, False)],
2: [(0.8, 9, -0.04, False), (0.1, 8, -0.04, False), (0.1, 4, -0.04, False)],
3: [(0.8, 8, -0.04, False), (0.1, 8, -0.04, False), (0.1, 9, -0.04, False)],
},
9: {
0: [(0.8, 8, -0.04, False), (0.1, 9, -0.04, False), (0.1, 9, -0.04, False)],
1: [(0.8, 9, -0.04, False), (0.1, 8, -0.04, False), (0.1, 10, -0.04, False)],
2: [(0.8, 10, -0.04, False), (0.1, 9, -0.04, False), (0.1, 9, -0.04, False)],
3: [(0.8, 9, -0.04, False), (0.1, 8, -0.04, False), (0.1, 10, -0.04, False)]
},
10: {
0: [(0.8, 9, -0.04, False), (0.1, 6, -0.04, False), (0.1, 10, -0.04, False)],
1: [(0.8, 6, -0.04, False), (0.1, 9, -0.04, False), (0.1, 11, -0.04, False)],
2: [(0.8, 11, -0.04, False), (0.1, 6, -0.04, False), (0.1, 10, -0.04, False)],
3: [(0.8, 10, -0.04, False), (0.1, 9, -0.04, False), (0.1, 11, -0.04, False)]
},
11: {
0: [(0.8, 10, -0.04, False), (0.1, 7, -1, True), (0.1, 11, -0.04, False)],
1: [(0.8, 7, -1, True), (0.1, 10, -0.04, False), (0.1, 11, -0.04, False)],
2: [(0.8, 11, -0.04, False), (0.1, 7, -1, True), (0.1, 11, -0.04, False)],
3: [(0.8, 11, -0.04, False), (0.1, 11, -0.04, False), (0.1, 10, -0.04, False)]
}
}
def seed(self, seed):
np.random.seed(seed)
return seed
def step(self, action):
d = np.random.choice([0, 1, 2], p=[0.8, 0.1, 0.1])
tr = self.transition_matrix[int(self.state)][int(action)][int(d)]
prob = tr[0]
self.state = int(tr[1])
reward = tr[2]
is_Terminal = tr[3]
return self.state, reward, is_Terminal, {}
def reset(self):
self.state = int(8)
return self.state, False
| 43.75969 | 94 | 0.379805 | 996 | 5,645 | 2.143574 | 0.078313 | 0.140515 | 0.37096 | 0.282436 | 0.662295 | 0.657143 | 0.651522 | 0.645433 | 0.635129 | 0.616862 | 0 | 0.235507 | 0.364393 | 5,645 | 128 | 95 | 44.101563 | 0.359532 | 0.052967 | 0 | 0.020408 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.040816 | false | 0.010204 | 0.081633 | 0 | 0.173469 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 5 |
1875cd4faba98b0e09e8236ab4f936faa127c91b | 108 | py | Python | rlgpu/utils/rl_pytorch/sac_hrl/__init__.py | cypypccpy/Isaac-ManipulaRL | 11168d0a8c2db31a02ac8af8962cead64671c99b | [
"Apache-2.0"
] | 26 | 2021-12-01T07:15:35.000Z | 2022-03-21T00:57:20.000Z | rlgpu/utils/rl_pytorch/sac_hrl/__init__.py | cypypccpy/Isaac-ManipulaRL | 11168d0a8c2db31a02ac8af8962cead64671c99b | [
"Apache-2.0"
] | null | null | null | rlgpu/utils/rl_pytorch/sac_hrl/__init__.py | cypypccpy/Isaac-ManipulaRL | 11168d0a8c2db31a02ac8af8962cead64671c99b | [
"Apache-2.0"
] | 2 | 2021-12-02T03:09:04.000Z | 2021-12-06T22:58:54.000Z | from .storage import ReplayBeffer
from .module import ActorCritic, MetaActorCritic
from .sac_hrl import SAC
| 27 | 48 | 0.842593 | 14 | 108 | 6.428571 | 0.642857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12037 | 108 | 3 | 49 | 36 | 0.947368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
1876fe67b6a0a88ef93948bab59653d3ff74a0d4 | 220 | py | Python | model_params.py | pguzowski/xgbooster-for-hps | f2633a03e56140b23f2c9439963e30dfa20bca6b | [
"MIT"
] | null | null | null | model_params.py | pguzowski/xgbooster-for-hps | f2633a03e56140b23f2c9439963e30dfa20bca6b | [
"MIT"
] | null | null | null | model_params.py | pguzowski/xgbooster-for-hps | f2633a03e56140b23f2c9439963e30dfa20bca6b | [
"MIT"
] | null | null | null | import importlib.util
spec = importlib.util.spec_from_file_location("module_name", "params/no_scale_eta_0.3.py")
foo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(foo)
model_params = foo.model_params
| 27.5 | 90 | 0.818182 | 36 | 220 | 4.666667 | 0.555556 | 0.232143 | 0.202381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009756 | 0.068182 | 220 | 7 | 91 | 31.428571 | 0.809756 | 0 | 0 | 0 | 0 | 0 | 0.16895 | 0.118721 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
a18fac8f0a8aaeb178a07f544795e33df96b7e07 | 78 | py | Python | Python/Programming Basics/Simple Calculations/06. Circle Area and Perimeter.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | Python/Programming Basics/Simple Calculations/06. Circle Area and Perimeter.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | Python/Programming Basics/Simple Calculations/06. Circle Area and Perimeter.py | teodoramilcheva/softuni-software-engineering | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | [
"MIT"
] | null | null | null | import math
r = float(input())
print(math.pi* r * r)
print(math.pi * 2 * r)
| 11.142857 | 22 | 0.602564 | 15 | 78 | 3.133333 | 0.533333 | 0.382979 | 0.468085 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016129 | 0.205128 | 78 | 6 | 23 | 13 | 0.741935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.5 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
a1b16195494d3e7a5ed30bf9b4c75be336c60963 | 182 | py | Python | note/Lec1/HelloTaichi.py | logic-three-body/Taichi_Course_Files | eee4f037e23af698bcf33d261ad0b54522181956 | [
"MIT"
] | null | null | null | note/Lec1/HelloTaichi.py | logic-three-body/Taichi_Course_Files | eee4f037e23af698bcf33d261ad0b54522181956 | [
"MIT"
] | 1 | 2021-10-12T08:27:49.000Z | 2021-10-12T08:27:49.000Z | note/Lec1/HelloTaichi.py | logic-three-body/Taichi_Course_Files | eee4f037e23af698bcf33d261ad0b54522181956 | [
"MIT"
] | null | null | null | import taichi as ti
ti.init(arch=ti.cpu)
'''python scope'''
def foo():
print('Hi,Im in py')
foo()
'''python scope'''
@ti.kernel
def foo():
print('Hi,Im in taichi')
foo() | 11.375 | 28 | 0.598901 | 31 | 182 | 3.516129 | 0.548387 | 0.201835 | 0.201835 | 0.238532 | 0.311927 | 0.311927 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186813 | 182 | 16 | 29 | 11.375 | 0.736486 | 0 | 0 | 0.444444 | 0 | 0 | 0.176871 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | true | 0 | 0.111111 | 0 | 0.333333 | 0.222222 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
a1baeb3b4efecd54e0049f121d0cff9845d1cce6 | 93 | py | Python | adm/templates/plugins/_common/hooks/post_gen_project.py | frdcms/mfserv | 82b20779ca8f8b5af39353383ff79f2018bc4f2f | [
"BSD-3-Clause"
] | 11 | 2018-11-23T16:39:31.000Z | 2021-06-01T12:44:31.000Z | adm/templates/plugins/_common/hooks/post_gen_project.py | frdcms/mfserv | 82b20779ca8f8b5af39353383ff79f2018bc4f2f | [
"BSD-3-Clause"
] | 315 | 2018-09-18T09:15:18.000Z | 2022-02-25T02:02:15.000Z | adm/templates/plugins/_common/hooks/post_gen_project.py | frdcms/mfserv | 82b20779ca8f8b5af39353383ff79f2018bc4f2f | [
"BSD-3-Clause"
] | 7 | 2018-09-20T10:22:36.000Z | 2019-07-31T12:09:06.000Z | #!/usr/bin/env python3
from cookiecutter_hooks import post_gen_project
post_gen_project()
| 13.285714 | 47 | 0.817204 | 14 | 93 | 5.071429 | 0.785714 | 0.197183 | 0.394366 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012048 | 0.107527 | 93 | 6 | 48 | 15.5 | 0.843373 | 0.225806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
a1d26a0055f9f25f29162bc560987cf26b7abfb8 | 253 | py | Python | src/loss/__init__.py | JacksonWuxs/taac2021-Video-Classification-Rank5 | abecf49b95fe82d9dd47ed37e020d510b04da018 | [
"MIT"
] | 7 | 2022-02-22T03:01:59.000Z | 2022-03-24T12:50:34.000Z | src/loss/__init__.py | JacksonWuxs/taac2021-Video-Classification-Rank5 | abecf49b95fe82d9dd47ed37e020d510b04da018 | [
"MIT"
] | null | null | null | src/loss/__init__.py | JacksonWuxs/taac2021-Video-Classification-Rank5 | abecf49b95fe82d9dd47ed37e020d510b04da018 | [
"MIT"
] | null | null | null | from src.loss.loss import CrossEntropyLoss
from src.loss.loss import SoftmaxLoss
def get_instance(name, paramters_dict):
model = {'CrossEntropyLoss': CrossEntropyLoss,
'SoftmaxLoss': SoftmaxLoss}[name]
return model(**paramters_dict) | 36.142857 | 50 | 0.750988 | 28 | 253 | 6.678571 | 0.5 | 0.074866 | 0.117647 | 0.160428 | 0.224599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15415 | 253 | 7 | 51 | 36.142857 | 0.873832 | 0 | 0 | 0 | 0 | 0 | 0.106299 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
a1d82defb99507c932860e79b07930a96992c23e | 136 | py | Python | python/testData/mover/functionBlock.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/mover/functionBlock.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/mover/functionBlock.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | class A:
def foo(self):
pass
<selection><caret>def bar(self):
pass</selection>
def baz(self):
pass
| 12.363636 | 36 | 0.522059 | 17 | 136 | 4.176471 | 0.588235 | 0.338028 | 0.478873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | 136 | 10 | 37 | 13.6 | 0.806818 | 0 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.428571 | 0 | null | null | 0 | 1 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
a1f134afd908f3b7d53a1204d333a4b210bf5455 | 223 | py | Python | pyprob/__init__.py | tuananhle7/pyprob | 6a46bc43a5af9f598b44bac7a74c80949c94fcec | [
"MIT"
] | 1 | 2018-02-11T16:32:23.000Z | 2018-02-11T16:32:23.000Z | pyprob/__init__.py | tuananhle7/pyprob | 6a46bc43a5af9f598b44bac7a74c80949c94fcec | [
"MIT"
] | null | null | null | pyprob/__init__.py | tuananhle7/pyprob | 6a46bc43a5af9f598b44bac7a74c80949c94fcec | [
"MIT"
] | 1 | 2020-06-24T15:29:15.000Z | 2020-06-24T15:29:15.000Z | __version__ = '0.10.0.dev10'
from pyprob.util import set_random_seed
from pyprob.util import set_cuda
from pyprob.util import get_config
from pyprob.model import Model, RemoteModel
from pyprob.state import sample, observe
| 27.875 | 43 | 0.825112 | 36 | 223 | 4.888889 | 0.527778 | 0.284091 | 0.238636 | 0.340909 | 0.261364 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030457 | 0.116592 | 223 | 7 | 44 | 31.857143 | 0.862944 | 0 | 0 | 0 | 0 | 0 | 0.053812 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
b800ba966fd605c3f5ecdd1d52be0245f637dbfe | 60 | py | Python | edb/common/vendor/__init__.py | aeros/edgedb | db8c240d1607765799caf124a4b418250e0c0a96 | [
"Apache-2.0"
] | null | null | null | edb/common/vendor/__init__.py | aeros/edgedb | db8c240d1607765799caf124a4b418250e0c0a96 | [
"Apache-2.0"
] | null | null | null | edb/common/vendor/__init__.py | aeros/edgedb | db8c240d1607765799caf124a4b418250e0c0a96 | [
"Apache-2.0"
] | null | null | null | # Vendored Dependencies
from __future__ import annotations
| 15 | 34 | 0.85 | 6 | 60 | 7.833333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 60 | 3 | 35 | 20 | 0.903846 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
b8060cf603ab1c04bb0b73962408402418aeb1e2 | 110 | py | Python | src/officehours_api/backends/__init__.py | vikaschanduri/remote-office-hours-queue | 485b7df27a013e804c42f04612cff0d1a911c64a | [
"Apache-2.0"
] | 9 | 2020-04-13T13:18:43.000Z | 2022-03-04T21:10:58.000Z | src/officehours_api/backends/__init__.py | vikaschanduri/remote-office-hours-queue | 485b7df27a013e804c42f04612cff0d1a911c64a | [
"Apache-2.0"
] | 249 | 2020-04-11T15:34:50.000Z | 2022-02-19T00:25:28.000Z | src/officehours_api/backends/__init__.py | vikaschanduri/remote-office-hours-queue | 485b7df27a013e804c42f04612cff0d1a911c64a | [
"Apache-2.0"
] | 7 | 2020-04-10T12:19:54.000Z | 2021-04-25T19:42:41.000Z | from . import inperson
from . import bluejeans
from . import zoom
__all__ = ['inperson', 'bluejeans', 'zoom']
| 22 | 43 | 0.718182 | 13 | 110 | 5.769231 | 0.461538 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154545 | 110 | 4 | 44 | 27.5 | 0.806452 | 0 | 0 | 0 | 0 | 0 | 0.190909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
62a380387f9e27071ddacd80f81bc038db34f28c | 50 | py | Python | python/GMatElastoPlasticFiniteStrainSimo/__init__.py | tdegeus/GMatFSElastoPlasticSimo | 601041d3bd56df30dac4f4dd72e292495f73d665 | [
"MIT"
] | null | null | null | python/GMatElastoPlasticFiniteStrainSimo/__init__.py | tdegeus/GMatFSElastoPlasticSimo | 601041d3bd56df30dac4f4dd72e292495f73d665 | [
"MIT"
] | 10 | 2019-10-12T22:38:22.000Z | 2021-08-30T07:10:00.000Z | python/GMatElastoPlasticFiniteStrainSimo/__init__.py | tdegeus/GMatFSElastoPlasticSimo | 601041d3bd56df30dac4f4dd72e292495f73d665 | [
"MIT"
] | null | null | null | from ._GMatElastoPlasticFiniteStrainSimo import *
| 25 | 49 | 0.88 | 3 | 50 | 14.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 50 | 1 | 50 | 50 | 0.934783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
1a145adb5a6d54fbefe60a0b39f35611b960f3b4 | 103 | py | Python | python/testData/paramInfo/DoubleNestedArg.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/paramInfo/DoubleNestedArg.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/paramInfo/DoubleNestedArg.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | # py 2.x only
def foo(a, (b, (c, d)), e):
pass
foo(<arg1>1, (<arg2>2, (<arg3>3, <arg4>4)), <arg5>5)
| 17.166667 | 52 | 0.495146 | 23 | 103 | 2.217391 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130952 | 0.184466 | 103 | 5 | 53 | 20.6 | 0.47619 | 0.106796 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.333333 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
a7e8967d6cb01d8761dbb2a54bf3de20575bd5df | 11,909 | py | Python | data/typing/geopandas.geoseries.py | pydata-apis/python-api-record | 684cffbbb6dc6e81f9de4e02619c8b0ebc557b2b | [
"MIT"
] | 67 | 2020-08-17T11:53:26.000Z | 2021-11-08T20:16:06.000Z | data/typing/geopandas.geoseries.py | data-apis/python-record-api | 684cffbbb6dc6e81f9de4e02619c8b0ebc557b2b | [
"MIT"
] | 36 | 2020-08-17T11:09:51.000Z | 2021-12-15T18:09:47.000Z | data/typing/geopandas.geoseries.py | pydata-apis/python-api-record | 684cffbbb6dc6e81f9de4e02619c8b0ebc557b2b | [
"MIT"
] | 7 | 2020-08-19T05:06:47.000Z | 2020-11-04T05:10:38.000Z | from typing import *
class GeoSeries:
@overload
def __getitem__(self, /, key: int):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: Literal["A"]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: Literal["B"]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: Literal["C"]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: slice[None, int, None]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: pandas.core.series.Series):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: List[bool]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: numpy.ndarray):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: slice[int, None, int]):
"""
usage.geopandas: 1
"""
...
@overload
def __getitem__(self, /, key: slice[None, None, None]):
"""
usage.geopandas: 1
"""
...
def __getitem__(self, /, key: object):
"""
usage.geopandas: 10
"""
...
@overload
def __init__(
self, /, data: pandas.core.internals.managers.SingleBlockManager, index: None
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(self, /, data: geopandas.geoseries.GeoSeries, index: None, name: None):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.range.RangeIndex,
name: Literal["geometry"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.range.RangeIndex,
name: Literal["geom"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.base.Index,
name: None,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(self, /, data: geopandas.array.GeometryArray, index: None, name: None):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.range.RangeIndex,
name: None,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
dtype: geopandas.array.GeometryDtype,
name: None,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
name: None,
fastpath: bool,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: pandas.core.internals.managers.SingleBlockManager,
index: None,
name: Literal["myshapes"],
fastpath: bool,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
name: Literal["myshapes"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.multi.MultiIndex,
name: Literal["myshapes"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
name: None,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.range.RangeIndex,
name: Literal["my_geom"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.multi.MultiIndex,
name: None,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.base.Index,
name: Literal["foo"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
dtype: geopandas.array.GeometryDtype,
name: Literal["geometry"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
name: Literal["tt"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: pandas.core.internals.managers.SingleBlockManager,
index: None,
name: Literal["geometry"],
fastpath: bool,
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: geopandas.array.GeometryArray,
index: pandas.core.indexes.numeric.Int64Index,
name: Literal["geometry"],
):
"""
usage.geopandas: 1
"""
...
@overload
def __init__(
self,
/,
data: pandas.core.internals.managers.SingleBlockManager,
index: None,
name: None,
fastpath: bool,
):
"""
usage.geopandas: 1
"""
...
def __init__(
self,
/,
data: Union[
pandas.core.internals.managers.SingleBlockManager,
geopandas.geoseries.GeoSeries,
geopandas.array.GeometryArray,
],
index: Union[
None,
pandas.core.indexes.multi.MultiIndex,
pandas.core.indexes.range.RangeIndex,
pandas.core.indexes.base.Index,
pandas.core.indexes.numeric.Int64Index,
],
dtype: geopandas.array.GeometryDtype = ...,
name: Union[None, str] = ...,
fastpath: bool = ...,
):
"""
usage.geopandas: 21
"""
...
@overload
def align(self, /, other: geopandas.geoseries.GeoSeries):
"""
usage.geopandas: 5
"""
...
@overload
def align(self, /, other: pandas.core.series.Series):
"""
usage.geopandas: 1
"""
...
def align(
self, /, other: Union[pandas.core.series.Series, geopandas.geoseries.GeoSeries]
):
"""
usage.geopandas: 6
"""
...
def all(self, /):
"""
usage.geopandas: 3
"""
...
def any(self, /):
"""
usage.geopandas: 3
"""
...
def apply(self, /, func: Callable, args: Tuple[None, ...]):
"""
usage.geopandas: 4
"""
...
@overload
def astype(self, /, dtype: Type[int]):
"""
usage.geopandas: 1
"""
...
@overload
def astype(self, /, dtype: Type[str]):
"""
usage.geopandas: 1
"""
...
@overload
def astype(self, /, dtype: Type[object]):
"""
usage.geopandas: 1
"""
...
def astype(self, /, dtype: type):
"""
usage.geopandas: 3
"""
...
def copy(self, /):
"""
usage.geopandas: 17
"""
...
def drop_duplicates(self, /):
"""
usage.geopandas: 1
"""
...
def dropna(self, /):
"""
usage.geopandas: 3
"""
...
@overload
def fillna(
self, /, value: shapely.geometry.base.BaseGeometry, method: None, inplace: bool
):
"""
usage.geopandas: 1
"""
...
@overload
def fillna(
self, /, value: shapely.geometry.point.Point, method: None, inplace: bool
):
"""
usage.geopandas: 1
"""
...
@overload
def fillna(self, /, value: float, method: None, inplace: bool):
"""
usage.geopandas: 1
"""
...
def fillna(
self,
/,
value: Union[
float, shapely.geometry.base.BaseGeometry, shapely.geometry.point.Point
],
method: None,
inplace: bool,
):
"""
usage.geopandas: 3
"""
...
def groupby(self, /, by: Callable):
"""
usage.geopandas: 1
"""
...
def head(self, /):
"""
usage.geopandas: 1
"""
...
def idxmax(self, /):
"""
usage.geopandas: 1
"""
...
def isna(self, /):
"""
usage.geopandas: 1
"""
...
def iteritems(self, /):
"""
usage.geopandas: 1
"""
...
def max(self, /):
"""
usage.geopandas: 1
"""
...
def notna(self, /):
"""
usage.geopandas: 1
"""
...
def reindex(self, /, index: List[int]):
"""
usage.geopandas: 2
"""
...
@overload
def reset_index(self, /, level: int):
"""
usage.geopandas: 1
"""
...
@overload
def reset_index(self, /):
"""
usage.geopandas: 1
"""
...
def reset_index(self, /, level: int = ...):
"""
usage.geopandas: 2
"""
...
def sort_index(self, /):
"""
usage.geopandas: 1
"""
...
def sum(self, /):
"""
usage.geopandas: 1
"""
...
def tail(self, /):
"""
usage.geopandas: 1
"""
...
@overload
def take(self, /, indices: numpy.ndarray, axis: int):
"""
usage.geopandas: 1
"""
...
@overload
def take(self, /, indices: numpy.ndarray):
"""
usage.geopandas: 1
"""
...
@overload
def take(self, /, indices: List[int]):
"""
usage.geopandas: 1
"""
...
def take(self, /, indices: Union[List[int], numpy.ndarray], axis: int = ...):
"""
usage.geopandas: 3
"""
...
def tolist(self, /):
"""
usage.geopandas: 1
"""
...
def unique(self, /):
"""
usage.geopandas: 1
"""
...
def value_counts(self, /):
"""
usage.geopandas: 1
"""
...
def where(self, /, cond: numpy.ndarray):
"""
usage.geopandas: 1
"""
...
| 18.963376 | 88 | 0.440927 | 938 | 11,909 | 5.449893 | 0.116205 | 0.197183 | 0.170188 | 0.166471 | 0.844679 | 0.719288 | 0.691119 | 0.656103 | 0.609351 | 0.554186 | 0 | 0.012993 | 0.411873 | 11,909 | 627 | 89 | 18.99362 | 0.716876 | 0.115039 | 0 | 0.775148 | 0 | 0 | 0.008444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.213018 | false | 0 | 0.002959 | 0 | 0.218935 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
c508c55b830bb37b55d3eed306273eb9bf3922c7 | 123 | py | Python | PredRadDATA/setup.py | klocey/DiversityTools | d3d27b2d3d4e0fe6a1a312f4f86c79d993cc1f96 | [
"MIT"
] | 1 | 2021-03-17T10:32:12.000Z | 2021-03-17T10:32:12.000Z | PredRadDATA/setup.py | klocey/DiversityTools | d3d27b2d3d4e0fe6a1a312f4f86c79d993cc1f96 | [
"MIT"
] | null | null | null | PredRadDATA/setup.py | klocey/DiversityTools | d3d27b2d3d4e0fe6a1a312f4f86c79d993cc1f96 | [
"MIT"
] | 1 | 2021-03-18T08:47:37.000Z | 2021-03-18T08:47:37.000Z | from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize("PredRadDATA_ALL.pyx"))
| 24.6 | 53 | 0.821138 | 17 | 123 | 5.823529 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 123 | 4 | 54 | 30.75 | 0.891892 | 0 | 0 | 0 | 0 | 0 | 0.154472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 1 | 0 | 0 | 5 |
c50c76135c49b833f1a7c50ceb7f093b2d30be73 | 87 | py | Python | pythonforandroid/recipes/android/src/android/__init__.py | Joreshic/python-for-android | c60e02d2e32e31a3a754838c51e9242cbadcd9e8 | [
"MIT"
] | 38 | 2016-03-09T08:48:19.000Z | 2021-11-28T15:31:22.000Z | pythonforandroid/recipes/android/src/android/__init__.py | Joreshic/python-for-android | c60e02d2e32e31a3a754838c51e9242cbadcd9e8 | [
"MIT"
] | 4 | 2020-07-17T01:37:37.000Z | 2020-07-21T14:21:08.000Z | pythonforandroid/recipes/android/src/android/__init__.py | Joreshic/python-for-android | c60e02d2e32e31a3a754838c51e9242cbadcd9e8 | [
"MIT"
] | 18 | 2016-07-13T17:30:05.000Z | 2022-02-22T07:04:33.000Z | '''
Android module
==============
'''
# legacy import
from android._android import *
| 9.666667 | 30 | 0.574713 | 8 | 87 | 6.125 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16092 | 87 | 8 | 31 | 10.875 | 0.671233 | 0.505747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
c50f2589820a4ea4d5217c58f84cb06f747c3837 | 6,486 | py | Python | silo/benchmarks/results/istc3-8-1-13_log_reduce_size_nofsync.py | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 274 | 2015-01-23T16:24:09.000Z | 2022-02-22T03:16:14.000Z | silo/benchmarks/results/istc3-8-1-13_log_reduce_size_nofsync.py | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 3 | 2015-03-17T11:52:36.000Z | 2019-07-22T23:04:25.000Z | silo/benchmarks/results/istc3-8-1-13_log_reduce_size_nofsync.py | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 94 | 2015-01-07T06:55:36.000Z | 2022-01-22T08:14:15.000Z | RESULTS = [({'scale_factor': 1, 'db': 'ndb-proto2', 'par_load': False, 'threads': 1, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '4G', 'persist': True}, [(27871.4, 27871.4, 0.0357607, 81.8997, 0.0), (29390.7, 29390.7, 0.0338998, 82.0619, 0.0), (28280.2, 28280.2, 0.0352519, 82.0879, 0.0)]), ({'scale_factor': 4, 'db': 'ndb-proto2', 'par_load': False, 'threads': 4, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '16G', 'persist': True}, [(107300.0, 107300.0, 0.0371596, 96.2916, 4.61302), (106620.0, 106620.0, 0.037399, 95.1791, 4.31287), (104450.0, 104450.0, 0.0381691, 94.9936, 4.39564)]), ({'scale_factor': 8, 'db': 'ndb-proto2', 'par_load': False, 'threads': 8, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '32G', 'persist': True}, [(198942.0, 198942.0, 0.0400843, 110.726, 8.97438), (199131.0, 199131.0, 0.0400565, 105.12, 8.5101), (200443.0, 200443.0, 0.0397906, 103.181, 7.71011)]), ({'scale_factor': 12, 'db': 'ndb-proto2', 'par_load': False, 'threads': 12, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '48G', 'persist': True}, [(299454.0, 299454.0, 0.0399389, 109.416, 12.6518), (299527.0, 299527.0, 0.0399373, 115.718, 12.2231), (300443.0, 300443.0, 0.0398378, 106.138, 12.145)]), ({'scale_factor': 16, 'db': 'ndb-proto2', 'par_load': False, 'threads': 16, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '64G', 'persist': True}, [(391388.0, 391388.0, 0.0407652, 124.563, 15.2232), (394657.0, 394657.0, 0.0404256, 130.43, 15.0728), (396611.0, 396611.0, 0.0402169, 136.605, 16.1692)]), ({'scale_factor': 20, 'db': 'ndb-proto2', 'par_load': False, 'threads': 20, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '80G', 'persist': True}, [(498099.0, 498099.0, 0.0400256, 134.432, 21.216), (488264.0, 488264.0, 0.0408347, 133.72, 20.5144), (495505.0, 495505.0, 0.0402241, 150.323, 21.0244)]), ({'scale_factor': 24, 'db': 'ndb-proto2', 'par_load': False, 'threads': 24, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '96G', 'persist': True}, [(584701.0, 584701.0, 0.0409133, 102.95, 23.1438), (586412.0, 586412.0, 0.0407895, 99.3766, 22.822), (589676.0, 589676.0, 0.0405919, 99.7467, 22.6878)]), ({'scale_factor': 28, 'db': 'ndb-proto2', 'par_load': False, 'threads': 28, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '112G', 'persist': True}, [(675436.0, 675436.0, 0.0413229, 105.453, 28.0404), (660534.0, 660534.0, 0.0422653, 103.337, 27.3102), (679870.0, 679870.0, 0.0410626, 101.341, 28.1444)]), ({'scale_factor': 32, 'db': 'ndb-proto2', 'par_load': False, 'threads': 32, 'bench_opts': '', 'log_fake_writes': False, 'retry': False, 'log_nofsync': True, 'name': 'scale_tpcc', 'bench': 'tpcc', 'numa_memory': '128G', 'persist': True}, [(711674.0, 711674.0, 0.0448229, 216.884, 28.8772), (715904.0, 715904.0, 0.0445292, 279.838, 29.7625), (725241.0, 725241.0, 0.0439786, 315.067, 29.7777)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 1, 'name': 'scale_tpcc', 'numa_memory': '4G', 'persist': False, 'threads': 1, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(30286.9, 30286.9, 0.0329245, 0.0, 0.0), (30753.4, 30753.4, 0.0324305, 0.0, 0.0), (31151.2, 31151.2, 0.0320159, 0.0, 0.0)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 4, 'name': 'scale_tpcc', 'numa_memory': '16G', 'persist': False, 'threads': 4, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(112481.0, 112481.0, 0.0354717, 0.0, 5.06663), (111014.0, 111014.0, 0.0359431, 0.0, 5.14995), (112559.0, 112559.0, 0.035451, 0.0, 4.39996)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 8, 'name': 'scale_tpcc', 'numa_memory': '32G', 'persist': False, 'threads': 8, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(209400.0, 209400.0, 0.0381135, 0.0, 9.3166), (209405.0, 209405.0, 0.0381132, 0.0, 9.03321), (214395.0, 214395.0, 0.0372271, 0.0, 9.49995)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 12, 'name': 'scale_tpcc', 'numa_memory': '48G', 'persist': False, 'threads': 12, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(317759.0, 317759.0, 0.0376752, 0.0, 13.5665), (319487.0, 319487.0, 0.0374694, 0.0, 13.5165), (323316.0, 323316.0, 0.0370279, 0.0, 13.9331)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 16, 'name': 'scale_tpcc', 'numa_memory': '64G', 'persist': False, 'threads': 16, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(420957.0, 420957.0, 0.0379212, 0.0, 18.2664), (419207.0, 419207.0, 0.0380766, 0.0, 18.8332), (421561.0, 421561.0, 0.0378607, 0.0, 17.6499)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 20, 'name': 'scale_tpcc', 'numa_memory': '80G', 'persist': False, 'threads': 20, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(526460.0, 526460.0, 0.0378989, 0.0, 22.0331), (529197.0, 529197.0, 0.0377043, 0.0, 23.7497), (533214.0, 533214.0, 0.0374174, 0.0, 22.3831)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 24, 'name': 'scale_tpcc', 'numa_memory': '96G', 'persist': False, 'threads': 24, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(625632.0, 625632.0, 0.0382689, 0.0, 26.5161), (631692.0, 631692.0, 0.0378988, 0.0, 26.8828), (622284.0, 622284.0, 0.038478, 0.0, 26.9162)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 28, 'name': 'scale_tpcc', 'numa_memory': '112G', 'persist': False, 'threads': 28, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(728676.0, 728676.0, 0.0383326, 0.0, 30.5828), (731237.0, 731237.0, 0.0382001, 0.0, 32.2995), (724542.0, 724542.0, 0.0385532, 0.0, 32.4161)]), ({'par_load': False, 'bench_opts': '', 'retry': False, 'scale_factor': 32, 'name': 'scale_tpcc', 'numa_memory': '128G', 'persist': False, 'threads': 32, 'db': 'ndb-proto2', 'bench': 'tpcc'}, [(783983.0, 783983.0, 0.0407091, 0.0, 35.0656), (782308.0, 782308.0, 0.040797, 0.0, 33.7652), (715915.0, 715915.0, 0.0445905, 0.0, 31.1658)])]
| 3,243 | 6,485 | 0.627505 | 1,054 | 6,486 | 3.750474 | 0.249526 | 0.042499 | 0.050089 | 0.031875 | 0.496838 | 0.352897 | 0.352897 | 0.284594 | 0.284594 | 0.18897 | 0 | 0.308525 | 0.102991 | 6,486 | 1 | 6,486 | 6,486 | 0.370918 | 0 | 0 | 0 | 0 | 0 | 0.308356 | 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 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
c51d7cbba7ce63ceb1e8a6df4d5ebdf2f29c41ae | 35 | py | Python | xl_helper/artifacts/server/ServerDist.py | xebialabs-community/xld-install-helper | a61baa9fabc6484afa5fd287a25fc6fb88d84670 | [
"MIT"
] | null | null | null | xl_helper/artifacts/server/ServerDist.py | xebialabs-community/xld-install-helper | a61baa9fabc6484afa5fd287a25fc6fb88d84670 | [
"MIT"
] | null | null | null | xl_helper/artifacts/server/ServerDist.py | xebialabs-community/xld-install-helper | a61baa9fabc6484afa5fd287a25fc6fb88d84670 | [
"MIT"
] | 2 | 2016-12-27T12:12:09.000Z | 2020-09-24T18:06:58.000Z |
class ServerDist(object):
pass | 11.666667 | 25 | 0.714286 | 4 | 35 | 6.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 35 | 3 | 26 | 11.666667 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
c51f95ab6a1deda9ad4b48e27c550f919af9bca7 | 6,832 | py | Python | tests/test_core.py | jonhealy1/stac-validator | 5e73c1e4488fa957eb1071d60855c9f12539ef2c | [
"Apache-2.0"
] | null | null | null | tests/test_core.py | jonhealy1/stac-validator | 5e73c1e4488fa957eb1071d60855c9f12539ef2c | [
"Apache-2.0"
] | null | null | null | tests/test_core.py | jonhealy1/stac-validator | 5e73c1e4488fa957eb1071d60855c9f12539ef2c | [
"Apache-2.0"
] | null | null | null | """
Description: Test the validator for core functionality without validating extensions
"""
__authors__ = "James Banting", "Jonathan Healy"
from stac_validator import stac_validator
def test_core_collection_local_v070():
stac_file = "tests/test_data/v070/collections/sentinel2.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.7.0",
"path": "tests/test_data/v070/collections/sentinel2.json",
"schema": ["https://cdn.staclint.com/v0.7.0/collection.json"],
"valid_stac": True,
"asset_type": "COLLECTION",
"validation_method": "core",
}
]
def test_core_item_local_v070():
stac_file = "tests/test_data/v070/items/sample-full.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "",
"path": "tests/test_data/v070/items/sample-full.json",
"schema": [""],
"valid_stac": False,
"error_type": "KeyError",
"error_message": "'stac_version'",
}
]
def test_core_item_local_v080():
stac_file = "tests/test_data/v080/items/sample-full.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.8.0",
"path": "tests/test_data/v080/items/sample-full.json",
"asset_type": "ITEM",
"validation_method": "core",
"schema": ["https://cdn.staclint.com/v0.8.0/item.json"],
"valid_stac": True,
}
]
def test_core_collection_remote_v090():
stac_file = "https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.9.0",
"path": "https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json",
"schema": ["https://cdn.staclint.com/v0.9.0/collection.json"],
"asset_type": "COLLECTION",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_item_local_v090():
stac_file = "tests/test_data/v090/items/good_item_v090.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.9.0",
"path": "tests/test_data/v090/items/good_item_v090.json",
"schema": ["https://cdn.staclint.com/v0.9.0/item.json"],
"asset_type": "ITEM",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_item_local_extensions_v090():
stac_file = "tests/test_data/v090/items/CBERS_4.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.9.0",
"path": "tests/test_data/v090/items/CBERS_4.json",
"schema": ["https://cdn.staclint.com/v0.9.0/item.json"],
"asset_type": "ITEM",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_bad_item_local_v090():
stac_file = "tests/test_data/bad_data/bad_item_v090.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "0.9.0",
"path": "tests/test_data/bad_data/bad_item_v090.json",
"asset_type": "ITEM",
"validation_method": "core",
"schema": ["https://cdn.staclint.com/v0.9.0/item.json"],
"valid_stac": False,
"error_type": "ValidationError",
"error_message": "'id' is a required property of the root of the STAC object",
}
]
def test_core_v1beta1():
stac_file = "tests/test_data/1beta1/sentinel2.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "1.0.0-beta.1",
"path": "tests/test_data/1beta1/sentinel2.json",
"schema": ["https://cdn.staclint.com/v1.0.0-beta.1/collection.json"],
"asset_type": "COLLECTION",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_item_local_v1beta2():
stac_file = "tests/test_data/1beta2/stac_item.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "1.0.0-beta.2",
"path": "tests/test_data/1beta2/stac_item.json",
"schema": [
"https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/item.json"
],
"asset_type": "ITEM",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_item_local_v1rc1():
stac_file = "tests/test_data/1rc1/collectionless-item.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "1.0.0-rc.1",
"path": "tests/test_data/1rc1/collectionless-item.json",
"schema": [
"https://schemas.stacspec.org/v1.0.0-rc.1/item-spec/json-schema/item.json"
],
"asset_type": "ITEM",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_collection_local_v1rc1():
stac_file = "tests/test_data/1rc1/collection.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "1.0.0-rc.1",
"path": "tests/test_data/1rc1/collection.json",
"schema": [
"https://schemas.stacspec.org/v1.0.0-rc.1/collection-spec/json-schema/collection.json"
],
"asset_type": "COLLECTION",
"validation_method": "core",
"valid_stac": True,
}
]
def test_core_item_local_v100():
stac_file = "tests/test_data/v100/extended-item.json"
stac = stac_validator.StacValidate(stac_file, core=True)
stac.run()
assert stac.message == [
{
"version": "1.0.0",
"path": "tests/test_data/v100/extended-item.json",
"schema": [
"https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
],
"valid_stac": True,
"asset_type": "ITEM",
"validation_method": "core",
}
]
| 32.533333 | 160 | 0.576991 | 805 | 6,832 | 4.691925 | 0.122981 | 0.050834 | 0.075721 | 0.06672 | 0.901244 | 0.857294 | 0.810696 | 0.73524 | 0.656606 | 0.628012 | 0 | 0.036539 | 0.270931 | 6,832 | 209 | 161 | 32.688995 | 0.721743 | 0.012295 | 0 | 0.483333 | 0 | 0.038889 | 0.411485 | 0.135035 | 0 | 0 | 0 | 0 | 0.066667 | 1 | 0.066667 | false | 0 | 0.005556 | 0 | 0.072222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
c5212bcecdd70c44803b54084c56b79d42647b77 | 33 | py | Python | iinput/__init__.py | dante-biase/iinput | 62b26ab1a3473d9d064c619cc238b018e8f88932 | [
"MIT"
] | null | null | null | iinput/__init__.py | dante-biase/iinput | 62b26ab1a3473d9d064c619cc238b018e8f88932 | [
"MIT"
] | null | null | null | iinput/__init__.py | dante-biase/iinput | 62b26ab1a3473d9d064c619cc238b018e8f88932 | [
"MIT"
] | null | null | null | from iinput.iinput import iinput
| 16.5 | 32 | 0.848485 | 5 | 33 | 5.6 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 33 | 1 | 33 | 33 | 0.965517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
c5470e23a21fa1eb256fd2f4c3ed4e058017c33c | 302 | py | Python | src/nodeconductor_plus/premium_support/extension.py | opennode/nodeconductor-plus | 418380e3e78aeb4d030b16ef9514556f82b57d41 | [
"MIT"
] | null | null | null | src/nodeconductor_plus/premium_support/extension.py | opennode/nodeconductor-plus | 418380e3e78aeb4d030b16ef9514556f82b57d41 | [
"MIT"
] | null | null | null | src/nodeconductor_plus/premium_support/extension.py | opennode/nodeconductor-plus | 418380e3e78aeb4d030b16ef9514556f82b57d41 | [
"MIT"
] | null | null | null | from nodeconductor.core import NodeConductorExtension
class SupportExtension(NodeConductorExtension):
@staticmethod
def django_app():
return 'nodeconductor_plus.premium_support'
@staticmethod
def rest_urls():
from .urls import register_in
return register_in
| 21.571429 | 53 | 0.735099 | 29 | 302 | 7.448276 | 0.655172 | 0.138889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211921 | 302 | 13 | 54 | 23.230769 | 0.907563 | 0 | 0 | 0.222222 | 0 | 0 | 0.112583 | 0.112583 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | true | 0 | 0.222222 | 0.111111 | 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 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.