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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2d2ba7695d4a791fd93865ae5289987dfd5bbfad | 124 | py | Python | cupyx/distributed/__init__.py | Onkar627/cupy | 8eef1ad5393c0a92c5065bc05137bf997f37044a | [
"MIT"
] | 6,180 | 2016-11-01T14:22:30.000Z | 2022-03-31T08:39:20.000Z | cupyx/distributed/__init__.py | Onkar627/cupy | 8eef1ad5393c0a92c5065bc05137bf997f37044a | [
"MIT"
] | 6,281 | 2016-12-22T07:42:31.000Z | 2022-03-31T19:57:02.000Z | cupyx/distributed/__init__.py | Onkar627/cupy | 8eef1ad5393c0a92c5065bc05137bf997f37044a | [
"MIT"
] | 829 | 2017-02-23T05:46:12.000Z | 2022-03-27T17:40:03.000Z | from cupyx.distributed._init import init_process_group # NOQA
from cupyx.distributed._nccl_comm import NCCLBackend # NOQA
| 41.333333 | 62 | 0.83871 | 17 | 124 | 5.823529 | 0.647059 | 0.181818 | 0.40404 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112903 | 124 | 2 | 63 | 62 | 0.9 | 0.072581 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 6 |
2d3f5516630986c48f40222bd6b5feb7d77a0c79 | 47 | py | Python | polyaxon/polyaxon/settings.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | polyaxon/polyaxon/settings.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | polyaxon/polyaxon/settings.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | from polyaxon.config_settings import * # noqa
| 23.5 | 46 | 0.787234 | 6 | 47 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148936 | 47 | 1 | 47 | 47 | 0.9 | 0.085106 | 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 | 1 | 0 | 0 | 6 |
74446abef16ce9847fed1001afa98696f138c193 | 1,380 | py | Python | codewars/8kyu/mohamedashrafamin/Remove_exclamation_marks/main.py | mohamedashrafamin/Training_one | 11748fdde85cdc9083e2b0bde7519b51a7acfa62 | [
"MIT"
] | null | null | null | codewars/8kyu/mohamedashrafamin/Remove_exclamation_marks/main.py | mohamedashrafamin/Training_one | 11748fdde85cdc9083e2b0bde7519b51a7acfa62 | [
"MIT"
] | 2 | 2019-01-22T10:53:42.000Z | 2019-01-31T08:02:48.000Z | codewars/8kyu/mohamedashrafamin/Remove_exclamation_marks/main.py | mohamedashrafamin/Training_one | 11748fdde85cdc9083e2b0bde7519b51a7acfa62 | [
"MIT"
] | 13 | 2019-01-22T10:37:42.000Z | 2019-01-25T13:30:43.000Z | def remove_exclamation_marks(s):
return s.replace('!', '')
def remove_exclamation_marks1(s):
return s.replace('!', '')
# ---------------------------------------------------------------------------------------- benchmark: 2 tests ---------------------------------------------------------------------------------------
# Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations
# ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# remove_exclamation_marks1 95.3674 (1.0) 3,004.0741 (3.76) 201.5001 (1.0) 116.4286 (2.61) 190.7349 (1.0) 23.8419 (2.50) 491;5027 4.9628 (1.0) 49933 10
# remove_exclamation_marks 178.8139 (1.88) 798.7022 (1.0) 202.2819 (1.00) 44.6808 (1.0) 190.7349 (1.0) 9.5367 (1.0) 2755;3097 4.9436 (1.00) 49933 100
# ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 98.571429 | 219 | 0.269565 | 106 | 1,380 | 3.433962 | 0.622642 | 0.043956 | 0.10989 | 0.082418 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152132 | 0.252174 | 1,380 | 13 | 220 | 106.153846 | 0.200581 | 0.896377 | 0 | 0.5 | 0 | 0 | 0.014706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
744a0394a2976bb111391bd77fcff5619c0679d9 | 55 | py | Python | server/tests/test_noop.py | Neoteroi/BlackSheep-Azure-API | e4a7dae9fd3002fe6926c56a1b2ff65ba851e5cb | [
"MIT"
] | null | null | null | server/tests/test_noop.py | Neoteroi/BlackSheep-Azure-API | e4a7dae9fd3002fe6926c56a1b2ff65ba851e5cb | [
"MIT"
] | null | null | null | server/tests/test_noop.py | Neoteroi/BlackSheep-Azure-API | e4a7dae9fd3002fe6926c56a1b2ff65ba851e5cb | [
"MIT"
] | null | null | null | def test_noop():
pass
def test_noop2():
pass
| 7.857143 | 17 | 0.6 | 8 | 55 | 3.875 | 0.625 | 0.451613 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.290909 | 55 | 6 | 18 | 9.166667 | 0.769231 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0.5 | 0 | 0 | 0.5 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
74738713f129e5d45d002ba7b54ccd392628c763 | 40 | py | Python | meup/models/__init__.py | abheist/goldenSwan-backend | 153e16bb829f113fb429131436324631f15ae064 | [
"MIT"
] | null | null | null | meup/models/__init__.py | abheist/goldenSwan-backend | 153e16bb829f113fb429131436324631f15ae064 | [
"MIT"
] | 9 | 2021-03-30T13:41:09.000Z | 2022-03-12T00:32:50.000Z | meup/models/__init__.py | abheist/goldenSwan-backend | 153e16bb829f113fb429131436324631f15ae064 | [
"MIT"
] | null | null | null | from meup.models.Article import Article
| 20 | 39 | 0.85 | 6 | 40 | 5.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 40 | 1 | 40 | 40 | 0.944444 | 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 | 1 | 0 | 0 | 6 |
7482a5c85f43293612e381d3275e8842fd7c12f0 | 206 | py | Python | RaspberryPi/SimpleAlertLog.py | fbleite/LandryMachineSensor | 2ae3e903e9b20cea955189aa07ecd64a8bced960 | [
"MIT"
] | null | null | null | RaspberryPi/SimpleAlertLog.py | fbleite/LandryMachineSensor | 2ae3e903e9b20cea955189aa07ecd64a8bced960 | [
"MIT"
] | 7 | 2018-11-21T02:17:38.000Z | 2019-04-19T02:34:11.000Z | RaspberryPi/SimpleAlertLog.py | fbleite/LandryMachineSensor | 2ae3e903e9b20cea955189aa07ecd64a8bced960 | [
"MIT"
] | null | null | null | import logging
class SimpleAlertLog :
def __init__(self, args):
pass
def alertCurrentStatus(self, laundryMachineStatus):
logging.info(laundryMachineStatus.generateAlertMessage())
| 20.6 | 65 | 0.73301 | 17 | 206 | 8.647059 | 0.764706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194175 | 206 | 9 | 66 | 22.888889 | 0.885542 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.166667 | 0.166667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 6 |
77c1724c64c825b95ad6ba046b8af2a0bb7b2800 | 255 | py | Python | utils/decorators/user_decorators.py | dawang-youy/Django-blog | 529e7ef16d65170dc56cd628c34c5c9806138eed | [
"Apache-2.0"
] | null | null | null | utils/decorators/user_decorators.py | dawang-youy/Django-blog | 529e7ef16d65170dc56cd628c34c5c9806138eed | [
"Apache-2.0"
] | null | null | null | utils/decorators/user_decorators.py | dawang-youy/Django-blog | 529e7ef16d65170dc56cd628c34c5c9806138eed | [
"Apache-2.0"
] | null | null | null | def my_decorator(func):
def wrapper(request,*args,**kwargs):
print('这是定义的装饰器')
print('判断用户是否登录,是否有相关权限')
print(args,kwargs)#(<WSGIRequest: GET '/admin/index/'>,) {}
return func(request,*args,**kwargs)
return wrapper | 36.428571 | 67 | 0.619608 | 28 | 255 | 5.607143 | 0.607143 | 0.191083 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207843 | 255 | 7 | 68 | 36.428571 | 0.777228 | 0.156863 | 0 | 0 | 0 | 0 | 0.111628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0 | 0.571429 | 0.428571 | 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 | 1 | 0 | 6 |
77c5a192cbb3ff5412175e92b56c3122f6c77a22 | 22 | py | Python | pyroSAR/__init__.py | jiechencyz/pyroSAR | 4c0e2294792b597f7663571ea8f0dbc98005868b | [
"MIT"
] | null | null | null | pyroSAR/__init__.py | jiechencyz/pyroSAR | 4c0e2294792b597f7663571ea8f0dbc98005868b | [
"MIT"
] | null | null | null | pyroSAR/__init__.py | jiechencyz/pyroSAR | 4c0e2294792b597f7663571ea8f0dbc98005868b | [
"MIT"
] | 1 | 2019-10-17T03:02:43.000Z | 2019-10-17T03:02:43.000Z | from .drivers import * | 22 | 22 | 0.772727 | 3 | 22 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.894737 | 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 | 1 | 0 | 0 | 6 |
77cc67282eeacd2f4a27ad38d716432de4dc86f7 | 9,340 | py | Python | src/stats2.py | KonstantinMack/fussball_vorhersagen | 8213eaa59fe8c5e099716819c257af494a6db563 | [
"MIT"
] | null | null | null | src/stats2.py | KonstantinMack/fussball_vorhersagen | 8213eaa59fe8c5e099716819c257af494a6db563 | [
"MIT"
] | null | null | null | src/stats2.py | KonstantinMack/fussball_vorhersagen | 8213eaa59fe8c5e099716819c257af494a6db563 | [
"MIT"
] | null | null | null |
def get_avg_goaldiff_rolling(df, window=6, min_periods=4):
"""
Calculates rolling average goal difference per team at home and away
"""
home = df.groupby('HomeTeam').GoalDiff.apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift(1))
away = - df.groupby('AwayTeam').GoalDiff.apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift(1))
return home, away
def get_avg_goaldiff_expanding(df):
"""
Calculates expanding average goal difference per team at home and away
"""
home = df.groupby('HomeTeam').GoalDiff.apply(lambda x: x.expanding().mean().shift(1))
away = - df.groupby('AwayTeam').GoalDiff.apply(lambda x: x.expanding().mean().shift(1))
return home, away
def get_avg_goals_rolling(df, window=6, min_periods=4):
"""
Calculates rolling average goals scored/conceded for the league and per team at home and away
"""
Lg_HG = df["FTHG"].expanding().mean().shift()
Lg_AG = df["FTAG"].expanding().mean().shift()
H_avgG = df.groupby("HomeTeam")["FTHG"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgG = df.groupby("AwayTeam")["FTAG"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
H_avgG_c = df.groupby("HomeTeam")["FTAG"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgG_c = df.groupby("AwayTeam")["FTHG"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
return Lg_HG, Lg_AG, H_avgG, A_avgG, H_avgG_c, A_avgG_c
def get_avg_goals_expanding(df):
"""
Calculates expanding average goals scored/conceded for the league and per team at home and away
"""
Lg_HG = df["FTHG"].expanding().mean().shift()
Lg_AG = df["FTAG"].expanding().mean().shift()
H_avgG = df.groupby("HomeTeam")["FTHG"].apply(lambda x: x.expanding().mean().shift())
A_avgG = df.groupby("AwayTeam")["FTAG"].apply(lambda x: x.expanding().mean().shift())
H_avgG_c = df.groupby("HomeTeam")["FTAG"].apply(lambda x: x.expanding().mean().shift())
A_avgG_c = df.groupby("AwayTeam")["FTHG"].apply(lambda x: x.expanding().mean().shift())
return Lg_HG, Lg_AG, H_avgG, A_avgG, H_avgG_c, A_avgG_c
def get_avg_shots_rolling(df, window=6, min_periods=4):
"""
Calculates rolling average shots/shots on target fired/conceded for the league and per team at home and away
"""
Lg_HS = df["HS"].expanding().mean().shift()
Lg_AS = df["AS"].expanding().mean().shift()
Lg_HST = df["HST"].expanding().mean().shift()
Lg_AST = df["AST"].expanding().mean().shift()
H_avgS = df.groupby("HomeTeam")["HS"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgS = df.groupby("AwayTeam")["AS"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
H_avgS_c = df.groupby("HomeTeam")["AS"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgS_c = df.groupby("AwayTeam")["HS"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
H_avgST = df.groupby("HomeTeam")["HST"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgST = df.groupby("AwayTeam")["AST"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
H_avgST_c = df.groupby("HomeTeam")["AST"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgST_c = df.groupby("AwayTeam")["HST"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
return Lg_HS, Lg_AS, Lg_HST, Lg_AST, H_avgS, A_avgS, H_avgS_c, A_avgS_c, H_avgST, A_avgST, H_avgST_c, A_avgST_c
def get_avg_shots_expanding(df):
"""
Calculates expanding average shots/shots on target fired/conceded for the league and per team at home and away
"""
Lg_HS = df["HS"].expanding().mean().shift()
Lg_AS = df["AS"].expanding().mean().shift()
Lg_HST = df["HST"].expanding().mean().shift()
Lg_AST = df["AST"].expanding().mean().shift()
H_avgS = df.groupby("HomeTeam")["HS"].apply(lambda x: x.expanding().mean().shift())
A_avgS = df.groupby("AwayTeam")["AS"].apply(lambda x: x.expanding().mean().shift())
H_avgS_c = df.groupby("HomeTeam")["AS"].apply(lambda x: x.expanding().mean().shift())
A_avgS_c = df.groupby("AwayTeam")["HS"].apply(lambda x: x.expanding().mean().shift())
H_avgST = df.groupby("HomeTeam")["HST"].apply(lambda x: x.expanding().mean().shift())
A_avgST = df.groupby("AwayTeam")["AST"].apply(lambda x: x.expanding().mean().shift())
H_avgST_c = df.groupby("HomeTeam")["AST"].apply(lambda x: x.expanding().mean().shift())
A_avgST_c = df.groupby("AwayTeam")["HST"].apply(lambda x: x.expanding().mean().shift())
return Lg_HS, Lg_AS, Lg_HST, Lg_AST, H_avgS, A_avgS, H_avgS_c, A_avgS_c, H_avgST, A_avgST, H_avgST_c, A_avgST_c
def get_avg_corners_rolling(df, window=6, min_periods=4):
"""
Calculates rolling average corners for/against per team at home and away
"""
H_avgC = df.groupby("HomeTeam")["HC"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgC = df.groupby("AwayTeam")["AC"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
H_avgC_c = df.groupby("HomeTeam")["AC"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
A_avgC_c = df.groupby("AwayTeam")["HC"].apply(lambda x: x.rolling(window=window, min_periods=min_periods).mean().shift())
return H_avgC, A_avgC, H_avgC_c, A_avgC_c
def get_avg_corners_expanding(df):
"""
Calculates expanding average corners for/against per team at home and away
"""
H_avgC = df.groupby("HomeTeam")["HC"].apply(lambda x: x.expanding().mean().shift())
A_avgC = df.groupby("AwayTeam")["AC"].apply(lambda x: x.expanding().mean().shift())
H_avgC_c = df.groupby("HomeTeam")["AC"].apply(lambda x: x.expanding().mean().shift())
A_avgC_c = df.groupby("AwayTeam")["HC"].apply(lambda x: x.expanding().mean().shift())
return H_avgC, A_avgC, H_avgC_c, A_avgC_c
def get_stats(df2, mode="expanding", window=6, min_periods=4):
df = df2.copy()
if mode == "rolling":
df["H_avgGD"], df["A_avgGD"] = get_avg_goaldiff_rolling(df, window, min_periods)
df["Lg_HG"], df["Lg_AG"], df["H_avgG"], df["A_avgG"], df["H_avgG_c"], df["A_avgG_c"] = get_avg_goals_rolling(df, window, min_periods)
df["Lg_HS"], df["Lg_AS"], df["Lg_HST"], df["Lg_AST"], df["H_avgS"], df["A_avgS"], df["H_avgS_c"], df["A_avgS_c"], df["H_avgST"], df["A_avgST"], df["H_avgST_c"], df["A_avgST_c"] = get_avg_shots_rolling(df, window, min_periods)
else:
df["H_avgGD"], df["A_avgGD"] = get_avg_goaldiff_expanding(df)
df["Lg_HG"], df["Lg_AG"], df["H_avgG"], df["A_avgG"], df["H_avgG_c"], df["A_avgG_c"] = get_avg_goals_expanding(df)
df["Lg_HS"], df["Lg_AS"], df["Lg_HST"], df["Lg_AST"], df["H_avgS"], df["A_avgS"], df["H_avgS_c"], df["A_avgS_c"], df["H_avgST"], df["A_avgST"], df["H_avgST_c"], df["A_avgST_c"] = get_avg_shots_expanding(df)
return df
def get_stats2(df2, window=6, min_periods=4):
"""
Calculates all stats as a mixture between the rolling and expanding versions of the respective stats
"""
df = df2.copy()
H_avgGDr, A_avgGDr = get_avg_goaldiff_rolling(df, window, min_periods)
H_avgGDe, A_avgGDe = get_avg_goaldiff_expanding(df)
df["H_avgGD"] = (H_avgGDr + 2 * H_avgGDe) / 3
df["A_avgGD"] = (A_avgGDr + 2 * A_avgGDe) / 3
Lg_HG, Lg_AG, H_avgG, A_avgG, H_avgG_c, A_avgG_c = get_avg_goals_rolling(df, window, min_periods)
Lg_HGe, Lg_AGe, H_avgGe, A_avgGe, H_avgG_ce, A_avgG_ce = get_avg_goals_expanding(df)
df["Lg_HG"] = (Lg_HG + 2*Lg_HGe) / 3
df["Lg_AG"] = (Lg_AG + 2*Lg_AGe) / 3
df["H_avgG"] = (H_avgG + 2*H_avgGe) / 3
df["A_avgG"] = (A_avgG + 2*A_avgGe) / 3
df["H_avgG_c"] = (H_avgG_c + 2*H_avgG_ce) / 3
df["A_avgG_c"] = (A_avgG_c + 2*A_avgG_ce) / 3
Lg_HS, Lg_AS, Lg_HST, Lg_AST, H_avgS, A_avgS, H_avgS_c, A_avgS_c, H_avgST, A_avgST, H_avgST_c, A_avgST_c = get_avg_shots_rolling(df, window, min_periods)
Lg_HSe, Lg_ASe, Lg_HSTe, Lg_ASTe, H_avgSe, A_avgSe, H_avgS_ce, A_avgS_ce, H_avgSTe, A_avgSTe, H_avgST_ce, A_avgST_ce = get_avg_shots_expanding(df)
H_avgC, A_avgC, H_avgC_c, A_avgC_c = get_avg_corners_rolling(df, window, min_periods)
H_avgCe, A_avgCe, H_avgC_ce, A_avgC_ce = get_avg_corners_expanding(df)
df["Lg_HS"] = (Lg_HS + 2*Lg_HSe) / 3
df["Lg_AS"] = (Lg_AS + 2*Lg_ASe) / 3
df["Lg_HST"] = (Lg_HST + 2*Lg_HSTe) / 3
df["Lg_AST"] = (Lg_AST + 2*Lg_ASTe) / 3
df["H_avgS"] = (H_avgS + 2*H_avgSe) / 3
df["A_avgS"] = (A_avgS + 2*A_avgSe) / 3
df["H_avgS_c"] = (H_avgS_c + 2*H_avgS_ce) / 3
df["A_avgS_c"] = (A_avgS_c + 2*A_avgS_ce) / 3
df["H_avgST"] = (H_avgST + 2*H_avgSTe) / 3
df["A_avgST"] = (A_avgST + 2*A_avgSTe) / 3
df["H_avgST_c"] = (H_avgST_c + 2*H_avgST_ce) / 3
df["A_avgST_c"] = (A_avgST_c + 2*A_avgST_ce) / 3
df["H_avgC"] = (H_avgC + 2*H_avgCe) / 3
df["A_avgC"] = (A_avgC + 2*A_avgCe) / 3
df["H_avgC_c"] = (H_avgC_c + 2*H_avgC_ce) / 3
df["A_avgC_c"] = (A_avgC_c + 2*A_avgC_ce) / 3
return df
| 57.300613 | 233 | 0.6697 | 1,601 | 9,340 | 3.626483 | 0.056839 | 0.084395 | 0.074406 | 0.080606 | 0.865828 | 0.818119 | 0.793834 | 0.787461 | 0.770238 | 0.728557 | 0 | 0.008626 | 0.143576 | 9,340 | 162 | 234 | 57.654321 | 0.717215 | 0.085439 | 0 | 0.218182 | 0 | 0 | 0.102082 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
7ae4cab312da5d5d9ec589b3b739a2dbec06136c | 169 | py | Python | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Singlechoice.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | null | null | null | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Singlechoice.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | 11 | 2020-05-04T09:05:29.000Z | 2021-04-08T13:22:34.000Z | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Singlechoice.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | 12 | 2020-05-02T09:36:14.000Z | 2021-06-22T08:10:45.000Z | import Genetic_MMI
class ModelApproachExp1(Genetic_MMI.ModelApproach):
def __init__(self):
Genetic_MMI.ModelApproach.__init__(self, 1, "MMI_singlechoice")
| 24.142857 | 71 | 0.775148 | 19 | 169 | 6.263158 | 0.578947 | 0.252101 | 0.386555 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013699 | 0.136095 | 169 | 6 | 72 | 28.166667 | 0.80137 | 0 | 0 | 0 | 0 | 0 | 0.094675 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
bb15f21ecbd1361d8a0b21bfa7c280bd4aec7d56 | 21,094 | py | Python | WebBrickLibs/EventHandlers/tests/TestEggNunciate.py | AndyThirtover/wb_gateway | 69f9c870369085f4440033201e2fb263a463a523 | [
"BSD-3-Clause"
] | null | null | null | WebBrickLibs/EventHandlers/tests/TestEggNunciate.py | AndyThirtover/wb_gateway | 69f9c870369085f4440033201e2fb263a463a523 | [
"BSD-3-Clause"
] | null | null | null | WebBrickLibs/EventHandlers/tests/TestEggNunciate.py | AndyThirtover/wb_gateway | 69f9c870369085f4440033201e2fb263a463a523 | [
"BSD-3-Clause"
] | null | null | null | # Copyright L.P.Klyne 2013
# Licenced under 3 clause BSD licence
# $Id: TestEggNunciate.py 2612 2008-08-11 20:08:49Z graham.klyne $
#
# Unit testing for WebBrick library functions (WbAccess.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
# NOTE: this is not strictly a unit test, in that it requires a WebBrick to be
# available at the specified IP address
import sys, logging, time
import unittest
from MiscLib.DomHelpers import *
from EventLib.Event import Event, makeEvent
from EventHandlers.BaseHandler import *
from EventHandlers.EventRouterLoad import EventRouterLoader
import EventHandlers.tests.TestEventLogger as TestEventLogger
import Events
from Utils import *
# Configuration for the tests
# a test with a single egg
testConfigEggNunciate1 = """<?xml version="1.0" encoding="utf-8"?>
<eventInterfaces>
<eventInterface module='EventHandlers.tests.TestEventLogger' name='TestEventLogger'>
<!-- This saves all events -->
<eventtype type="">
<eventsource source="" >
<event>
<!-- interested in all events -->
</event>
</eventsource>
</eventtype>
</eventInterface>
<eventInterface module='EventHandlers.TwistedReactor' name='TwistedReactor' debug="yes" />
<eventInterface module='EventHandlers.EggNunciate' name='EggNunciate'>
<eventtype type="">
<!-- setup default scene -->
<eventsource source="time/runtime" >
<event>
<params>
<testEq name="elapsed">
<value>5</value>
</testEq>
</params>
<add name="defaultHigh" egg="lower" pri="0"/>
<add name="defaultLow" egg="lower" pri="0"/>
</event>
</eventsource>
</eventtype>
<eventtype type="">
<!-- setup default scene -->
<eventsource source="time/second" >
<event>
<next/>
</event>
</eventsource>
</eventtype>
<eventtype type="">
<!-- Garage -->
<eventsource source="webbrick/100/DO/0" >
<event>
<params>
<testEq name="state">
<value>1</value>
</testEq>
</params>
<add name="garageOpenLow" egg="lower" pri="1"/>
<add name="garageOpenHigh" egg="lower" pri="1"/>
<add name="somethingActive" egg="lower" pri="1"/>
</event>
<event>
<params>
<testEq name="state">
<value>0</value>
</testEq>
</params>
<delete name="garageOpenLow" egg="lower" pri="1"/>
<delete name="garageOpenHigh" egg="lower" pri="1"/>
<delete name="somethingActive" egg="lower" pri="1"/>
</event>
</eventsource>
<!-- Alarm -->
<eventsource source="webbrick/100/DO/1" >
<event>
<params>
<testEq name="state">
<value>1</value>
</testEq>
</params>
<add name="AlarmOnLow" egg="lower" pri="1"/>
<add name="AlarmOnHigh" egg="lower" pri="1"/>
<add name="somethingActive" egg="lower" pri="1"/>
</event>
<event>
<params>
<testEq name="state">
<value>0</value>
</testEq>
</params>
<delete name="AlarmOnLow" egg="lower" pri="1"/>
<delete name="AlarmOnHigh" egg="lower" pri="1"/>
<delete name="somethingActive" egg="lower" pri="1"/>
</event>
</eventsource>
</eventtype>
<!-- The steps we want -->
<step id="defaultHigh" redMin="16" redMax="16" blueMin="16" blueMax="16" greenMin="16" greenMax="16"/>
<step id="defaultLow" redMin="8" redMax="8" blueMin="8" blueMax="8" greenMin="8" greenMax="8"/>
<step id="AlarmOnLow" redMin="33" redMax="33" blueMin="33" blueMax="33" greenMin="33" greenMax="33"/>
<step id="AlarmOnHigh" redMin="47" redMax="47" blueMin="47" blueMax="47" greenMin="47" greenMax="47"/>
<step id="garageOpenLow" redMin="32" redMax="32" blueMin="32" blueMax="32" greenMin="32" greenMax="32"/>
<step id="garageOpenHigh" redMin="48" redMax="48" blueMin="48" blueMax="48" greenMin="48" greenMax="48"/>
<step id="somethingActive" redMin="4" redMax="4" blueMin="4" blueMax="4" greenMin="4" greenMax="4"/>
<!-- what eggs we have and there addresses and channels -->
<!-- the cmdTemplate and adr are mandatory, the cmdTemplate will be filled using a combination of the dictionary with all
these attributes and the red,green,blue attributes calculated for a scene -->
<egg name="lower" adr="localhost:20999"
redChn="0" greenChn="1" blueChn="2"
cmdTemplate="/hid.spi?com=:DM%(redChn)s;%(red)s;%(greenChn)s;%(green)s;%(blueChn)s;%(blue)s:"/>
</eventInterface>
</eventInterfaces>
"""
# a test with two egg
testConfigEggNunciate2 = """<?xml version="1.0" encoding="utf-8"?>
<eventInterfaces>
<eventInterface module='EventHandlers.tests.TestEventLogger' name='TestEventLogger'>
<!-- This saves all events -->
<eventtype type="">
<eventsource source="" >
<event>
<!-- interested in all events -->
</event>
</eventsource>
</eventtype>
</eventInterface>
<eventInterface module='EventHandlers.TwistedReactor' name='TwistedReactor' debug="yes" />
<eventInterface module='EventHandlers.EggNunciate' name='EggNunciate'>
<eventtype type="">
<!-- setup default scene -->
<eventsource source="time/runtime" >
<event>
<params>
<testEq name="elapsed">
<value>5</value>
</testEq>
</params>
<add name="defaultHigh" egg="lower" pri="0"/>
<add name="defaultHigh" egg="upper" pri="0"/>
<add name="defaultLow" egg="lower" pri="0"/>
<add name="defaultLow" egg="upper" pri="0"/>
</event>
</eventsource>
</eventtype>
<eventtype type="">
<!-- setup default scene -->
<eventsource source="time/second" >
<event>
<next/>
</event>
</eventsource>
</eventtype>
<eventtype type="">
<!-- events from a source of a specific type -->
<eventsource source="webbrick/100/DO/0" >
<event>
<params>
<testEq name="state">
<value>1</value>
</testEq>
</params>
<add name="garageOpenLow" egg="lower" pri="1"/>
<add name="garageOpenHigh" egg="lower" pri="1"/>
<add name="somethingActive" egg="lower" pri="1"/>
</event>
<event>
<params>
<testEq name="state">
<value>0</value>
</testEq>
</params>
<delete name="garageOpenLow" egg="lower" pri="1"/>
<delete name="garageOpenHigh" egg="lower" pri="1"/>
<delete name="somethingActive" egg="lower" pri="1"/>
</event>
</eventsource>
</eventtype>
<!-- The steps we want -->
<step id="defaultHigh" redMin="16" redMax="16" blueMin="16" blueMax="16" greenMin="16" greenMax="16"/>
<step id="defaultLow" redMin="8" redMax="8" blueMin="8" blueMax="8" greenMin="8" greenMax="8"/>
<step id="garageOpenLow" redMin="32" redMax="32" blueMin="32" blueMax="32" greenMin="32" greenMax="32"/>
<step id="garageOpenHigh" redMin="48" redMax="48" blueMin="48" blueMax="48" greenMin="48" greenMax="48"/>
<step id="somethingActive" redMin="4" redMax="4" blueMin="4" blueMax="4" greenMin="4" greenMax="4"/>
<!-- what eggs we have and there addresses and channels -->
<!-- the cmdTemplate and adr are mandatory, the cmdTemplate will be filled using a combination of the dictionary with all
these attributes and the red,green,blue attributes calculated for a scene -->
<egg name="lower" adr="localhost:20999"
redChn="0" greenChn="1" blueChn="2"
cmdTemplate="/hid.spi?com=:DM%(redChn)s;%(red)s;%(greenChn)s;%(green)s;%(blueChn)s;%(blue)s:"/>
<egg name="upper" adr="localhost:20999"
redChn="3" greenChn="4" blueChn="5"
cmdTemplate="/hid.spi?com=:DM%(redChn)s;%(red)s;%(greenChn)s;%(green)s;%(blueChn)s;%(blue)s:"/>
</eventInterface>
</eventInterfaces>
"""
class TestEggNunciate(unittest.TestCase):
def setUp(self):
self._log = logging.getLogger( "TestEggNunciate" )
self._log.debug( "\n\nsetUp" )
self.httpServer = None
self.httpServer = TestHttpServer()
self.httpServer.start()
self.router = None
self.loader = None
def tearDown(self):
self._log.debug( "\n\ntearDown" )
time.sleep(1) # allow twisted time
if self.loader:
self.loader.stop() # all tasks
self.loader = None
self.router = None
if self.httpServer:
self.httpServer.stop()
time.sleep(5)
def expectNhttp(self, cnt ):
idx = 20
while (len(self.httpServer.requests()) < cnt) and (idx > 0):
time.sleep(0.05)
idx = idx - 1
if ( len(self.httpServer.requests()) != cnt):
for req in self.httpServer.requests():
self._log.debug( "request %s", req )
self.assertEqual( len(self.httpServer.requests()), cnt)
# Actual tests follow
def testEggNunciateSingle(self):
self._log.debug( "\ntestEggNunciateSingle" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigEggNunciate1) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestEggNunciate"), Events.evtRuntime5 ) # set up base scene
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect single HTTP request for default scene step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 1)
self.assertEqual( self.httpServer.requests()[0], "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect second HTTP request for default scene step 2.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 2)
self.assertEqual( self.httpServer.requests()[1], "/hid.spi?com=:DM0;8;1;8;2;8:" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect third HTTP request for default scene step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 3)
self.assertEqual( self.httpServer.requests()[2], "/hid.spi?com=:DM0;16;1;16;2;16:" )
def testEggNunciateTwo(self):
self._log.debug( "\ntestEggNunciateTwo" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigEggNunciate2) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestEggNunciate"), Events.evtRuntime5 ) # set up base scene
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect single HTTP request for default scene step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 2)
self.assertEqual( self.httpServer.requests()[0], "/hid.spi?com=:DM3;16;4;16;5;16:" )
self.assertEqual( self.httpServer.requests()[1], "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect second HTTP request for default scene step 2.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 4)
self.assertEqual( self.httpServer.requests()[3], "/hid.spi?com=:DM0;8;1;8;2;8:" )
self.assertEqual( self.httpServer.requests()[2], "/hid.spi?com=:DM3;8;4;8;5;8:" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect third HTTP request for default scene step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 6)
self.assertEqual( self.httpServer.requests()[5], "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.assertEqual( self.httpServer.requests()[4], "/hid.spi?com=:DM3;16;4;16;5;16:" )
def subCheckSeq(self, reqs):
# each time tick causes another http request
idx = len(self.httpServer.requests())
for i in range(len(reqs)):
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
self.expectNhttp( idx+1 )
hReq = self.httpServer.requests()[idx]
self._log.debug( "testHttpAction (%u:%s) (%u:%s)", idx, hReq, i, reqs[i] )
self.assertEqual( hReq, reqs[i] )
idx = idx + 1
def subTestGarageOpen(self):
self._log.debug( "\nsubTestGarageOpen" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_0_on )
reqs = ["/hid.spi?com=:DM0;32;1;32;2;32:",
"/hid.spi?com=:DM0;48;1;48;2;48:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;32;1;32;2;32:",
"/hid.spi?com=:DM0;48;1;48;2;48:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
]
self.subCheckSeq(reqs)
def subTestGarageClose(self):
self._log.debug( "\nsubTestGarageClose" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_0_off )
reqs = ["/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
"/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
]
self.subCheckSeq(reqs)
# Actual tests follow
def testEggNunciateGarage(self):
self._log.debug( "\ntestEggNunciateEvent" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigEggNunciate1) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestEggNunciate"), Events.evtRuntime5 ) # set up base scene
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect HTTP request for default scene 1 step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 1)
hReq = self.httpServer.requests()[len(self.httpServer.requests())-1]
self.assertEqual( hReq, "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.subTestGarageOpen()
self.expectNhttp( 7)
self.subTestGarageClose()
self.expectNhttp( 11)
self.subTestGarageOpen()
self.expectNhttp( 17)
self.subTestGarageClose()
self.expectNhttp( 21)
def subTestAlarmOn(self):
self._log.debug( "\nsubTestAlarmOn" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_1_on )
reqs = ["/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
]
self.subCheckSeq(reqs)
def subTestAlarmOff(self):
self._log.debug( "\nsubTestAlarmOn" )
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_1_off )
reqs = ["/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
"/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
]
self.subCheckSeq(reqs)
# Actual tests follow
def testEggNunciateAlarm(self):
self._log.debug( "\ntestEggNunciateAlarm" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigEggNunciate1) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestEggNunciate"), Events.evtRuntime5 ) # set up base scene
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect HTTP request for default scene 1 step 1.
self._log.debug( "testHttpAction %s", self.httpServer.requests() )
self.expectNhttp( 1)
self.assertEqual( self.httpServer.requests()[0], "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.subTestAlarmOn()
self.subTestAlarmOff()
self.subTestAlarmOn()
self.subTestAlarmOff()
# Actual tests follow
def testEggNunciateGarageAlarm(self):
self._log.debug( "\ntestEggNunciateGarageAlarm" )
self.loader = EventRouterLoader()
self.loader.loadHandlers( getDictFromXmlString(testConfigEggNunciate1) )
self.loader.start() # all tasks
self.router = self.loader.getEventRouter()
self.router.publish( EventAgent("TestEggNunciate"), Events.evtRuntime5 ) # set up base scene
self.router.publish( EventAgent("TestEggNunciate"), Events.evtSecond5 )
# expect HTTP request for default scene 1 step 1.
self.expectNhttp( 1)
hReq = self.httpServer.requests()[len(self.httpServer.requests())-1]
self._log.debug( "testHttpAction %u:%s", (len(self.httpServer.requests())-1,hReq) )
self.assertEqual( hReq, "/hid.spi?com=:DM0;16;1;16;2;16:" )
self.subTestGarageOpen()
self.expectNhttp( 7)
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_1_on )
reqs = ["/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;32;1;32;2;32:",
"/hid.spi?com=:DM0;48;1;48;2;48:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;32;1;32;2;32:",
"/hid.spi?com=:DM0;48;1;48;2;48:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
]
self.subCheckSeq(reqs)
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_0_off ) # garage closed
reqs = ["/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
"/hid.spi?com=:DM0;33;1;33;2;33:",
"/hid.spi?com=:DM0;47;1;47;2;47:",
"/hid.spi?com=:DM0;4;1;4;2;4:",
]
self.subCheckSeq(reqs)
self.router.publish( EventAgent("TestEggNunciate"), Events.evtDO_1_off ) # Alarm
reqs = ["/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
"/hid.spi?com=:DM0;16;1;16;2;16:",
"/hid.spi?com=:DM0;8;1;8;2;8:",
]
self.subCheckSeq(reqs)
def testDummy(self):
pass
from MiscLib import TestUtils
def getTestSuite(select="unit"):
"""
Get test suite
select is one of the following:
"unit" return suite of unit tests only
"component" return suite of unit and component tests
"all" return suite of unit, component and integration tests
"pending" return suite of pending tests
name a single named test to be run
"""
testdict = {
"unit":
[ "testEggNunciateSingle"
, "testEggNunciateTwo"
, "testEggNunciateGarage"
, "testEggNunciateAlarm"
, "testEggNunciateGarageAlarm"
],
"component":
[ "testDummy"
],
"integration":
[ "testDummy"
],
"pending":
[ "testDummy"
]
}
return TestUtils.getTestSuite(TestEggNunciate, testdict, select=select)
# Run unit tests directly from command line
if __name__ == "__main__":
TestUtils.runTests("TestEggNunciate.log", getTestSuite, sys.argv)
| 38.918819 | 129 | 0.56381 | 2,342 | 21,094 | 5.058924 | 0.122972 | 0.028866 | 0.043298 | 0.051654 | 0.755149 | 0.734808 | 0.720122 | 0.709065 | 0.702819 | 0.681296 | 0 | 0.04819 | 0.283825 | 21,094 | 541 | 130 | 38.990758 | 0.736083 | 0.074429 | 0 | 0.717391 | 0 | 0.041063 | 0.551972 | 0.143085 | 0 | 0 | 0 | 0 | 0.033816 | 1 | 0.036232 | false | 0.002415 | 0.024155 | 0 | 0.065217 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 6 |
24a8566e8fce81f6e4fc85e799902a22530f3c88 | 228 | py | Python | chat/views.py | vlajna95/crazy_app | ffcda00e6247e01273be443a723ea4538d683420 | [
"CC0-1.0"
] | null | null | null | chat/views.py | vlajna95/crazy_app | ffcda00e6247e01273be443a723ea4538d683420 | [
"CC0-1.0"
] | null | null | null | chat/views.py | vlajna95/crazy_app | ffcda00e6247e01273be443a723ea4538d683420 | [
"CC0-1.0"
] | null | null | null | from django.shortcuts import render
def index(request):
return render(request, 'chat/index.html')
def room(request, room_name):
return render(request, 'chat/room.html', {'user': request.user, 'room_name': room_name})
| 28.5 | 90 | 0.723684 | 32 | 228 | 5.0625 | 0.4375 | 0.148148 | 0.234568 | 0.283951 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131579 | 228 | 7 | 91 | 32.571429 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.190045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.2 | 0.4 | 1 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
24e79ee27cfc4ab49166ad541f0b70ebac828884 | 112 | py | Python | EqGNN/models/__init__.py | urielsinger/EqGNN | c757bb44b1750b08e37f8827363b947e5cc92396 | [
"Apache-2.0"
] | 1 | 2021-08-20T05:56:26.000Z | 2021-08-20T05:56:26.000Z | EqGNN/models/__init__.py | urielsinger/EqGNN | c757bb44b1750b08e37f8827363b947e5cc92396 | [
"Apache-2.0"
] | null | null | null | EqGNN/models/__init__.py | urielsinger/EqGNN | c757bb44b1750b08e37f8827363b947e5cc92396 | [
"Apache-2.0"
] | null | null | null | from EqGNN.models.GNN import GNN
from EqGNN.models.EqGNN import GraphModule, AdversarialGraphModule, GraphModel | 56 | 78 | 0.857143 | 14 | 112 | 6.857143 | 0.571429 | 0.1875 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089286 | 112 | 2 | 78 | 56 | 0.941176 | 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 | 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 | 1 | 0 | 0 | 6 |
24f8b43d463fbb9b8a25df3cd7be97d3e38eda32 | 23 | py | Python | fcs_api_py/__init__.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | fcs_api_py/__init__.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | fcs_api_py/__init__.py | JoaquinChartier/fcs_api_python | 530da72d7fb26a569eb7106dfcb5ad6d320b171f | [
"MIT"
] | null | null | null | from .main import Forex | 23 | 23 | 0.826087 | 4 | 23 | 4.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 23 | 1 | 23 | 23 | 0.95 | 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 | 1 | 0 | 0 | 6 |
701aced8ddcf8faa206033ec3cb77a5791d222f8 | 48 | py | Python | qmpy/analysis/symmetry/__init__.py | WalterjhShen/qmpy | 686e18cecbb82a6bb523249ac1779a99fb865350 | [
"MIT"
] | 2 | 2019-04-25T17:49:16.000Z | 2019-06-01T01:36:04.000Z | qmpy/analysis/symmetry/__init__.py | WalterjhShen/qmpy | 686e18cecbb82a6bb523249ac1779a99fb865350 | [
"MIT"
] | 10 | 2018-07-05T03:19:58.000Z | 2019-03-24T13:05:14.000Z | qmpy/analysis/symmetry/__init__.py | WalterjhShen/qmpy | 686e18cecbb82a6bb523249ac1779a99fb865350 | [
"MIT"
] | 1 | 2020-04-30T14:08:45.000Z | 2020-04-30T14:08:45.000Z | from routines import *
from spacegroup import *
| 16 | 24 | 0.791667 | 6 | 48 | 6.333333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 48 | 2 | 25 | 24 | 0.95 | 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 | 1 | 0 | 0 | 6 |
70a808a9cb2063c1de09b134440db37af50fb8fc | 7,640 | py | Python | prjcom/roc/migrations/0001_initial.py | ds-suyog/corporanalytics | 797da93bdca33bef3d7eeb7b047c1b93fafea201 | [
"MIT"
] | null | null | null | prjcom/roc/migrations/0001_initial.py | ds-suyog/corporanalytics | 797da93bdca33bef3d7eeb7b047c1b93fafea201 | [
"MIT"
] | 3 | 2019-10-21T20:40:21.000Z | 2019-12-08T15:42:32.000Z | prjcom/roc/migrations/0001_initial.py | ds-suyog/corporanalytics | 797da93bdca33bef3d7eeb7b047c1b93fafea201 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.2 on 2019-06-15 06:18
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='DefaultersCompanies',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cin_number', models.CharField(max_length=100)),
('company_name', models.CharField(max_length=100)),
('dated', models.DateField()),
('insert_time', models.DateField()),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='DefaultersDirectors',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cin_number', models.CharField(max_length=100, unique=True)),
('company_name', models.CharField(max_length=100)),
('dated', models.DateField(null=True)),
('defaulting_year', models.CharField(max_length=100)),
('insert_time', models.DateField(null=True)),
('name', models.CharField(max_length=100)),
('signatory_id', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='DefaultersSecretaries',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cin_number', models.CharField(max_length=100, unique=True)),
('company_name', models.CharField(max_length=100)),
('dated', models.DateField(null=True)),
('defaulting_year', models.CharField(max_length=100)),
('insert_time', models.DateField(null=True)),
('name', models.CharField(max_length=100)),
('signatory_id', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='DirectorDetails',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('address', models.CharField(max_length=100)),
('base_url', models.CharField(max_length=100)),
('companies', models.CharField(max_length=100)),
('din_number', models.CharField(max_length=100)),
('director_name', models.CharField(max_length=100)),
('dob', models.DateField(null=True)),
('father_lastname', models.CharField(max_length=100)),
('hhh', models.CharField(max_length=100)),
('insert_time', models.DateField(null=True)),
('status', models.FloatField()),
('storage_id', models.CharField(max_length=100)),
('update_time', models.DateField(null=True)),
('url', models.CharField(max_length=100)),
('vfv', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='DirectorDisqualifieds',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cin_number', models.CharField(max_length=100)),
('company_name', models.CharField(max_length=100)),
('company_status', models.CharField(max_length=100)),
('din_number', models.CharField(max_length=100)),
('director_name', models.CharField(max_length=100)),
('helpdesk_ticket', models.CharField(max_length=100)),
('insert_time', models.DateField()),
('period_from', models.DateField()),
('period_till', models.DateField()),
('reason', models.CharField(max_length=100)),
('roc_code', models.CharField(max_length=100)),
('roc_name', models.CharField(max_length=100)),
('signatory_id', models.CharField(max_length=100)),
('status', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='RocData',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('agm_date', models.DateTimeField()),
('authorised_capital', models.IntegerField()),
('balancesheet_date', models.DateTimeField()),
('charges', models.CharField(max_length=100)),
('charges_storage_id', models.CharField(max_length=100)),
('cin_number', models.CharField(max_length=100, unique=True)),
('company_category', models.CharField(max_length=100)),
('company_class', models.CharField(max_length=100)),
('company_name', models.CharField(max_length=100)),
('company_status', models.CharField(max_length=100)),
('company_subcategory', models.CharField(max_length=100)),
('designated_partners', models.CharField(max_length=100)),
('email_id', models.CharField(max_length=100)),
('incorporation_country', models.CharField(max_length=100)),
('incorporation_date', models.DateTimeField()),
('insert_time', models.DateTimeField()),
('listed_type', models.CharField(max_length=100)),
('llp_status', models.CharField(max_length=100)),
('main_division', models.CharField(max_length=100)),
('members', models.IntegerField(blank=True, null=True)),
('obligation_contribution', models.IntegerField()),
('other_address', models.CharField(max_length=100)),
('paid_capital', models.IntegerField()),
('partners', models.CharField(max_length=100)),
('registered_address', models.CharField(max_length=100)),
('registration_number', models.CharField(max_length=100)),
('roc_code', models.CharField(max_length=100)),
('signatory', models.CharField(max_length=300)),
('signatory_storage_id', models.CharField(max_length=100)),
('solvency_filed_date', models.DateTimeField()),
('status', models.FloatField()),
('stock', models.CharField(max_length=100)),
('storage_id', models.CharField(max_length=100)),
('update_time', models.DateTimeField()),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
]
| 53.426573 | 114 | 0.569241 | 725 | 7,640 | 5.768276 | 0.154483 | 0.200861 | 0.241033 | 0.321377 | 0.78001 | 0.737207 | 0.63869 | 0.621473 | 0.621473 | 0.609039 | 0 | 0.033516 | 0.28534 | 7,640 | 142 | 115 | 53.802817 | 0.732418 | 0.00589 | 0 | 0.577778 | 1 | 0 | 0.149085 | 0.011326 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.007407 | 0 | 0.037037 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
561ce6d9a07900986c6ca3d62308e171a6a20b09 | 392 | py | Python | spira/core/all.py | qedalab/spira | 32e4d2096e298b9fcc5952abd654312dc232a259 | [
"MIT"
] | 10 | 2018-07-13T09:46:21.000Z | 2021-06-22T13:34:50.000Z | spira/core/all.py | qedalab/spira | 32e4d2096e298b9fcc5952abd654312dc232a259 | [
"MIT"
] | 8 | 2018-09-09T11:32:40.000Z | 2019-10-08T07:47:31.000Z | spira/core/all.py | qedalab/spira | 32e4d2096e298b9fcc5952abd654312dc232a259 | [
"MIT"
] | 7 | 2019-01-17T18:50:17.000Z | 2022-01-13T20:27:52.000Z | from spira.core.parameters.variables import *
from spira.core.parameters.restrictions import *
from spira.core.parameters.descriptor import *
from spira.core.parameters.initializer import *
from spira.core.transformable import *
from spira.core.transformation import *
from spira.core.transforms import *
from spira.core.parameters.processors import *
from spira.core.decorators import *
| 28 | 48 | 0.816327 | 50 | 392 | 6.4 | 0.28 | 0.253125 | 0.365625 | 0.475 | 0.3625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102041 | 392 | 13 | 49 | 30.153846 | 0.909091 | 0 | 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 | 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 | 6 |
563ddee67c3972dab21cc345e9e15bc6348e4cca | 112 | py | Python | demo/master/master_app/new_conversations/__init__.py | darksigma/traceless | eed3a35e90b8bbbf272e1f324e1c28de7afe08da | [
"MIT"
] | 1 | 2015-06-19T14:27:52.000Z | 2015-06-19T14:27:52.000Z | server/app/new_conversations/__init__.py | pratheeknagaraj/securechat | eed3a35e90b8bbbf272e1f324e1c28de7afe08da | [
"MIT"
] | null | null | null | server/app/new_conversations/__init__.py | pratheeknagaraj/securechat | eed3a35e90b8bbbf272e1f324e1c28de7afe08da | [
"MIT"
] | 1 | 2016-04-09T19:25:11.000Z | 2016-04-09T19:25:11.000Z | from flask import Blueprint
new_conversations = Blueprint('new_conversations', __name__)
from . import routes
| 18.666667 | 60 | 0.8125 | 13 | 112 | 6.538462 | 0.615385 | 0.282353 | 0.588235 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 112 | 5 | 61 | 22.4 | 0.867347 | 0 | 0 | 0 | 0 | 0 | 0.151786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 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 | 1 | 0 | 6 |
56696632cec5103022d3ea8dab2669aaab42436f | 373 | py | Python | probables/countminsketch/__init__.py | dekoza/pyprobables | 9460471d7e391060874d342945b2352d0a35603f | [
"MIT"
] | null | null | null | probables/countminsketch/__init__.py | dekoza/pyprobables | 9460471d7e391060874d342945b2352d0a35603f | [
"MIT"
] | null | null | null | probables/countminsketch/__init__.py | dekoza/pyprobables | 9460471d7e391060874d342945b2352d0a35603f | [
"MIT"
] | null | null | null | ''' count-min sketch submodule '''
from __future__ import (unicode_literals, absolute_import, print_function)
from . countminsketch import (CountMinSketch, HeavyHitters, StreamThreshold,
CountMeanSketch, CountMeanMinSketch)
__all__ = ['CountMinSketch', 'HeavyHitters', 'StreamThreshold',
'CountMeanSketch', 'CountMeanMinSketch']
| 37.3 | 76 | 0.715818 | 27 | 373 | 9.481481 | 0.666667 | 0.203125 | 0.320313 | 0.4375 | 0.578125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190349 | 373 | 9 | 77 | 41.444444 | 0.847682 | 0.069705 | 0 | 0 | 0 | 0 | 0.218289 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 1 | 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 | 6 |
56816711d2404457a8b234d287d41eb902d5f3f2 | 341 | py | Python | ufmtrends_sdk/__init__.py | UFM-Market-Trends/UFM-Market-Trends-SDK | 12d94ca7a905caec3d8038f4df5631097cbcf1af | [
"CC0-1.0"
] | null | null | null | ufmtrends_sdk/__init__.py | UFM-Market-Trends/UFM-Market-Trends-SDK | 12d94ca7a905caec3d8038f4df5631097cbcf1af | [
"CC0-1.0"
] | null | null | null | ufmtrends_sdk/__init__.py | UFM-Market-Trends/UFM-Market-Trends-SDK | 12d94ca7a905caec3d8038f4df5631097cbcf1af | [
"CC0-1.0"
] | null | null | null | # This is so that we can write
# `import ufmtrends_sdk` or `import test from ufmtrends_sdk`
# instead of
# `from ufmtrends_sdk.functions import test`
from .functions import test, get_yearly_values, get_yearly_variation
from .functions import get_yearonyear_variation
from .functions import get_accumulated_values, get_accumulated_variation | 42.625 | 72 | 0.832845 | 49 | 341 | 5.530612 | 0.44898 | 0.221402 | 0.210332 | 0.206642 | 0.228782 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117302 | 341 | 8 | 72 | 42.625 | 0.900332 | 0.416422 | 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 | 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 | 6 |
3b1b8410f34818f7f5c68ed5dc8de7be56272b86 | 49 | py | Python | alpinonaf/__init__.py | brdiep113/morphosyntactic_parser_nl | 68519dbe3921f81a273dd8b3969878d6953bf41e | [
"Apache-2.0"
] | 4 | 2018-01-17T05:34:37.000Z | 2020-04-05T00:40:11.000Z | alpinonaf/__init__.py | brdiep113/morphosyntactic_parser_nl | 68519dbe3921f81a273dd8b3969878d6953bf41e | [
"Apache-2.0"
] | 26 | 2018-03-14T08:48:48.000Z | 2018-05-15T15:45:35.000Z | morphosyntactic_parser_nl/alpinonaf/__init__.py | NLeSC/EviDENce | ff51f27e392076e51ad56236d039d38cb5fcadce | [
"Apache-2.0"
] | 7 | 2016-02-05T08:06:58.000Z | 2021-05-20T19:57:47.000Z | from .morph_syn_parser import parse, __version__
| 24.5 | 48 | 0.857143 | 7 | 49 | 5.142857 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102041 | 49 | 1 | 49 | 49 | 0.818182 | 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 | 1 | 0 | 0 | 6 |
3b439ac9f28cdc083d7b00ba4e65324247d80034 | 5,770 | py | Python | wikipedia_workload/de/uni-stuttgart/iaas/utility_calculation/cost_calculation.py | sgomezsaez/SCARF-Evaluation | a118039ddd62798ca93b78cb968d6ee8b15ec6f2 | [
"Apache-2.0"
] | null | null | null | wikipedia_workload/de/uni-stuttgart/iaas/utility_calculation/cost_calculation.py | sgomezsaez/SCARF-Evaluation | a118039ddd62798ca93b78cb968d6ee8b15ec6f2 | [
"Apache-2.0"
] | null | null | null | wikipedia_workload/de/uni-stuttgart/iaas/utility_calculation/cost_calculation.py | sgomezsaez/SCARF-Evaluation | a118039ddd62798ca93b78cb968d6ee8b15ec6f2 | [
"Apache-2.0"
] | null | null | null | import constants as cs
def calculate_price_aws_vm (vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer):
# VM Price
vm_price_per_hour = 0
if vm_type == cs.AWS_EC2_VM_T2_SMALL:
vm_price_per_hour = cs.AWS_EC2_VM_T2_SMALL_PRICE * num_vms
elif vm_type == cs.AWS_EC2_VM_M4_LARGE:
vm_price_per_hour = cs.AWS_EC2_VM_M4_LARGE_PRICE * num_vms
elif vm_type == cs.AWS_EC2_VM_M4_XLARGE:
vm_price_per_hour = cs.AWS_EC2_VM_M4_XLARGE_PRICE * num_vms
else:
vm_price_per_hour = 0
vm_price = vm_price_per_hour * usage_duration_hours
# Storage Price per GB Month
storage_price = num_vms * cs.AWS_EC2_STORAGE_GB_MONTH_PRICE * storage_size * num_months
# Data Transfer
if data_transfer > 0:
data_transfer_egress = float(data_transfer) - cs.AWS_EC2_DATA_TRANSFER_FREE_GB
data_transfer_price = cs.AWS_EC2_DATA_TRANSFER_GB_PRICE * data_transfer_egress
else:
data_transfer_price = 0
return vm_price + storage_price + data_transfer_price
def calculate_price_aws_vm_internal (vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer):
# VM Price
vm_price_per_hour = 0
if vm_type == cs.AWS_EC2_VM_T2_SMALL:
vm_price_per_hour = cs.AWS_EC2_VM_T2_SMALL_PRICE * num_vms
elif vm_type == cs.AWS_EC2_VM_M4_LARGE:
vm_price_per_hour = cs.AWS_EC2_VM_M4_LARGE_PRICE * num_vms
elif vm_type == cs.AWS_EC2_VM_M4_XLARGE:
vm_price_per_hour = cs.AWS_EC2_VM_M4_XLARGE_PRICE * num_vms
else:
vm_price_per_hour = 0
vm_price = vm_price_per_hour * usage_duration_hours
# Storage Price per GB Month
storage_price = num_vms * cs.AWS_EC2_STORAGE_GB_MONTH_PRICE * storage_size * num_months
return vm_price + storage_price
def calculate_price_aws_rds (rds_type, num_rds, usage_duration_hours, num_months, storage_size, data_transfer_out):
rds_price_per_hour = 0
if rds_type == cs.AWS_RDS_M4_LARGE:
rds_price_per_hour = cs.AWS_RDS_DB_M4_LARGE_PRICE * num_rds
rds_price = rds_price_per_hour * num_rds * usage_duration_hours
storage_price = cs.AWS_RDS_STORAGE_GB_MONTH_PRICE * storage_size * num_months
if data_transfer_out > 0:
data_transfer_egress = float(data_transfer_out) - cs.AWS_RDS_DATA_TRANSFER_FREE_GB
data_transfer_price = cs.AWS_RDS_DATA_TRANSFER_GB_PRICE * data_transfer_egress
else:
data_transfer_price = 0
return rds_price + storage_price + data_transfer_price
def calculate_price_aws_beanstalk (vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer, num_elb):
# VM Price
vm_price_per_hour = 0
vm_price = calculate_price_aws_vm(vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer)
# Load Balancing Price
elb_price = num_elb * (cs.AWS_LB_PRICE * usage_duration_hours + data_transfer * cs.AWS_LB_DATA_TRANSFER_GB_PRICE)
return vm_price + elb_price
def calculate_price_aws_ecs (vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer, num_elb):
# VM Price
vm_price_per_hour = 0
vm_price = calculate_price_aws_vm(vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer)
# Load Balancing Price
elb_price = num_elb * (cs.AWS_LB_PRICE * usage_duration_hours + data_transfer * cs.AWS_LB_DATA_TRANSFER_GB_PRICE)
return vm_price + elb_price
def calculate_price_azure_vm (vm_type, num_vms, usage_duration_hours, num_months, storage_size, data_transfer):
# VM Price
vm_price_per_hour = 0
if vm_type == cs.AZURE_VM_DS1:
vm_price_per_hour = cs.AZURE_VM_DS1_PRICE * num_vms
elif vm_type == cs.AZURE_VM_DS2:
vm_price_per_hour = cs.AZURE_VM_DS2_PRICE * num_vms
elif vm_type == cs.AZURE_VM_DS3:
vm_price_per_hour = cs.AZURE_VM_DS3_PRICE * num_vms
else:
vm_price_per_hour = 0
vm_price = vm_price_per_hour * usage_duration_hours
# Data Transfer
if data_transfer > 0:
data_transfer_egress = float(data_transfer) - cs.AZURE_DATA_TRANSFER_FREE_GB
data_transfer_price = cs.AZURE_EC2_DATA_TRANSFER_GB_PRICE * data_transfer_egress
else:
data_transfer_price = 0
return vm_price + data_transfer_price
def calculate_price_azure_container (vm_type_master, vm_type_agents, num_vms_agents, usage_duration_hours, num_months, storage_size, data_transfer):
# VM Price
vm_price_master_per_hour = 0
if vm_type_master == cs.AZURE_VM_DS1:
vm_price_master_per_hour = cs.AZURE_VM_DS1_PRICE * 1
elif vm_type_master == cs.AZURE_VM_DS2:
vm_price_master_per_hour = cs.AZURE_VM_DS2_PRICE * 1
elif vm_type_master == cs.AZURE_VM_DS3:
vm_price_master_per_hour = cs.AZURE_VM_DS3_PRICE * 1
else:
vm_price_master_per_hour = 0
vm_price_master = vm_price_master_per_hour * usage_duration_hours
vm_price_agent_per_hour = 0
if vm_type_agents == cs.AZURE_VM_DS1:
vm_price_agent_per_hour = cs.AZURE_VM_DS1_PRICE * num_vms_agents
elif vm_type_agents == cs.AZURE_VM_DS2:
vm_price_agent_per_hour = cs.AZURE_VM_DS2_PRICE * num_vms_agents
elif vm_type_agents == cs.AZURE_VM_DS3:
vm_price_agent_per_hour = cs.AZURE_VM_DS3_PRICE * num_vms_agents
else:
vm_price_agent_per_hour = 0
vm_price_agents = vm_price_master_per_hour * usage_duration_hours
# Data Transfer
if data_transfer > 0:
data_transfer_egress = float(data_transfer) - cs.AZURE_DATA_TRANSFER_FREE_GB
data_transfer_price = cs.AZURE_EC2_DATA_TRANSFER_GB_PRICE * data_transfer_egress
else:
data_transfer_price = 0
return vm_price_master + vm_price_agents + data_transfer_price | 36.289308 | 148 | 0.755459 | 944 | 5,770 | 4.049788 | 0.060381 | 0.163223 | 0.072195 | 0.073241 | 0.935653 | 0.886738 | 0.846194 | 0.818729 | 0.763013 | 0.6644 | 0 | 0.015812 | 0.188908 | 5,770 | 159 | 149 | 36.289308 | 0.801068 | 0.033102 | 0 | 0.561224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.010204 | 0 | 0.153061 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
3b6e00b63c9fb82f9fc27882a00ac566449920ba | 5,845 | py | Python | 20_edgetpu-deeplab/01_float32/02_weight_quantization.py | khanfarhan10/PINTO_model_zoo | 4cad2e506d8c0fb604aa7b5f84115a840ab59ba1 | [
"MIT"
] | 1,529 | 2019-12-11T13:36:23.000Z | 2022-03-31T18:38:27.000Z | 20_edgetpu-deeplab/01_float32/02_weight_quantization.py | khanfarhan10/PINTO_model_zoo | 4cad2e506d8c0fb604aa7b5f84115a840ab59ba1 | [
"MIT"
] | 200 | 2020-01-06T09:24:42.000Z | 2022-03-31T17:29:08.000Z | 20_edgetpu-deeplab/01_float32/02_weight_quantization.py | khanfarhan10/PINTO_model_zoo | 4cad2e506d8c0fb604aa7b5f84115a840ab59ba1 | [
"MIT"
] | 288 | 2020-02-21T14:56:02.000Z | 2022-03-30T03:00:35.000Z | import tensorflow as tf
### Tensorflow v1.15.2
#tf.compat.v1.enable_eager_execution()
graph_def_file="frozen_inference_graph_257_os16.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,257,257,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_257_os16_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_257_os16_weight_quant.tflite")
graph_def_file="frozen_inference_graph_257_os32.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,257,257,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_257_os32_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_257_os32_weight_quant.tflite")
graph_def_file="frozen_inference_graph_321_os16.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,321,321,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_321_os16_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_321_os16_weight_quant.tflite")
graph_def_file="frozen_inference_graph_321_os32.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,321,321,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_321_os32_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_321_os32_weight_quant.tflite")
graph_def_file="frozen_inference_graph_513_os16.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,513,513,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_513_os16_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_513_os16_weight_quant.tflite")
graph_def_file="frozen_inference_graph_513_os32.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,513,513,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_513_os32_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_513_os32_weight_quant.tflite")
graph_def_file="frozen_inference_graph_769_os16.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,769,769,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_769_os16_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_769_os16_weight_quant.tflite")
graph_def_file="frozen_inference_graph_769_os32.pb"
input_arrays=["ImageTensor"]
output_arrays=['ArgMax']
input_tensor={"ImageTensor":[1,769,769,3]}
# Weight Quantization - Input/Output=float32
#converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter = tf.lite.TFLiteConverter.from_frozen_graph(graph_def_file, input_arrays, output_arrays,input_tensor)
#converter.experimental_new_converter = True
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_quant_model = converter.convert()
with open('./edgetpu_deeplab_769_os32_weight_quant.tflite', 'wb') as w:
w.write(tflite_quant_model)
print("Integer Quantization complete! - edgetpu_deeplab_769_os32_weight_quant.tflite") | 44.618321 | 111 | 0.821728 | 798 | 5,845 | 5.645363 | 0.075188 | 0.031964 | 0.042619 | 0.106548 | 0.985572 | 0.985572 | 0.985572 | 0.972475 | 0.972475 | 0.972475 | 0 | 0.037368 | 0.06142 | 5,845 | 131 | 112 | 44.618321 | 0.783813 | 0.221557 | 0 | 0.691358 | 0 | 0 | 0.330827 | 0.219372 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.012346 | 0 | 0.012346 | 0.098765 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
8eb58792f929a57521a8d7401ab81d64f831a901 | 95 | py | Python | With_backend/Feasta/login/admin.py | HILAYTRIVEDI/Feasta_Backend | 25c785e5ced66be05cabe44cb66cc42c8010831f | [
"MIT"
] | null | null | null | With_backend/Feasta/login/admin.py | HILAYTRIVEDI/Feasta_Backend | 25c785e5ced66be05cabe44cb66cc42c8010831f | [
"MIT"
] | null | null | null | With_backend/Feasta/login/admin.py | HILAYTRIVEDI/Feasta_Backend | 25c785e5ced66be05cabe44cb66cc42c8010831f | [
"MIT"
] | 2 | 2020-10-27T18:46:54.000Z | 2020-10-27T18:47:18.000Z | from django.contrib import admin
from .models import user_info
admin.site.register(user_info)
| 19 | 32 | 0.831579 | 15 | 95 | 5.133333 | 0.666667 | 0.207792 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 95 | 4 | 33 | 23.75 | 0.905882 | 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 | 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 | 6 |
8eb963ac6381a8062b056aab855107f0f0898b80 | 143 | py | Python | djangobb_forum/tests/__init__.py | tuffnatty/DjangoBB | 423607675e9501f6ff5579d86c30540e377c4742 | [
"BSD-3-Clause"
] | 121 | 2016-02-16T09:05:15.000Z | 2022-03-30T21:17:15.000Z | djangobb_forum/tests/__init__.py | tuffnatty/DjangoBB | 423607675e9501f6ff5579d86c30540e377c4742 | [
"BSD-3-Clause"
] | 12 | 2015-05-09T09:27:05.000Z | 2016-02-05T14:44:33.000Z | djangobb_forum/tests/__init__.py | tuffnatty/DjangoBB | 423607675e9501f6ff5579d86c30540e377c4742 | [
"BSD-3-Clause"
] | 76 | 2016-02-11T16:35:52.000Z | 2022-01-25T13:26:06.000Z | from .test_forum import *
from .test_reputation import *
from .test_profile import *
from .test_utils import *
from .test_templatetags import * | 28.6 | 32 | 0.797203 | 20 | 143 | 5.45 | 0.4 | 0.366972 | 0.513761 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132867 | 143 | 5 | 32 | 28.6 | 0.879032 | 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 | 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 | 6 |
8ed7b42aa31cb29427f7cea6456f289ec3390326 | 21,659 | py | Python | blackjack.py | Collin-Campbell/games | c6c3bb9247e7d793e680ab6237f058ebae12728e | [
"MIT"
] | null | null | null | blackjack.py | Collin-Campbell/games | c6c3bb9247e7d793e680ab6237f058ebae12728e | [
"MIT"
] | null | null | null | blackjack.py | Collin-Campbell/games | c6c3bb9247e7d793e680ab6237f058ebae12728e | [
"MIT"
] | null | null | null | import random
import time
import sys
instructions = """
General rules for how to play Blackjack can be found at:
https://bicyclecards.com/how-to-play/blackjack/
Things to know:
- An Ace counts as 1 or 11. Face cards count as 10.
- A blackjack (A and K/Q/J/10) pays out x1.5 unless the dealer also has a blackjack, which results in a push.
- A push or tie with the dealer results in no exchange of coins.
- ‘Doubling down’ (possible if total of first two cards dealt equals 9, 10 or 11) doubles the wager.
- Choosing to double down results in only being able to take one more card.
- House/dealer wins if player goes over 21 first, regardless of dealer’s cards.
- This version does not allow for splitting mainly due to the display.
"""
class Hand:
def __init__(self,hand=[],display=[],value=0):
self.hand = []
self.display = []
self.value = 0
def deal_card(self):
possible_cards = ['A ','2 ','3 ','4 ','5 ','6 ','7 ','8 ','9 ','10','J ','Q ','K ']
card = random.choice(possible_cards)
card_display = [' -----','| |','| {} |'.format(card),'| |',' -----']
card_values = {'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'10':10,'J':10,'Q':10,'K':10,'A':1}
self.hand.append(card)
self.display.append(card_display)
self.value += card_values[card.strip()]
def print_value(self):
if 'A ' in self.hand and (self.value + 10 < 22):
print('{} or {}'.format(self.value, self.value+10))
else:
print('{}'.format(self.value))
def print_hand(self):
if len(self.display) == 1:
for a in self.display[0]:
print(a)
elif len(self.display) == 2:
for a,b in zip(*self.display):
print(a + '\t' + b)
elif len(self.display) == 3:
for a,b,c in zip(*self.display):
print(a + '\t' + b + '\t' + c)
elif len(self.display) == 4:
for a,b,c,d in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d)
elif len(self.display) == 5:
for a,b,c,d,e in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e)
elif len(self.display) == 6:
for a,b,c,d,e,f in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e + '\t' + f)
elif len(self.display) == 7:
for a,b,c,d,e,f,g in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e + '\t' + f + '\t' + g)
elif len(self.display) == 8:
for a,b,c,d,e,f,g,h in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e + '\t' + f + '\t' + g + '\t' + h)
elif len(self.display) == 9:
for a,b,c,d,e,f,g,h,i in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e + '\t' + f + '\t' + g + '\t' + h + '\t' + i)
elif len(self.display) == 10:
for a,b,c,d,e,f,g,h,i,j in zip(*self.display):
print(a + '\t' + b + '\t' + c + '\t' + d + '\t' + e + '\t' + f + '\t' + g + '\t' + h + '\t' + i + '\t' + j)
def game(name,player_pot,wager):
name = Hand()
dealer = Hand()
name.deal_card()
name.deal_card()
dealer.deal_card()
print("\n\nDealer's up card:")
dealer.print_hand()
dealer.deal_card() # dealer's second card, not showing, but will use to check for blackjack
time.sleep(2)
print('\nYour hand:')
name.print_hand()
time.sleep(2)
if 'A ' in name.hand and (name.value + 10) == 21:
if 'A ' in dealer.hand and (dealer.value + 10) == 21:
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nWow, blackjacks all around..")
return player_pot
else:
time.sleep(2)
print('\nBlackjack! Congrats, you win the hand!')
player_pot += (wager + (wager // 2))
return player_pot
elif 'A ' in dealer.hand and (dealer.value + 10) == 21:
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nHouse wins with blackjack..")
player_pot -= wager
return player_pot
print('\nYour total:')
name.print_value()
time.sleep(2)
response = ''
one_hit = ''
if name.value in [9,10,11] and (player_pot >= wager*2):
double_down = ''
while double_down not in ['YES','NO','Y','N']:
double_down = (input('\nWould you like to double down? (Y/N) ')).strip().upper()
if double_down in ['YES','Y']:
wager += wager
response = 'HIT'
one_hit = 'YES'
# Since dealer's up card has been printed, can finish out dealer's hand on the backend:
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
elif dealer.value < 17:
dealer.deal_card()
if 'A ' in dealer.hand and (dealer.value + 10) > 16 and (dealer.value + 10) < 22:
dealer.value += 10
#dealer.value is dealer's final score
#dealer.print_hand() is dealer's cards displayed
time.sleep(1)
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY'] and one_hit == '':
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY' or one_hit == 'YES':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
else:
time.sleep(2)
name.deal_card()
print('\nYour hand:')
name.print_hand()
time.sleep(2)
print('\nYour total:')
name.print_value()
time.sleep(1)
if name.value > 21:
print('\nBusted!')
player_pot -= wager
return player_pot
response = ''
if name.value == 21:
response = 'STAY'
if 'A ' in name.hand and (name.value + 10) == 21:
name.value += 10
response = 'STAY'
while response not in ['HIT','STAY']:
response = input('\nHit or Stay?: ').strip().upper()
if response == 'STAY':
if 'A ' in name.hand and (name.value + 10) < 22:
name.value += 10
time.sleep(2)
print("\nDealer's hand:")
dealer.print_hand()
time.sleep(2)
print("\nDealer's total: {}".format(dealer.value))
time.sleep(2)
if dealer.value > 21:
print('\n\nDealer busted, you won the hand!')
player_pot += wager
return player_pot
elif name.value > dealer.value:
print('\n\nYou won the hand!')
player_pot += wager
return player_pot
elif name.value == dealer.value:
print('\n\nWhen push comes to shove..')
return player_pot
elif name.value < dealer.value:
print('\n\nHouse wins.')
player_pot -= wager
return player_pot
if __name__ == '__main__':
print(instructions)
name = input('\nName, please: ')
time.sleep(1)
print('\n\nOkay {}, place your bet!'.format(name))
player_pot = 100
wager = 0
while wager <= 0 or wager > player_pot:
try:
wager = int((input('\nYou currently have {} coins, what will you wager? '.format(player_pot))).strip())
except ValueError:
print('\n Please input an integer value.')
continue
time.sleep(3)
player_pot = game(name,player_pot,wager)
wager = 0
leave_table = ''
while leave_table not in ['YES','Y']:
time.sleep(3)
if player_pot == 0:
sys.exit('\n\nYou ran out of coins... better luck next time.\n\n')
leave_table = (input("\n\nLeave table? ('Yes' or 'Y' to exit game, anything else to continue) ")).strip().upper()
time.sleep(2)
if leave_table in ['YES','Y']:
sys.exit('\n\nFinal coin count: {} coins\n\n'.format(player_pot))
print('\n\nOkay {}, place your bet!'.format(name))
while wager <= 0 or wager > player_pot:
try:
wager = int((input('\nYou currently have {} coins, what will you wager? '.format(player_pot))).strip())
except ValueError:
print('\n Please input an integer value.')
continue
time.sleep(3)
player_pot = game(name,player_pot,wager)
wager = 0
| 35.623355 | 118 | 0.494252 | 2,706 | 21,659 | 3.889135 | 0.077605 | 0.082953 | 0.049411 | 0.068415 | 0.799031 | 0.79333 | 0.789814 | 0.786203 | 0.77309 | 0.768339 | 0 | 0.030974 | 0.367976 | 21,659 | 607 | 119 | 35.682043 | 0.737819 | 0.011035 | 0 | 0.832452 | 0 | 0.005291 | 0.159281 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.008818 | false | 0 | 0.005291 | 0 | 0.098765 | 0.238095 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 6 |
d90b84e7c3c574de89fd179f23e8f6b161830000 | 6,066 | py | Python | halotools/empirical_models/sfr_models/zu_mandelbaum16.py | pllim/halotools | 6499cff09e7e0f169e4f425ee265403f6be816e8 | [
"BSD-3-Clause"
] | 83 | 2015-01-15T14:54:16.000Z | 2021-12-09T11:28:02.000Z | halotools/empirical_models/sfr_models/zu_mandelbaum16.py | pllim/halotools | 6499cff09e7e0f169e4f425ee265403f6be816e8 | [
"BSD-3-Clause"
] | 579 | 2015-01-14T15:57:37.000Z | 2022-01-13T18:58:44.000Z | halotools/empirical_models/sfr_models/zu_mandelbaum16.py | pllim/halotools | 6499cff09e7e0f169e4f425ee265403f6be816e8 | [
"BSD-3-Clause"
] | 70 | 2015-01-14T15:15:58.000Z | 2021-12-22T18:18:31.000Z | """
Module containing the `~halotools.empirical_models.ZuMandelbaum16QuenchingCens`
and `~halotools.empirical_models.ZuMandelbaum16QuenchingSats` classes
responsible for providing a mapping between halo mass and galaxy quenching designation.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from ..component_model_templates import BinaryGalpropModel
__all__ = ('ZuMandelbaum16QuenchingCens', 'ZuMandelbaum16QuenchingSats')
class ZuMandelbaum16QuenchingCens(BinaryGalpropModel):
""" Model for the quiescent fraction of centrals as a function of halo mass
defined by an exponential function of halo mass.
See :ref:`zu_mandelbaum16_composite_model` for a tutorial on this model.
"""
def __init__(self, prim_haloprop_key='halo_m200m', **kwargs):
"""
Parameters
-----------
prim_haloprop_key : string
Name of the column of the halo table storing the
mass-like variable the model is based on,
e.g., 'halo_mvir' or 'halo_m200b'.
Examples
--------
>>> model = ZuMandelbaum16QuenchingCens()
"""
BinaryGalpropModel.__init__(self,
galprop_name='quiescent', prim_haloprop_key=prim_haloprop_key)
self.param_dict = self._retrieve_default_param_dict()
self.gal_type = 'centrals'
def mean_quiescent_fraction(self, **kwargs):
r"""
Quiescent fraction as a function of halo mass, modeled as an exponential:
:math:`F_{\rm quiescent}(M_{\rm halo}) = 1 - {\rm exp}(-(M_{\rm halo}/M_{\rm char})^{\alpha})`
Parameters
----------
prim_haloprop : array, optional
Array of mass-like variable upon which occupation statistics are based.
If ``prim_haloprop`` is not passed, then ``table`` keyword argument must be passed.
table : object, optional
Data table storing halo catalog.
If ``table`` is not passed, then ``prim_haloprop`` keyword argument must be passed.
Returns
-------
quiescent_fraction : array_like
Array containing mean fraction of quiescent galaxies.
Examples
--------
>>> model = ZuMandelbaum16QuenchingCens()
>>> quiescent_fraction = model.mean_quiescent_fraction(prim_haloprop=1e12)
"""
if 'table' in list(kwargs.keys()):
halo_mass = np.atleast_1d(kwargs['table'][self.prim_haloprop_key])
elif 'prim_haloprop' in list(kwargs.keys()):
halo_mass = np.atleast_1d(kwargs['prim_haloprop'])
else:
raise KeyError("Must pass one of the following keyword arguments "
"to mean_stellar_mass:\n``table`` or ``prim_haloprop``")
mass_ratio = halo_mass/self.param_dict['quenching_mass_centrals']
exparg = mass_ratio**self.param_dict['quenching_exp_power_centrals']
result = 1 - np.exp(-exparg)
result = np.where(result < 0, 0, result)
result = np.where(result > 1, 1, result)
return result
def _retrieve_default_param_dict(self):
d = {}
d['quenching_mass_centrals'] = 10**12.2
d['quenching_exp_power_centrals'] = 0.38
return d
class ZuMandelbaum16QuenchingSats(BinaryGalpropModel):
""" Model for the quiescent fraction of satellites as a function of halo mass
defined by an exponential function of halo mass.
See :ref:`zu_mandelbaum16_composite_model` for a tutorial on this model.
"""
def __init__(self, prim_haloprop_key='halo_m200m', **kwargs):
"""
Parameters
-----------
prim_haloprop_key : string
Name of the column of the halo table storing the
mass-like variable the model is based on,
e.g., 'halo_mvir' or 'halo_m200b'.
Examples
--------
>>> model = ZuMandelbaum16QuenchingSats()
"""
BinaryGalpropModel.__init__(self,
galprop_name='quiescent', prim_haloprop_key=prim_haloprop_key)
self.param_dict = self._retrieve_default_param_dict()
self.gal_type = 'satellites'
def mean_quiescent_fraction(self, **kwargs):
r"""
Quiescent fraction as a function of halo mass, modeled as an exponential:
:math:`F_{\rm quiescent}(M_{\rm halo}) = 1 - {\rm exp}(-(M_{\rm halo}/M_{\rm char})^{\alpha})`
Parameters
----------
prim_haloprop : array, optional
Array of mass-like variable upon which occupation statistics are based.
If ``prim_haloprop`` is not passed, then ``table`` keyword argument must be passed.
table : object, optional
Data table storing halo catalog.
If ``table`` is not passed, then ``prim_haloprop`` keyword argument must be passed.
Returns
-------
quiescent_fraction : array_like
Array containing mean fraction of quiescent galaxies.
Examples
--------
>>> model = ZuMandelbaum16QuenchingSats()
>>> quiescent_fraction = model.mean_quiescent_fraction(prim_haloprop=1e12)
"""
if 'table' in list(kwargs.keys()):
halo_mass = np.atleast_1d(kwargs['table'][self.prim_haloprop_key])
elif 'prim_haloprop' in list(kwargs.keys()):
halo_mass = np.atleast_1d(kwargs['prim_haloprop'])
else:
raise KeyError("Must pass one of the following keyword arguments "
"to mean_stellar_mass:\n``table`` or ``prim_haloprop``")
mass_ratio = halo_mass/self.param_dict['quenching_mass_satellites']
exparg = mass_ratio**self.param_dict['quenching_exp_power_satellites']
result = 1 - np.exp(-exparg)
result = np.where(result < 0, 0, result)
result = np.where(result > 1, 1, result)
return result
def _retrieve_default_param_dict(self):
d = {}
d['quenching_mass_satellites'] = 10**12.17
d['quenching_exp_power_satellites'] = 0.15
return d
| 36.763636 | 102 | 0.635509 | 702 | 6,066 | 5.260684 | 0.209402 | 0.077985 | 0.040617 | 0.029245 | 0.803141 | 0.803141 | 0.803141 | 0.777146 | 0.777146 | 0.752776 | 0 | 0.016674 | 0.25849 | 6,066 | 164 | 103 | 36.987805 | 0.804357 | 0.44395 | 0 | 0.678571 | 0 | 0 | 0.211084 | 0.114366 | 0 | 0 | 0 | 0 | 0 | 1 | 0.107143 | false | 0.035714 | 0.053571 | 0 | 0.267857 | 0.017857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
d93c4416d7cf133e45bc6c5f84e68480e03b88a5 | 28 | py | Python | floris/tools/optimization/other/__init__.py | ElieKadoche/floris | d18f4d263ecabf502242592f9d60815a07c7b89c | [
"Apache-2.0"
] | 91 | 2019-06-04T08:56:29.000Z | 2022-03-13T17:39:22.000Z | floris/tools/optimization/other/__init__.py | ElieKadoche/floris | d18f4d263ecabf502242592f9d60815a07c7b89c | [
"Apache-2.0"
] | 224 | 2019-04-08T22:03:45.000Z | 2022-03-31T17:56:09.000Z | floris/tools/optimization/other/__init__.py | ElieKadoche/floris | d18f4d263ecabf502242592f9d60815a07c7b89c | [
"Apache-2.0"
] | 97 | 2019-04-23T20:48:20.000Z | 2022-03-29T08:17:02.000Z | from . import boundary_grid
| 14 | 27 | 0.821429 | 4 | 28 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 28 | 1 | 28 | 28 | 0.916667 | 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 | 1 | 0 | 0 | 6 |
794254654f00f6fd4b817c6016e9d9c1874f374e | 224 | py | Python | espaloma/mm/__init__.py | jstaker7/espaloma | d80d280acd608dc04c93966afe15cc3cb74f65a8 | [
"MIT"
] | null | null | null | espaloma/mm/__init__.py | jstaker7/espaloma | d80d280acd608dc04c93966afe15cc3cb74f65a8 | [
"MIT"
] | null | null | null | espaloma/mm/__init__.py | jstaker7/espaloma | d80d280acd608dc04c93966afe15cc3cb74f65a8 | [
"MIT"
] | null | null | null | import espaloma
import espaloma.mm
import espaloma.mm.angle
import espaloma.mm.bond
import espaloma.mm.energy
import espaloma.mm.functional
import espaloma.mm.geometry
import espaloma.mm.nonbonded
import espaloma.mm.torsion
| 22.4 | 29 | 0.852679 | 33 | 224 | 5.787879 | 0.30303 | 0.659686 | 0.670157 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080357 | 224 | 9 | 30 | 24.888889 | 0.927184 | 0 | 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 | 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 | 6 |
7955739b89d0d07687808e42cbe3b0c1835466e2 | 26 | py | Python | Python/hellolies.py | saurabhcommand/Hello-world | 647bad9da901a52d455f05ecc37c6823c22dc77e | [
"MIT"
] | 1,428 | 2018-10-03T15:15:17.000Z | 2019-03-31T18:38:36.000Z | Python/hellolies.py | saurabhcommand/Hello-world | 647bad9da901a52d455f05ecc37c6823c22dc77e | [
"MIT"
] | 1,162 | 2018-10-03T15:05:49.000Z | 2018-10-18T14:17:52.000Z | Python/hellolies.py | saurabhcommand/Hello-world | 647bad9da901a52d455f05ecc37c6823c22dc77e | [
"MIT"
] | 3,909 | 2018-10-03T15:07:19.000Z | 2019-03-31T18:39:08.000Z | print("Hello, pyLadies!")
| 13 | 25 | 0.692308 | 3 | 26 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 26 | 1 | 26 | 26 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.615385 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
8dc5ed5f7b2340bb23fcaf7a02ecec7450b01699 | 4,469 | py | Python | Baixar arquivos Tesouro direto.py | ajzanella/Tesouro-Direto | b573ec3d777cc93d469514446701039a755c0e65 | [
"MIT"
] | 2 | 2020-04-25T23:31:59.000Z | 2021-03-01T09:38:43.000Z | Baixar arquivos Tesouro direto.py | ajzanella/Tesouro-Direto | b573ec3d777cc93d469514446701039a755c0e65 | [
"MIT"
] | 1 | 2019-03-14T03:58:22.000Z | 2019-03-14T03:58:22.000Z | Baixar arquivos Tesouro direto.py | ajzanella/Tesouro-Direto | b573ec3d777cc93d469514446701039a755c0e65 | [
"MIT"
] | 1 | 2020-10-03T14:13:11.000Z | 2020-10-03T14:13:11.000Z | import datetime
import requests
import urllib.request
from bs4 import BeautifulSoup
import ssl
import certifi
base_url = "https://sisweb.tesouro.gov.br/apex/"
query = "f?p=2031:2"
url = base_url + query
response = requests.get(url, verify=False)
soup = BeautifulSoup(response.text, "html.parser")
div = soup.find("div", {"class": "bl-body"})
#ass = div.find_all('a')[0]
#for a in ass:
# path = a['href']
# name = a.string
# download_url = base_url + path
# ssl._create_default_https_context = ssl._create_unverified_context
# urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/{}.xls".format(name))
#Fazer um a um para adicionar na pasta correta
#data de ontem
x = (datetime.datetime.today()-datetime.timedelta(days = 1)).year
#baixar ano anterior
a = div.find_all('a')[0]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/LFT/{}_%s.xls".format(name) %(x))
a = div.find_all('a')[1]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/LTN/{}_%s.xls".format(name) %(x))
a = div.find_all('a')[2]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-C/{}_%s.xls".format(name) %(x))
a = div.find_all('a')[3]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-B/{}_%s.xls".format(name) %(x))
a = div.find_all('a')[4]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-BPrincipal/{}_%s.xls".format(name) %(x))
a = div.find_all('a')[5]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-F/{}_%s.xls".format(name) %(x))
####baixar ano atual
a = div.find_all('a')[6]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/LFT/{}_%s.xls".format(name) %(x-1))
a = div.find_all('a')[7]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/LTN/{}_%s.xls".format(name) %(x-1))
a = div.find_all('a')[8]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-C/{}_%s.xls".format(name) %(x-1))
a = div.find_all('a')[9]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-B/{}_%s.xls".format(name) %(x-1))
a = div.find_all('a')[10]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-BPrincipal/{}_%s.xls".format(name) %(x-1))
a = div.find_all('a')[11]
path = a['href']
name = a.string
download_url = base_url + path
ssl._create_default_https_context = ssl._create_unverified_context
urllib.request.urlretrieve(download_url, "C:/Users/ajzan/Documents/GitHub/Tesouro-Direto/DataBase/Historic/NTN-F/{}_%s.xls".format(name) %(x-1))
| 36.040323 | 153 | 0.760349 | 691 | 4,469 | 4.690304 | 0.140376 | 0.088244 | 0.043197 | 0.044122 | 0.871027 | 0.859611 | 0.859303 | 0.859303 | 0.859303 | 0.859303 | 0 | 0.006816 | 0.080779 | 4,469 | 123 | 154 | 36.333333 | 0.782132 | 0.088834 | 0 | 0.564706 | 0 | 0.141176 | 0.27145 | 0.239152 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.070588 | 0 | 0.070588 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
8dca97bf63914ac219d7a9fcdbbcca792d3ecd8c | 25 | py | Python | __init__.py | rtogo/SAPCostCenterHierarchy | 5a5863562b37e2e5c12e0a7aeea3b94c9eeb2f50 | [
"MIT"
] | null | null | null | __init__.py | rtogo/SAPCostCenterHierarchy | 5a5863562b37e2e5c12e0a7aeea3b94c9eeb2f50 | [
"MIT"
] | null | null | null | __init__.py | rtogo/SAPCostCenterHierarchy | 5a5863562b37e2e5c12e0a7aeea3b94c9eeb2f50 | [
"MIT"
] | null | null | null | from .process import run
| 12.5 | 24 | 0.8 | 4 | 25 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 25 | 1 | 25 | 25 | 0.952381 | 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 | 1 | 0 | 0 | 6 |
8dfcc63954738078588ba7602e05b079fe086d01 | 1,903 | py | Python | Python/seedlist.py | tifuzeau/LifeGame | 5c10990ccc04ceb412d5dd355f9e828748420456 | [
"MIT"
] | null | null | null | Python/seedlist.py | tifuzeau/LifeGame | 5c10990ccc04ceb412d5dd355f9e828748420456 | [
"MIT"
] | null | null | null | Python/seedlist.py | tifuzeau/LifeGame | 5c10990ccc04ceb412d5dd355f9e828748420456 | [
"MIT"
] | null | null | null | # coding: utf8
# lang: python 3
from seed import Seed
mini = [
[1],
[1],
[1],
]
spaceships = [
[ 0, 1, 1 ],
[ 1, 1, 0 ],
[ 0, 0, 1 ],
]
block_test = [
[ 1, 1 ],
[ 1, 1 ],
]
clown = [
[ 1, 0, 1],
[ 1, 0, 1],
[ 1, 1, 1],
]
batellestart = [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, ],
[ 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
]
#{'name' : "", 'x' : , 'y' : , 'seed' : },
SeedList = [
{'name' : "mini", 'x' : 5, 'y' : 5, 'seed' : mini},
{'name' : "spaceships", 'x': 10, 'y': 10, 'seed' : spaceships},
{'name' : "block_test", 'x' : 5, 'y' : 5, 'seed' : block_test},
{'name' : "clown", 'x' : 50, 'y' : 30, 'seed' : clown},
{'name' : "batellestart", 'x' : 50, 'y' : 30, 'seed' : batellestart},
# {'name' : "", 'x' : , 'y' : ,'seed' : },
]
| 35.90566 | 117 | 0.336837 | 451 | 1,903 | 1.414634 | 0.053215 | 0.92163 | 1.269592 | 1.548589 | 0.647335 | 0.575235 | 0.575235 | 0.575235 | 0.551724 | 0.551724 | 0 | 0.324477 | 0.347346 | 1,903 | 52 | 118 | 36.596154 | 0.189211 | 0.058854 | 0 | 0.179487 | 0 | 0 | 0.05098 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.025641 | 0 | 0.025641 | 0 | 0 | 0 | 1 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5c3d25e5bd314d81f90fc97dfa5a53a3b9b19bee | 120 | py | Python | perm_security/TokenStrategy/TokenHandlerStrategy/__init__.py | TheJoeSmo/perm-security | 2fd8ceb4fc72cce5889f55731056665a887399e1 | [
"MIT"
] | null | null | null | perm_security/TokenStrategy/TokenHandlerStrategy/__init__.py | TheJoeSmo/perm-security | 2fd8ceb4fc72cce5889f55731056665a887399e1 | [
"MIT"
] | null | null | null | perm_security/TokenStrategy/TokenHandlerStrategy/__init__.py | TheJoeSmo/perm-security | 2fd8ceb4fc72cce5889f55731056665a887399e1 | [
"MIT"
] | null | null | null | from .TokenHandlerStrategy import TokenHandlerStrategy
from .BasicTokenHandlerStrategy import BasicTokenHandlerStrategy
| 40 | 64 | 0.916667 | 8 | 120 | 13.75 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 120 | 2 | 65 | 60 | 0.982143 | 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 | 1 | 0 | 0 | 6 |
30e1e694ebef8321302ba82df471be4ab73d6384 | 37,723 | py | Python | instances/passenger_demand/pas-20210421-2109-int12e/82.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int12e/82.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int12e/82.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 2755
passenger_arriving = (
(6, 6, 12, 5, 1, 0, 7, 6, 7, 3, 2, 0), # 0
(0, 9, 7, 3, 2, 0, 6, 8, 4, 2, 1, 0), # 1
(1, 7, 6, 1, 2, 0, 10, 7, 2, 5, 1, 0), # 2
(4, 3, 4, 1, 3, 0, 7, 8, 3, 7, 1, 0), # 3
(5, 11, 4, 1, 3, 0, 6, 6, 5, 3, 1, 0), # 4
(4, 8, 6, 4, 0, 0, 5, 11, 4, 4, 0, 0), # 5
(2, 8, 2, 4, 2, 0, 5, 5, 3, 2, 1, 0), # 6
(1, 7, 4, 3, 2, 0, 7, 3, 2, 6, 2, 0), # 7
(6, 11, 3, 1, 1, 0, 5, 6, 4, 0, 2, 0), # 8
(3, 7, 6, 3, 0, 0, 8, 10, 4, 4, 1, 0), # 9
(3, 5, 10, 2, 0, 0, 5, 4, 4, 8, 1, 0), # 10
(5, 7, 10, 2, 0, 0, 2, 14, 5, 5, 5, 0), # 11
(5, 9, 6, 6, 5, 0, 4, 5, 8, 2, 1, 0), # 12
(0, 8, 5, 4, 2, 0, 4, 6, 4, 3, 1, 0), # 13
(5, 4, 4, 4, 3, 0, 3, 9, 3, 7, 0, 0), # 14
(2, 4, 6, 1, 3, 0, 7, 9, 3, 4, 2, 0), # 15
(5, 7, 7, 3, 2, 0, 6, 7, 5, 2, 2, 0), # 16
(3, 8, 11, 3, 2, 0, 9, 7, 1, 2, 0, 0), # 17
(5, 5, 4, 0, 1, 0, 11, 11, 5, 6, 3, 0), # 18
(4, 6, 5, 4, 2, 0, 4, 7, 4, 2, 3, 0), # 19
(4, 10, 5, 3, 1, 0, 3, 3, 6, 6, 0, 0), # 20
(1, 9, 5, 6, 1, 0, 3, 5, 5, 5, 4, 0), # 21
(3, 9, 9, 1, 5, 0, 6, 14, 4, 7, 1, 0), # 22
(3, 10, 11, 5, 1, 0, 8, 14, 7, 5, 2, 0), # 23
(5, 5, 6, 4, 0, 0, 6, 7, 9, 6, 2, 0), # 24
(3, 3, 10, 3, 2, 0, 8, 8, 4, 4, 2, 0), # 25
(5, 5, 4, 3, 1, 0, 5, 5, 6, 5, 0, 0), # 26
(2, 6, 7, 4, 1, 0, 4, 13, 8, 7, 2, 0), # 27
(3, 7, 7, 6, 1, 0, 6, 12, 2, 3, 1, 0), # 28
(8, 9, 9, 6, 2, 0, 8, 7, 6, 2, 1, 0), # 29
(1, 5, 4, 2, 2, 0, 6, 7, 4, 8, 0, 0), # 30
(5, 8, 8, 2, 3, 0, 3, 8, 4, 7, 4, 0), # 31
(4, 11, 7, 2, 1, 0, 7, 4, 4, 3, 3, 0), # 32
(3, 3, 7, 3, 2, 0, 8, 9, 5, 2, 2, 0), # 33
(4, 14, 3, 1, 0, 0, 4, 4, 4, 1, 2, 0), # 34
(6, 4, 7, 5, 5, 0, 3, 6, 6, 10, 1, 0), # 35
(2, 7, 4, 3, 1, 0, 4, 6, 5, 4, 1, 0), # 36
(2, 9, 5, 1, 2, 0, 3, 6, 1, 5, 7, 0), # 37
(5, 7, 9, 4, 0, 0, 4, 4, 6, 8, 2, 0), # 38
(2, 10, 8, 2, 3, 0, 6, 13, 5, 5, 1, 0), # 39
(5, 8, 7, 2, 2, 0, 7, 9, 7, 5, 1, 0), # 40
(1, 11, 6, 3, 3, 0, 8, 8, 7, 7, 2, 0), # 41
(4, 4, 2, 1, 1, 0, 5, 7, 3, 2, 3, 0), # 42
(2, 8, 9, 4, 3, 0, 3, 9, 8, 3, 3, 0), # 43
(4, 7, 4, 3, 1, 0, 2, 5, 5, 2, 4, 0), # 44
(5, 5, 7, 4, 1, 0, 6, 6, 2, 7, 1, 0), # 45
(3, 4, 9, 4, 3, 0, 5, 7, 4, 4, 4, 0), # 46
(4, 12, 11, 4, 5, 0, 4, 11, 4, 8, 1, 0), # 47
(1, 5, 5, 4, 1, 0, 5, 7, 7, 6, 1, 0), # 48
(6, 8, 8, 1, 1, 0, 4, 9, 3, 5, 4, 0), # 49
(3, 10, 3, 2, 2, 0, 8, 10, 8, 4, 2, 0), # 50
(4, 9, 4, 4, 6, 0, 1, 8, 5, 3, 2, 0), # 51
(7, 8, 6, 3, 1, 0, 6, 3, 5, 6, 2, 0), # 52
(6, 10, 8, 4, 1, 0, 3, 7, 4, 4, 0, 0), # 53
(6, 9, 6, 4, 4, 0, 6, 5, 2, 5, 6, 0), # 54
(10, 5, 4, 5, 1, 0, 6, 8, 8, 1, 2, 0), # 55
(1, 6, 6, 3, 1, 0, 5, 5, 6, 6, 3, 0), # 56
(4, 5, 5, 6, 2, 0, 2, 13, 8, 3, 0, 0), # 57
(3, 12, 6, 5, 2, 0, 4, 9, 6, 4, 5, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(3.1795818700614573, 8.15575284090909, 9.59308322622108, 7.603532608695652, 8.571634615384614, 5.708152173913044), # 0
(3.20942641205736, 8.246449918455387, 9.644898645029993, 7.6458772644927535, 8.635879807692307, 5.706206567028985), # 1
(3.238930172666081, 8.335801683501682, 9.695484147386459, 7.687289855072463, 8.69876923076923, 5.704201449275362), # 2
(3.268068107989464, 8.42371171875, 9.744802779562981, 7.727735054347824, 8.760245192307693, 5.702137092391305), # 3
(3.296815174129353, 8.510083606902358, 9.792817587832047, 7.767177536231884, 8.82025, 5.700013768115941), # 4
(3.3251463271875914, 8.594820930660775, 9.839491618466152, 7.805581974637681, 8.87872596153846, 5.697831748188405), # 5
(3.353036523266023, 8.677827272727273, 9.88478791773779, 7.842913043478261, 8.935615384615383, 5.695591304347826), # 6
(3.380460718466491, 8.75900621580387, 9.92866953191945, 7.879135416666666, 8.990860576923078, 5.693292708333334), # 7
(3.40739386889084, 8.83826134259259, 9.971099507283634, 7.914213768115941, 9.044403846153847, 5.6909362318840575), # 8
(3.4338109306409126, 8.915496235795453, 10.012040890102828, 7.9481127717391304, 9.0961875, 5.68852214673913), # 9
(3.459686859818554, 8.990614478114479, 10.051456726649528, 7.980797101449276, 9.146153846153846, 5.68605072463768), # 10
(3.4849966125256073, 9.063519652251683, 10.089310063196228, 8.012231431159421, 9.194245192307692, 5.683522237318841), # 11
(3.509715144863916, 9.134115340909089, 10.125563946015424, 8.042380434782608, 9.240403846153844, 5.680936956521738), # 12
(3.5338174129353224, 9.20230512678872, 10.160181421379605, 8.071208786231884, 9.284572115384616, 5.678295153985506), # 13
(3.5572783728416737, 9.267992592592593, 10.193125535561265, 8.098681159420288, 9.326692307692307, 5.6755971014492745), # 14
(3.5800729806848106, 9.331081321022726, 10.224359334832902, 8.124762228260868, 9.36670673076923, 5.672843070652174), # 15
(3.6021761925665783, 9.391474894781144, 10.25384586546701, 8.149416666666665, 9.404557692307693, 5.6700333333333335), # 16
(3.6235629645888205, 9.449076896569863, 10.281548173736075, 8.172609148550725, 9.4401875, 5.667168161231884), # 17
(3.64420825285338, 9.503790909090908, 10.307429305912597, 8.194304347826087, 9.473538461538464, 5.664247826086956), # 18
(3.664087013462101, 9.555520515046295, 10.331452308269066, 8.214466938405796, 9.504552884615384, 5.661272599637681), # 19
(3.683174202516827, 9.604169297138045, 10.353580227077975, 8.2330615942029, 9.533173076923077, 5.658242753623187), # 20
(3.7014447761194034, 9.649640838068178, 10.373776108611827, 8.250052989130435, 9.559341346153845, 5.655158559782609), # 21
(3.7188736903716704, 9.69183872053872, 10.3920029991431, 8.26540579710145, 9.582999999999998, 5.652020289855073), # 22
(3.7354359013754754, 9.730666527251683, 10.408223944944302, 8.279084692028986, 9.604091346153846, 5.6488282155797105), # 23
(3.75110636523266, 9.76602784090909, 10.422401992287917, 8.291054347826087, 9.62255769230769, 5.645582608695652), # 24
(3.7658600380450684, 9.797826244212962, 10.434500187446444, 8.301279438405798, 9.638341346153844, 5.642283740942029), # 25
(3.779671875914545, 9.825965319865318, 10.444481576692374, 8.309724637681159, 9.651384615384615, 5.63893188405797), # 26
(3.792516834942932, 9.85034865056818, 10.452309206298198, 8.316354619565217, 9.661629807692309, 5.635527309782609), # 27
(3.804369871232075, 9.870879819023568, 10.457946122536418, 8.321134057971014, 9.66901923076923, 5.632070289855072), # 28
(3.815205940883816, 9.887462407933501, 10.461355371679518, 8.324027626811594, 9.673495192307692, 5.628561096014493), # 29
(3.8249999999999997, 9.9, 10.4625, 8.325, 9.674999999999999, 5.625), # 30
(3.834164434143222, 9.910414559659088, 10.461641938405796, 8.324824387254901, 9.674452393617022, 5.620051511744128), # 31
(3.843131010230179, 9.920691477272728, 10.459092028985506, 8.324300980392156, 9.672821276595744, 5.612429710144928), # 32
(3.8519037563938614, 9.930829474431818, 10.45488668478261, 8.323434926470588, 9.670124202127658, 5.6022092203898035), # 33
(3.860486700767263, 9.940827272727272, 10.449062318840578, 8.32223137254902, 9.666378723404256, 5.589464667666167), # 34
(3.8688838714833755, 9.950683593749998, 10.441655344202898, 8.320695465686274, 9.661602393617022, 5.574270677161419), # 35
(3.8770992966751923, 9.96039715909091, 10.432702173913043, 8.318832352941177, 9.655812765957448, 5.556701874062968), # 36
(3.885137004475703, 9.96996669034091, 10.422239221014491, 8.316647181372549, 9.64902739361702, 5.536832883558221), # 37
(3.893001023017902, 9.979390909090908, 10.410302898550723, 8.314145098039214, 9.641263829787233, 5.514738330834581), # 38
(3.900695380434782, 9.988668536931817, 10.396929619565215, 8.31133125, 9.632539627659574, 5.490492841079459), # 39
(3.908224104859335, 9.997798295454546, 10.382155797101449, 8.308210784313726, 9.62287234042553, 5.464171039480259), # 40
(3.915591224424552, 10.006778906249998, 10.366017844202899, 8.304788848039216, 9.612279521276594, 5.435847551224389), # 41
(3.9228007672634266, 10.015609090909093, 10.348552173913044, 8.301070588235293, 9.600778723404256, 5.40559700149925), # 42
(3.929856761508952, 10.024287571022725, 10.329795199275361, 8.297061151960785, 9.5883875, 5.373494015492254), # 43
(3.936763235294117, 10.032813068181818, 10.309783333333334, 8.292765686274508, 9.575123404255319, 5.339613218390804), # 44
(3.9435242167519178, 10.041184303977271, 10.288552989130435, 8.288189338235293, 9.561003989361701, 5.304029235382309), # 45
(3.9501437340153456, 10.0494, 10.266140579710147, 8.28333725490196, 9.546046808510638, 5.266816691654173), # 46
(3.956625815217391, 10.05745887784091, 10.24258251811594, 8.278214583333332, 9.530269414893617, 5.228050212393803), # 47
(3.962974488491049, 10.065359659090909, 10.217915217391303, 8.272826470588234, 9.513689361702127, 5.187804422788607), # 48
(3.9691937819693086, 10.073101065340907, 10.19217509057971, 8.26717806372549, 9.49632420212766, 5.146153948025987), # 49
(3.9752877237851663, 10.080681818181816, 10.165398550724637, 8.261274509803922, 9.478191489361702, 5.103173413293353), # 50
(3.9812603420716113, 10.088100639204544, 10.137622010869565, 8.255120955882353, 9.459308776595744, 5.0589374437781105), # 51
(3.987115664961637, 10.09535625, 10.10888188405797, 8.248722549019607, 9.439693617021277, 5.013520664667666), # 52
(3.992857720588235, 10.10244737215909, 10.079214583333332, 8.24208443627451, 9.419363563829787, 4.966997701149425), # 53
(3.9984905370843995, 10.109372727272726, 10.04865652173913, 8.235211764705882, 9.398336170212765, 4.919443178410794), # 54
(4.00401814258312, 10.116131036931817, 10.017244112318838, 8.22810968137255, 9.376628989361702, 4.87093172163918), # 55
(4.0094445652173905, 10.122721022727271, 9.985013768115941, 8.220783333333333, 9.354259574468085, 4.821537956021989), # 56
(4.014773833120205, 10.129141406250001, 9.952001902173912, 8.213237867647058, 9.331245478723403, 4.771336506746626), # 57
(4.0200099744245525, 10.135390909090907, 9.91824492753623, 8.20547843137255, 9.307604255319148, 4.7204019990005), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(6, 6, 12, 5, 1, 0, 7, 6, 7, 3, 2, 0), # 0
(6, 15, 19, 8, 3, 0, 13, 14, 11, 5, 3, 0), # 1
(7, 22, 25, 9, 5, 0, 23, 21, 13, 10, 4, 0), # 2
(11, 25, 29, 10, 8, 0, 30, 29, 16, 17, 5, 0), # 3
(16, 36, 33, 11, 11, 0, 36, 35, 21, 20, 6, 0), # 4
(20, 44, 39, 15, 11, 0, 41, 46, 25, 24, 6, 0), # 5
(22, 52, 41, 19, 13, 0, 46, 51, 28, 26, 7, 0), # 6
(23, 59, 45, 22, 15, 0, 53, 54, 30, 32, 9, 0), # 7
(29, 70, 48, 23, 16, 0, 58, 60, 34, 32, 11, 0), # 8
(32, 77, 54, 26, 16, 0, 66, 70, 38, 36, 12, 0), # 9
(35, 82, 64, 28, 16, 0, 71, 74, 42, 44, 13, 0), # 10
(40, 89, 74, 30, 16, 0, 73, 88, 47, 49, 18, 0), # 11
(45, 98, 80, 36, 21, 0, 77, 93, 55, 51, 19, 0), # 12
(45, 106, 85, 40, 23, 0, 81, 99, 59, 54, 20, 0), # 13
(50, 110, 89, 44, 26, 0, 84, 108, 62, 61, 20, 0), # 14
(52, 114, 95, 45, 29, 0, 91, 117, 65, 65, 22, 0), # 15
(57, 121, 102, 48, 31, 0, 97, 124, 70, 67, 24, 0), # 16
(60, 129, 113, 51, 33, 0, 106, 131, 71, 69, 24, 0), # 17
(65, 134, 117, 51, 34, 0, 117, 142, 76, 75, 27, 0), # 18
(69, 140, 122, 55, 36, 0, 121, 149, 80, 77, 30, 0), # 19
(73, 150, 127, 58, 37, 0, 124, 152, 86, 83, 30, 0), # 20
(74, 159, 132, 64, 38, 0, 127, 157, 91, 88, 34, 0), # 21
(77, 168, 141, 65, 43, 0, 133, 171, 95, 95, 35, 0), # 22
(80, 178, 152, 70, 44, 0, 141, 185, 102, 100, 37, 0), # 23
(85, 183, 158, 74, 44, 0, 147, 192, 111, 106, 39, 0), # 24
(88, 186, 168, 77, 46, 0, 155, 200, 115, 110, 41, 0), # 25
(93, 191, 172, 80, 47, 0, 160, 205, 121, 115, 41, 0), # 26
(95, 197, 179, 84, 48, 0, 164, 218, 129, 122, 43, 0), # 27
(98, 204, 186, 90, 49, 0, 170, 230, 131, 125, 44, 0), # 28
(106, 213, 195, 96, 51, 0, 178, 237, 137, 127, 45, 0), # 29
(107, 218, 199, 98, 53, 0, 184, 244, 141, 135, 45, 0), # 30
(112, 226, 207, 100, 56, 0, 187, 252, 145, 142, 49, 0), # 31
(116, 237, 214, 102, 57, 0, 194, 256, 149, 145, 52, 0), # 32
(119, 240, 221, 105, 59, 0, 202, 265, 154, 147, 54, 0), # 33
(123, 254, 224, 106, 59, 0, 206, 269, 158, 148, 56, 0), # 34
(129, 258, 231, 111, 64, 0, 209, 275, 164, 158, 57, 0), # 35
(131, 265, 235, 114, 65, 0, 213, 281, 169, 162, 58, 0), # 36
(133, 274, 240, 115, 67, 0, 216, 287, 170, 167, 65, 0), # 37
(138, 281, 249, 119, 67, 0, 220, 291, 176, 175, 67, 0), # 38
(140, 291, 257, 121, 70, 0, 226, 304, 181, 180, 68, 0), # 39
(145, 299, 264, 123, 72, 0, 233, 313, 188, 185, 69, 0), # 40
(146, 310, 270, 126, 75, 0, 241, 321, 195, 192, 71, 0), # 41
(150, 314, 272, 127, 76, 0, 246, 328, 198, 194, 74, 0), # 42
(152, 322, 281, 131, 79, 0, 249, 337, 206, 197, 77, 0), # 43
(156, 329, 285, 134, 80, 0, 251, 342, 211, 199, 81, 0), # 44
(161, 334, 292, 138, 81, 0, 257, 348, 213, 206, 82, 0), # 45
(164, 338, 301, 142, 84, 0, 262, 355, 217, 210, 86, 0), # 46
(168, 350, 312, 146, 89, 0, 266, 366, 221, 218, 87, 0), # 47
(169, 355, 317, 150, 90, 0, 271, 373, 228, 224, 88, 0), # 48
(175, 363, 325, 151, 91, 0, 275, 382, 231, 229, 92, 0), # 49
(178, 373, 328, 153, 93, 0, 283, 392, 239, 233, 94, 0), # 50
(182, 382, 332, 157, 99, 0, 284, 400, 244, 236, 96, 0), # 51
(189, 390, 338, 160, 100, 0, 290, 403, 249, 242, 98, 0), # 52
(195, 400, 346, 164, 101, 0, 293, 410, 253, 246, 98, 0), # 53
(201, 409, 352, 168, 105, 0, 299, 415, 255, 251, 104, 0), # 54
(211, 414, 356, 173, 106, 0, 305, 423, 263, 252, 106, 0), # 55
(212, 420, 362, 176, 107, 0, 310, 428, 269, 258, 109, 0), # 56
(216, 425, 367, 182, 109, 0, 312, 441, 277, 261, 109, 0), # 57
(219, 437, 373, 187, 111, 0, 316, 450, 283, 265, 114, 0), # 58
(219, 437, 373, 187, 111, 0, 316, 450, 283, 265, 114, 0), # 59
)
passenger_arriving_rate = (
(3.1795818700614573, 6.524602272727271, 5.755849935732647, 3.0414130434782605, 1.7143269230769227, 0.0, 5.708152173913044, 6.857307692307691, 4.562119565217391, 3.8372332904884314, 1.6311505681818177, 0.0), # 0
(3.20942641205736, 6.597159934764309, 5.786939187017996, 3.0583509057971012, 1.7271759615384612, 0.0, 5.706206567028985, 6.908703846153845, 4.587526358695652, 3.857959458011997, 1.6492899836910773, 0.0), # 1
(3.238930172666081, 6.668641346801345, 5.817290488431875, 3.074915942028985, 1.7397538461538458, 0.0, 5.704201449275362, 6.959015384615383, 4.612373913043478, 3.8781936589545833, 1.6671603367003363, 0.0), # 2
(3.268068107989464, 6.738969375, 5.846881667737788, 3.091094021739129, 1.7520490384615384, 0.0, 5.702137092391305, 7.0081961538461535, 4.636641032608694, 3.897921111825192, 1.68474234375, 0.0), # 3
(3.296815174129353, 6.808066885521885, 5.875690552699228, 3.106871014492753, 1.76405, 0.0, 5.700013768115941, 7.0562, 4.66030652173913, 3.9171270351328187, 1.7020167213804713, 0.0), # 4
(3.3251463271875914, 6.87585674452862, 5.903694971079691, 3.122232789855072, 1.775745192307692, 0.0, 5.697831748188405, 7.102980769230768, 4.6833491847826085, 3.9357966473864603, 1.718964186132155, 0.0), # 5
(3.353036523266023, 6.942261818181818, 5.930872750642674, 3.137165217391304, 1.7871230769230766, 0.0, 5.695591304347826, 7.148492307692306, 4.705747826086957, 3.953915167095116, 1.7355654545454544, 0.0), # 6
(3.380460718466491, 7.007204972643096, 5.95720171915167, 3.1516541666666664, 1.7981721153846155, 0.0, 5.693292708333334, 7.192688461538462, 4.727481249999999, 3.97146781276778, 1.751801243160774, 0.0), # 7
(3.40739386889084, 7.0706090740740715, 5.982659704370181, 3.165685507246376, 1.8088807692307691, 0.0, 5.6909362318840575, 7.2355230769230765, 4.7485282608695645, 3.9884398029134536, 1.7676522685185179, 0.0), # 8
(3.4338109306409126, 7.132396988636362, 6.007224534061696, 3.179245108695652, 1.8192374999999996, 0.0, 5.68852214673913, 7.2769499999999985, 4.768867663043478, 4.004816356041131, 1.7830992471590905, 0.0), # 9
(3.459686859818554, 7.1924915824915825, 6.030874035989717, 3.19231884057971, 1.829230769230769, 0.0, 5.68605072463768, 7.316923076923076, 4.7884782608695655, 4.020582690659811, 1.7981228956228956, 0.0), # 10
(3.4849966125256073, 7.250815721801346, 6.053586037917737, 3.204892572463768, 1.8388490384615384, 0.0, 5.683522237318841, 7.355396153846153, 4.807338858695652, 4.0357240252784905, 1.8127039304503365, 0.0), # 11
(3.509715144863916, 7.30729227272727, 6.0753383676092545, 3.2169521739130427, 1.8480807692307688, 0.0, 5.680936956521738, 7.392323076923075, 4.825428260869565, 4.050225578406169, 1.8268230681818176, 0.0), # 12
(3.5338174129353224, 7.361844101430976, 6.096108852827762, 3.228483514492753, 1.8569144230769232, 0.0, 5.678295153985506, 7.427657692307693, 4.84272527173913, 4.0640725685518415, 1.840461025357744, 0.0), # 13
(3.5572783728416737, 7.414394074074074, 6.115875321336759, 3.2394724637681147, 1.8653384615384612, 0.0, 5.6755971014492745, 7.461353846153845, 4.859208695652172, 4.077250214224506, 1.8535985185185184, 0.0), # 14
(3.5800729806848106, 7.46486505681818, 6.134615600899742, 3.249904891304347, 1.873341346153846, 0.0, 5.672843070652174, 7.493365384615384, 4.874857336956521, 4.089743733933161, 1.866216264204545, 0.0), # 15
(3.6021761925665783, 7.513179915824915, 6.152307519280206, 3.259766666666666, 1.8809115384615382, 0.0, 5.6700333333333335, 7.523646153846153, 4.889649999999999, 4.101538346186803, 1.8782949789562287, 0.0), # 16
(3.6235629645888205, 7.55926151725589, 6.168928904241645, 3.26904365942029, 1.8880374999999998, 0.0, 5.667168161231884, 7.552149999999999, 4.903565489130435, 4.11261926949443, 1.8898153793139725, 0.0), # 17
(3.64420825285338, 7.603032727272725, 6.184457583547558, 3.2777217391304343, 1.8947076923076926, 0.0, 5.664247826086956, 7.578830769230771, 4.916582608695652, 4.122971722365039, 1.9007581818181813, 0.0), # 18
(3.664087013462101, 7.644416412037035, 6.198871384961439, 3.285786775362318, 1.9009105769230765, 0.0, 5.661272599637681, 7.603642307692306, 4.928680163043477, 4.132580923307626, 1.9111041030092588, 0.0), # 19
(3.683174202516827, 7.683335437710435, 6.2121481362467845, 3.2932246376811594, 1.9066346153846152, 0.0, 5.658242753623187, 7.626538461538461, 4.93983695652174, 4.14143209083119, 1.9208338594276086, 0.0), # 20
(3.7014447761194034, 7.719712670454542, 6.224265665167096, 3.3000211956521737, 1.911868269230769, 0.0, 5.655158559782609, 7.647473076923076, 4.950031793478261, 4.14951044344473, 1.9299281676136355, 0.0), # 21
(3.7188736903716704, 7.753470976430976, 6.23520179948586, 3.3061623188405793, 1.9165999999999994, 0.0, 5.652020289855073, 7.666399999999998, 4.959243478260869, 4.15680119965724, 1.938367744107744, 0.0), # 22
(3.7354359013754754, 7.784533221801346, 6.244934366966581, 3.311633876811594, 1.920818269230769, 0.0, 5.6488282155797105, 7.683273076923076, 4.967450815217392, 4.163289577977721, 1.9461333054503365, 0.0), # 23
(3.75110636523266, 7.812822272727271, 6.25344119537275, 3.3164217391304347, 1.9245115384615379, 0.0, 5.645582608695652, 7.6980461538461515, 4.974632608695652, 4.168960796915166, 1.9532055681818177, 0.0), # 24
(3.7658600380450684, 7.838260995370368, 6.260700112467866, 3.320511775362319, 1.9276682692307685, 0.0, 5.642283740942029, 7.710673076923074, 4.980767663043479, 4.173800074978577, 1.959565248842592, 0.0), # 25
(3.779671875914545, 7.860772255892254, 6.266688946015424, 3.3238898550724634, 1.9302769230769228, 0.0, 5.63893188405797, 7.721107692307691, 4.985834782608695, 4.177792630676949, 1.9651930639730635, 0.0), # 26
(3.792516834942932, 7.8802789204545425, 6.2713855237789184, 3.326541847826087, 1.9323259615384616, 0.0, 5.635527309782609, 7.729303846153846, 4.98981277173913, 4.180923682519278, 1.9700697301136356, 0.0), # 27
(3.804369871232075, 7.8967038552188535, 6.2747676735218505, 3.328453623188405, 1.9338038461538458, 0.0, 5.632070289855072, 7.735215384615383, 4.992680434782608, 4.183178449014567, 1.9741759638047134, 0.0), # 28
(3.815205940883816, 7.9099699263468, 6.276813223007711, 3.3296110507246373, 1.9346990384615383, 0.0, 5.628561096014493, 7.738796153846153, 4.994416576086956, 4.184542148671807, 1.9774924815867, 0.0), # 29
(3.8249999999999997, 7.92, 6.2775, 3.3299999999999996, 1.9349999999999996, 0.0, 5.625, 7.739999999999998, 4.994999999999999, 4.185, 1.98, 0.0), # 30
(3.834164434143222, 7.92833164772727, 6.276985163043477, 3.3299297549019604, 1.9348904787234043, 0.0, 5.620051511744128, 7.739561914893617, 4.994894632352941, 4.184656775362318, 1.9820829119318175, 0.0), # 31
(3.843131010230179, 7.936553181818182, 6.275455217391303, 3.329720392156862, 1.9345642553191487, 0.0, 5.612429710144928, 7.738257021276595, 4.994580588235293, 4.1836368115942015, 1.9841382954545455, 0.0), # 32
(3.8519037563938614, 7.944663579545454, 6.272932010869566, 3.329373970588235, 1.9340248404255314, 0.0, 5.6022092203898035, 7.736099361702125, 4.994060955882353, 4.181954673913044, 1.9861658948863634, 0.0), # 33
(3.860486700767263, 7.952661818181817, 6.269437391304347, 3.3288925490196077, 1.9332757446808508, 0.0, 5.589464667666167, 7.733102978723403, 4.993338823529411, 4.179624927536231, 1.9881654545454543, 0.0), # 34
(3.8688838714833755, 7.960546874999998, 6.264993206521739, 3.328278186274509, 1.9323204787234043, 0.0, 5.574270677161419, 7.729281914893617, 4.9924172794117645, 4.176662137681159, 1.9901367187499994, 0.0), # 35
(3.8770992966751923, 7.968317727272727, 6.259621304347825, 3.3275329411764707, 1.9311625531914893, 0.0, 5.556701874062968, 7.724650212765957, 4.9912994117647065, 4.173080869565217, 1.9920794318181818, 0.0), # 36
(3.885137004475703, 7.975973352272726, 6.253343532608695, 3.3266588725490194, 1.9298054787234038, 0.0, 5.536832883558221, 7.719221914893615, 4.989988308823529, 4.168895688405796, 1.9939933380681816, 0.0), # 37
(3.893001023017902, 7.983512727272726, 6.246181739130434, 3.325658039215685, 1.9282527659574464, 0.0, 5.514738330834581, 7.713011063829786, 4.988487058823528, 4.164121159420289, 1.9958781818181814, 0.0), # 38
(3.900695380434782, 7.990934829545453, 6.238157771739129, 3.3245324999999997, 1.9265079255319146, 0.0, 5.490492841079459, 7.7060317021276585, 4.98679875, 4.1587718478260856, 1.9977337073863632, 0.0), # 39
(3.908224104859335, 7.998238636363636, 6.229293478260869, 3.32328431372549, 1.924574468085106, 0.0, 5.464171039480259, 7.698297872340424, 4.984926470588236, 4.1528623188405795, 1.999559659090909, 0.0), # 40
(3.915591224424552, 8.005423124999998, 6.219610706521739, 3.321915539215686, 1.9224559042553186, 0.0, 5.435847551224389, 7.689823617021275, 4.982873308823529, 4.146407137681159, 2.0013557812499996, 0.0), # 41
(3.9228007672634266, 8.012487272727274, 6.209131304347826, 3.320428235294117, 1.920155744680851, 0.0, 5.40559700149925, 7.680622978723404, 4.980642352941175, 4.1394208695652175, 2.0031218181818184, 0.0), # 42
(3.929856761508952, 8.01943005681818, 6.1978771195652165, 3.3188244607843136, 1.9176774999999997, 0.0, 5.373494015492254, 7.670709999999999, 4.978236691176471, 4.131918079710144, 2.004857514204545, 0.0), # 43
(3.936763235294117, 8.026250454545455, 6.18587, 3.317106274509803, 1.9150246808510636, 0.0, 5.339613218390804, 7.660098723404254, 4.975659411764705, 4.123913333333333, 2.0065626136363637, 0.0), # 44
(3.9435242167519178, 8.032947443181817, 6.1731317934782615, 3.315275735294117, 1.91220079787234, 0.0, 5.304029235382309, 7.64880319148936, 4.972913602941175, 4.115421195652174, 2.008236860795454, 0.0), # 45
(3.9501437340153456, 8.03952, 6.159684347826087, 3.313334901960784, 1.9092093617021275, 0.0, 5.266816691654173, 7.63683744680851, 4.970002352941176, 4.106456231884058, 2.00988, 0.0), # 46
(3.956625815217391, 8.045967102272726, 6.1455495108695635, 3.3112858333333324, 1.9060538829787232, 0.0, 5.228050212393803, 7.624215531914893, 4.966928749999999, 4.097033007246376, 2.0114917755681816, 0.0), # 47
(3.962974488491049, 8.052287727272727, 6.130749130434782, 3.309130588235293, 1.9027378723404254, 0.0, 5.187804422788607, 7.610951489361701, 4.96369588235294, 4.087166086956521, 2.013071931818182, 0.0), # 48
(3.9691937819693086, 8.058480852272725, 6.115305054347826, 3.306871225490196, 1.899264840425532, 0.0, 5.146153948025987, 7.597059361702128, 4.960306838235294, 4.076870036231884, 2.014620213068181, 0.0), # 49
(3.9752877237851663, 8.064545454545453, 6.099239130434782, 3.3045098039215683, 1.8956382978723403, 0.0, 5.103173413293353, 7.582553191489361, 4.956764705882353, 4.066159420289854, 2.016136363636363, 0.0), # 50
(3.9812603420716113, 8.070480511363634, 6.082573206521739, 3.302048382352941, 1.8918617553191486, 0.0, 5.0589374437781105, 7.567447021276594, 4.953072573529411, 4.055048804347826, 2.0176201278409085, 0.0), # 51
(3.987115664961637, 8.076284999999999, 6.065329130434782, 3.299489019607843, 1.8879387234042553, 0.0, 5.013520664667666, 7.551754893617021, 4.949233529411765, 4.043552753623188, 2.0190712499999997, 0.0), # 52
(3.992857720588235, 8.081957897727271, 6.047528749999999, 3.2968337745098037, 1.8838727127659571, 0.0, 4.966997701149425, 7.5354908510638285, 4.945250661764706, 4.0316858333333325, 2.020489474431818, 0.0), # 53
(3.9984905370843995, 8.08749818181818, 6.0291939130434775, 3.294084705882353, 1.8796672340425529, 0.0, 4.919443178410794, 7.5186689361702115, 4.941127058823529, 4.019462608695651, 2.021874545454545, 0.0), # 54
(4.00401814258312, 8.092904829545454, 6.010346467391303, 3.2912438725490194, 1.8753257978723403, 0.0, 4.87093172163918, 7.501303191489361, 4.936865808823529, 4.006897644927535, 2.0232262073863634, 0.0), # 55
(4.0094445652173905, 8.098176818181816, 5.991008260869564, 3.288313333333333, 1.8708519148936167, 0.0, 4.821537956021989, 7.483407659574467, 4.9324699999999995, 3.994005507246376, 2.024544204545454, 0.0), # 56
(4.014773833120205, 8.103313125, 5.971201141304347, 3.285295147058823, 1.8662490957446805, 0.0, 4.771336506746626, 7.464996382978722, 4.927942720588234, 3.980800760869564, 2.02582828125, 0.0), # 57
(4.0200099744245525, 8.108312727272725, 5.950946956521738, 3.2821913725490197, 1.8615208510638295, 0.0, 4.7204019990005, 7.446083404255318, 4.923287058823529, 3.9672979710144918, 2.0270781818181813, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
81, # 1
)
| 112.60597 | 213 | 0.727911 | 5,147 | 37,723 | 5.332815 | 0.222848 | 0.314777 | 0.249198 | 0.472166 | 0.332119 | 0.330297 | 0.32986 | 0.32986 | 0.32986 | 0.32986 | 0 | 0.818122 | 0.119662 | 37,723 | 334 | 214 | 112.943114 | 0.008401 | 0.032102 | 0 | 0.202532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.015823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
30f4b7e44a02f5ecd3c79e4a22a066b4b7a542da | 16,978 | py | Python | madminer/plotting/uncertainties.py | rbarrue/madminer | e1d17b2d6be48cc5686b5cbe5d01f62f6cd2450c | [
"MIT"
] | 46 | 2019-06-29T14:56:00.000Z | 2021-08-02T06:05:41.000Z | madminer/plotting/uncertainties.py | Sinclert/madminer | 6556f164725baab6b79e5ffa2a64913a0ac50f7a | [
"MIT"
] | 52 | 2019-06-18T18:42:58.000Z | 2021-10-04T14:56:39.000Z | madminer/plotting/uncertainties.py | Sinclert/madminer | 6556f164725baab6b79e5ffa2a64913a0ac50f7a | [
"MIT"
] | 20 | 2019-06-17T15:29:49.000Z | 2021-09-22T18:14:35.000Z | import logging
import numpy as np
from matplotlib import pyplot as plt, gridspec
from ..sampling import SampleAugmenter
from ..utils.morphing import NuisanceMorpher
from ..utils.various import mdot, shuffle, sanitize_array
logger = logging.getLogger(__name__)
def plot_uncertainty(
filename,
theta,
observable,
obs_label,
obs_range,
n_bins=50,
systematics=None,
n_events=None,
n_toys=100,
linecolor="black",
bandcolor1="#CC002E",
bandcolor2="orange",
ratio_range=(0.8, 1.2),
):
"""
Plots absolute and relative uncertainty bands in a histogram of one observable in a MadMiner file.
Parameters
----------
filename : str
Filename of a MadMiner HDF5 file.
theta : ndarray, optional
Which parameter points to use for histogramming the data.
observable : str
Which observable to plot, given by its name in the MadMiner file.
obs_label : str
x-axis label naming the observable.
obs_range : tuple of two float
Range to be plotted for the observable.
n_bins : int
Number of bins. Default value: 50.
systematics : None or list of str, optional
This can restrict which nuisance parameters are used to draw the uncertainty
bands. Each entry of this list is the name of a systematic uncertainty (see `MadMiner.add_systematics()`).
n_events : None or int, optional
If not None, sets the number of events from the MadMiner file that will be analyzed and plotted. Default value:
None.
n_toys : int, optional
Number of toy nuisance parameter vectors used to estimate the systematic uncertainties. Default value: 100.
linecolor : str, optional
Line color for central prediction. Default value: "black".
bandcolor1 : str, optional
Error band color for 1 sigma uncertainty. Default value: "#CC002E".
bandcolor2 : str, optional
Error band color for 2 sigma uncertainty. Default value: "orange".
ratio_range : tuple of two floar
y-axis range for the plots of the ratio to the central prediction. Default value: (0.8, 1.2).
Returns
-------
figure : Figure
Plot as Matplotlib Figure instance.
"""
# Load data
sa = SampleAugmenter(filename, include_nuisance_parameters=True)
nuisance_morpher = NuisanceMorpher(
sa.nuisance_parameters, list(sa.benchmarks.keys()), reference_benchmark=sa.reference_benchmark
)
# Observable index
obs_idx = list(sa.observables.keys()).index(observable)
# Get event data (observations and weights)
x, weights_benchmarks = sa.weighted_events()
x = x[:, obs_idx]
# Theta matrix
theta_matrix = sa._get_theta_benchmark_matrix(theta)
weights = mdot(theta_matrix, weights_benchmarks)
# Remove negative weights
x = x[weights >= 0.0]
weights_benchmarks = weights_benchmarks[weights >= 0.0]
weights = weights[weights >= 0.0]
# Shuffle events
x, weights, weights_benchmarks = shuffle(x, weights, weights_benchmarks)
# Only analyze n_events
if n_events is not None and n_events < x.shape[0]:
x = x[:n_events]
weights_benchmarks = weights_benchmarks[:n_events]
weights = weights[:n_events]
# Nuisance parameters
n_nuisance_params = sa.n_nuisance_parameters
nuisance_toys = np.random.normal(loc=0.0, scale=1.0, size=n_nuisance_params * n_toys)
nuisance_toys = nuisance_toys.reshape(n_toys, n_nuisance_params)
# Restrict nuisance parameters
if systematics is not None:
nuisance_parameters = []
for npar, (npar_syst, _, _) in sa.nuisance_parameters.items():
if npar_syst in systematics:
nuisance_parameters.append(npar)
for i in range(n_nuisance_params):
if i not in nuisance_parameters:
nuisance_toys[:, i] = 0.0
nuisance_toy_factors = np.array(
[
nuisance_morpher.calculate_nuisance_factors(nuisance_toy, weights_benchmarks)
for nuisance_toy in nuisance_toys
]
) # Shape (n_toys, n_events)
nuisance_toy_factors = sanitize_array(nuisance_toy_factors, min_value=1.0e-2, max_value=100.0)
# Shape (n_toys, n_events)
# Calculate histogram for central prediction, not normalized
histo, bin_edges = np.histogram(x, bins=n_bins, range=obs_range, weights=weights, density=False)
# Calculate toy histograms, not normalized
histos_toys_this_theta = []
for i_toy, nuisance_toy_factors_this_toy in enumerate(nuisance_toy_factors):
toy_histo, _ = np.histogram(
x, bins=n_bins, range=obs_range, weights=weights * nuisance_toy_factors_this_toy, density=False
)
histos_toys_this_theta.append(toy_histo)
histo_plus2sigma = np.percentile(histos_toys_this_theta, 97.5, axis=0)
histo_plus1sigma = np.percentile(histos_toys_this_theta, 84.0, axis=0)
histo_minus1sigma = np.percentile(histos_toys_this_theta, 16.0, axis=0)
histo_minus2sigma = np.percentile(histos_toys_this_theta, 2.5, axis=0)
# Calculate histogram for central prediction, normalized
histo_norm, bin_edges_norm = np.histogram(x, bins=n_bins, range=obs_range, weights=weights, density=True)
# Calculate toy histograms, normalized
histos_toys_this_theta = []
for i_toy, nuisance_toy_factors_this_toy in enumerate(nuisance_toy_factors):
toy_histo, _ = np.histogram(
x, bins=n_bins, range=obs_range, weights=weights * nuisance_toy_factors_this_toy, density=True
)
histos_toys_this_theta.append(toy_histo)
histo_plus2sigma_norm = np.percentile(histos_toys_this_theta, 97.5, axis=0)
histo_plus1sigma_norm = np.percentile(histos_toys_this_theta, 84.0, axis=0)
histo_minus1sigma_norm = np.percentile(histos_toys_this_theta, 16.0, axis=0)
histo_minus2sigma_norm = np.percentile(histos_toys_this_theta, 2.5, axis=0)
# Prepare plotting
def plot_mc(edges, histo_central, histo_m2, histo_m1, histo_p1, histo_p2, relative=False):
bin_edges_ = np.repeat(edges, 2)[1:-1]
histo_ = np.repeat(histo_central, 2)
histo_m2_ = np.repeat(histo_m2, 2)
histo_m1_ = np.repeat(histo_m1, 2)
histo_p1_ = np.repeat(histo_p1, 2)
histo_p2_ = np.repeat(histo_p2, 2)
if relative:
histo_m2_ /= histo_
histo_m1_ /= histo_
histo_p1_ /= histo_
histo_p2_ /= histo_
histo_ /= histo_
plt.fill_between(bin_edges_, histo_m2_, histo_p2_, facecolor=bandcolor2, edgecolor="none")
plt.fill_between(bin_edges_, histo_m1_, histo_p1_, facecolor=bandcolor1, edgecolor="none")
plt.plot(bin_edges_, histo_, color=linecolor, lw=1.5, ls="-")
# Make plot
fig = plt.figure(figsize=(10, 7))
gs = gridspec.GridSpec(2, 2, height_ratios=[2, 1])
# MC, absolute residuals
ax = plt.subplot(gs[2])
plot_mc(bin_edges, histo, histo_minus2sigma, histo_minus1sigma, histo_plus1sigma, histo_plus2sigma, relative=True)
plt.xlabel(obs_label)
plt.ylabel(r"Relative to central pred.")
plt.xlim(obs_range[0], obs_range[1])
plt.ylim(ratio_range[0], ratio_range[1])
# MC, absolute
ax = plt.subplot(gs[0], sharex=ax)
plot_mc(bin_edges, histo, histo_minus2sigma, histo_minus1sigma, histo_plus1sigma, histo_plus2sigma)
plt.ylabel(r"Differential cross section [pb/bin]")
plt.ylim(0.0, None)
plt.setp(ax.get_xticklabels(), visible=False)
# MC, relative residuals
ax = plt.subplot(gs[3])
plot_mc(
bin_edges_norm,
histo_norm,
histo_minus2sigma_norm,
histo_minus1sigma_norm,
histo_plus1sigma_norm,
histo_plus2sigma_norm,
relative=True,
)
plt.xlabel(r"$p_{T,\gamma}$ [GeV]")
plt.ylabel(r"Relative to central pred.")
plt.xlim(obs_range[0], obs_range[1])
plt.ylim(ratio_range[0], ratio_range[1])
# MC, relative
ax = plt.subplot(gs[1], sharex=ax)
plot_mc(
bin_edges_norm,
histo_norm,
histo_minus2sigma_norm,
histo_minus1sigma_norm,
histo_plus1sigma_norm,
histo_plus2sigma_norm,
)
plt.ylabel(r"Normalized distribution")
plt.ylim(0.0, None)
plt.setp(ax.get_xticklabels(), visible=False)
# Return
plt.tight_layout()
return fig
def plot_systematics(
filename,
theta,
observable,
obs_label,
obs_range,
n_bins=50,
n_events=None,
n_toys=100,
linecolor="black",
bandcolors=None,
band_alpha=0.2,
ratio_range=(0.8, 1.2),
):
"""
Plots absolute and relative uncertainty bands for all systematic uncertainties in a histogram of one observable in
a MadMiner file.
Parameters
----------
filename : str
Filename of a MadMiner HDF5 file.
theta : ndarray, optional
Which parameter points to use for histogramming the data.
observable : str
Which observable to plot, given by its name in the MadMiner file.
obs_label : str
x-axis label naming the observable.
obs_range : tuple of two float
Range to be plotted for the observable.
n_bins : int
Number of bins. Default value: 50.
n_events : None or int, optional
If not None, sets the number of events from the MadMiner file that will be analyzed and plotted. Default value:
None.
n_toys : int, optional
Number of toy nuisance parameter vectors used to estimate the systematic uncertainties. Default value: 100.
linecolor : str, optional
Line color for central prediction. Default value: "black".
bandcolors : None or list of str, optional
Error band colors. Default value: None.
ratio_range : tuple of two float
y-axis range for the plots of the ratio to the central prediction. Default value: (0.8, 1.2).
Returns
-------
figure : Figure
Plot as Matplotlib Figure instance.
"""
# Colors
if bandcolors is None:
bandcolors = [f"C{i}" for i in range(10)]
# Load data
sa = SampleAugmenter(filename, include_nuisance_parameters=True)
nuisance_morpher = NuisanceMorpher(
sa.nuisance_parameters, list(sa.benchmarks.keys()), reference_benchmark=sa.reference_benchmark
)
# Observable index
obs_idx = list(sa.observables.keys()).index(observable)
# Get event data (observations and weights)
x, weights_benchmarks = sa.weighted_events()
x = x[:, obs_idx]
# Theta matrix
theta_matrix = sa._get_theta_benchmark_matrix(theta)
weights = mdot(theta_matrix, weights_benchmarks)
# Remove negative weights
x = x[weights >= 0.0]
weights_benchmarks = weights_benchmarks[weights >= 0.0]
weights = weights[weights >= 0.0]
# Shuffle events
x, weights, weights_benchmarks = shuffle(x, weights, weights_benchmarks)
# Only analyze n_events
if n_events is not None and n_events < x.shape[0]:
x = x[:n_events]
weights_benchmarks = weights_benchmarks[:n_events]
weights = weights[:n_events]
# Systematics
n_systematics = len(sa.systematics) + 1
labels = list(sa.systematics.keys()) + ["combined"]
# Nuisance parameters
n_nuisance_params = sa.n_nuisance_parameters
nuisance_toys = np.random.normal(loc=0.0, scale=1.0, size=n_systematics * n_nuisance_params * n_toys)
nuisance_toys = nuisance_toys.reshape(n_systematics, n_toys, n_nuisance_params)
# Restrict nuisance parameters
all_nuisance_parameters = list(sa.nuisance_parameters.keys())
for i_syst, syst_name in enumerate(sa.systematics.keys()):
n_used = n_nuisance_params
used_nuisance_parameters = []
for npar, (npar_syst, _, _) in sa.nuisance_parameters.items():
if npar_syst == syst_name:
used_nuisance_parameters.append(npar)
for i in range(n_nuisance_params):
if all_nuisance_parameters[i] not in used_nuisance_parameters:
nuisance_toys[i_syst, :, i] = 0.0
n_used -= 1
logger.debug("Systematics %s based on %s nuisance parameters", syst_name, n_used)
nuisance_toys = nuisance_toys.reshape(n_systematics * n_toys, n_nuisance_params)
nuisance_toy_factors = np.array(
[
nuisance_morpher.calculate_nuisance_factors(nuisance_toy, weights_benchmarks)
for nuisance_toy in nuisance_toys
]
) # Shape (n_systematics*n_toys, n_events)
nuisance_toy_factors = sanitize_array(nuisance_toy_factors, min_value=1.0e-2, max_value=100.0)
# Shape (n_systematics*n_toys, n_events)
# Calculate histogram for central prediction, not normalized
histo, bin_edges = np.histogram(x, bins=n_bins, range=obs_range, weights=weights, density=False)
# Calculate toy histograms, not normalized
histos_toys_this_theta = []
for i_toy, nuisance_toy_factors_this_toy in enumerate(nuisance_toy_factors):
toy_histo, _ = np.histogram(
x, bins=n_bins, range=obs_range, weights=weights * nuisance_toy_factors_this_toy, density=False
)
histos_toys_this_theta.append(toy_histo)
histos_toys_this_theta = np.array(histos_toys_this_theta)
histos_toys_this_theta = histos_toys_this_theta.reshape(n_systematics, n_toys, -1)
# Shape (n_systematics, n_toys, v)
histo_plus1sigma = np.percentile(histos_toys_this_theta, 84.0, axis=1)
histo_minus1sigma = np.percentile(histos_toys_this_theta, 16.0, axis=1)
# Calculate histogram for central prediction, normalized
histo_norm, bin_edges_norm = np.histogram(x, bins=n_bins, range=obs_range, weights=weights, density=True)
# Calculate toy histograms, normalized
histos_toys_this_theta = []
for i_toy, nuisance_toy_factors_this_toy in enumerate(nuisance_toy_factors):
toy_histo, _ = np.histogram(
x, bins=n_bins, range=obs_range, weights=weights * nuisance_toy_factors_this_toy, density=True
)
histos_toys_this_theta.append(toy_histo)
histos_toys_this_theta = np.array(histos_toys_this_theta)
histos_toys_this_theta = histos_toys_this_theta.reshape(n_systematics, n_toys, -1)
# Shape (n_systematics, n_toys, n_bins)
histo_plus1sigma_norm = np.percentile(histos_toys_this_theta, 84.0, axis=1)
histo_minus1sigma_norm = np.percentile(histos_toys_this_theta, 16.0, axis=1)
# Prepare plotting
def plot_mc(edges, histo_central, histos_minus, histos_plus, relative=False):
bin_edges_ = np.repeat(edges, 2)[1:-1]
histo_central_ = np.repeat(histo_central, 2)
histos_minus_ = [np.repeat(h, 2) for h in histos_minus]
histos_plus_ = [np.repeat(h, 2) for h in histos_plus]
if relative:
histos_minus_ = [h / histo_central_ for h in histos_minus_]
histos_plus_ = [h / histo_central_ for h in histos_plus_]
histo_central_ /= histo_central_
for i, (histo_minus_, histo_plus_) in enumerate(zip(histos_minus_, histos_plus_)):
plt.fill_between(
bin_edges_,
histo_minus_,
histo_plus_,
facecolor=bandcolors[i % len(bandcolors)],
alpha=band_alpha,
edgecolor="none",
label=labels[i],
)
plt.plot(bin_edges_, histo_minus_, color=bandcolors[i % len(bandcolors)], lw=1.0, ls="-")
plt.plot(bin_edges_, histo_plus_, color=bandcolors[i % len(bandcolors)], lw=1.0, ls="-")
plt.plot(bin_edges_, histo_central_, color=linecolor, lw=1.5, ls="-")
# Make plot
fig = plt.figure(figsize=(10, 7))
gs = gridspec.GridSpec(2, 2, height_ratios=[2, 1])
# MC, absolute residuals
ax = plt.subplot(gs[2])
plot_mc(bin_edges, histo, histo_minus1sigma, histo_plus1sigma, relative=True)
plt.xlabel(obs_label)
plt.ylabel(r"Relative to central pred.")
plt.xlim(obs_range[0], obs_range[1])
plt.ylim(ratio_range[0], ratio_range[1])
# MC, absolute
ax = plt.subplot(gs[0], sharex=ax)
plot_mc(bin_edges, histo, histo_minus1sigma, histo_plus1sigma)
plt.legend()
plt.ylabel(r"Differential cross section [pb/bin]")
plt.ylim(0.0, None)
plt.setp(ax.get_xticklabels(), visible=False)
# MC, relative residuals
ax = plt.subplot(gs[3])
plot_mc(bin_edges_norm, histo_norm, histo_minus1sigma_norm, histo_plus1sigma_norm, relative=True)
plt.xlabel(obs_label)
plt.ylabel(r"Relative to central pred.")
plt.xlim(obs_range[0], obs_range[1])
plt.ylim(ratio_range[0], ratio_range[1])
# MC, relative
ax = plt.subplot(gs[1], sharex=ax)
plot_mc(bin_edges_norm, histo_norm, histo_minus1sigma_norm, histo_plus1sigma_norm)
plt.legend()
plt.ylabel(r"Normalized distribution")
plt.ylim(0.0, None)
plt.setp(ax.get_xticklabels(), visible=False)
# Return
plt.tight_layout()
return fig
| 35.593291 | 119 | 0.683649 | 2,309 | 16,978 | 4.767432 | 0.110437 | 0.025436 | 0.03561 | 0.048328 | 0.856014 | 0.834575 | 0.81786 | 0.807867 | 0.783975 | 0.776526 | 0 | 0.020501 | 0.22429 | 16,978 | 476 | 120 | 35.668067 | 0.815338 | 0.236483 | 0 | 0.597744 | 0 | 0 | 0.026372 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015038 | false | 0 | 0.022556 | 0 | 0.045113 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
30ffe8945bd775eb2a620fe9d38bc6c432a68239 | 2,921 | py | Python | schunk_robots/schunk_lwa4d/scripts/move_lin.py | briefgw/brief_schunklwa4p_simulation | 7b148225bfca2f2d3289a9b924d6afde7507b9e8 | [
"BSD-3-Clause"
] | 2 | 2019-03-27T11:01:08.000Z | 2019-08-07T09:38:53.000Z | schunk_robots/schunk_lwa4d/scripts/move_lin.py | briefgw/brief_schunklwa4p_simulation | 7b148225bfca2f2d3289a9b924d6afde7507b9e8 | [
"BSD-3-Clause"
] | 1 | 2019-04-01T11:20:08.000Z | 2019-06-07T07:57:26.000Z | schunk_robots/schunk_lwa4d/scripts/move_lin.py | briefgw/brief_schunklwa4p_simulation | 7b148225bfca2f2d3289a9b924d6afde7507b9e8 | [
"BSD-3-Clause"
] | null | null | null | #! /usr/bin/env python
import math
import rospy
from geometry_msgs.msg import Pose
from cob_cartesian_controller.msg import Profile
from simple_script_server.simple_script_server import simple_script_server
import simple_cartesian_interface as sci
def init_pos():
sss = simple_script_server()
sss.move("arm", [[-0.00032004093963244884, -0.7064191894021441, -1.577532922958369e-06, 1.4183686971944311, 1.2084352562169443e-05, -0.6913530502577565, -0.0002663056533762642]])
if __name__ == '__main__':
rospy.init_node('test_move_lin_interface')
init_pos()
pose = sci.gen_pose(pos=[0.0, 0.0, 0.9], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
pose = sci.gen_pose(pos=[0.3, 0.0, 0.9], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
pose = sci.gen_pose(pos=[0.3, 0.0, 0.8], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
pose = sci.gen_pose(pos=[-0.3, 0.0, 0.8], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
pose = sci.gen_pose(pos=[-0.3, 0.0, 0.9], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
pose = sci.gen_pose(pos=[0.0, 0.0, 0.9], rpy=[0.0, 0.0, 0.0])
profile = Profile()
profile.vel = 0.1
profile.accl = 0.05
#profile.profile_type = Profile.SINOID
profile.profile_type = Profile.RAMP
success, message = sci.move_lin(pose, "world", profile)
if success:
rospy.loginfo(message)
else:
rospy.logerr(message)
rospy.sleep(3.0)
| 25.622807 | 182 | 0.644642 | 430 | 2,921 | 4.260465 | 0.144186 | 0.050218 | 0.055677 | 0.048035 | 0.795852 | 0.766376 | 0.766376 | 0.766376 | 0.766376 | 0.766376 | 0 | 0.10616 | 0.216364 | 2,921 | 113 | 183 | 25.849558 | 0.69419 | 0.083191 | 0 | 0.794872 | 0 | 0 | 0.023961 | 0.008611 | 0 | 0 | 0 | 0 | 0 | 1 | 0.012821 | false | 0 | 0.076923 | 0 | 0.089744 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 6 |
a50ba269a585223f45e8d0fce2c263db7207fb1a | 2,816 | py | Python | draft_app/migrations/0001_initial.py | lopes05/battlerite_draft_graphql | 69e3764e603b6162e3e5009647a0aafe5831d101 | [
"MIT"
] | 1 | 2020-03-02T21:33:09.000Z | 2020-03-02T21:33:09.000Z | draft_app/migrations/0001_initial.py | lopes05/battlerite_draft_graphql | 69e3764e603b6162e3e5009647a0aafe5831d101 | [
"MIT"
] | 7 | 2021-03-19T00:42:11.000Z | 2022-03-12T00:18:29.000Z | draft_app/migrations/0001_initial.py | lopes05/battlerite_draft_graphql | 69e3764e603b6162e3e5009647a0aafe5831d101 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.3 on 2020-03-08 15:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Captain',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Champion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=40, unique=True)),
('picture', models.ImageField(upload_to='')),
],
),
migrations.CreateModel(
name='Map',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=40, unique=True)),
('picture', models.ImageField(upload_to='')),
],
),
migrations.CreateModel(
name='Team',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('champion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='draft_app.Champion')),
],
),
migrations.CreateModel(
name='DraftLobby',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('captain_a', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='captain_a', to='draft_app.Captain')),
('captain_b', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='captain_b', to='draft_app.Captain')),
('chosen_map', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='map', to='draft_app.Map')),
('team_a', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_a', to='draft_app.Team')),
('team_a_bans', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bans_a', to='draft_app.Champion')),
('team_b', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_b', to='draft_app.Team')),
('team_b_bans', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bans_b', to='draft_app.Champion')),
],
),
]
| 47.728814 | 156 | 0.604403 | 315 | 2,816 | 5.209524 | 0.193651 | 0.048751 | 0.076782 | 0.120658 | 0.74223 | 0.720293 | 0.720293 | 0.720293 | 0.720293 | 0.687995 | 0 | 0.010387 | 0.247869 | 2,816 | 58 | 157 | 48.551724 | 0.7644 | 0.01598 | 0 | 0.568627 | 1 | 0 | 0.116287 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.039216 | 0 | 0.117647 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
eb71b0a0ed00b83929cd60ffbedd20558daa58a5 | 39 | py | Python | routes/admin/__init__.py | bilginfurkan/Anonimce | 7d73c13ae8d5c873b6863878370ad83ec9ee5acc | [
"Apache-2.0"
] | 2 | 2021-02-15T12:56:58.000Z | 2021-02-21T12:38:47.000Z | routes/admin/__init__.py | bilginfurkan/Anonimce | 7d73c13ae8d5c873b6863878370ad83ec9ee5acc | [
"Apache-2.0"
] | null | null | null | routes/admin/__init__.py | bilginfurkan/Anonimce | 7d73c13ae8d5c873b6863878370ad83ec9ee5acc | [
"Apache-2.0"
] | null | null | null | from .admin import *
from .api import * | 19.5 | 20 | 0.717949 | 6 | 39 | 4.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179487 | 39 | 2 | 21 | 19.5 | 0.875 | 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 | 1 | 0 | 0 | 6 |
eb8d9d20c0c168ad1cce80735928bb37e88f571f | 5,239 | py | Python | test/test_13_filtercapabilities.py | growell/svnhook | ceb337c472c5ec470286576a9bfca8f5b8ec424e | [
"Apache-2.0"
] | 1 | 2015-11-23T21:05:19.000Z | 2015-11-23T21:05:19.000Z | test/test_13_filtercapabilities.py | growell/svnhook | ceb337c472c5ec470286576a9bfca8f5b8ec424e | [
"Apache-2.0"
] | null | null | null | test/test_13_filtercapabilities.py | growell/svnhook | ceb337c472c5ec470286576a9bfca8f5b8ec424e | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
######################################################################
# Test Client Capabilities Filter
######################################################################
import os, re, sys, unittest
# Prefer local modules.
mylib = os.path.normpath(os.path.join(
os.path.dirname(__file__), '..'))
if os.path.isdir(mylib): sys.path.insert(0, mylib)
from test.base import HookTestCase
# Test Hook and Configuration File
testhook = 'start-commit'
testconf = 'start-commit.xml'
class TestFilterCapabilities(HookTestCase):
def setUp(self):
super(TestFilterCapabilities, self).setUp(
re.sub(r'^test_?(.+)\.[^\.]+$', r'\1',
os.path.basename(__file__)))
def test_01_no_capabilities(self):
"""No client capabilities."""
# Define the hook configuration.
self.writeConf(testconf, '''\
<?xml version="1.0"?>
<Actions>
<FilterCapabilities>
<CapabilitiesRegex sense="false">mergeinfo</CapabilitiesRegex>
<SendError>Capability missing: mergeinfo</SendError>
</FilterCapabilities>
</Actions>
''')
# Call the script with a mismatch.
p = self.callHook(testhook,
self.repopath, self.username, '')
(stdoutdata, stderrdata) = p.communicate()
p.wait()
# Verify the proper error is returned.
self.assertRegexpMatches(
stderrdata, r'Capability missing',
'Expected error message not found')
# Verify a failure is indicated.
self.assertTrue(p.returncode != 0,
'Expected error exit code is zero')
def test_02_exact_match(self):
"""Exact capability match."""
# Define the hook configuration.
self.writeConf(testconf, '''\
<?xml version="1.0"?>
<Actions>
<FilterCapabilities>
<CapabilitiesRegex sense="false">mergeinfo</CapabilitiesRegex>
<SendError>Capability missing: mergeinfo</SendError>
</FilterCapabilities>
</Actions>
''')
# Call the script with a single capability that exactly
# matches the desired capability.
p = self.callHook(testhook,
self.repopath, self.username, 'mergeinfo')
(stdoutdata, stderrdata) = p.communicate()
p.wait()
# Verify that no error message is returned.
self.assertRegexpMatches(
stderrdata, r'(?s)^\s*$',
'Unexpected error message found')
# Verify that no failure is indicated.
self.assertTrue(
p.returncode == 0,
'Expected success exit code is non-zero')
def test_03_multiple_client_match(self):
"""Match capability in client list."""
# Define the hook configuration.
self.writeConf(testconf, '''\
<?xml version="1.0"?>
<Actions>
<FilterCapabilities>
<CapabilitiesRegex sense="false">mergeinfo</CapabilitiesRegex>
<SendError>Capability missing: mergeinfo</SendError>
</FilterCapabilities>
</Actions>
''')
# Call the script with multiple colon-delimited capabilities
# - one of which matches the desired capability.
p = self.callHook(testhook,
self.repopath, self.username,
'mindread:mergeinfo:emote')
(stdoutdata, stderrdata) = p.communicate()
p.wait()
# Verify that no error message is returned.
self.assertRegexpMatches(
stderrdata, r'(?s)^\s*$',
'Unexpected error message found')
# Verify that no failure is indicated.
self.assertTrue(
p.returncode == 0,
'Expected success exit code is non-zero')
def test_04_case_sensitive(self):
"""Case-sensitive client capabilities."""
# Define the hook configuration.
self.writeConf(testconf, '''\
<?xml version="1.0"?>
<Actions>
<FilterCapabilities>
<CapabilitiesRegex sense="false">mergeinfo</CapabilitiesRegex>
<SendError>Capability missing: mergeinfo</SendError>
</FilterCapabilities>
</Actions>
''')
# Call the script with a mismatch.
p = self.callHook(testhook,
self.repopath, self.username,
'MindRead:MergeInfo:Emote')
(stdoutdata, stderrdata) = p.communicate()
p.wait()
# Verify the proper error is returned.
self.assertRegexpMatches(
stderrdata, r'Capability missing',
'Expected error message not found')
# Verify a failure is indicated.
self.assertTrue(p.returncode != 0,
'Expected error exit code is zero')
# Allow manual execution of tests.
if __name__=='__main__':
suite = unittest.TestLoader()\
.loadTestsFromTestCase(TestFilterCapabilities)
unittest.TextTestRunner(verbosity=2).run(suite)
########################### end of file ##############################
| 34.926667 | 76 | 0.559267 | 475 | 5,239 | 6.105263 | 0.277895 | 0.035172 | 0.017931 | 0.035862 | 0.734828 | 0.734828 | 0.734828 | 0.734828 | 0.734828 | 0.734828 | 0 | 0.006276 | 0.300439 | 5,239 | 149 | 77 | 35.161074 | 0.784993 | 0.180378 | 0 | 0.75 | 0 | 0 | 0.399457 | 0.116457 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.052083 | false | 0 | 0.020833 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 6 |
ebd5c77583169affa3445c54f3e34877f364fe6f | 3,706 | py | Python | query_mpg.py | MicroServicesAIOps/ElasticSearchPython | 75a9fb2a147fc735f962eb37bfa125409bab425a | [
"Apache-2.0"
] | null | null | null | query_mpg.py | MicroServicesAIOps/ElasticSearchPython | 75a9fb2a147fc735f962eb37bfa125409bab425a | [
"Apache-2.0"
] | null | null | null | query_mpg.py | MicroServicesAIOps/ElasticSearchPython | 75a9fb2a147fc735f962eb37bfa125409bab425a | [
"Apache-2.0"
] | null | null | null |
import utils
import pandas as pd
# 创建mpg
def generate_mpg_data(data_dir):
df = pd.DataFrame(columns=['source', 'destination'])
query_arr = [["source_workload", "destination_workload", "service", "service",
"sum(istio_tcp_received_bytes_total) by (source_workload, destination_workload)"],
["source_workload", "destination_workload", "service", "service",
"sum(istio_requests_total{destination_workload_namespace=\'sock-shop\'}) "
"by (source_workload, destination_workload)"],
["pod", "instance", "container", "host",
"sum(container_cpu_usage_seconds_total{namespace=\"sock-shop\", "
"container!~\"POD|istio-proxy|\"}) by (instance, pod)"],
["instance", "pod", "host", "container",
"sum(container_cpu_usage_seconds_total{namespace=\"sock-shop\", "
"container!~\"POD|istio-proxy|\"}) by (instance, pod)"],
["kubernetes_pod_name", "source_workload", "container", "service",
"sum(istio_requests_total{destination_workload_namespace='sock-shop', reporter='source'})"
" by (kubernetes_pod_name, source_workload)"],
["source_workload", "kubernetes_pod_name", "service", "container",
"sum(istio_requests_total{destination_workload_namespace='sock-shop', reporter='source'})"
" by (kubernetes_pod_name, source_workload)"],
["kubernetes_pod_name", "destination_workload", "container", "service",
"sum(istio_requests_total{destination_workload_namespace='sock-shop', reporter='destination'})"
" by (kubernetes_pod_name, destination_workload)"],
["destination_workload", "kubernetes_pod_name", "service", "container",
"sum(istio_requests_total{destination_workload_namespace='sock-shop', reporter='destination'})"
" by (kubernetes_pod_name, destination_workload)"],
["kubernetes_pod_name", "source_workload", "container", "service",
"sum(istio_tcp_received_bytes_total{destination_workload_namespace='sock-shop', reporter='source'})"
" by (kubernetes_pod_name, source_workload)"],
["source_workload", "kubernetes_pod_name", "service", "container",
"sum(istio_tcp_received_bytes_total{destination_workload_namespace='sock-shop', reporter='source'})"
" by (kubernetes_pod_name, source_workload)"],
["kubernetes_pod_name", "destination_workload", "container", "service",
"sum(istio_tcp_received_bytes_total{destination_workload_namespace='sock-shop', "
"reporter='destination'}) by (kubernetes_pod_name, destination_workload)"],
["destination_workload", "kubernetes_pod_name", "service", "container",
"sum(istio_tcp_received_bytes_total{destination_workload_namespace='sock-shop', "
"reporter='destination'}) by (kubernetes_pod_name, destination_workload)"],
]
for query_info in query_arr:
results = utils.query_range_prom_data(query_info[-1], None, None, instant=True)['data']['result']
for result in results:
metric = result['metric']
source = metric[query_info[0]]
destination = metric[query_info[1]]
df = df.append({'source': source + '_' + query_info[2],
'destination': destination + '_' + query_info[3]}, ignore_index=True)
df = df.drop_duplicates()
df.to_csv(data_dir + '_mpg.csv')
| 69.924528 | 118 | 0.618996 | 363 | 3,706 | 5.953168 | 0.176309 | 0.184637 | 0.125868 | 0.137436 | 0.795002 | 0.76261 | 0.76261 | 0.752892 | 0.708931 | 0.687645 | 0 | 0.001788 | 0.245278 | 3,706 | 52 | 119 | 71.269231 | 0.770826 | 0.001349 | 0 | 0.56 | 1 | 0 | 0.569497 | 0.318551 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02 | false | 0 | 0.04 | 0 | 0.06 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ebd9833208bd8078770ffa548f791456f8a3d2fb | 4,934 | py | Python | tests/barriers/test_archive.py | felix781/market-access-python-frontend | 3b0e49feb4fdf0224816326938a46002aa4a2b1c | [
"MIT"
] | 1 | 2021-12-15T04:14:03.000Z | 2021-12-15T04:14:03.000Z | tests/barriers/test_archive.py | felix781/market-access-python-frontend | 3b0e49feb4fdf0224816326938a46002aa4a2b1c | [
"MIT"
] | 19 | 2019-12-11T11:32:47.000Z | 2022-03-29T15:40:57.000Z | tests/barriers/test_archive.py | felix781/market-access-python-frontend | 3b0e49feb4fdf0224816326938a46002aa4a2b1c | [
"MIT"
] | 2 | 2021-02-09T09:38:45.000Z | 2021-03-29T19:07:09.000Z | from http import HTTPStatus
from django.urls import reverse
from mock import patch
from core.tests import MarketAccessTestCase
class ArchiveTestCase(MarketAccessTestCase):
@patch("utils.api.resources.APIResource.patch")
def test_empty_reason(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]})
)
assert response.status_code == HTTPStatus.OK
form = response.context["form"]
assert form.is_valid() is False
assert "reason" in form.errors
assert mock_patch.called is False
@patch("utils.api.resources.APIResource.patch")
def test_duplicate_empty_explanation(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "DUPLICATE"},
)
assert response.status_code == HTTPStatus.OK
form = response.context["form"]
assert form.is_valid() is False
assert "duplicate_explanation" in form.errors
assert mock_patch.called is False
@patch("utils.api.resources.APIResource.patch")
def test_non_a_barrier_empty_explanation(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "NOT_A_BARRIER"},
)
assert response.status_code == HTTPStatus.OK
form = response.context["form"]
assert form.is_valid() is False
assert "not_a_barrier_explanation" in form.errors
assert mock_patch.called is False
@patch("utils.api.resources.APIResource.patch")
def test_other_empty_explanation(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "OTHER"},
)
assert response.status_code == HTTPStatus.OK
form = response.context["form"]
assert form.is_valid() is False
assert "other_explanation" in form.errors
assert mock_patch.called is False
@patch("utils.api.resources.APIResource.patch")
def test_duplicate_success(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "DUPLICATE", "duplicate_explanation": "Explanation"},
)
assert response.status_code == HTTPStatus.FOUND
mock_patch.assert_called_with(
id=self.barrier["id"],
archived=True,
archived_reason="DUPLICATE",
archived_explanation="Explanation",
)
@patch("utils.api.resources.APIResource.patch")
def test_not_a_barrier_success(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={
"reason": "NOT_A_BARRIER",
"not_a_barrier_explanation": "Explanation",
},
)
assert response.status_code == HTTPStatus.FOUND
mock_patch.assert_called_with(
id=self.barrier["id"],
archived=True,
archived_reason="NOT_A_BARRIER",
archived_explanation="Explanation",
)
@patch("utils.api.resources.APIResource.patch")
def test_other_success(self, mock_patch):
response = self.client.post(
reverse("barriers:archive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "OTHER", "other_explanation": "Other Explanation"},
)
assert response.status_code == HTTPStatus.FOUND
mock_patch.assert_called_with(
id=self.barrier["id"],
archived=True,
archived_reason="OTHER",
archived_explanation="Other Explanation",
)
class UnarchiveTestCase(MarketAccessTestCase):
@patch("utils.api.resources.APIResource.patch")
def test_empty_reason(self, mock_patch):
response = self.client.post(
reverse("barriers:unarchive", kwargs={"barrier_id": self.barrier["id"]})
)
assert response.status_code == HTTPStatus.OK
form = response.context["form"]
assert form.is_valid() is False
assert "reason" in form.errors
assert mock_patch.called is False
@patch("utils.api.resources.APIResource.patch")
def test_success(self, mock_patch):
response = self.client.post(
reverse("barriers:unarchive", kwargs={"barrier_id": self.barrier["id"]}),
data={"reason": "Reason for unarchiving"},
)
assert response.status_code == HTTPStatus.FOUND
mock_patch.assert_called_with(
id=self.barrier["id"],
archived=False,
unarchived_reason="Reason for unarchiving",
)
| 38.850394 | 85 | 0.632955 | 537 | 4,934 | 5.636872 | 0.111732 | 0.065411 | 0.055831 | 0.06442 | 0.88107 | 0.88107 | 0.88107 | 0.88107 | 0.877767 | 0.874463 | 0 | 0 | 0.247669 | 4,934 | 126 | 86 | 39.15873 | 0.815463 | 0 | 0 | 0.575221 | 0 | 0 | 0.202675 | 0.086137 | 0 | 0 | 0 | 0 | 0.247788 | 1 | 0.079646 | false | 0 | 0.035398 | 0 | 0.132743 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
696615a33763d3f5e34d089929055763e868b6c6 | 60 | py | Python | testFunction.py | gtg3vv/cs3240-labdemo | 8d49de60cdd5f9dd314da1225959bf95735e174a | [
"MIT"
] | null | null | null | testFunction.py | gtg3vv/cs3240-labdemo | 8d49de60cdd5f9dd314da1225959bf95735e174a | [
"MIT"
] | null | null | null | testFunction.py | gtg3vv/cs3240-labdemo | 8d49de60cdd5f9dd314da1225959bf95735e174a | [
"MIT"
] | null | null | null | def test_function(x):
return x*x*x
print(test_function(4)) | 15 | 23 | 0.75 | 12 | 60 | 3.583333 | 0.583333 | 0.55814 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018519 | 0.1 | 60 | 4 | 23 | 15 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.333333 | 0.666667 | 0.333333 | 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 | 1 | 1 | 0 | 0 | 6 |
15d9da476eadece26d9c9f71048e3d8719e20882 | 27 | py | Python | test3.py | Da-Tony-W/test1 | 95726b125a51c8712141f76a8d2511d68da99769 | [
"MIT"
] | null | null | null | test3.py | Da-Tony-W/test1 | 95726b125a51c8712141f76a8d2511d68da99769 | [
"MIT"
] | null | null | null | test3.py | Da-Tony-W/test1 | 95726b125a51c8712141f76a8d2511d68da99769 | [
"MIT"
] | null | null | null | print("Hello, Mondasians")
| 13.5 | 26 | 0.740741 | 3 | 27 | 6.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 27 | 1 | 27 | 27 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.62963 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
c655b651da1c114da264d0e492d2d93f8da6fa94 | 100 | py | Python | dvt/byod_dvt/fargate/validation/src/rules/__init__.py | joben/bring-your-own-data-labs | b580a2553220648e1273e585689267932812c732 | [
"MIT-0"
] | null | null | null | dvt/byod_dvt/fargate/validation/src/rules/__init__.py | joben/bring-your-own-data-labs | b580a2553220648e1273e585689267932812c732 | [
"MIT-0"
] | 1 | 2020-12-07T05:03:04.000Z | 2020-12-07T05:03:04.000Z | dvt/byod_dvt/fargate/validation/src/rules/__init__.py | joben/bring-your-own-data-labs | b580a2553220648e1273e585689267932812c732 | [
"MIT-0"
] | 3 | 2020-10-13T08:52:38.000Z | 2021-01-18T02:58:51.000Z | from .csv_header_rule import CsvHeaderRule
from .filesize_encoding_rule import FileSizeEncodingRule
| 33.333333 | 56 | 0.9 | 12 | 100 | 7.166667 | 0.75 | 0.232558 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 100 | 2 | 57 | 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 | 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 | 6 |
d6c20982e7ad8a076cc6b8d4d8312c43304e65d9 | 62 | py | Python | brain_training/programming_challenges/src/T022/palindrome.py | kuzxnia/algoritms | eda3185f39d79a2657b7ef0da869fcc6b825889d | [
"MIT"
] | null | null | null | brain_training/programming_challenges/src/T022/palindrome.py | kuzxnia/algoritms | eda3185f39d79a2657b7ef0da869fcc6b825889d | [
"MIT"
] | null | null | null | brain_training/programming_challenges/src/T022/palindrome.py | kuzxnia/algoritms | eda3185f39d79a2657b7ef0da869fcc6b825889d | [
"MIT"
] | null | null | null | def is_palindrome(seq):
return str(seq) == str(seq)[::-1]
| 20.666667 | 37 | 0.612903 | 10 | 62 | 3.7 | 0.7 | 0.324324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.16129 | 62 | 2 | 38 | 31 | 0.692308 | 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 | 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 | 1 | 1 | 0 | 0 | 6 |
d6ef13000ea2455e440a82c2bea154ca3013e854 | 434 | py | Python | denoisers/base.py | parthe/VAMP | 1a17af5aef4aaf9cc37bc3ae6b9c9b7d58de5b84 | [
"BSD-3-Clause"
] | 1 | 2021-12-08T03:15:04.000Z | 2021-12-08T03:15:04.000Z | denoisers/base.py | parthe/VAMP | 1a17af5aef4aaf9cc37bc3ae6b9c9b7d58de5b84 | [
"BSD-3-Clause"
] | null | null | null | denoisers/base.py | parthe/VAMP | 1a17af5aef4aaf9cc37bc3ae6b9c9b7d58de5b84 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 5 18:38:10 2021
@author: Parthe
"""
from functools import partial
class Denoiser():
def __init__(self, denoising_function, *args, **kwargs):
self.denoising_function = partial(denoising_function, *args, **kwargs)
self.__dict__.update(**kwargs)
def __call__(self, *args, **kwargs):
return self.denoising_function(*args, **kwargs) | 22.842105 | 78 | 0.631336 | 50 | 434 | 5.16 | 0.62 | 0.263566 | 0.244186 | 0.313953 | 0.375969 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035821 | 0.228111 | 434 | 19 | 79 | 22.842105 | 0.734328 | 0.172811 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.142857 | 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 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
ba399699970ab90393d6c4446632917433ad64fd | 116 | py | Python | zsplot/__init__.py | Zsailer/zsplot | ed0fe811e35d89ff929726a2e39688cecdf5fbb7 | [
"MIT"
] | null | null | null | zsplot/__init__.py | Zsailer/zsplot | ed0fe811e35d89ff929726a2e39688cecdf5fbb7 | [
"MIT"
] | null | null | null | zsplot/__init__.py | Zsailer/zsplot | ed0fe811e35d89ff929726a2e39688cecdf5fbb7 | [
"MIT"
] | null | null | null | from .kde2d import kde2d
from .correlations import (corr, resid, rhist, corr_resid, corr_resid_rhist)
__all__ = []
| 23.2 | 76 | 0.767241 | 16 | 116 | 5.125 | 0.5 | 0.329268 | 0.341463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0.137931 | 116 | 4 | 77 | 29 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 6 |
ba586c482bdbf1eb4ab02e4fb4cfe7d019b85c79 | 130 | py | Python | jobs/admin.py | Ascensiony/Software-Dev-Project | 85513737ae4a4b76fa0cfdab579b037d33b72faf | [
"MIT"
] | 2 | 2021-03-05T01:38:24.000Z | 2021-03-19T21:11:14.000Z | jobs/admin.py | yabhi0807/Software-Dev-Project | 85513737ae4a4b76fa0cfdab579b037d33b72faf | [
"MIT"
] | 7 | 2021-04-08T21:12:42.000Z | 2022-03-12T00:13:59.000Z | jobs/admin.py | venky012/ase-1-site | 877e36344c82567d3ebc7b0f29a2757da2a7f071 | [
"MIT"
] | 4 | 2020-02-17T09:47:39.000Z | 2020-02-22T12:11:18.000Z | from django.contrib import admin
from .models import Jobs_details
# Register your models here.
admin.site.register(Jobs_details)
| 21.666667 | 33 | 0.823077 | 19 | 130 | 5.526316 | 0.631579 | 0.209524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 130 | 5 | 34 | 26 | 0.913043 | 0.2 | 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 | 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 | 6 |
ba81334f92a132a4d913d2577c9a58dfe3da3856 | 248 | py | Python | python27/directoryCreationTest.py | xiemingzhi/pythonproject | 9b860b274a71a84676a98f61cf6f4f283ff4bf78 | [
"MIT"
] | null | null | null | python27/directoryCreationTest.py | xiemingzhi/pythonproject | 9b860b274a71a84676a98f61cf6f4f283ff4bf78 | [
"MIT"
] | null | null | null | python27/directoryCreationTest.py | xiemingzhi/pythonproject | 9b860b274a71a84676a98f61cf6f4f283ff4bf78 | [
"MIT"
] | 1 | 2018-09-19T00:31:35.000Z | 2018-09-19T00:31:35.000Z | import os
os.makedirs('bak_10_28_2014/TVepisodescopy/ad93e12b-2f85-4b20-9905-8f7687f4a97f/Images/English /')
#os.makedirs('parent/thisisadirectorywith space ')
#os.makedirs(r'thisisadirectorywith space ')
#spacestr = 'thisisadirectorywith space '
| 35.428571 | 98 | 0.810484 | 29 | 248 | 6.827586 | 0.689655 | 0.151515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12931 | 0.064516 | 248 | 6 | 99 | 41.333333 | 0.724138 | 0.532258 | 0 | 0 | 0 | 0 | 0.734513 | 0.716814 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
bac0f0130f55f36ca620a503c08c4c73b15c053b | 100 | py | Python | pagina.py | Hugo1568/Real-time-facial-recognition-MTCNN | cba9b483e87b84af6414d01cb91a0024ed882e0d | [
"MIT"
] | 3 | 2021-05-19T09:54:13.000Z | 2021-11-05T09:05:05.000Z | pagina.py | Hugo1568/Real-time-facial-recognition-MTCNN | cba9b483e87b84af6414d01cb91a0024ed882e0d | [
"MIT"
] | 1 | 2021-05-24T08:31:52.000Z | 2021-05-24T08:31:52.000Z | pagina.py | Hugo1568/Real-time-facial-recognition-MTCNN | cba9b483e87b84af6414d01cb91a0024ed882e0d | [
"MIT"
] | 4 | 2021-05-24T08:22:14.000Z | 2021-11-05T09:05:27.000Z | import streamlit as st
from streamlit_webrtc import webrtc_streamer
webrtc_streamer(key="example")
| 20 | 44 | 0.85 | 14 | 100 | 5.857143 | 0.642857 | 0.341463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 100 | 4 | 45 | 25 | 0.911111 | 0 | 0 | 0 | 0 | 0 | 0.07 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
bad623b8fd2195874383396db59b7f8b253a3c93 | 249 | py | Python | bfgame/queries/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | 3 | 2017-10-28T11:28:38.000Z | 2018-09-12T09:47:00.000Z | bfgame/queries/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | null | null | null | bfgame/queries/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | null | null | null | from bfgame.queries.experience import Experience
from bfgame.queries.restrictions import Restrictions
from bfgame.queries.skills import Skills
from bfgame.queries.specialability import SpecialAbility
from bfgame.queries.visibility import Visibility
| 41.5 | 56 | 0.879518 | 30 | 249 | 7.3 | 0.3 | 0.228311 | 0.388128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.080321 | 249 | 5 | 57 | 49.8 | 0.956332 | 0 | 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 | 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 | 6 |
243eae4d9d9ebdc274efde5057b3ba3e85026d11 | 74 | py | Python | applied/tasks/aoex/__init__.py | ndoll1998/AppliedTransformers | 76cbdef6fdd765b2178af71038a61e3e71e0cec9 | [
"MIT"
] | 3 | 2020-09-02T03:51:49.000Z | 2020-09-18T14:09:48.000Z | applied/tasks/aoex/__init__.py | ndoll1998/AppliedTransformers | 76cbdef6fdd765b2178af71038a61e3e71e0cec9 | [
"MIT"
] | null | null | null | applied/tasks/aoex/__init__.py | ndoll1998/AppliedTransformers | 76cbdef6fdd765b2178af71038a61e3e71e0cec9 | [
"MIT"
] | 2 | 2021-01-30T12:37:43.000Z | 2021-05-19T06:29:31.000Z | from . import models
from . import datasets
from .trainer import Trainer | 24.666667 | 28 | 0.783784 | 10 | 74 | 5.8 | 0.5 | 0.344828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175676 | 74 | 3 | 28 | 24.666667 | 0.95082 | 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 | 1 | 0 | 0 | 6 |
2448bc1006a9478b4faa376d8f686d18ac4da327 | 2,365 | py | Python | merge-files.py | joaofig/dublin-buses | b40896783643582aeaad3a7005c7aa4278d3b4e6 | [
"MIT"
] | 1 | 2020-01-22T19:13:36.000Z | 2020-01-22T19:13:36.000Z | merge-files.py | joaofig/dublin-buses | b40896783643582aeaad3a7005c7aa4278d3b4e6 | [
"MIT"
] | 1 | 2020-01-30T14:38:55.000Z | 2020-01-30T14:38:55.000Z | merge-files.py | joaofig/dublin-buses | b40896783643582aeaad3a7005c7aa4278d3b4e6 | [
"MIT"
] | null | null | null | import dask.dataframe as dd
import pandas as pd
import numpy as np
def dask_load_day(day):
header = ['timestamp', 'line_id', 'direction', 'jrny_patt_id', 'time_frame', 'journey_id', 'operator',
'congestion', 'lon', 'lat', 'delay', 'block_id', 'vehicle_id', 'stop_id', 'at_stop']
types = {'timestamp': np.int64,
'journey_id': np.int32,
'congestion': np.int8,
'lon': np.float64,
'lat': np.float64,
'delay': np.int8,
'vehicle_id': np.int32,
'at_stop': np.int8}
file_name = 'data/siri.201301{0:02d}.csv'.format(day)
df = dd.read_csv(file_name, header=None, names=header, dtype=types, parse_dates=['time_frame'],
infer_datetime_format=True)
null_replacements = {'line_id': 0, 'stop_id': 0}
df = df.fillna(value=null_replacements)
df['line_id'] = df['line_id'].astype(np.int32)
df['stop_id'] = df['stop_id'].astype(np.int32)
df['timestamp'] = dd.to_datetime(df['timestamp'], unit='us')
return df
def pandas_load_day(day):
header = ['timestamp', 'line_id', 'direction', 'jrny_patt_id', 'time_frame', 'journey_id', 'operator',
'congestion', 'lon', 'lat', 'delay', 'block_id', 'vehicle_id', 'stop_id', 'at_stop']
types = {'timestamp': np.int64,
'journey_id': np.int32,
'congestion': np.int8,
'lon': np.float64,
'lat': np.float64,
'delay': np.int8,
'vehicle_id': np.int32,
'at_stop': np.int8}
file_name = 'data/siri.201301{0:02d}.csv'.format(day)
df = pd.read_csv(file_name, header=None, names=header, dtype=types, parse_dates=['time_frame'],
infer_datetime_format=True)
null_replacements = {'line_id': 0, 'stop_id': 0}
df = df.fillna(value=null_replacements)
df['line_id'] = df['line_id'].astype(np.int32)
df['stop_id'] = df['stop_id'].astype(np.int32)
# df['timestamp'] = pd.to_datetime(df['timestamp'], unit='us')
return df
def run():
df = None
for day in range(1, 32):
print(day)
day_df = pandas_load_day(day)
if df is None:
df = day_df
else:
df = df.append(day_df, ignore_index=True)
df.to_csv('data/month.csv', index=False)
if __name__ == '__main__':
run()
| 36.953125 | 106 | 0.579704 | 321 | 2,365 | 4.037383 | 0.249221 | 0.037037 | 0.027778 | 0.046296 | 0.828704 | 0.828704 | 0.828704 | 0.828704 | 0.828704 | 0.770062 | 0 | 0.033352 | 0.252008 | 2,365 | 63 | 107 | 37.539683 | 0.699265 | 0.02537 | 0 | 0.62963 | 0 | 0 | 0.238819 | 0.023448 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0 | 0.055556 | 0 | 0.148148 | 0.018519 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
245ed034d789f6b8454a5b4fdb9cad2070e5893b | 696 | py | Python | pava/implementation/natives/sun/java2d/opengl/OGLSurfaceData.py | laffra/pava | 54d10cf7f8def2f96e254c0356623d08f221536f | [
"MIT"
] | 4 | 2017-03-30T16:51:16.000Z | 2020-10-05T12:25:47.000Z | pava/implementation/natives/sun/java2d/opengl/OGLSurfaceData.py | laffra/pava | 54d10cf7f8def2f96e254c0356623d08f221536f | [
"MIT"
] | null | null | null | pava/implementation/natives/sun/java2d/opengl/OGLSurfaceData.py | laffra/pava | 54d10cf7f8def2f96e254c0356623d08f221536f | [
"MIT"
] | null | null | null | def add_native_methods(clazz):
def initTexture__long__boolean__boolean__boolean__int__int__(a0, a1, a2, a3, a4, a5, a6):
raise NotImplementedError()
def initFBObject__long__boolean__boolean__boolean__int__int__(a0, a1, a2, a3, a4, a5, a6):
raise NotImplementedError()
def initFlipBackbuffer__long__(a0, a1):
raise NotImplementedError()
clazz.initTexture__long__boolean__boolean__boolean__int__int__ = initTexture__long__boolean__boolean__boolean__int__int__
clazz.initFBObject__long__boolean__boolean__boolean__int__int__ = initFBObject__long__boolean__boolean__boolean__int__int__
clazz.initFlipBackbuffer__long__ = initFlipBackbuffer__long__
| 46.4 | 127 | 0.820402 | 81 | 696 | 5.839506 | 0.246914 | 0.35518 | 0.22833 | 0.317125 | 0.733615 | 0.733615 | 0.733615 | 0.30444 | 0.30444 | 0.30444 | 0 | 0.026316 | 0.126437 | 696 | 14 | 128 | 49.714286 | 0.751645 | 0 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
033ec08de916e40e952cee70655dddeca4bcde74 | 31,594 | py | Python | code/src/features.py | bsm8734/BC_stage2_Tabular_data_Classification | e421360f3f6f9016c58bfff2dd20485206e4a365 | [
"MIT"
] | null | null | null | code/src/features.py | bsm8734/BC_stage2_Tabular_data_Classification | e421360f3f6f9016c58bfff2dd20485206e4a365 | [
"MIT"
] | null | null | null | code/src/features.py | bsm8734/BC_stage2_Tabular_data_Classification | e421360f3f6f9016c58bfff2dd20485206e4a365 | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
import os, sys, gc, random
import datetime
import dateutil.relativedelta
# Machine learning
from sklearn.preprocessing import LabelEncoder
from sklearn.impute import SimpleImputer
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import roc_auc_score
# Custom library
from utils import seed_everything, print_score
TOTAL_THRES = 300 # 구매액 임계값
SEED = 42 # 랜덤 시드
seed_everything(SEED) # 시드 고정
data_dir = '../input/train.csv' # os.environ['SM_CHANNEL_TRAIN']
model_dir = '../model' # os.environ['SM_MODEL_DIR']
'''
입력인자로 받는 year_month에 대해 고객 ID별로 총 구매액이
구매액 임계값을 넘는지 여부의 binary label을 생성하는 함수
'''
def generate_label(df, year_month, total_thres=TOTAL_THRES, print_log=False):
df = df.copy()
# year_month에 해당하는 label 데이터 생성
df['year_month'] = df['order_date'].dt.strftime('%Y-%m')
df.reset_index(drop=True, inplace=True)
# year_month 이전 월의 고객 ID 추출
cust = df[df['year_month']<year_month]['customer_id'].unique()
# year_month에 해당하는 데이터 선택
df = df[df['year_month']==year_month]
# label 데이터프레임 생성
label = pd.DataFrame({'customer_id':cust})
label['year_month'] = year_month
# year_month에 해당하는 고객 ID의 구매액의 합 계산
grped = df.groupby(['customer_id','year_month'], as_index=False)[['total']].sum()
# label 데이터프레임과 merge하고 구매액 임계값을 넘었는지 여부로 label 생성
label = label.merge(grped, on=['customer_id','year_month'], how='left')
label['total'].fillna(0.0, inplace=True)
label['label'] = (label['total'] > total_thres).astype(int)
# 고객 ID로 정렬
label = label.sort_values('customer_id').reset_index(drop=True)
if print_log: print(f'{year_month} - final label shape: {label.shape}')
return label
def feature_preprocessing(train, test, features, do_imputing=True):
x_tr = train.copy()
x_te = test.copy()
# 범주형 피처 이름을 저장할 변수
cate_cols = []
# 레이블 인코딩
for f in features:
if x_tr[f].dtype.name == 'object': # 데이터 타입이 object(str)이면 레이블 인코딩
cate_cols.append(f)
le = LabelEncoder()
# train + test 데이터를 합쳐서 레이블 인코딩 함수에 fit
le.fit(list(x_tr[f].values) + list(x_te[f].values))
# train 데이터 레이블 인코딩 변환 수행
x_tr[f] = le.transform(list(x_tr[f].values))
# test 데이터 레이블 인코딩 변환 수행
x_te[f] = le.transform(list(x_te[f].values))
print('categorical feature:', cate_cols)
if do_imputing:
# 중위값으로 결측치 채우기
imputer = SimpleImputer(strategy='median')
x_tr[features] = imputer.fit_transform(x_tr[features])
x_te[features] = imputer.transform(x_te[features])
return x_tr, x_te
def feature_engineering(df, year_month):
df = df.copy()
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
prev_ym = prev_ym.strftime('%Y-%m')
# train, test 데이터 선택
train = df[df['order_date'] < prev_ym]
test = df[df['order_date'] < year_month]
# train, test 레이블 데이터 생성
train_label = generate_label(df, prev_ym)[['customer_id','year_month','label']]
test_label = generate_label(df, year_month)[['customer_id','year_month','label']]
# group by aggregation 함수 선언
agg_func = ['mean','max','min','sum','count','std','skew']
all_train_data = pd.DataFrame()
for i, tr_ym in enumerate(train_label['year_month'].unique()):
# group by aggretation 함수로 train 데이터 피처 생성
train_agg = train.loc[train['order_date'] < tr_ym].groupby(['customer_id']).agg(agg_func)
# 멀티 레벨 컬럼을 사용하기 쉽게 1 레벨 컬럼명으로 변경
new_cols = []
for col in train_agg.columns.levels[0]:
for stat in train_agg.columns.levels[1]:
new_cols.append(f'{col}-{stat}')
train_agg.columns = new_cols
train_agg.reset_index(inplace = True)
train_agg['year_month'] = tr_ym
all_train_data = all_train_data.append(train_agg)
all_train_data = train_label.merge(all_train_data, on=['customer_id', 'year_month'], how='left')
features = all_train_data.drop(columns=['customer_id', 'label', 'year_month']).columns
# group by aggretation 함수로 test 데이터 피처 생성
test_agg = test.groupby(['customer_id']).agg(agg_func)
test_agg.columns = new_cols
test_data = test_label.merge(test_agg, on=['customer_id'], how='left')
# train, test 데이터 전처리
x_tr, x_te = feature_preprocessing(all_train_data, test_data, features)
print('x_tr.shape', x_tr.shape, ', x_te.shape', x_te.shape)
return x_tr, x_te, all_train_data['label'], features
def feature_engineering1(df, year_month):
df = df.copy()
# customer_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_cust_id'] = df.groupby(['customer_id'])['total'].cumsum()
df['cumsum_quantity_by_cust_id'] = df.groupby(['customer_id'])['quantity'].cumsum()
df['cumsum_price_by_cust_id'] = df.groupby(['customer_id'])['price'].cumsum()
# product_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_prod_id'] = df.groupby(['product_id'])['total'].cumsum()
df['cumsum_quantity_by_prod_id'] = df.groupby(['product_id'])['quantity'].cumsum()
df['cumsum_price_by_prod_id'] = df.groupby(['product_id'])['price'].cumsum()
# order_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_order_id'] = df.groupby(['order_id'])['total'].cumsum()
df['cumsum_quantity_by_order_id'] = df.groupby(['order_id'])['quantity'].cumsum()
df['cumsum_price_by_order_id'] = df.groupby(['order_id'])['price'].cumsum()
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
prev_ym = prev_ym.strftime('%Y-%m')
# train, test 데이터 선택
train = df[df['order_date'] < prev_ym]
test = df[df['order_date'] < year_month]
# train, test 레이블 데이터 생성
train_label = generate_label(df, prev_ym)[['customer_id', 'year_month', 'label']]
test_label = generate_label(df, year_month)[['customer_id', 'year_month', 'label']]
# group by aggregation 함수 선언
agg_func = ['mean', 'max', 'min', 'sum', 'count', 'std', 'skew']
agg_dict = {
'quantity': agg_func,
'price': agg_func,
'total': agg_func,
'cumsum_total_by_cust_id': agg_func,
'cumsum_quantity_by_cust_id': agg_func,
'cumsum_price_by_cust_id': agg_func,
'cumsum_total_by_prod_id': agg_func,
'cumsum_quantity_by_prod_id': agg_func,
'cumsum_price_by_prod_id': agg_func,
'cumsum_total_by_order_id': agg_func,
'cumsum_quantity_by_order_id': agg_func,
'cumsum_price_by_order_id': agg_func,
'order_id': ['nunique'],
'product_id': ['nunique'],
}
all_train_data = pd.DataFrame()
for i, tr_ym in enumerate(train_label['year_month'].unique()):
# group by aggretation 함수로 train 데이터 피처 생성
train_agg = train.loc[train['order_date'] < tr_ym].groupby(['customer_id']).agg(agg_dict)
new_cols = []
for col in agg_dict.keys():
for stat in agg_dict[col]:
if type(stat) is str:
new_cols.append(f'{col}-{stat}')
else:
new_cols.append(f'{col}-mode')
train_agg.columns = new_cols
train_agg.reset_index(inplace=True)
train_agg['year_month'] = tr_ym
all_train_data = all_train_data.append(train_agg)
all_train_data = train_label.merge(all_train_data, on=['customer_id', 'year_month'], how='left')
features = all_train_data.drop(columns=['customer_id', 'label', 'year_month']).columns
# group by aggretation 함수로 test 데이터 피처 생성
test_agg = test.groupby(['customer_id']).agg(agg_dict)
test_agg.columns = new_cols
test_data = test_label.merge(test_agg, on=['customer_id'], how='left')
# train, test 데이터 전처리
x_tr, x_te = feature_preprocessing(all_train_data, test_data, features)
print('x_tr.shape', x_tr.shape, ', x_te.shape', x_te.shape)
return x_tr, x_te, all_train_data['label'], features
# def get_year_month_list(df, year_month):
# df = df.copy()
#
# df['year_month-mode'] = df['order_date'].dt.strftime('%Y-%m')
# dd = df.groupby(['year_month-mode', 'customer_id'])['total'].sum()
# cust_ids = df['customer_id'].unique()
#
# # year_month 이전 월 계산
# bef_12_d = datetime.datetime.strptime(year_month, "%Y-%m")
# bef_12_prev_ym = bef_12_d - dateutil.relativedelta.relativedelta(months=12)
# bef_12_prev_ym = bef_12_prev_ym.strftime('%Y-%m')
#
# # ddt = df[df['year_month-mode'] == bef_12_prev_ym]
#
# first_bef = []
# for id in cust_ids:
# dd[:, bef_12_prev_ym]
# # first_bef.append(dd.xs((id, bef_12_prev_ym)))
#
# # df['cycle_month'] = pd.Series(first_bef)
#
# print(df)
def make_time_series_data(df, Input, year_month, stand):
# 기준을 잡습니다. 기준은 여기서 %Y-%m 입니다.
standard = ['customer_id'] + [stand]
data = Input.copy()
df = df.copy()
data[stand] = pd.to_datetime(df['order_date']).dt.strftime(stand)
data.order_date = pd.to_datetime(data['order_date'])
# 월단위의 틀을 만들어주고, 기준으로 aggregation을 해준 다음에 merge를 해줄 것입니다
times = pd.date_range('2009-12-01', periods=(data.order_date.max() - data.order_date.min()).days + 1, freq='1d')
customerid_frame = np.repeat(data.customer_id.unique(), len(times))
date_frame = np.tile(times, len(data.customer_id.unique()))
frame = pd.DataFrame({'customer_id': customerid_frame, 'order_date': date_frame})
frame[stand] = pd.to_datetime(frame.order_date).dt.strftime(stand)
# group by
data_group = data.groupby(standard).sum().reset_index()
frame_group = frame.groupby(standard).count().reset_index().drop(['order_date'], axis=1)
# merge
merge = pd.merge(frame_group, data_group, on=standard, how='left').fillna(0)
merge = merge.rename(columns={stand: 'standard'})
merge_test = merge[merge['standard'] == year_month].drop(columns=['standard', 'quantity', 'price']) #.drop(merge.columns.tolist() - ['customer_id', 'total'])
return merge_test
def add_trend(df, year_month):
df = df.copy()
df['year_month'] = df['order_date'].dt.strftime('%Y-%m')
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
# train과 test 데이터 생성
train = df[df['order_date'] < prev_ym] # 2009-12부터 2011-10 데이터 추출
test = df[df['order_date'] < year_month] # 2009-12부터 2011-11 데이터 추출
train_window_ym = []
test_window_ym = []
for month_back in [1, 2, 3, 5, 7, 12, 20, 23]: # 1개월, 2개월, ... 20개월, 23개월 전 year_month 파악
train_window_ym.append((prev_ym - dateutil.relativedelta.relativedelta(months=month_back)).strftime('%Y-%m'))
test_window_ym.append((d - dateutil.relativedelta.relativedelta(months=month_back)).strftime('%Y-%m'))
# aggregation 함수 선언
agg_func = ['max', 'min', 'sum', 'mean', 'count', 'std', 'skew']
# group by aggregation with Dictionary
agg_dict = {
'quantity': agg_func,
'price': agg_func,
'total': agg_func,
}
# general statistics for train data with time series trend
for i, tr_ym in enumerate(train_window_ym):
# group by aggretation 함수로 train 데이터 피처 생성
train_agg = train.loc[train['year_month'] >= tr_ym].groupby(['customer_id']).agg(
agg_dict) # 해당 year_month 이후부터 모든 데이터에 대한 aggregation을 실시
# 멀티 레벨 컬럼을 사용하기 쉽게 1 레벨 컬럼명으로 변경
new_cols = []
for level1, level2 in train_agg.columns:
new_cols.append(f'{level1}-{level2}-{i}')
train_agg.columns = new_cols
train_agg.reset_index(inplace=True)
if i == 0:
train_data = train_agg
else:
train_data = train_data.merge(train_agg, on=['customer_id'], how='right')
# general statistics for test data with time series trend
for i, tr_ym in enumerate(test_window_ym):
# group by aggretation 함수로 test 데이터 피처 생성
test_agg = test.loc[test['year_month'] >= tr_ym].groupby(['customer_id']).agg(agg_dict)
# 멀티 레벨 컬럼을 사용하기 쉽게 1 레벨 컬럼명으로 변경
new_cols = []
for level1, level2 in test_agg.columns:
new_cols.append(f'{level1}-{level2}-{i}')
test_agg.columns = new_cols
test_agg.reset_index(inplace=True)
if i == 0:
test_data = test_agg
else:
test_data = test_data.merge(test_agg, on=['customer_id'], how='right')
return train_data, test_data
def add_seasonality(df, year_month):
df = df.copy()
df['year_month'] = df['order_date'].dt.strftime('%Y-%m')
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
# train과 test 데이터 생성
train = df[df['order_date'] < prev_ym] # 2009-12부터 2011-10 데이터 추출
test = df[df['order_date'] < year_month] # 2009-12부터 2011-11 데이터 추출
train_window_ym = []
test_window_ym = []
for month_back in [1, 6, 12, 18]: # 각 주기성을 파악하고 싶은 구간을 생성
train_window_ym.append(
(
(prev_ym - dateutil.relativedelta.relativedelta(months=month_back)).strftime('%Y-%m'),
(prev_ym - dateutil.relativedelta.relativedelta(months=month_back + 2)).strftime('%Y-%m')
# 1~3, 6~8, 12~14, 18~20 Pair를 만들어준다
)
)
test_window_ym.append(
(
(d - dateutil.relativedelta.relativedelta(months=month_back)).strftime('%Y-%m'),
(d - dateutil.relativedelta.relativedelta(months=month_back + 2)).strftime('%Y-%m')
)
)
# aggregation 함수 선언
agg_func = ['max', 'min', 'sum', 'mean', 'count', 'std', 'skew']
# group by aggregation with Dictionary
agg_dict = {
'quantity': agg_func,
'price': agg_func,
'total': agg_func,
}
# seasonality for train data with time series
for i, (tr_ym, tr_ym_3) in enumerate(train_window_ym):
# group by aggretation 함수로 train 데이터 피처 생성
# 구간 사이에 존재하는 월들에 대해서 aggregation을 진행
train_agg = train.loc[(train['year_month'] >= tr_ym_3) & (train['year_month'] <= tr_ym)].groupby(
['customer_id']).agg(agg_dict)
# 멀티 레벨 컬럼을 사용하기 쉽게 1 레벨 컬럼명으로 변경
new_cols = []
for level1, level2 in train_agg.columns:
new_cols.append(f'{level1}-{level2}-season{i}')
train_agg.columns = new_cols
train_agg.reset_index(inplace=True)
if i == 0:
train_data = train_agg
else:
train_data = train_data.merge(train_agg, on=['customer_id'], how='right')
# seasonality for test data with time series
for i, (tr_ym, tr_ym_3) in enumerate(test_window_ym):
# group by aggretation 함수로 train 데이터 피처 생성
test_agg = test.loc[(test['year_month'] >= tr_ym_3) & (test['year_month'] <= tr_ym)].groupby(
['customer_id']).agg(agg_dict)
# 멀티 레벨 컬럼을 사용하기 쉽게 1 레벨 컬럼명으로 변경
new_cols = []
for level1, level2 in test_agg.columns:
new_cols.append(f'{level1}-{level2}-season{i}')
test_agg.columns = new_cols
test_agg.reset_index(inplace=True)
if i == 0:
test_data = test_agg
else:
test_data = test_data.merge(test_agg, on=['customer_id'], how='right')
return train_data, test_data
def feature_engineering2(df, year_month):
df = df.copy()
# customer_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_cust_id'] = df.groupby(['customer_id'])['total'].cumsum()
df['cumsum_quantity_by_cust_id'] = df.groupby(['customer_id'])['quantity'].cumsum()
df['cumsum_price_by_cust_id'] = df.groupby(['customer_id'])['price'].cumsum()
# product_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_prod_id'] = df.groupby(['product_id'])['total'].cumsum()
df['cumsum_quantity_by_prod_id'] = df.groupby(['product_id'])['quantity'].cumsum()
df['cumsum_price_by_prod_id'] = df.groupby(['product_id'])['price'].cumsum()
# order_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_order_id'] = df.groupby(['order_id'])['total'].cumsum()
df['cumsum_quantity_by_order_id'] = df.groupby(['order_id'])['quantity'].cumsum()
df['cumsum_price_by_order_id'] = df.groupby(['order_id'])['price'].cumsum()
# oredr_ts
df['order_ts'] = df['order_date'].astype(np.int64)//1e9
df['order_ts_diff'] = df.groupby(['customer_id'])['order_ts'].diff()
df['quantity_diff'] = df.groupby(['customer_id'])['quantity'].diff()
df['price_diff'] = df.groupby(['customer_id'])['price'].diff()
df['total_diff'] = df.groupby(['customer_id'])['total'].diff()
# mode
df['month-mode'] = df['order_date'].dt.month
df['year_month-mode'] = df['order_date'].dt.strftime('%Y-%m')
# oredr_ts_plus ===
df['order_ts_plus'] = df[df['total'] > 0]['order_date'].astype(np.int64) // 1e9
df['order_ts_plus_diff'] = df[df['total'] > 0].groupby(['customer_id'])['order_ts'].diff()
df['order_ts_plus'] = df['order_ts_plus'].fillna(0)
df['order_ts_plus_diff'] = df['order_ts_plus_diff'].fillna(0)
# df[~(df.order_id.str.contains('C'))].groupby(['customer_id'])['order_date'].last().astype(np.int64) // 1e9
# ================================================================================================
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
prev_ym = prev_ym.strftime('%Y-%m')
# train, test 데이터 선택
train = df[df['order_date'] < prev_ym]
test = df[df['order_date'] < year_month]
# train, test 레이블 데이터 생성
train_label = generate_label(df, prev_ym)[['customer_id', 'year_month', 'label']]
test_label = generate_label(df, year_month)[['customer_id', 'year_month', 'label']]
# ================================================================================================
# 연월 피처 생성
target = datetime.datetime.strptime('2011-11', "%Y-%m") # 타겟 연월
prev = target - dateutil.relativedelta.relativedelta(years=1) # 전년 연월
prev = prev.strftime('%Y-%m') # 문자열로 변환
groupby = train.groupby(['customer_id', 'year_month-mode'])['total'].sum() # 고객별, 월별 total 합
groupby = groupby.unstack() # 월별을 컬럼으로 변환
prev_pprev_total = groupby.loc[:, [prev]] # 전년, 전전년 데이터만 추출
prev_pprev_total = prev_pprev_total.fillna(0)
train_1224 = (prev_pprev_total['2010-11']) / 2
target = datetime.datetime.strptime('2011-12', "%Y-%m") # 타겟 연월
prev = target - dateutil.relativedelta.relativedelta(years=1) # 전년 연월
pprev = prev - dateutil.relativedelta.relativedelta(years=1) # 전전년 연월
prev, pprev = prev.strftime('%Y-%m'), pprev.strftime('%Y-%m') # 문자열로 변환
groupby = test.groupby(['customer_id', 'year_month-mode'])['total'].sum() # 고객별, 월별 total 합
groupby = groupby.unstack() # 월별을 컬럼으로 변환
prev_pprev_total = groupby.loc[:, [prev, pprev]] # 전년, 전전년 데이터만 추출
prev_pprev_total = prev_pprev_total.fillna(0)
test_1224 = (prev_pprev_total['2010-12'] + prev_pprev_total['2009-12']) / 2
# ================================================================================================
# lambda 식
mode_f = lambda x: x.value_counts().index[0]
# group by aggregation 함수 선언
agg_func = ['mean', 'max', 'min', 'sum', 'count', 'std', 'skew']
# agg_func = ['mean', 'max'] # , 'min', 'sum', 'count', 'std', 'skew']
agg_dict = {
'order_ts': ['first', 'last'],
'order_ts_diff': agg_func,
'order_ts_plus': ['first', 'last'],
'order_ts_plus_diff': agg_func,
'quantity_diff': agg_func,
'price_diff': agg_func,
'total_diff': agg_func,
'quantity': agg_func,
'price': agg_func,
'total': agg_func,
'cumsum_total_by_cust_id': agg_func,
'cumsum_quantity_by_cust_id': agg_func,
'cumsum_price_by_cust_id': agg_func,
'cumsum_total_by_prod_id': agg_func,
'cumsum_quantity_by_prod_id': agg_func,
'cumsum_price_by_prod_id': agg_func,
'cumsum_total_by_order_id': agg_func,
'cumsum_quantity_by_order_id': agg_func,
'cumsum_price_by_order_id': agg_func,
'order_id': ['nunique'],
'product_id': ['nunique'],
'month-mode': [mode_f],
'year_month-mode': [mode_f],
}
all_train_data = pd.DataFrame()
for i, tr_ym in enumerate(train_label['year_month'].unique()):
# group by aggretation 함수로 train 데이터 피처 생성
train_agg = train.loc[train['order_date'] < tr_ym].groupby(['customer_id']).agg(agg_dict)
new_cols = []
for col in agg_dict.keys():
for stat in agg_dict[col]:
if type(stat) is str:
new_cols.append(f'{col}-{stat}')
else:
new_cols.append(f'{col}-mode')
train_agg.columns = new_cols
train_agg.reset_index(inplace=True)
train_agg['year_month'] = tr_ym
all_train_data = all_train_data.append(train_agg)
all_train_data = train_label.merge(all_train_data, on=['customer_id', 'year_month'], how='left')
all_train_data['cycle_1224'] = train_1224.to_numpy()
# ================================================================================================
data = pd.read_csv("/opt/ml/code/input/train.csv", parse_dates=["order_date"])
# # baseline feature engineering
# train, test, y, features = feature_engineering(data, '2011-12')
# trend
train_t, test_t = add_trend(data, year_month='2011-12')
# seasonality
train_s, test_s = add_seasonality(data, year_month='2011-12')
# train 데이터 병합
all_train_data = all_train_data.merge(train_t, on=['customer_id'], how='left')
all_train_data = all_train_data.merge(train_s, on=['customer_id'], how='left')
all_train_data = all_train_data.fillna(0)
# ================================================================================================
features = all_train_data.drop(columns=['customer_id', 'label', 'year_month']).columns
print(features.shape)
import csv
with open("../output/feature.csv", 'w', newline='') as f:
writer = csv.writer(f)
for items in features.tolist():
print(items)
writer.writerow([items])
test_agg = test.groupby(['customer_id']).agg(agg_dict)
test_agg.columns = new_cols
test_agg['cycle_1224'] = test_1224
test_data = test_label.merge(test_agg, on=['customer_id'], how='left')
# test 데이터 병합 ===================================================================================
test_data = test_data.merge(test_t, on=['customer_id'], how='left')
test_data = test_data.merge(test_s, on=['customer_id'], how='left')
test_data = test_data.fillna(0)
# train, test 데이터 전처리
print(all_train_data.shape)
print(test_data.shape)
x_tr, x_te = feature_preprocessing(all_train_data, test_data, features)
print('x_tr.shape', x_tr.shape, ', x_te.shape', x_te.shape)
return x_tr, x_te, all_train_data['label'], features
def feature_engineering3(df, year_month):
my_pick = [
'order_ts-last',
'order_ts-first',
'price_diff-skew',
'price-skew',
'order_ts_diff-max',
'quantity_diff-skew',
'cumsum_total_by_prod_id-skew',
'cumsum_price_by_prod_id-skew',
'cumsum_total_by_cust_id-skew',
'cumsum_quantity_by_prod_id-sum',
'quantity-skew',
'cumsum_total_by_order_id-skew',
'cumsum_price_by_cust_id-skew',
'cumsum_price_by_order_id-skew',
'year_month-mode',
'total_diff-skew',
'price-mean',
'cumsum_quantity_by_order_id-skew',
'cumsum_quantity_by_prod_id-skew',
'price_diff-mean',
]
df = df.copy()
# customer_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_cust_id'] = df.groupby(['customer_id'])['total'].cumsum()
df['cumsum_quantity_by_cust_id'] = df.groupby(['customer_id'])['quantity'].cumsum()
df['cumsum_price_by_cust_id'] = df.groupby(['customer_id'])['price'].cumsum()
# product_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_prod_id'] = df.groupby(['product_id'])['total'].cumsum()
df['cumsum_quantity_by_prod_id'] = df.groupby(['product_id'])['quantity'].cumsum()
df['cumsum_price_by_prod_id'] = df.groupby(['product_id'])['price'].cumsum()
# order_id 기준으로 pandas group by 후 total, quantity, price 누적합 계산
df['cumsum_total_by_order_id'] = df.groupby(['order_id'])['total'].cumsum()
df['cumsum_quantity_by_order_id'] = df.groupby(['order_id'])['quantity'].cumsum()
df['cumsum_price_by_order_id'] = df.groupby(['order_id'])['price'].cumsum()
# oredr_ts
df['order_ts'] = df['order_date'].astype(np.int64)//1e9
df['order_ts_diff'] = df.groupby(['customer_id'])['order_ts'].diff()
df['quantity_diff'] = df.groupby(['customer_id'])['quantity'].diff()
df['price_diff'] = df.groupby(['customer_id'])['price'].diff()
df['total_diff'] = df.groupby(['customer_id'])['total'].diff()
# mode
df['month-mode'] = df['order_date'].dt.month
df['year_month-mode'] = df['order_date'].dt.strftime('%Y-%m')
# oredr_ts_plus ===
df['order_ts_plus'] = df[df['total'] > 0]['order_date'].astype(np.int64) // 1e9
df['order_ts_plus_diff'] = df[df['total'] > 0].groupby(['customer_id'])['order_ts'].diff()
df['order_ts_plus'] = df['order_ts_plus'].fillna(0)
df['order_ts_plus_diff'] = df['order_ts_plus_diff'].fillna(0)
# df[~(df.order_id.str.contains('C'))].groupby(['customer_id'])['order_date'].last().astype(np.int64) // 1e9
# ================================================================================================
# year_month 이전 월 계산
d = datetime.datetime.strptime(year_month, "%Y-%m")
prev_ym = d - dateutil.relativedelta.relativedelta(months=1)
prev_ym = prev_ym.strftime('%Y-%m')
# train, test 데이터 선택
train = df[df['order_date'] < prev_ym]
test = df[df['order_date'] < year_month]
# train, test 레이블 데이터 생성
train_label = generate_label(df, prev_ym)[['customer_id', 'year_month', 'label']]
test_label = generate_label(df, year_month)[['customer_id', 'year_month', 'label']]
####################################################################################
# year_month 이전 월 계산
bef_12_d1 = datetime.datetime.strptime(year_month, "%Y-%m")
bef_12_prev_ym1 = bef_12_d1 - dateutil.relativedelta.relativedelta(months=12)
bef_12_prev_ym1 = bef_12_prev_ym1.strftime('%Y-%m')
merge_df_12_train = make_time_series_data(train, train, bef_12_prev_ym1, "%Y-%m")
print(bef_12_prev_ym1)
bef_24_d1 = datetime.datetime.strptime(year_month, "%Y-%m")
bef_24_prev_ym1 = bef_24_d1 - dateutil.relativedelta.relativedelta(months=24)
bef_24_prev_ym1 = bef_24_prev_ym1.strftime('%Y-%m')
merge_df_24_train = make_time_series_data(train, train, bef_24_prev_ym1, "%Y-%m")
print(bef_24_prev_ym1)
merge_1224_train = merge_df_24_train.merge(merge_df_12_train, on=['customer_id'], how='left')
series_1224_train = (merge_1224_train['total_x'] + merge_1224_train['total_y']) / 2
####################################################################################
# year_month 이전 월 계산
bef_12_d2 = datetime.datetime.strptime(prev_ym, "%Y-%m")
bef_12_prev_ym2 = bef_12_d2 - dateutil.relativedelta.relativedelta(months=12)
bef_12_prev_ym2 = bef_12_prev_ym2.strftime('%Y-%m')
merge_df_12_test = make_time_series_data(test, test, bef_12_prev_ym2, "%Y-%m")
print(bef_12_prev_ym2)
bef_24_d2 = datetime.datetime.strptime(prev_ym, "%Y-%m")
bef_24_prev_ym2 = bef_24_d2 - dateutil.relativedelta.relativedelta(months=24)
bef_24_prev_ym2 = bef_24_prev_ym2.strftime('%Y-%m')
merge_df_24_test = make_time_series_data(test, test, bef_24_prev_ym2, "%Y-%m")
print(bef_24_prev_ym2)
merge_1224_test = merge_df_24_test.merge(merge_df_12_test, on=['customer_id'], how='left')
series_1224_test = (merge_1224_test['total_x'] + merge_1224_test['total_y']) / 2
####################################################################################
# lambda 식
mode_f = lambda x: x.value_counts().index[0]
# group by aggregation 함수 선언
# agg_func = ['mean', 'max', 'min', 'sum', 'count', 'std', 'skew']
agg_func = ['mean', 'max'] # , 'min', 'sum', 'count', 'std', 'skew']
agg_dict = {
'order_ts': ['first', 'last'],
'order_ts_diff': agg_func,
# 'order_ts_plus': ['first', 'last'],
# 'order_ts_plus_diff': agg_func,
# 'quantity_diff': agg_func,
# 'price_diff': agg_func,
# 'total_diff': agg_func,
# 'quantity': agg_func,
# 'price': agg_func,
# 'total': agg_func,
# 'cumsum_total_by_cust_id': agg_func,
# 'cumsum_quantity_by_cust_id': agg_func,
# 'cumsum_price_by_cust_id': agg_func,
# 'cumsum_total_by_prod_id': agg_func,
# 'cumsum_quantity_by_prod_id': agg_func,
# 'cumsum_price_by_prod_id': agg_func,
# 'cumsum_total_by_order_id': agg_func,
# 'cumsum_quantity_by_order_id': agg_func,
# 'cumsum_price_by_order_id': agg_func,
# 'order_id': ['nunique'],
# 'product_id': ['nunique'],
# 'month-mode': [mode_f],
# 'year_month-mode': [mode_f],
}
all_train_data = pd.DataFrame()
for i, tr_ym in enumerate(train_label['year_month'].unique()):
# group by aggretation 함수로 train 데이터 피처 생성
train_agg = train.loc[train['order_date'] < tr_ym].groupby(['customer_id']).agg(agg_dict)
new_cols = []
for col in agg_dict.keys():
for stat in agg_dict[col]:
if type(stat) is str:
new_cols.append(f'{col}-{stat}')
else:
new_cols.append(f'{col}-mode')
train_agg.columns = new_cols
train_agg.reset_index(inplace=True)
train_agg['year_month'] = tr_ym
all_train_data = all_train_data.append(train_agg)
all_train_data = train_label.merge(all_train_data, on=['customer_id', 'year_month'], how='left')
all_train_data['cycle_1224'] = series_1224_train
features = all_train_data.drop(columns=['customer_id', 'label', 'year_month']).columns
import csv
with open("../output/feature.csv", 'w', newline='') as f:
writer = csv.writer(f)
for items in features.tolist():
print(items)
writer.writerow([items])
test_agg = test.groupby(['customer_id']).agg(agg_dict)
test_agg.columns = new_cols
test_agg['cycle_1224'] = series_1224_test
test_data = test_label.merge(test_agg, on=['customer_id'], how='left')
# train, test 데이터 전처리
x_tr, x_te = feature_preprocessing(all_train_data, test_data, features)
# x_tr = x_tr[my_pick]
# x_te = x_te[my_pick]
# features = pd.Index(my_pick)
print('x_tr.shape', x_tr.shape, ', x_te.shape', x_te.shape)
return x_tr, x_te, all_train_data['label'], features
if __name__ == '__main__':
print('data_dir', data_dir)
| 40.298469 | 161 | 0.620877 | 4,494 | 31,594 | 4.067868 | 0.084112 | 0.047262 | 0.026913 | 0.019693 | 0.804551 | 0.770363 | 0.744544 | 0.728352 | 0.704064 | 0.690115 | 0 | 0.017278 | 0.203108 | 31,594 | 783 | 162 | 40.349936 | 0.708822 | 0.181269 | 0 | 0.610994 | 0 | 0 | 0.205233 | 0.060149 | 0 | 0 | 0 | 0 | 0 | 1 | 0.019027 | false | 0 | 0.02537 | 0 | 0.063425 | 0.038055 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
0363b5205df6dfc0e6790f0a27cda6b94a226324 | 33 | py | Python | kivymd/uix/menu/__init__.py | AnEx07/KivyMD | e4004a570ad3f1874b3540cc1b0c243b3037bba8 | [
"MIT"
] | null | null | null | kivymd/uix/menu/__init__.py | AnEx07/KivyMD | e4004a570ad3f1874b3540cc1b0c243b3037bba8 | [
"MIT"
] | null | null | null | kivymd/uix/menu/__init__.py | AnEx07/KivyMD | e4004a570ad3f1874b3540cc1b0c243b3037bba8 | [
"MIT"
] | null | null | null | from .menu import MDDropdownMenu
| 16.5 | 32 | 0.848485 | 4 | 33 | 7 | 1 | 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 | 1 | 0 | 0 | 6 |
03657d0b752b4939d547063648aeac22904dfa9e | 101 | py | Python | ci/util/urlencode.py | markleybros/yer-face | 638566edfd80143ea75a7488ef6406faf88a1976 | [
"MIT"
] | 25 | 2018-02-27T03:39:43.000Z | 2021-09-03T08:22:00.000Z | ci/util/urlencode.py | markleybros/yer-face | 638566edfd80143ea75a7488ef6406faf88a1976 | [
"MIT"
] | 4 | 2019-03-21T02:48:44.000Z | 2020-05-14T17:17:49.000Z | ci/util/urlencode.py | markleybros/yer-face | 638566edfd80143ea75a7488ef6406faf88a1976 | [
"MIT"
] | 7 | 2018-05-14T06:51:55.000Z | 2021-05-15T10:52:19.000Z | #!/usr/bin/env python3
import sys,urllib.parse
print(urllib.parse.quote(sys.stdin.read().strip()))
| 16.833333 | 51 | 0.732673 | 16 | 101 | 4.625 | 0.8125 | 0.297297 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010638 | 0.069307 | 101 | 5 | 52 | 20.2 | 0.776596 | 0.207921 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 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 | 1 | 0 | 6 |
cee2da2296c99a00d048b44f20876551c7df2df9 | 152 | py | Python | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/nerio/phys/Phys_Datasheet.py | PascalGuenther/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 82 | 2016-06-29T17:24:43.000Z | 2021-04-16T06:49:17.000Z | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/nerio/phys/Phys_Datasheet.py | PascalGuenther/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 6 | 2022-01-12T18:22:08.000Z | 2022-03-25T10:19:27.000Z | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/nerio/phys/Phys_Datasheet.py | PascalGuenther/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 56 | 2016-08-02T10:50:50.000Z | 2021-07-19T08:57:34.000Z | from pyradioconfig.parts.jumbo.phys.Phys_Datasheet import PHYS_Datasheet
class PHYS_Datasheet_Nerio(PHYS_Datasheet):
# inherit from Jumbo
pass
| 25.333333 | 72 | 0.815789 | 20 | 152 | 5.95 | 0.55 | 0.436975 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131579 | 152 | 5 | 73 | 30.4 | 0.901515 | 0.118421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 6 |
cef5d61c02e0d5e363ad73b1dabc998c0d26e6b1 | 44 | py | Python | src/greetings/hello-hun.py | Gervercom/ef-01-git | cb2808f52ce6a1a8dc60bf913792a3d535b4083d | [
"MIT"
] | 1 | 2019-09-05T18:34:21.000Z | 2019-09-05T18:34:21.000Z | src/greetings/hello-hun.py | Gervercom/ef-01-git | cb2808f52ce6a1a8dc60bf913792a3d535b4083d | [
"MIT"
] | 20 | 2019-07-08T17:17:02.000Z | 2019-07-09T20:20:28.000Z | src/greetings/hello-hun.py | Gervercom/ef-01-git | cb2808f52ce6a1a8dc60bf913792a3d535b4083d | [
"MIT"
] | 23 | 2019-07-08T09:03:20.000Z | 2019-08-01T01:27:54.000Z | print("Hello Hun, Say hello to Jung Un Kim") | 44 | 44 | 0.727273 | 9 | 44 | 3.555556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 44 | 1 | 44 | 44 | 0.864865 | 0 | 0 | 0 | 0 | 0 | 0.777778 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
cefaa9bdc6b3c18e10a880c7f942bf0221c1d9a3 | 15,328 | py | Python | python/smurff/test/test_centering.py | msteijaert/smurff | e6066d51e1640e9aad0118628ba72c9d662919fb | [
"MIT"
] | 65 | 2017-06-23T14:01:58.000Z | 2022-03-10T16:13:48.000Z | python/smurff/test/test_centering.py | msteijaert/smurff | e6066d51e1640e9aad0118628ba72c9d662919fb | [
"MIT"
] | 143 | 2017-08-11T10:43:52.000Z | 2021-09-23T17:07:51.000Z | python/smurff/test/test_centering.py | msteijaert/smurff | e6066d51e1640e9aad0118628ba72c9d662919fb | [
"MIT"
] | 14 | 2018-05-17T18:33:28.000Z | 2021-12-23T20:41:32.000Z | #!/usr/bin/env python
import unittest
import numpy as np
import scipy as sp
from smurff.center import mean, center, std, scale, center_and_scale
class TestCentering(unittest.TestCase):
def test_rows_centering(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_mean = mean(origin_matrix, 'rows')
centered_matrix = center(origin_matrix, 'rows', origin_matrix_mean)
expected_matrix = np.array([[-1.5, -0.5, 0.5, 1.5],
[-1.5, -0.5, 0.5, 1.5],
[-1.5, -0.5, 0.5, 1.5]])
self.assertTrue(np.allclose(centered_matrix, expected_matrix))
def test_cols_centering(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_mean = mean(origin_matrix, 'cols')
centered_matrix = center(origin_matrix, 'cols', origin_matrix_mean)
expected_matrix = np.array([[-4,-4, -4, -4],
[ 0, 0, 0, 0],
[ 4, 4, 4, 4]])
self.assertTrue(np.allclose(centered_matrix, expected_matrix))
def test_global_centering(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_mean = mean(origin_matrix, 'global')
centered_matrix = center(origin_matrix, 'global', origin_matrix_mean)
expected_matrix = np.array([[-5.5, -4.5, -3.5, -2.5],
[-1.5, -0.5, 0.5, 1.5],
[ 2.5, 3.5, 4.5, 5.5]])
self.assertTrue(np.allclose(centered_matrix, expected_matrix))
def test_none_centering(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_mean = mean(origin_matrix, 'none')
centered_matrix = center(origin_matrix, 'none', origin_matrix_mean)
expected_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
self.assertTrue(np.allclose(centered_matrix, expected_matrix))
def test_dense_matrix_rows_scaling(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_std = std(origin_matrix, 'rows')
expected_matrix_std = [[1.11803399, 1.11803399, 1.11803399]]
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'rows', origin_matrix_std)
expected_matrix = [[ 0.89442719, 1.78885438, 2.68328157, 3.57770876],
[ 4.47213595, 5.36656315, 6.26099034, 7.15541753],
[ 8.04984472, 8.94427191, 9.83869910, 10.73312629]]
self.assertTrue(np.allclose(scaled_matrix, expected_matrix))
def test_sparse_matrix_rows_scaling(self):
origin_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
origin_matrix_cols = np.array([0, 1, 0, 1, 0, 1])
origin_matrix_vals = np.array([1, 2, 5, 6, 9, 10], dtype=sp.float64)
origin_matrix = sp.sparse.coo_matrix((origin_matrix_vals, (origin_matrix_rows, origin_matrix_cols)), shape=(3, 4))
origin_matrix_std = std(origin_matrix, 'rows')
expected_matrix_std = [[1.29099445, 4.50924975, 7.76745347]]
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'rows', origin_matrix_std)
expected_matrix_rows = np.array([0, 1, 2, 0, 1, 2])
expected_matrix_cols = np.array([0, 0, 0, 1, 1, 1])
expected_matrix_vals = [ 0.7745966692414834
, 1.1088319064318592
, 1.1586809036417614
, 1.5491933384829668
, 1.3305982877182312
, 1.2874232262686236
]
expected_matrix = sp.sparse.coo_matrix((expected_matrix_vals, (expected_matrix_rows, expected_matrix_cols)), shape=(3, 4))
self.assertTrue(np.allclose(scaled_matrix.todense(), expected_matrix.todense()))
def test_dense_matrix_cols_scaling(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_std = std(origin_matrix, 'cols')
expected_matrix_std = [[3.26598632, 3.26598632, 3.26598632, 3.26598632]]
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'cols', origin_matrix_std)
expected_matrix = [[0.30618622, 0.61237244, 0.91855865, 1.22474487],
[1.53093109, 1.83711731, 2.14330352, 2.44948974],
[2.75567596, 3.06186218, 3.36804840, 3.67423461]]
self.assertTrue(np.allclose(scaled_matrix, expected_matrix))
def test_sparse_matrix_cols_scaling(self):
origin_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
origin_matrix_cols = np.array([0, 1, 2, 3, 0, 1])
origin_matrix_vals = np.array([1, 2, 7, 8, 9, 10], dtype=sp.float64)
origin_matrix = sp.sparse.coo_matrix((origin_matrix_vals, (origin_matrix_rows, origin_matrix_cols)), shape=(3, 4))
origin_matrix_std = std(origin_matrix, 'cols')
expected_matrix_std = [[4.35889894, 4.76095229, 5.71547607, 6.53197265]]
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'cols', origin_matrix_std)
expected_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
expected_matrix_cols = np.array([0, 1, 2, 3, 0, 1])
expected_matrix_vals = [ 0.22941573387056174
, 0.42008402520840293
, 1.22474487139158920
, 1.22474487139158900
, 2.06474160483505550
, 2.10042012604201500
]
expected_matrix = sp.sparse.coo_matrix((expected_matrix_vals, (expected_matrix_rows, expected_matrix_cols)), shape=(3, 4))
self.assertTrue(np.allclose(scaled_matrix.todense(), expected_matrix.todense()))
def test_dense_matrix_global_scaling(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_std = std(origin_matrix, 'global')
expected_matrix_std = 3.45205252953
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'global', origin_matrix_std)
expected_matrix = [[0.28968273, 0.57936546, 0.86904819, 1.15873092],
[1.44841365, 1.73809638, 2.02777911, 2.31746184],
[2.60714457, 2.89682730, 3.18651003, 3.47619276]]
self.assertTrue(np.allclose(scaled_matrix, expected_matrix))
def test_sparse_matrix_global_scaling(self):
origin_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
origin_matrix_cols = np.array([0, 1, 2, 3, 0, 1])
origin_matrix_vals = np.array([1, 2, 7, 8, 9, 10], dtype=sp.float64)
origin_matrix = sp.sparse.coo_matrix((origin_matrix_vals, (origin_matrix_rows, origin_matrix_cols)), shape=(3, 4))
origin_matrix_std = std(origin_matrix, 'global')
expected_matrix_std = 3.43592135468
self.assertTrue(np.allclose(origin_matrix_std, expected_matrix_std))
scaled_matrix = scale(origin_matrix, 'global', origin_matrix_std)
expected_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
expected_matrix_cols = np.array([0, 1, 2, 3, 0, 1])
expected_matrix_vals = [ 0.2910427500435996
, 0.5820855000871992
, 2.0372992503051970
, 2.3283420003487967
, 2.6193847503923960
, 2.9104275004359956
]
expected_matrix = sp.sparse.coo_matrix((expected_matrix_vals, (expected_matrix_rows, expected_matrix_cols)), shape=(3, 4))
self.assertTrue(np.allclose(scaled_matrix.todense(), expected_matrix.todense()))
def test_dense_matrix_none_scaling(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
origin_matrix_std = std(origin_matrix, 'none')
scaled_matrix = scale(origin_matrix, 'none', origin_matrix_std)
self.assertTrue(np.allclose(scaled_matrix, origin_matrix))
def test_sparse_matrix_none_scaling(self):
origin_matrix_rows = np.array([0, 0, 1, 1, 2, 2])
origin_matrix_cols = np.array([0, 1, 2, 3, 0, 1])
origin_matrix_vals = np.array([1, 2, 7, 8, 9, 10], dtype=sp.float64)
origin_matrix = sp.sparse.coo_matrix((origin_matrix_vals, (origin_matrix_rows, origin_matrix_cols)), shape=(3, 4))
origin_matrix_std = std(origin_matrix, 'none')
scaled_matrix = scale(origin_matrix, 'none', origin_matrix_std)
self.assertTrue(np.allclose(scaled_matrix.todense(), origin_matrix.todense()))
def test_dense_matrix_rows_center_and_scale(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'rows')
expected_matrix = [[-1.34164079, -0.4472136, 0.4472136, 1.34164079],
[-1.34164079, -0.4472136, 0.4472136, 1.34164079],
[-1.34164079, -0.4472136, 0.4472136, 1.34164079]]
expected_matrix_mean = [2.5, 6.5, 10.5]
expected_matrix_std = [1.11803399, 1.11803399, 1.11803399]
self.assertTrue(np.allclose(centered_and_scaled_matrix, expected_matrix))
self.assertTrue(np.allclose(centered_and_scaled_matrix_mean, expected_matrix_mean))
self.assertTrue(np.allclose(centered_and_scaled_matrix_std, expected_matrix_std))
def test_dense_matrix_rows_center_and_scale_with_mean_only(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'rows', with_std=False)
expected_matrix = np.array([[-1.5, -0.5, 0.5, 1.5],
[-1.5, -0.5, 0.5, 1.5],
[-1.5, -0.5, 0.5, 1.5]])
self.assertTrue(np.allclose(centered_and_scaled_matrix, expected_matrix))
self.assertEqual(centered_and_scaled_matrix_std, None)
def test_dense_matrix_rows_center_and_scale_with_std_only(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'rows', with_mean=False)
expected_matrix = [[ 0.89442719, 1.78885438, 2.68328157, 3.57770876],
[ 4.47213595, 5.36656315, 6.26099034, 7.15541753],
[ 8.04984472, 8.94427191, 9.83869910, 10.73312629]]
self.assertTrue(np.allclose(centered_and_scaled_matrix, expected_matrix))
self.assertEqual(centered_and_scaled_matrix_mean, None)
def test_dense_matrix_rows_center_and_scale_with_no_mean_and_std(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'rows', with_mean=False, with_std=False)
self.assertTrue(np.allclose(centered_and_scaled_matrix, origin_matrix))
self.assertEqual(centered_and_scaled_matrix_mean, None)
self.assertEqual(centered_and_scaled_matrix_std, None)
def test_dense_matrix_cols_center_and_scale(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'cols')
expected_matrix = [[-1.22474487, -1.22474487, -1.22474487, -1.22474487],
[ 0., 0., 0., 0. ],
[ 1.22474487, 1.22474487, 1.22474487, 1.22474487]]
expected_matrix_mean = [5., 6., 7., 8.]
expected_matrix_std = [3.26598632, 3.26598632, 3.26598632, 3.26598632]
self.assertTrue(np.allclose(centered_and_scaled_matrix, expected_matrix))
self.assertTrue(np.allclose(centered_and_scaled_matrix_mean, expected_matrix_mean))
self.assertTrue(np.allclose(centered_and_scaled_matrix_std, expected_matrix_std))
def test_dense_matrix_global_center_and_scale(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'global')
expected_matrix = [[-1.59325501, -1.30357228, -1.01388955, -0.72420682],
[-0.43452409, -0.14484136, 0.14484136, 0.43452409],
[ 0.72420682, 1.01388955, 1.30357228, 1.59325501]]
expected_matrix_mean = 6.5
expected_matrix_std = 3.45205252953
self.assertTrue(np.allclose(centered_and_scaled_matrix, expected_matrix))
self.assertTrue(np.allclose(centered_and_scaled_matrix_mean, expected_matrix_mean))
self.assertTrue(np.allclose(centered_and_scaled_matrix_std, expected_matrix_std))
def test_dense_matrix_none_center_and_scale(self):
origin_matrix = np.array([[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]])
centered_and_scaled_matrix, centered_and_scaled_matrix_mean, centered_and_scaled_matrix_std = center_and_scale(origin_matrix, 'none')
self.assertTrue(np.allclose(centered_and_scaled_matrix, origin_matrix))
self.assertEqual(centered_and_scaled_matrix_mean, None)
self.assertEqual(centered_and_scaled_matrix_std, None)
if __name__ == '__main__':
unittest.main()
| 57.841509 | 174 | 0.580441 | 1,893 | 15,328 | 4.396725 | 0.073957 | 0.155713 | 0.081701 | 0.110537 | 0.8706 | 0.839481 | 0.831912 | 0.818935 | 0.802836 | 0.789139 | 0 | 0.161934 | 0.303823 | 15,328 | 264 | 175 | 58.060606 | 0.61803 | 0.001305 | 0 | 0.575107 | 0 | 0 | 0.009538 | 0 | 0 | 0 | 0 | 0 | 0.158798 | 1 | 0.081545 | false | 0 | 0.017167 | 0 | 0.103004 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
30035d9cb4198f6eeabe2b73ff0be200d7e89955 | 138 | py | Python | deterministic_encryption_utils/encryption/extensions/__init__.py | seiferma/encviewfuse.commons | a747da3cd6daf39b0c26d4d497725e8863af1dd1 | [
"MIT"
] | null | null | null | deterministic_encryption_utils/encryption/extensions/__init__.py | seiferma/encviewfuse.commons | a747da3cd6daf39b0c26d4d497725e8863af1dd1 | [
"MIT"
] | null | null | null | deterministic_encryption_utils/encryption/extensions/__init__.py | seiferma/encviewfuse.commons | a747da3cd6daf39b0c26d4d497725e8863af1dd1 | [
"MIT"
] | null | null | null | __all__ = ['ModificationTimeFilenameSaltProvider', 'ModificationTimeFileSaltProvider', 'NameFileSaltProvider', 'NameFilenameSaltProvider'] | 138 | 138 | 0.862319 | 5 | 138 | 23 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036232 | 138 | 1 | 138 | 138 | 0.864662 | 0 | 0 | 0 | 0 | 0 | 0.805755 | 0.661871 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
30611a3feef6ea4a34a2f59acc6548e5fbc8874c | 28 | py | Python | jupyter_flashcards/__init__.py | patarapolw/jupyter-flashcards | ecab7550669b899d2d018556632f92387147e43d | [
"Apache-2.0"
] | 3 | 2018-07-22T18:56:40.000Z | 2020-02-04T21:03:30.000Z | jupyter_flashcards/__init__.py | patarapolw/jupyter-flashcards | ecab7550669b899d2d018556632f92387147e43d | [
"Apache-2.0"
] | null | null | null | jupyter_flashcards/__init__.py | patarapolw/jupyter-flashcards | ecab7550669b899d2d018556632f92387147e43d | [
"Apache-2.0"
] | 3 | 2020-02-04T21:05:40.000Z | 2021-09-10T19:09:37.000Z | from .app import Flashcards
| 14 | 27 | 0.821429 | 4 | 28 | 5.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 28 | 1 | 28 | 28 | 0.958333 | 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 | 1 | 0 | 0 | 6 |
306a6903b0e7d5236dc6e0bf077ce7197287a56b | 20,916 | py | Python | util/data/gen/kernel.appcore.dll.py | 56kyle/bloons_auto | 419d55b51d1cddc49099593970adf1c67985b389 | [
"MIT"
] | null | null | null | util/data/gen/kernel.appcore.dll.py | 56kyle/bloons_auto | 419d55b51d1cddc49099593970adf1c67985b389 | [
"MIT"
] | null | null | null | util/data/gen/kernel.appcore.dll.py | 56kyle/bloons_auto | 419d55b51d1cddc49099593970adf1c67985b389 | [
"MIT"
] | null | null | null | symbols = []
exports = [{'type': 'function', 'name': 'AcquireStateLock', 'address': '0x7ffb398f3000'}, {'type': 'function', 'name': 'AddDependencyToProcessPackageGraph', 'address': '0x7ffb398f3010'}, {'type': 'function', 'name': 'AddExtensionProgId', 'address': '0x7ffb398f3020'}, {'type': 'function', 'name': 'AddPackageToFamilyXref', 'address': '0x7ffb398f3030'}, {'type': 'function', 'name': 'AppContainerDeriveSidFromMoniker', 'address': '0x7ffb398f3040'}, {'type': 'function', 'name': 'AppContainerFreeMemory', 'address': '0x7ffb398f3050'}, {'type': 'function', 'name': 'AppContainerLookupDisplayNameMrtReference', 'address': '0x7ffb398f3060'}, {'type': 'function', 'name': 'AppContainerLookupMoniker', 'address': '0x7ffb398f3070'}, {'type': 'function', 'name': 'AppContainerRegisterSid', 'address': '0x7ffb398f3080'}, {'type': 'function', 'name': 'AppContainerUnregisterSid', 'address': '0x7ffb398f3090'}, {'type': 'function', 'name': 'AppPolicyGetClrCompat', 'address': '0x7ffb398f30a0'}, {'type': 'function', 'name': 'AppPolicyGetCreateFileAccess', 'address': '0x7ffb398f30b0'}, {'type': 'function', 'name': 'AppPolicyGetLifecycleManagement', 'address': '0x7ffb398f30c0'}, {'type': 'function', 'name': 'AppPolicyGetMediaFoundationCodecLoading', 'address': '0x7ffb398f30d0'}, {'type': 'function', 'name': 'AppPolicyGetProcessTerminationMethod', 'address': '0x7ffb398f30e0'}, {'type': 'function', 'name': 'AppPolicyGetShowDeveloperDiagnostic', 'address': '0x7ffb398f30f0'}, {'type': 'function', 'name': 'AppPolicyGetThreadInitializationType', 'address': '0x7ffb398f3100'}, {'type': 'function', 'name': 'AppPolicyGetWindowingModel', 'address': '0x7ffb398f3110'}, {'type': 'function', 'name': 'AppXFreeMemory', 'address': '0x7ffb398f3120'}, {'type': 'function', 'name': 'AppXGetApplicationData', 'address': '0x7ffb398f3130'}, {'type': 'function', 'name': 'AppXGetDevelopmentMode', 'address': '0x7ffb398f3140'}, {'type': 'function', 'name': 'AppXGetOSMaxVersionTested', 'address': '0x7ffb398f3150'}, {'type': 'function', 'name': 'AppXGetOSMinVersion', 'address': '0x7ffb398f3160'}, {'type': 'function', 'name': 'AppXGetPackageCapabilities', 'address': '0x7ffb398f3170'}, {'type': 'function', 'name': 'AppXGetPackageSid', 'address': '0x7ffb398f3180'}, {'type': 'function', 'name': 'AppXLookupDisplayName', 'address': '0x7ffb398f3190'}, {'type': 'function', 'name': 'AppXLookupMoniker', 'address': '0x7ffb398f31a0'}, {'type': 'function', 'name': 'AppXUpdatePackageCapabilities', 'address': '0x7ffb398f31b0'}, {'type': 'function', 'name': 'ApplicationUserModelIdFromProductId', 'address': '0x7ffb398f31c0'}, {'type': 'function', 'name': 'BuildProcThreadAttributeListFromBlob', 'address': '0x7ffb398f2070'}, {'type': 'function', 'name': 'CheckIfStateChangeNotificationExists', 'address': '0x7ffb398f31d0'}, {'type': 'function', 'name': 'ClosePackageInfo', 'address': '0x7ffb398f31e0'}, {'type': 'function', 'name': 'CloseState', 'address': '0x7ffb398f31f0'}, {'type': 'function', 'name': 'CloseStateAtom', 'address': '0x7ffb398f3200'}, {'type': 'function', 'name': 'CloseStateChangeNotification', 'address': '0x7ffb398f3210'}, {'type': 'function', 'name': 'CloseStateContainer', 'address': '0x7ffb398f3220'}, {'type': 'function', 'name': 'CloseStateLock', 'address': '0x7ffb398f3230'}, {'type': 'function', 'name': 'CommitStateAtom', 'address': '0x7ffb398f3240'}, {'type': 'function', 'name': 'CouldMultiUserAppsBehaviorBePossibleForPackage', 'address': '0x7ffb398f3250'}, {'type': 'function', 'name': 'CreateStateAtom', 'address': '0x7ffb398f3260'}, {'type': 'function', 'name': 'CreateStateChangeNotification', 'address': '0x7ffb398f3270'}, {'type': 'function', 'name': 'CreateStateContainer', 'address': '0x7ffb398f3280'}, {'type': 'function', 'name': 'CreateStateLock', 'address': '0x7ffb398f3290'}, {'type': 'function', 'name': 'CreateStateSubcontainer', 'address': '0x7ffb398f32a0'}, {'type': 'function', 'name': 'DeleteStateAtomValue', 'address': '0x7ffb398f32b0'}, {'type': 'function', 'name': 'DeleteStateContainer', 'address': '0x7ffb398f32c0'}, {'type': 'function', 'name': 'DeleteStateContainerValue', 'address': '0x7ffb398f32d0'}, {'type': 'function', 'name': 'DuplicateStateContainerHandle', 'address': '0x7ffb398f32e0'}, {'type': 'function', 'name': 'EnumerateExtensionNames', 'address': '0x7ffb398f32f0'}, {'type': 'function', 'name': 'EnumerateStateAtomValues', 'address': '0x7ffb398f3300'}, {'type': 'function', 'name': 'EnumerateStateContainerItems', 'address': '0x7ffb398f3310'}, {'type': 'function', 'name': 'ExtensionProgIdExists', 'address': '0x7ffb398f3320'}, {'type': 'function', 'name': 'FindPackagesByPackageFamily', 'address': '0x7ffb398f3330'}, {'type': 'function', 'name': 'FormatApplicationUserModelId', 'address': '0x7ffb398f3340'}, {'type': 'function', 'name': 'FormatApplicationUserModelIdA', 'address': '0x7ffb398f3350'}, {'type': 'function', 'name': 'GenerateProcThreadAttributeBlob', 'address': '0x7ffb398f2270'}, {'type': 'function', 'name': 'GetAlternatePackageRoots', 'address': '0x7ffb398f3360'}, {'type': 'function', 'name': 'GetAppDataFolder', 'address': '0x7ffb398f3370'}, {'type': 'function', 'name': 'GetAppModelVersion', 'address': '0x7ffb398f3380'}, {'type': 'function', 'name': 'GetApplicationUserModelId', 'address': '0x7ffb398f3390'}, {'type': 'function', 'name': 'GetApplicationUserModelIdFromToken', 'address': '0x7ffb398f33a0'}, {'type': 'function', 'name': 'GetCurrentApplicationUserModelId', 'address': '0x7ffb398f33b0'}, {'type': 'function', 'name': 'GetCurrentPackageApplicationContext', 'address': '0x7ffb398f33c0'}, {'type': 'function', 'name': 'GetCurrentPackageApplicationResourcesContext', 'address': '0x7ffb398f33d0'}, {'type': 'function', 'name': 'GetCurrentPackageContext', 'address': '0x7ffb398f33e0'}, {'type': 'function', 'name': 'GetCurrentPackageFamilyName', 'address': '0x7ffb398f33f0'}, {'type': 'function', 'name': 'GetCurrentPackageFullName', 'address': '0x7ffb398f3400'}, {'type': 'function', 'name': 'GetCurrentPackageGlobalizationContext', 'address': '0x7ffb398f3410'}, {'type': 'function', 'name': 'GetCurrentPackageId', 'address': '0x7ffb398f3420'}, {'type': 'function', 'name': 'GetCurrentPackageInfo', 'address': '0x7ffb398f3430'}, {'type': 'function', 'name': 'GetCurrentPackageInfo2', 'address': '0x7ffb398f3440'}, {'type': 'function', 'name': 'GetCurrentPackageInfo3', 'address': '0x7ffb398f3450'}, {'type': 'function', 'name': 'GetCurrentPackagePath', 'address': '0x7ffb398f3460'}, {'type': 'function', 'name': 'GetCurrentPackagePath2', 'address': '0x7ffb398f3470'}, {'type': 'function', 'name': 'GetCurrentPackageResourcesContext', 'address': '0x7ffb398f3480'}, {'type': 'function', 'name': 'GetCurrentPackageSecurityContext', 'address': '0x7ffb398f3490'}, {'type': 'function', 'name': 'GetCurrentTargetPlatformContext', 'address': '0x7ffb398f34a0'}, {'type': 'function', 'name': 'GetEffectivePackageStatusForUser', 'address': '0x7ffb398f34b0'}, {'type': 'function', 'name': 'GetEffectivePackageStatusForUserSid', 'address': '0x7ffb398f34c0'}, {'type': 'function', 'name': 'GetExtensionApplicationUserModelId', 'address': '0x7ffb398f34d0'}, {'type': 'function', 'name': 'GetExtensionProgIds', 'address': '0x7ffb398f34e0'}, {'type': 'function', 'name': 'GetExtensionProperty', 'address': '0x7ffb398f34f0'}, {'type': 'function', 'name': 'GetExtensionProperty2', 'address': '0x7ffb398f3500'}, {'type': 'function', 'name': 'GetHivePath', 'address': '0x7ffb398f3510'}, {'type': 'function', 'name': 'GetPackageApplicationContext', 'address': '0x7ffb398f3520'}, {'type': 'function', 'name': 'GetPackageApplicationIds', 'address': '0x7ffb398f3530'}, {'type': 'function', 'name': 'GetPackageApplicationProperty', 'address': '0x7ffb398f3540'}, {'type': 'function', 'name': 'GetPackageApplicationPropertyString', 'address': '0x7ffb398f3550'}, {'type': 'function', 'name': 'GetPackageApplicationResourcesContext', 'address': '0x7ffb398f3560'}, {'type': 'function', 'name': 'GetPackageContext', 'address': '0x7ffb398f3570'}, {'type': 'function', 'name': 'GetPackageFamilyName', 'address': '0x7ffb398f3580'}, {'type': 'function', 'name': 'GetPackageFamilyNameFromProgId', 'address': '0x7ffb398f3590'}, {'type': 'function', 'name': 'GetPackageFamilyNameFromToken', 'address': '0x7ffb398f35a0'}, {'type': 'function', 'name': 'GetPackageFullName', 'address': '0x7ffb398f35b0'}, {'type': 'function', 'name': 'GetPackageFullNameFromToken', 'address': '0x7ffb398f35c0'}, {'type': 'function', 'name': 'GetPackageGlobalizationContext', 'address': '0x7ffb398f35d0'}, {'type': 'function', 'name': 'GetPackageGlobalizationProperty', 'address': '0x7ffb398f35e0'}, {'type': 'function', 'name': 'GetPackageId', 'address': '0x7ffb398f35f0'}, {'type': 'function', 'name': 'GetPackageInfo', 'address': '0x7ffb398f3600'}, {'type': 'function', 'name': 'GetPackageInfo2', 'address': '0x7ffb398f3610'}, {'type': 'function', 'name': 'GetPackageInfo3', 'address': '0x7ffb398f3620'}, {'type': 'function', 'name': 'GetPackageInstallTime', 'address': '0x7ffb398f3630'}, {'type': 'function', 'name': 'GetPackageOSMaxVersionTested', 'address': '0x7ffb398f3640'}, {'type': 'function', 'name': 'GetPackagePath', 'address': '0x7ffb398f3650'}, {'type': 'function', 'name': 'GetPackagePathByFullName', 'address': '0x7ffb398f3660'}, {'type': 'function', 'name': 'GetPackagePathByFullName2', 'address': '0x7ffb398f3670'}, {'type': 'function', 'name': 'GetPackagePathOnVolume', 'address': '0x7ffb398f3680'}, {'type': 'function', 'name': 'GetPackageProperty', 'address': '0x7ffb398f3690'}, {'type': 'function', 'name': 'GetPackagePropertyString', 'address': '0x7ffb398f36a0'}, {'type': 'function', 'name': 'GetPackageResourcesContext', 'address': '0x7ffb398f36b0'}, {'type': 'function', 'name': 'GetPackageResourcesProperty', 'address': '0x7ffb398f36c0'}, {'type': 'function', 'name': 'GetPackageSecurityContext', 'address': '0x7ffb398f36d0'}, {'type': 'function', 'name': 'GetPackageSecurityProperty', 'address': '0x7ffb398f36e0'}, {'type': 'function', 'name': 'GetPackageStatus', 'address': '0x7ffb398f36f0'}, {'type': 'function', 'name': 'GetPackageStatusForUser', 'address': '0x7ffb398f3700'}, {'type': 'function', 'name': 'GetPackageStatusForUserSid', 'address': '0x7ffb398f3710'}, {'type': 'function', 'name': 'GetPackageTargetPlatformProperty', 'address': '0x7ffb398f3720'}, {'type': 'function', 'name': 'GetPackageVolumeSisPath', 'address': '0x7ffb398f3730'}, {'type': 'function', 'name': 'GetPackagesByPackageFamily', 'address': '0x7ffb398f3740'}, {'type': 'function', 'name': 'GetProtocolAumid', 'address': '0x7ffb398f3750'}, {'type': 'function', 'name': 'GetProtocolProperty', 'address': '0x7ffb398f3760'}, {'type': 'function', 'name': 'GetPublisherCacheFolder', 'address': '0x7ffb398f3770'}, {'type': 'function', 'name': 'GetPublisherRootFolder', 'address': '0x7ffb398f3780'}, {'type': 'function', 'name': 'GetRoamingLastObservedChangeTime', 'address': '0x7ffb398f3790'}, {'type': 'function', 'name': 'GetSecureSystemAppDataFolder', 'address': '0x7ffb398f37a0'}, {'type': 'function', 'name': 'GetSerializedAtomBytes', 'address': '0x7ffb398f37b0'}, {'type': 'function', 'name': 'GetSharedLocalFolder', 'address': '0x7ffb398f37c0'}, {'type': 'function', 'name': 'GetStagedPackageOrigin', 'address': '0x7ffb398f37d0'}, {'type': 'function', 'name': 'GetStagedPackagePathByFullName', 'address': '0x7ffb398f37e0'}, {'type': 'function', 'name': 'GetStagedPackagePathByFullName2', 'address': '0x7ffb398f37f0'}, {'type': 'function', 'name': 'GetStateContainerDepth', 'address': '0x7ffb398f3800'}, {'type': 'function', 'name': 'GetStateFolder', 'address': '0x7ffb398f3810'}, {'type': 'function', 'name': 'GetStateRootFolder', 'address': '0x7ffb398f3820'}, {'type': 'function', 'name': 'GetStateRootFolderBase', 'address': '0x7ffb398f3830'}, {'type': 'function', 'name': 'GetStateSettingsFolder', 'address': '0x7ffb398f3840'}, {'type': 'function', 'name': 'GetStateVersion', 'address': '0x7ffb398f3850'}, {'type': 'function', 'name': 'GetSystemAppDataFolder', 'address': '0x7ffb398f3860'}, {'type': 'function', 'name': 'GetSystemAppDataKey', 'address': '0x7ffb398f3870'}, {'type': 'function', 'name': 'GetSystemMetadataPath', 'address': '0x7ffb398f3880'}, {'type': 'function', 'name': 'GetSystemMetadataPathForPackage', 'address': '0x7ffb398f3890'}, {'type': 'function', 'name': 'GetSystemMetadataPathForPackageFamily', 'address': '0x7ffb398f38a0'}, {'type': 'function', 'name': 'GetSystemStateRootFolder', 'address': '0x7ffb398f38b0'}, {'type': 'function', 'name': 'GetTargetPlatformContext', 'address': '0x7ffb398f38c0'}, {'type': 'function', 'name': 'IncrementPackageStatusVersion', 'address': '0x7ffb398f38d0'}, {'type': 'function', 'name': 'InvalidateAppModelVersionCache', 'address': '0x7ffb398f38e0'}, {'type': 'function', 'name': 'IsDeveloperModeEnabled', 'address': '0x7ffb398f38f0'}, {'type': 'function', 'name': 'IsDeveloperModePolicyApplied', 'address': '0x7ffb398f3900'}, {'type': 'function', 'name': 'IsMrtResourceRedirectionEnabled', 'address': '0x7ffb398f3910'}, {'type': 'function', 'name': 'IsOnDemandRegistrationSupportedForExtensionCategory', 'address': '0x7ffb398f3920'}, {'type': 'function', 'name': 'IsSideloadingEnabled', 'address': '0x7ffb398f3930'}, {'type': 'function', 'name': 'IsSideloadingPolicyApplied', 'address': '0x7ffb398f3940'}, {'type': 'function', 'name': 'OpenPackageInfoByFullName', 'address': '0x7ffb398f3950'}, {'type': 'function', 'name': 'OpenPackageInfoByFullNameForMachine', 'address': '0x7ffb398f3960'}, {'type': 'function', 'name': 'OpenPackageInfoByFullNameForUser', 'address': '0x7ffb398f3970'}, {'type': 'function', 'name': 'OpenState', 'address': '0x7ffb398f3980'}, {'type': 'function', 'name': 'OpenStateAtom', 'address': '0x7ffb398f3990'}, {'type': 'function', 'name': 'OpenStateExplicit', 'address': '0x7ffb398f39a0'}, {'type': 'function', 'name': 'OpenStateExplicitForUserSid', 'address': '0x7ffb398f39b0'}, {'type': 'function', 'name': 'OpenStateExplicitForUserSidString', 'address': '0x7ffb398f39c0'}, {'type': 'function', 'name': 'OverrideRoamingDataModificationTimesInRange', 'address': '0x7ffb398f39d0'}, {'type': 'function', 'name': 'PackageFamilyNameFromFullName', 'address': '0x7ffb398f39e0'}, {'type': 'function', 'name': 'PackageFamilyNameFromFullNameA', 'address': '0x7ffb398f39f0'}, {'type': 'function', 'name': 'PackageFamilyNameFromId', 'address': '0x7ffb398f3a00'}, {'type': 'function', 'name': 'PackageFamilyNameFromIdA', 'address': '0x7ffb398f3a10'}, {'type': 'function', 'name': 'PackageFamilyNameFromProductId', 'address': '0x7ffb398f3a20'}, {'type': 'function', 'name': 'PackageFullNameFromId', 'address': '0x7ffb398f3a30'}, {'type': 'function', 'name': 'PackageFullNameFromIdA', 'address': '0x7ffb398f3a40'}, {'type': 'function', 'name': 'PackageFullNameFromProductId', 'address': '0x7ffb398f3a50'}, {'type': 'function', 'name': 'PackageIdFromFullName', 'address': '0x7ffb398f3a60'}, {'type': 'function', 'name': 'PackageIdFromFullNameA', 'address': '0x7ffb398f3a70'}, {'type': 'function', 'name': 'PackageIdFromProductId', 'address': '0x7ffb398f3a80'}, {'type': 'function', 'name': 'PackageNameAndPublisherIdFromFamilyName', 'address': '0x7ffb398f3a90'}, {'type': 'function', 'name': 'PackageNameAndPublisherIdFromFamilyNameA', 'address': '0x7ffb398f3aa0'}, {'type': 'function', 'name': 'PackageRelativeApplicationIdFromProductId', 'address': '0x7ffb398f3ab0'}, {'type': 'function', 'name': 'PackageSidFromFamilyName', 'address': '0x7ffb398f3ac0'}, {'type': 'function', 'name': 'PackageSidFromProductId', 'address': '0x7ffb398f2ff0'}, {'type': 'function', 'name': 'ParseApplicationUserModelId', 'address': '0x7ffb398f3ad0'}, {'type': 'function', 'name': 'ParseApplicationUserModelIdA', 'address': '0x7ffb398f3ae0'}, {'type': 'function', 'name': 'ProductIdFromPackageFamilyName', 'address': '0x7ffb398f3af0'}, {'type': 'function', 'name': 'PsmActivateApplicationByToken', 'address': '0x7ffb398f4790'}, {'type': 'function', 'name': 'PsmAdjustActivationToken', 'address': '0x7ffb398f4910'}, {'type': 'function', 'name': 'PsmAdjustActivationTokenEx', 'address': '0x7ffb398f1130'}, {'type': 'function', 'name': 'PsmAdjustActivationTokenPkgClaim', 'address': '0x7ffb398f4960'}, {'type': 'function', 'name': 'PsmAdjustActivationTokenWithDynamicId', 'address': '0x7ffb398f4aa0'}, {'type': 'function', 'name': 'PsmCreateBrokerToken', 'address': '0x7ffb398f1140'}, {'type': 'function', 'name': 'PsmCreateMatchToken', 'address': '0x7ffb398f4af0'}, {'type': 'function', 'name': 'PsmQueryBackgroundActivationType', 'address': '0x7ffb398f1010'}, {'type': 'function', 'name': 'PsmRegisterApplicationProcess', 'address': '0x7ffb398f2570'}, {'type': 'function', 'name': 'PsmRegisterDesktopProcess', 'address': '0x7ffb398f4d80'}, {'type': 'function', 'name': 'PsmRegisterDesktopProcessWithAppContainerToken', 'address': '0x7ffb398f2580'}, {'type': 'function', 'name': 'PsmRegisterServiceProcess', 'address': '0x7ffb398f2470'}, {'type': 'function', 'name': 'PublishStateChangeNotification', 'address': '0x7ffb398f3b00'}, {'type': 'function', 'name': 'PublisherFromPackageFullName', 'address': '0x7ffb398f3b10'}, {'type': 'function', 'name': 'QueryStateAtomValueInfo', 'address': '0x7ffb398f3b20'}, {'type': 'function', 'name': 'QueryStateContainerCreatedNew', 'address': '0x7ffb398f3b30'}, {'type': 'function', 'name': 'QueryStateContainerItemInfo', 'address': '0x7ffb398f3b40'}, {'type': 'function', 'name': 'ReadStateAtomValue', 'address': '0x7ffb398f3b50'}, {'type': 'function', 'name': 'ReadStateContainerValue', 'address': '0x7ffb398f3b60'}, {'type': 'function', 'name': 'RefreshPackageInfo', 'address': '0x7ffb398f3b70'}, {'type': 'function', 'name': 'RegisterStateChangeNotification', 'address': '0x7ffb398f3b80'}, {'type': 'function', 'name': 'RegisterStateLock', 'address': '0x7ffb398f3b90'}, {'type': 'function', 'name': 'ReleaseStateLock', 'address': '0x7ffb398f3ba0'}, {'type': 'function', 'name': 'RemoveExtensionProgIds', 'address': '0x7ffb398f3bb0'}, {'type': 'function', 'name': 'RemovePackageFromFamilyXref', 'address': '0x7ffb398f3bc0'}, {'type': 'function', 'name': 'RemovePackageStatus', 'address': '0x7ffb398f3bd0'}, {'type': 'function', 'name': 'RemovePackageStatusForUser', 'address': '0x7ffb398f3be0'}, {'type': 'function', 'name': 'ResetState', 'address': '0x7ffb398f3bf0'}, {'type': 'function', 'name': 'SaveAlternatePackageRootPath', 'address': '0x7ffb398f3c00'}, {'type': 'function', 'name': 'SaveStateRootFolderPath', 'address': '0x7ffb398f3c10'}, {'type': 'function', 'name': 'SetExtensionProperty', 'address': '0x7ffb398f3c20'}, {'type': 'function', 'name': 'SetIsDeveloperModeEnabled', 'address': '0x7ffb398f3c30'}, {'type': 'function', 'name': 'SetIsSideloadingEnabled', 'address': '0x7ffb398f3c40'}, {'type': 'function', 'name': 'SetProtocolProperty', 'address': '0x7ffb398f3c50'}, {'type': 'function', 'name': 'SetRoamingLastObservedChangeTime', 'address': '0x7ffb398f3c60'}, {'type': 'function', 'name': 'SetStateVersion', 'address': '0x7ffb398f3c70'}, {'type': 'function', 'name': 'SharedLocalIsEnabled', 'address': '0x7ffb398f3c80'}, {'type': 'function', 'name': 'SubscribeStateChangeNotification', 'address': '0x7ffb398f3c90'}, {'type': 'function', 'name': 'UnregisterStateChangeNotification', 'address': '0x7ffb398f3ca0'}, {'type': 'function', 'name': 'UnregisterStateLock', 'address': '0x7ffb398f3cb0'}, {'type': 'function', 'name': 'UnsubscribeStateChangeNotification', 'address': '0x7ffb398f3cc0'}, {'type': 'function', 'name': 'UpdatePackageStatus', 'address': '0x7ffb398f3cd0'}, {'type': 'function', 'name': 'UpdatePackageStatusForUser', 'address': '0x7ffb398f3ce0'}, {'type': 'function', 'name': 'UpdatePackageStatusForUserSid', 'address': '0x7ffb398f3cf0'}, {'type': 'function', 'name': 'VerifyApplicationUserModelId', 'address': '0x7ffb398f3d00'}, {'type': 'function', 'name': 'VerifyApplicationUserModelIdA', 'address': '0x7ffb398f3d10'}, {'type': 'function', 'name': 'VerifyPackageFamilyName', 'address': '0x7ffb398f3d20'}, {'type': 'function', 'name': 'VerifyPackageFamilyNameA', 'address': '0x7ffb398f3d30'}, {'type': 'function', 'name': 'VerifyPackageFullName', 'address': '0x7ffb398f3d40'}, {'type': 'function', 'name': 'VerifyPackageFullNameA', 'address': '0x7ffb398f3d50'}, {'type': 'function', 'name': 'VerifyPackageId', 'address': '0x7ffb398f3d60'}, {'type': 'function', 'name': 'VerifyPackageIdA', 'address': '0x7ffb398f3d70'}, {'type': 'function', 'name': 'VerifyPackagePublisher', 'address': '0x7ffb398f3d80'}, {'type': 'function', 'name': 'VerifyPackagePublisherA', 'address': '0x7ffb398f3d90'}, {'type': 'function', 'name': 'VerifyPackageRelativeApplicationId', 'address': '0x7ffb398f3da0'}, {'type': 'function', 'name': 'VerifyPackageRelativeApplicationIdA', 'address': '0x7ffb398f3db0'}, {'type': 'function', 'name': 'WriteStateAtomValue', 'address': '0x7ffb398f3dc0'}, {'type': 'function', 'name': 'WriteStateContainerValue', 'address': '0x7ffb398f3dd0'}] | 10,458 | 20,903 | 0.704963 | 1,424 | 20,916 | 10.354635 | 0.337079 | 0.192879 | 0.257172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102104 | 0.068177 | 20,916 | 2 | 20,903 | 10,458 | 0.654438 | 0 | 0 | 0 | 0 | 0 | 0.70426 | 0.236267 | 0 | 0 | 0.158627 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
062aa46b512766dda49213d2215cfa703a1c57eb | 170 | py | Python | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Premiseorder.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | null | null | null | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Premiseorder.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | 11 | 2020-05-04T09:05:29.000Z | 2021-04-08T13:22:34.000Z | relational/student_projects/2019_guth/models/MMI_Genetic/Genetic_MMI_Premiseorder.py | monthie/cogmods | 62af4b8bf2effb77f26a8877d6a89949164d83f0 | [
"MIT"
] | 12 | 2020-05-02T09:36:14.000Z | 2021-06-22T08:10:45.000Z | import Genetic_MMI
class ModelApproachExp32(Genetic_MMI.ModelApproach):
def __init__(self):
Genetic_MMI.ModelApproach.__init__(self, 3, "MMI_premiseorder")
| 24.285714 | 71 | 0.776471 | 19 | 170 | 6.315789 | 0.578947 | 0.25 | 0.383333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020408 | 0.135294 | 170 | 6 | 72 | 28.333333 | 0.795918 | 0 | 0 | 0 | 0 | 0 | 0.094118 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
063005d803559e4c2b400abac7feb31e44da8ef5 | 247 | py | Python | ctaplot/gammaboard/tests/test_gammaboard.py | vuillaut/CTAPLOT | 3a7757f6e2487806ca87e41fcd123ccfbd4b964c | [
"MIT"
] | 5 | 2018-07-03T16:13:29.000Z | 2021-02-22T13:59:57.000Z | ctaplot/gammaboard/tests/test_gammaboard.py | vuillaut/CTAPLOT | 3a7757f6e2487806ca87e41fcd123ccfbd4b964c | [
"MIT"
] | 39 | 2020-03-10T16:52:45.000Z | 2022-01-26T14:13:40.000Z | ctaplot/gammaboard/tests/test_gammaboard.py | vuillaut/CTAPLOT | 3a7757f6e2487806ca87e41fcd123ccfbd4b964c | [
"MIT"
] | 6 | 2019-11-22T10:01:23.000Z | 2021-09-20T12:32:34.000Z |
def test_find_dashboard():
from ctaplot.io import get
get('dashboard.ipynb')
def test_open_dashboard():
"""
TODO: test and close notebook automatically
"""
# process = open_dashboard()
# process.terminate()
pass
| 17.642857 | 47 | 0.651822 | 28 | 247 | 5.571429 | 0.678571 | 0.089744 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238866 | 247 | 13 | 48 | 19 | 0.829787 | 0.368421 | 0 | 0 | 0 | 0 | 0.109489 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 1 | 0.4 | true | 0.2 | 0.2 | 0 | 0.6 | 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 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 6 |
06395e454afbc6e0709c48a7a2a25b3d6d9485cd | 74 | py | Python | gravity/utils/__init__.py | ko-han/gravity | d3e1ff31e5cc3955d19acbbee8d10c2240191670 | [
"Apache-2.0"
] | null | null | null | gravity/utils/__init__.py | ko-han/gravity | d3e1ff31e5cc3955d19acbbee8d10c2240191670 | [
"Apache-2.0"
] | null | null | null | gravity/utils/__init__.py | ko-han/gravity | d3e1ff31e5cc3955d19acbbee8d10c2240191670 | [
"Apache-2.0"
] | null | null | null | from .meta_clsss import *
from .utils import *
from .yaml_help import *
| 12.333333 | 25 | 0.72973 | 11 | 74 | 4.727273 | 0.636364 | 0.384615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189189 | 74 | 5 | 26 | 14.8 | 0.866667 | 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 | 1 | 0 | 0 | 6 |
06429cbe6acaf2f316bf6c20d7cf9a8dc9453274 | 40 | py | Python | src/python/zquantum/core/wip/circuits/__init__.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | 24 | 2020-04-15T17:36:59.000Z | 2022-01-25T05:02:14.000Z | src/python/zquantum/core/wip/circuits/__init__.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | 177 | 2020-04-23T15:19:59.000Z | 2022-03-30T18:06:17.000Z | src/python/zquantum/core/wip/circuits/__init__.py | alexjuda2/z-quantum-core | c258100dbd091f0b22495b77b36399426ae9abac | [
"Apache-2.0"
] | 19 | 2020-06-24T10:56:02.000Z | 2021-09-30T13:02:21.000Z | from ...circuits import * # noqa: F403
| 20 | 39 | 0.65 | 5 | 40 | 5.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09375 | 0.2 | 40 | 1 | 40 | 40 | 0.71875 | 0.25 | 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 | 1 | 0 | 0 | 6 |
06b285ce7f9ec3038ee5f3485fca543a0b0ae003 | 44 | py | Python | make_it_sync/__init__.py | gordonwatts/make-it-sync | 7e0885131a7e7a502ecc9a467a4e7121d2416730 | [
"MIT"
] | 2 | 2020-10-01T16:35:38.000Z | 2021-09-17T17:57:12.000Z | make_it_sync/__init__.py | gordonwatts/make-it-sync | 7e0885131a7e7a502ecc9a467a4e7121d2416730 | [
"MIT"
] | 2 | 2020-06-13T16:49:36.000Z | 2020-06-13T23:43:50.000Z | make_it_sync/__init__.py | gordonwatts/make-it-sync | 7e0885131a7e7a502ecc9a467a4e7121d2416730 | [
"MIT"
] | 1 | 2020-10-01T16:32:56.000Z | 2020-10-01T16:32:56.000Z | from .func_wrapper import make_sync # NOQA
| 22 | 43 | 0.795455 | 7 | 44 | 4.714286 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.159091 | 44 | 1 | 44 | 44 | 0.891892 | 0.090909 | 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 | 1 | 0 | 0 | 6 |
ebf9720cc3bb7c0090206f7dc8ea691a685c6b9c | 3,698 | py | Python | tests/unit/controllers/test_department_controller.py | Maxcutex/personal_ecommerce | be09fb20eae1b225523acde06f8e75effcc3676f | [
"MIT"
] | null | null | null | tests/unit/controllers/test_department_controller.py | Maxcutex/personal_ecommerce | be09fb20eae1b225523acde06f8e75effcc3676f | [
"MIT"
] | 2 | 2019-05-21T08:44:29.000Z | 2021-04-30T20:46:08.000Z | tests/unit/controllers/test_department_controller.py | Maxcutex/personal_ecommerce | be09fb20eae1b225523acde06f8e75effcc3676f | [
"MIT"
] | null | null | null | '''
Unit tests for the Department Controller.
'''
from unittest.mock import patch
from app.controllers.department_controller import DepartmentController
from tests.base_test_case import BaseTestCase
from factories import DepartmentFactory
class TestDepartmentController(BaseTestCase):
'''
DepartmentController test class.
'''
def setUp(self):
self.BaseSetUp()
@patch.object(DepartmentController, 'request_params_dict')
def test_create_department_succeeds(self, mock_request_params):
with self.app.app_context():
mock_request_params.return_value = {
'name': "eastern",
'description': "test description",
}
department_controller = DepartmentController(self.request_context)
# Act
result = department_controller.create_department()
# Assert
assert result.status_code == 201
assert result.get_json()['msg'] == 'OK'
self.assertEqual(
result.get_json()['payload']['department']['name'], "eastern"
)
self.assertEqual(
result.get_json()['payload']['department']['description'], "test description"
)
def test_delete_department_succeeds(self):
with self.app.app_context():
department = DepartmentFactory.create(name="test")
department_controller = DepartmentController(self.request_context)
# Act
result = department_controller.delete_department(department.department_id)
# Assert
assert result.status_code == 200
assert result.get_json()['msg'] == 'Department successfully deleted'
def test_delete_department_fails(self):
with self.app.app_context():
department_controller = DepartmentController(self.request_context)
# Act
result = department_controller.delete_department(department_id=6)
# Assert
assert result.status_code == 404
assert result.get_json()['msg'] == 'Department not found'
@patch.object(DepartmentController, 'request_params_dict')
def test_update_department_succeeds(self, mock_request_params):
with self.app.app_context():
department = DepartmentFactory.create(name="test")
mock_request_params.return_value = {
'name': "eastern",
'description': "test description",
}
department_controller = DepartmentController(self.request_context)
# Act
result = department_controller.update_department(department.department_id)
# Assert
assert result.status_code == 200
assert result.get_json()['msg'] == 'OK'
self.assertEqual(
result.get_json()['payload']['department']['name'], "eastern"
)
self.assertEqual(
result.get_json()['payload']['department']['description'], "test description"
)
@patch.object(DepartmentController, 'request_params_dict')
def test_update_department_fails(self, mock_request_params):
with self.app.app_context():
mock_request_params.return_value = {
'name': "eastern",
'description': "test description",
}
department_controller = DepartmentController(self.request_context)
# Act
result = department_controller.update_department(department_id=6)
# Assert
assert result.status_code == 404
assert result.get_json()['msg'] == 'Department not found'
| 35.219048 | 93 | 0.621147 | 338 | 3,698 | 6.553254 | 0.183432 | 0.108352 | 0.052822 | 0.031603 | 0.817607 | 0.804966 | 0.800451 | 0.787359 | 0.762528 | 0.762528 | 0 | 0.006396 | 0.281233 | 3,698 | 104 | 94 | 35.557692 | 0.826938 | 0.035154 | 0 | 0.606061 | 0 | 0 | 0.116799 | 0 | 0 | 0 | 0 | 0 | 0.212121 | 1 | 0.090909 | false | 0 | 0.060606 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
ebfaa1b90c608e4fe874233196cfde50a26ec8cd | 26 | py | Python | src/debugpy/_vendored/pydevd/tests_python/resources/my_code/my_code_on_entry.py | r3m0t/debugpy | 090e3c3ef5758e5b316514c9d6f44f9b9b488cf1 | [
"MIT"
] | 695 | 2020-01-30T14:34:51.000Z | 2022-03-31T09:31:57.000Z | src/debugpy/_vendored/pydevd/tests_python/resources/my_code/my_code_on_entry.py | r3m0t/debugpy | 090e3c3ef5758e5b316514c9d6f44f9b9b488cf1 | [
"MIT"
] | 845 | 2020-01-29T23:53:36.000Z | 2022-03-31T19:45:04.000Z | src/debugpy/_vendored/pydevd/tests_python/resources/my_code/my_code_on_entry.py | r3m0t/debugpy | 090e3c3ef5758e5b316514c9d6f44f9b9b488cf1 | [
"MIT"
] | 66 | 2020-01-30T13:10:38.000Z | 2022-03-29T07:11:17.000Z | print('my code on entry')
| 13 | 25 | 0.692308 | 5 | 26 | 3.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 26 | 1 | 26 | 26 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.615385 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
231c867a5071db465b7e8963fab57f60da620aa3 | 228 | py | Python | celery_conf/tasks.py | rivendale/ethsigns | 8ffecc264a54b00d5615c6fa36c9f661dce468b5 | [
"MIT"
] | 1 | 2021-01-24T04:27:57.000Z | 2021-01-24T04:27:57.000Z | celery_conf/tasks.py | rivendale/ethsigns | 8ffecc264a54b00d5615c6fa36c9f661dce468b5 | [
"MIT"
] | 19 | 2021-02-07T18:24:31.000Z | 2021-07-02T08:03:56.000Z | celery_conf/tasks.py | rivendale/ethsigns | 8ffecc264a54b00d5615c6fa36c9f661dce468b5 | [
"MIT"
] | null | null | null | """Celery Tasks"""
from ethsigns import celery_app
@celery_app.task(name="sample_scheduler")
def sample_scheduler():
"""Sample to test `/celery` endpoint has scheduled tasks"""
return dict(message="sample scheduler")
| 22.8 | 63 | 0.732456 | 29 | 228 | 5.62069 | 0.655172 | 0.276074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135965 | 228 | 9 | 64 | 25.333333 | 0.827411 | 0.289474 | 0 | 0 | 0 | 0 | 0.211921 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.25 | 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 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
003762c8c2241d61ff3268795856a14d4b4ea14d | 1,718 | py | Python | tests/sublime_plugin_lib/test_collections.py | my-personal-forks/dart-sublime-bundle | 580127c13c3a97d7cb0c9ac09152f68cb665946c | [
"BSD-3-Clause"
] | 145 | 2015-01-04T21:07:32.000Z | 2021-10-16T21:35:20.000Z | tests/sublime_plugin_lib/test_collections.py | kkurian/dart-sublime-bundle | 429324e43ea487f8c05a4fb7002c5fd2c8c56b42 | [
"BSD-3-Clause"
] | 93 | 2015-01-25T00:10:01.000Z | 2021-02-01T12:11:31.000Z | tests/sublime_plugin_lib/test_collections.py | kkurian/dart-sublime-bundle | 429324e43ea487f8c05a4fb7002c5fd2c8c56b42 | [
"BSD-3-Clause"
] | 45 | 2015-01-25T00:18:01.000Z | 2021-02-25T18:09:08.000Z | # Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
import unittest
import os
from Dart.sublime_plugin_lib.collections import CircularArray
class Test_CircularList(unittest.TestCase):
def testCanInstantiate(self):
ca = CircularArray(list(range(0, 5)))
self.assertEqual(len(ca), 5)
def testForward(self):
ca = CircularArray(list(range(0, 5)))
self.assertEqual(ca.forward(), 0)
self.assertEqual(ca.forward(), 1)
self.assertEqual(ca.forward(), 2)
self.assertEqual(ca.forward(), 3)
self.assertEqual(ca.forward(), 4)
self.assertEqual(ca.forward(), 0)
def testBackward(self):
ca = CircularArray(list(range(0, 5)))
self.assertEqual(ca.backward(), 4)
self.assertEqual(ca.backward(), 3)
self.assertEqual(ca.backward(), 2)
self.assertEqual(ca.backward(), 1)
self.assertEqual(ca.backward(), 0)
self.assertEqual(ca.backward(), 4)
def xtestBidirectionality(self):
ca = CircularArray(list(range(0, 5)))
self.assertEqual(ca.backward(), 4)
self.assertEqual(ca.forward(), 0)
self.assertEqual(ca.backward(), 4)
self.assertEqual(ca.forward(), 0)
self.assertEqual(ca.forward(), 1)
self.assertEqual(ca.forward(), 2)
self.assertEqual(ca.forward(), 3)
self.assertEqual(ca.forward(), 4)
self.assertEqual(ca.backward(), 3)
self.assertEqual(ca.backward(), 2)
self.assertEqual(ca.backward(), 1)
self.assertEqual(ca.backward(), 0)
| 35.791667 | 87 | 0.64319 | 214 | 1,718 | 5.149533 | 0.308411 | 0.34029 | 0.370236 | 0.261343 | 0.677858 | 0.677858 | 0.647005 | 0.647005 | 0.647005 | 0.606171 | 0 | 0.027571 | 0.218859 | 1,718 | 47 | 88 | 36.553191 | 0.793592 | 0.119325 | 0 | 0.756757 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.675676 | 1 | 0.108108 | false | 0 | 0.081081 | 0 | 0.216216 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
aea20186117137585f5254fde3254a736cea4847 | 239 | py | Python | cogkge/adapter/graph_adapter.py | CogNLP/CogKGE | 70d851d6489600c1e90eb25b0388a3ceba2f078c | [
"MIT"
] | 1 | 2022-03-17T08:21:59.000Z | 2022-03-17T08:21:59.000Z | cogkge/adapter/graph_adapter.py | CogNLP/CogKGE | 70d851d6489600c1e90eb25b0388a3ceba2f078c | [
"MIT"
] | null | null | null | cogkge/adapter/graph_adapter.py | CogNLP/CogKGE | 70d851d6489600c1e90eb25b0388a3ceba2f078c | [
"MIT"
] | null | null | null | import torch
def graph_adapter(func):
def inner(*args, **kwargs):
head_embedding, relation_embedding, tail_embedding = func(*args, **kwargs)
return head_embedding, relation_embedding, tail_embedding
return inner
| 23.9 | 82 | 0.719665 | 28 | 239 | 5.892857 | 0.5 | 0.121212 | 0.254545 | 0.363636 | 0.521212 | 0.521212 | 0 | 0 | 0 | 0 | 0 | 0 | 0.192469 | 239 | 9 | 83 | 26.555556 | 0.854922 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0 | 0.833333 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
aef7e1a8924e13c026a3d928bc76782001e5e4da | 424 | py | Python | Losses/RootRelativeSquaredError.py | recep-yildirim/Machine-Learning-Algorithms | dc4f4e6939631468246efc7537b1569007fee792 | [
"MIT"
] | 3 | 2021-05-12T13:13:52.000Z | 2022-01-19T19:54:16.000Z | Losses/RootRelativeSquaredError.py | recep-yildirim/Machine-Learning-Algorithms | dc4f4e6939631468246efc7537b1569007fee792 | [
"MIT"
] | null | null | null | Losses/RootRelativeSquaredError.py | recep-yildirim/Machine-Learning-Algorithms | dc4f4e6939631468246efc7537b1569007fee792 | [
"MIT"
] | null | null | null | import numpy as np
from Losses import Loss
class RootRelativeSquaredError(Loss):
def call(self, true_labels, predicted_labels):
error = np.square(predicted_labels - true_labels)
denominator = np.square(true_labels - np.mean(true_labels))
return np.sqrt(np.sum(error / denominator))
def __call__(self, true_labels, predicted_labels):
return self.call(true_labels, predicted_labels) | 32.615385 | 67 | 0.728774 | 55 | 424 | 5.363636 | 0.4 | 0.20339 | 0.19322 | 0.254237 | 0.244068 | 0.244068 | 0.244068 | 0 | 0 | 0 | 0 | 0 | 0.183962 | 424 | 13 | 68 | 32.615385 | 0.852601 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.111111 | 0.777778 | 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 | 1 | 1 | 0 | 0 | 6 |
aefb4403ac84e316b6668c15539d878e97963560 | 83 | py | Python | code/11/fah_converter.py | TeamLab/introduction_to_pythoy_TEAMLAB_MOOC | ebf1ff02d6a341bfee8695eac478ff8297cb97e4 | [
"MIT"
] | 65 | 2017-11-01T01:57:21.000Z | 2022-02-08T13:36:25.000Z | code/11/fah_converter.py | TeamLab/introduction_to_pythoy_TEAMLAB_MOOC | ebf1ff02d6a341bfee8695eac478ff8297cb97e4 | [
"MIT"
] | 9 | 2017-11-03T15:05:30.000Z | 2018-05-17T03:18:36.000Z | code/11/fah_converter.py | TeamLab/introduction_to_pythoy_TEAMLAB_MOOC | ebf1ff02d6a341bfee8695eac478ff8297cb97e4 | [
"MIT"
] | 64 | 2017-11-01T01:57:23.000Z | 2022-01-19T03:52:12.000Z | def covert_c_to_f(celsius_value):
return celsius_value * 9.0 / 5 + 32
B = 155
| 16.6 | 39 | 0.686747 | 16 | 83 | 3.25 | 0.875 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123077 | 0.216867 | 83 | 4 | 40 | 20.75 | 0.676923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.333333 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
4e36986381695f93a2ab378be0e749104622d4de | 22 | py | Python | cpcbccr/__init__.py | sakethramanujam/cpcbccr-python-client | 658fa6d8c4c222e2fa19d96b52276403440952ff | [
"MIT"
] | 2 | 2020-08-10T12:22:15.000Z | 2021-12-28T14:17:48.000Z | cpcbccr/__init__.py | sakethramanujam/cpcbccr-python-client | 658fa6d8c4c222e2fa19d96b52276403440952ff | [
"MIT"
] | null | null | null | cpcbccr/__init__.py | sakethramanujam/cpcbccr-python-client | 658fa6d8c4c222e2fa19d96b52276403440952ff | [
"MIT"
] | 1 | 2020-12-20T10:51:21.000Z | 2020-12-20T10:51:21.000Z | from .cpcbccr import * | 22 | 22 | 0.772727 | 3 | 22 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 22 | 1 | 22 | 22 | 0.894737 | 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 | 1 | 0 | 0 | 6 |
9dcf58dd526d343689a225af97b04f0cd4e575ed | 79 | py | Python | vit.py | Junhojuno/vision-transfomer-tf2 | 4110ea9153214c08162a642272a909e72446e3d3 | [
"MIT"
] | null | null | null | vit.py | Junhojuno/vision-transfomer-tf2 | 4110ea9153214c08162a642272a909e72446e3d3 | [
"MIT"
] | null | null | null | vit.py | Junhojuno/vision-transfomer-tf2 | 4110ea9153214c08162a642272a909e72446e3d3 | [
"MIT"
] | null | null | null | import tensorflow as tf
class PatchEmbedding(tf.keras.layers.Layer):
pass
| 15.8 | 44 | 0.772152 | 11 | 79 | 5.545455 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151899 | 79 | 4 | 45 | 19.75 | 0.910448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 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 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
d1798109909dc4f88ca93ef6c5848236e78181fd | 67 | py | Python | danlp/datasets/__init__.py | nikaoz/danlp | 1dd11a7301d2f8005f2b3a8a4fe3ccd15cfac74b | [
"BSD-3-Clause"
] | null | null | null | danlp/datasets/__init__.py | nikaoz/danlp | 1dd11a7301d2f8005f2b3a8a4fe3ccd15cfac74b | [
"BSD-3-Clause"
] | null | null | null | danlp/datasets/__init__.py | nikaoz/danlp | 1dd11a7301d2f8005f2b3a8a4fe3ccd15cfac74b | [
"BSD-3-Clause"
] | null | null | null | from .ddt import *
from .wiki_ann import *
from .word_sim import *
| 16.75 | 23 | 0.731343 | 11 | 67 | 4.272727 | 0.636364 | 0.425532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179104 | 67 | 3 | 24 | 22.333333 | 0.854545 | 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 | 1 | 0 | 0 | 6 |
ae03cadc03f377978fa0978717763c52c09d5f89 | 38 | py | Python | Bioinformatics-basics-yt/rosalind-challenges/python-prelim/pythagoras.py | peranovicc/python | b669060eb539f5f23684ffa1de13e6c927cc0b06 | [
"MIT"
] | null | null | null | Bioinformatics-basics-yt/rosalind-challenges/python-prelim/pythagoras.py | peranovicc/python | b669060eb539f5f23684ffa1de13e6c927cc0b06 | [
"MIT"
] | null | null | null | Bioinformatics-basics-yt/rosalind-challenges/python-prelim/pythagoras.py | peranovicc/python | b669060eb539f5f23684ffa1de13e6c927cc0b06 | [
"MIT"
] | null | null | null | x = 874
y = 923
print(x ** 2 + y ** 2) | 12.666667 | 22 | 0.447368 | 9 | 38 | 1.888889 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | 0.315789 | 38 | 3 | 22 | 12.666667 | 0.346154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 1 | 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 | 6 |
88a91fa56e7abad6cb12d5e3bdf7a8f583f3131e | 33 | py | Python | wikireader/browser/__init__.py | mke21/wikireader | 767422a736498d5147650cae52a89da7d0c43b65 | [
"MIT"
] | null | null | null | wikireader/browser/__init__.py | mke21/wikireader | 767422a736498d5147650cae52a89da7d0c43b65 | [
"MIT"
] | 7 | 2020-11-12T20:16:14.000Z | 2020-11-18T20:33:16.000Z | wikireader/browser/__init__.py | mke21/wikireader | 767422a736498d5147650cae52a89da7d0c43b65 | [
"MIT"
] | null | null | null | from .browser import run_browser
| 16.5 | 32 | 0.848485 | 5 | 33 | 5.4 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 33 | 1 | 33 | 33 | 0.931034 | 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 | 1 | 0 | 0 | 6 |
88ad019cec010fd4b3c7997d821e8c8b0d793576 | 41,416 | py | Python | tests/test_expr.py | JoaoFelipe/PyPosAST | 94dc8cdc2568dcdc833c0c2a61ff52a4011d27ec | [
"MIT"
] | 1 | 2015-10-17T18:43:43.000Z | 2015-10-17T18:43:43.000Z | tests/test_expr.py | JoaoFelipe/PyPosAST | 94dc8cdc2568dcdc833c0c2a61ff52a4011d27ec | [
"MIT"
] | 1 | 2016-02-01T02:22:08.000Z | 2016-02-01T07:53:18.000Z | tests/test_expr.py | JoaoFelipe/PyPosAST | 94dc8cdc2568dcdc833c0c2a61ff52a4011d27ec | [
"MIT"
] | 1 | 2017-12-17T16:51:49.000Z | 2017-12-17T16:51:49.000Z | # coding: utf-8
# Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# This file is part of PyPosAST.
# Please, consult the license terms in the LICENSE file.
from __future__ import (absolute_import, division)
import ast
from .utils import get_nodes, NodeTestCase
from .utils import only_python2, only_python3, only_python35, only_python36, only_python38
def nprint(nodes):
"""Print nodes"""
for i, node in enumerate(nodes):
print(i, node.lineno, node.col_offset)
class TestExpr(NodeTestCase):
# pylint: disable=missing-docstring, too-many-public-methods
def test_name(self):
code = ("#bla\n"
"abc")
nodes = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 3))
self.assertNoBeforeInnerAfter(nodes[0])
def test_name2(self):
code = ("#bla\n"
"(z)")
nodes = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 3))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 2))
def test_name3(self):
code = ("#bla\n"
"( z )")
nodes = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertSimpleInnerPosition(nodes[0], (2, 2), (2, 3))
def test_name4(self):
code = ("#bla\n"
"((z))")
nodes = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertSimpleInnerPosition(nodes[0], (2, 2), (2, 3))
def test_name5(self):
code = ("#bla\n"
"((z\n"
"))")
nodes = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (2, 0), (3, 2), (3, 2))
self.assertSimpleInnerPosition(nodes[0], (2, 2), (3, 0))
def test_num(self):
code = ("#bla\n"
"12")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 0), (2, 2), (2, 2))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_num2(self):
""" Python 3 Num uses the minus as unaryop, USub """
code = ("#bla\n"
"- 1245")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 0), (2, 7), (2, 7))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_num3(self):
""" Python 3 Num uses the minus as unaryop, USub """
code = ("#bla\n"
"- 0")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 0), (2, 4), (2, 4))
self.assertNoBeforeInnerAfter(nodes[0])
def test_num4(self):
code = ("#bla\n"
"0x1245")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 0), (2, 6), (2, 6))
self.assertNoBeforeInnerAfter(nodes[0])
def test_num5(self):
code = ("#bla\n"
"(2)")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 3))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 2))
def test_num6(self):
code = ("#bla\n"
"f(2)")
nodes = get_nodes(code, ast.Num)
self.assertPosition(nodes[0], (2, 2), (2, 3), (2, 3))
self.assertNoBeforeInnerAfter(nodes[0])
def test_str(self):
code = ("#bla\n"
"'ab\\\n"
" cd\\\n"
" ef'")
nodes = get_nodes(code, ast.Str)
self.assertPosition(nodes[0], (2, 0), (4, 4), (4, 4))
self.assertNoBeforeInnerAfter(nodes[0])
def test_str2(self):
code = ("#bla\n"
"'abcd'")
nodes = get_nodes(code, ast.Str)
self.assertPosition(nodes[0], (2, 0), (2, 6), (2, 6))
self.assertNoBeforeInnerAfter(nodes[0])
def test_str3(self):
code = ("#bla\n"
"('ab'\\\n"
" 'cd'\n"
" 'ef')")
nodes = get_nodes(code, ast.Str)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 5))
def test_str4(self):
code = ("#bla\n"
"'ab' 'cd' 'ef'")
nodes = get_nodes(code, ast.Str)
self.assertPosition(nodes[0], (2, 0), (2, 14), (2, 14))
self.assertNoBeforeInnerAfter(nodes[0])
def test_attribute(self):
code = ("#bla\n"
"a.b")
nodes = get_nodes(code, ast.Attribute)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '.')
self.assertNoBeforeInnerAfter(nodes[0])
def test_attribute2(self):
code = ("#bla\n"
"a.\\\n"
"b")
nodes = get_nodes(code, ast.Attribute)
self.assertPosition(nodes[0], (2, 0), (3, 1), (2, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '.')
self.assertNoBeforeInnerAfter(nodes[0])
def test_attribute3(self):
code = ("#bla\n"
"a.b.c")
nodes = get_nodes(code, ast.Attribute)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '.')
self.assertPosition(nodes[1], (2, 0), (2, 3), (2, 2))
self.assertOperation(nodes[1].op_pos[0], (2, 1), (2, 2), (2, 2), '.')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertNoBeforeInnerAfter(nodes[1])
def test_attribute4(self):
code = ("#bla\n"
"a.\\\n"
"b.c\\\n"
".d")
nodes = get_nodes(code, ast.Attribute)
self.assertPosition(nodes[0], (2, 0), (4, 2), (4, 1))
self.assertOperation(nodes[0].op_pos[0], (4, 0), (4, 1), (4, 1), '.')
self.assertPosition(nodes[1], (2, 0), (3, 3), (3, 2))
self.assertOperation(nodes[1].op_pos[0], (3, 1), (3, 2), (3, 2), '.')
self.assertPosition(nodes[2], (2, 0), (3, 1), (2, 2))
self.assertOperation(nodes[2].op_pos[0], (2, 1), (2, 2), (2, 2), '.')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertNoBeforeInnerAfter(nodes[1])
self.assertNoBeforeInnerAfter(nodes[2])
def test_attribute5(self):
code = ("#bla\n"
"(a.\\\n"
" b)")
nodes = get_nodes(code, ast.Attribute)
self.assertPosition(nodes[0], (2, 0), (3, 5), (2, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '.')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 4))
def test_ellipsis(self):
code = ("#bla\n"
"a[...]")
nodes = get_nodes(code, ast.Ellipsis)
self.assertPosition(nodes[0], (2, 2), (2, 5), (2, 5))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_ellipsis2(self):
""" Invalid Python 3 syntax """
code = ("#bla\n"
"a[.\\\n"
"..]")
nodes = get_nodes(code, ast.Ellipsis)
self.assertPosition(nodes[0], (2, 2), (3, 2), (3, 2))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_ellipsis3(self):
""" Invalid Python 2 syntax """
code = ("#bla\n"
"a[(...)]")
nodes = get_nodes(code, ast.Ellipsis)
self.assertPosition(nodes[0], (2, 2), (2, 7), (2, 7))
self.assertSimpleInnerPosition(nodes[0], (2, 3), (2, 6))
def test_subscript(self):
code = ("#bla\n"
"a\\\n"
"[1]")
nodes = get_nodes(code, ast.Subscript)
self.assertPosition(nodes[0], (2, 0), (3, 3), (3, 3))
self.assertOperation(nodes[0].op_pos[0], (3, 0), (3, 1), (3, 1), '[')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 3), (3, 3), ']')
self.assertNoBeforeInnerAfter(nodes[0])
def test_subscript2(self):
code = ("#bla\n"
"a[\n"
"1]")
nodes = get_nodes(code, ast.Subscript)
self.assertPosition(nodes[0], (2, 0), (3, 2), (3, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '[')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ']')
self.assertNoBeforeInnerAfter(nodes[0])
def test_subscript3(self):
code = ("#bla\n"
"a[1:\n"
"2,\n"
"3 ]")
nodes = get_nodes(code, ast.Subscript)
self.assertPosition(nodes[0], (2, 0), (4, 3), (4, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '[')
self.assertOperation(nodes[0].op_pos[1], (4, 2), (4, 3), (4, 3), ']')
self.assertNoBeforeInnerAfter(nodes[0])
def test_subscript4(self):
code = ("#bla\n"
"(a\n"
"[1])")
nodes = get_nodes(code, ast.Subscript)
self.assertPosition(nodes[0], (2, 0), (3, 4), (3, 4))
self.assertOperation(nodes[0].op_pos[0], (3, 0), (3, 1), (3, 1), '[')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 3), (3, 3), ']')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 3))
def test_subscript5(self):
code = (u"#bla\n"
u"f('Ç', ns['u'])\n")
nodes = get_nodes(code, ast.Subscript)
self.assertPosition(nodes[0], (2, 7), (2, 14), (2, 14))
self.assertOperation(nodes[0].op_pos[0], (2, 9), (2, 10), (2, 10), '[')
self.assertOperation(nodes[0].op_pos[1], (2, 13), (2, 14), (2, 14), ']')
self.assertNoBeforeInnerAfter(nodes[0])
def test_tuple(self):
code = ("#bla\n"
"(\n"
"1, 2,\n"
"3\n"
")")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (5, 1), (3, 1))
self.assertOperation(nodes[0].op_pos[0], (3, 1), (3, 2), (3, 2), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 4), (3, 5), (3, 5), ',')
self.assertSimpleInnerPosition(nodes[0], (3, 0), (5, 0))
def test_tuple2(self):
code = ("#bla\n"
"(\n"
")")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (3, 1), (3, 1))
self.assertNoBeforeInnerAfter(nodes[0])
self.assertEqual(nodes[0].op_pos, [])
def test_tuple3(self):
code = ("#bla\n"
"(((0),\n"
"1, 2,\n"
"3\n"
"))")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (5, 2), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 5), (2, 6), (2, 6), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ',')
self.assertOperation(nodes[0].op_pos[2], (3, 4), (3, 5), (3, 5), ',')
self.assertSimpleInnerPosition(nodes[0], (2, 2), (5, 0))
def test_tuple4(self):
code = ("#bla\n"
"1,")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (2, 2), (2, 1))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), ',')
self.assertNoBeforeInnerAfter(nodes[0])
def test_tuple5(self):
code = ("#bla\n"
"([1, 2], 3)")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (2, 11), (2, 7))
self.assertOperation(nodes[0].op_pos[0], (2, 7), (2, 8), (2, 8), ',')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 10))
def test_tuple6(self):
code = ("#bla\n"
"1, 2 ,")
nodes = get_nodes(code, ast.Tuple)
self.assertPosition(nodes[0], (2, 0), (2, 7), (2, 1))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), ',')
self.assertOperation(nodes[0].op_pos[1], (2, 6), (2, 7), (2, 7), ',')
self.assertNoBeforeInnerAfter(nodes[0])
def test_list(self):
code = ("#bla\n"
"[\n"
"1, 2,\n"
"3\n"
"]")
nodes = get_nodes(code, ast.List)
self.assertPosition(nodes[0], (2, 0), (5, 1), (5, 1))
self.assertOperation(nodes[0].op_pos[0], (3, 1), (3, 2), (3, 2), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 4), (3, 5), (3, 5), ',')
self.assertNoBeforeInnerAfter(nodes[0])
def test_list2(self):
code = ("#bla\n"
"[\n"
"]")
nodes = get_nodes(code, ast.List)
self.assertPosition(nodes[0], (2, 0), (3, 1), (3, 1))
self.assertEqual(nodes[0].op_pos, [])
self.assertNoBeforeInnerAfter(nodes[0])
def test_list3(self):
code = ("#bla\n"
"([(0),\n"
"1, 2,\n"
"3\n"
"])")
nodes = get_nodes(code, ast.List)
self.assertPosition(nodes[0], (2, 0), (5, 2), (5, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 5), (2, 6), (2, 6), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ',')
self.assertOperation(nodes[0].op_pos[2], (3, 4), (3, 5), (3, 5), ',')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (5, 1))
@only_python2
def test_repr(self):
code = ("#bla\n"
"`1`")
nodes = get_nodes(code, ast.Repr)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 1), (2, 1), '`')
self.assertOperation(nodes[0].op_pos[1], (2, 2), (2, 3), (2, 3), '`')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_repr2(self):
code = ("#bla\n"
"``1``")
nodes = get_nodes(code, ast.Repr)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 1), (2, 1), '`')
self.assertOperation(nodes[0].op_pos[1], (2, 4), (2, 5), (2, 5), '`')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_repr3(self):
code = ("#bla\n"
"``2\\\n"
"``")
nodes = get_nodes(code, ast.Repr)
self.assertPosition(nodes[0], (2, 0), (3, 2), (3, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 1), (2, 1), '`')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), '`')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python2
def test_repr4(self):
code = ("#bla\n"
"(``2\n"
"``)")
nodes = get_nodes(code, ast.Repr)
self.assertPosition(nodes[0], (2, 0), (3, 3), (3, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '`')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), '`')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 2))
def test_call(self):
code = ("#bla\n"
"fn(\n"
"2)")
nodes = get_nodes(code, ast.Call)
self.assertPosition(nodes[0], (2, 0), (3, 2), (3, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '(')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ')')
self.assertNoBeforeInnerAfter(nodes[0])
def test_call2(self):
code = ("#bla\n"
"fn(\n"
"2,)")
nodes = get_nodes(code, ast.Call)
self.assertPosition(nodes[0], (2, 0), (3, 3), (3, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '(')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ',')
self.assertOperation(nodes[0].op_pos[2], (3, 2), (3, 3), (3, 3), ')')
self.assertNoBeforeInnerAfter(nodes[0])
def test_call3(self):
code = ("#bla\n"
"fn\\\n"
"((\n"
"2, 3))")
nodes = get_nodes(code, ast.Call)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertOperation(nodes[0].op_pos[0], (3, 0), (3, 1), (3, 1), '(')
self.assertOperation(nodes[0].op_pos[1], (4, 5), (4, 6), (4, 6), ')')
self.assertNoBeforeInnerAfter(nodes[0])
def test_call4(self):
code = ("#bla\n"
"fn()\\\n"
"((\n"
"2, 3))")
nodes = get_nodes(code, ast.Call)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertPosition(nodes[1], (2, 0), (2, 4), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (3, 0), (3, 1), (3, 1), '(')
self.assertOperation(nodes[0].op_pos[1], (4, 5), (4, 6), (4, 6), ')')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertOperation(nodes[1].op_pos[0], (2, 2), (2, 3), (2, 3), '(')
self.assertOperation(nodes[1].op_pos[1], (2, 3), (2, 4), (2, 4), ')')
self.assertNoBeforeInnerAfter(nodes[1])
def test_call5(self):
code = ("#bla\n"
"(fn(\n"
"2))")
nodes = get_nodes(code, ast.Call)
self.assertPosition(nodes[0], (2, 0), (3, 3), (3, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '(')
self.assertOperation(nodes[0].op_pos[1], (3, 1), (3, 2), (3, 2), ')')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 2))
def test_compare(self):
code = ("#bla\n"
"2 < 3")
nodes = get_nodes(code, ast.Compare)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '<')
self.assertNoBeforeInnerAfter(nodes[0])
def test_compare2(self):
code = ("#bla\n"
"2 < 3 <\\\n"
" 5")
nodes = get_nodes(code, ast.Compare)
self.assertPosition(nodes[0], (2, 0), (3, 2), (3, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '<')
self.assertOperation(nodes[0].op_pos[1], (2, 6), (2, 7), (2, 7), '<')
self.assertNoBeforeInnerAfter(nodes[0])
def test_compare3(self):
code = ("#bla\n"
"(2 < 3 <\n"
" 5)")
nodes = get_nodes(code, ast.Compare)
self.assertPosition(nodes[0], (2, 0), (3, 3), (3, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '<')
self.assertOperation(nodes[0].op_pos[1], (2, 7), (2, 8), (2, 8), '<')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 2))
@only_python35
def test_await(self):
code = ("async def f():\n"
" await 2")
nodes = get_nodes(code, ast.Await)
self.assertPosition(nodes[0], (2, 4), (2, 13), (2, 9))
self.assertOperation(nodes[0].op_pos[0], (2, 4), (2, 9), (2, 9), 'await')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python35
def test_await2(self):
code = ("async def f():\n"
" (await \n"
"2)")
nodes = get_nodes(code, ast.Await)
self.assertPosition(nodes[0], (2, 4), (3, 2), (2, 10))
self.assertOperation(nodes[0].op_pos[0], (2, 5), (2, 10), (2, 10), 'await')
self.assertSimpleInnerPosition(nodes[0], (2, 5), (3, 1))
def test_yield(self):
code = ("#bla\n"
"yield 2")
nodes = get_nodes(code, ast.Yield)
self.assertPosition(nodes[0], (2, 0), (2, 9), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 5), (2, 5), 'yield')
self.assertNoBeforeInnerAfter(nodes[0])
def test_yield2(self):
code = ("#bla\n"
"(yield \n"
"2)")
nodes = get_nodes(code, ast.Yield)
self.assertPosition(nodes[0], (2, 0), (3, 2), (2, 6))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 6), (2, 6), 'yield')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 1))
def test_yield3(self):
code = ("#bla\n"
"yield")
nodes = get_nodes(code, ast.Yield)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 5), (2, 5), 'yield')
self.assertNoBeforeInnerAfter(nodes[0])
def test_yield4(self):
code = ("#bla\n"
"(yield \n"
"2)\n"
"(yield \n"
"2)")
nodes = get_nodes(code, ast.Yield)
self.assertPosition(nodes[0], (2, 0), (3, 2), (2, 6))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 6), (2, 6), 'yield')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 1))
self.assertPosition(nodes[1], (4, 0), (5, 2), (4, 6))
self.assertOperation(nodes[1].op_pos[0], (4, 1), (4, 6), (4, 6), 'yield')
self.assertSimpleInnerPosition(nodes[1], (4, 1), (5, 1))
def test_generator_exp(self):
code = ("#bla\n"
"f(x\n"
" for x in l\n"
" if x)")
nodes = get_nodes(code, ast.GeneratorExp)
self.assertPosition(nodes[0], (2, 2), (4, 5), (2, 3))
self.assertNoBeforeInnerAfter(nodes[0])
def test_generator_exp2(self):
code = ("#bla\n"
"f(x\n"
" for x in l\n"
" if x)\n"
"g(y\n"
" for y in m\n"
" if y)")
nodes = get_nodes(code, ast.GeneratorExp)
self.assertPosition(nodes[0], (2, 2), (4, 5), (2, 3))
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(nodes[1], (5, 2), (7, 5), (5, 3))
self.assertNoBeforeInnerAfter(nodes[1])
def test_dict_comp(self):
code = ("#bla\n"
"{x:2\n"
" for x in l\n"
" if x}")
nodes = get_nodes(code, ast.DictComp)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertNoBeforeInnerAfter(nodes[0])
def test_dict_comp2(self):
code = ("#bla\n"
"({x:2\n"
" for x in l\n"
" if x})")
nodes = get_nodes(code, ast.DictComp)
self.assertPosition(nodes[0], (2, 0), (4, 7), (4, 7))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 6))
def test_set_comp(self):
code = ("#bla\n"
"{x\n"
" for x in l\n"
" if x}")
nodes = get_nodes(code, ast.SetComp)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertNoBeforeInnerAfter(nodes[0])
def test_set_comp2(self):
code = ("#bla\n"
"({x\n"
" for x in l\n"
" if x})")
nodes = get_nodes(code, ast.SetComp)
self.assertPosition(nodes[0], (2, 0), (4, 7), (4, 7))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 6))
def test_list_comp(self):
code = ("#bla\n"
"[x\n"
" for x in l\n"
" if x]")
nodes = get_nodes(code, ast.ListComp)
self.assertPosition(nodes[0], (2, 0), (4, 6), (4, 6))
self.assertNoBeforeInnerAfter(nodes[0])
def test_list_comp2(self):
code = ("#bla\n"
"([x\n"
" for x in l\n"
" if x])")
nodes = get_nodes(code, ast.ListComp)
self.assertPosition(nodes[0], (2, 0), (4, 7), (4, 7))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 6))
@only_python36
def test_async_comp(self):
code = ("#bla\n"
"async def f():\n"
" [x\n"
" async for x in l\n"
" if x]")
nodes = get_nodes(code, ast.ListComp)
self.assertPosition(nodes[0], (3, 4), (5, 10), (5, 10))
self.assertNoBeforeInnerAfter(nodes[0])
def test_set(self):
code = ("#bla\n"
"{x,\n"
" 1,\n"
" 3}")
nodes = get_nodes(code, ast.Set)
self.assertPosition(nodes[0], (2, 0), (4, 3), (4, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 3), (3, 3), ',')
self.assertNoBeforeInnerAfter(nodes[0])
def test_set2(self):
code = ("#bla\n"
"({x,\n"
" 1,\n"
" 3})")
nodes = get_nodes(code, ast.Set)
self.assertPosition(nodes[0], (2, 0), (4, 4), (4, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), ',')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 3), (3, 3), ',')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 3))
def test_dict(self):
code = ("#bla\n"
"{}")
nodes = get_nodes(code, ast.Dict)
self.assertPosition(nodes[0], (2, 0), (2, 2), (2, 2))
self.assertEqual(nodes[0].op_pos, [])
self.assertNoBeforeInnerAfter(nodes[0])
def test_dict2(self):
code = ("#bla\n"
"{1}, {1: x,\n"
" 2: 1,\n"
" 3: 3}")
nodes = get_nodes(code, ast.Dict)
self.assertPosition(nodes[0], (2, 5), (4, 7), (4, 7))
self.assertOperation(nodes[0].op_pos[0], (2, 7), (2, 8), (2, 8), ':')
self.assertOperation(nodes[0].op_pos[1], (2, 10), (2, 11), (2, 11), ',')
self.assertOperation(nodes[0].op_pos[2], (3, 3), (3, 4), (3, 4), ':')
self.assertOperation(nodes[0].op_pos[3], (3, 6), (3, 7), (3, 7), ',')
self.assertOperation(nodes[0].op_pos[4], (4, 3), (4, 4), (4, 4), ':')
self.assertNoBeforeInnerAfter(nodes[0])
def test_dict3(self):
code = ("#bla\n"
"{1}, ({1: x,\n"
" 2: 1,\n"
" 3: 3})")
nodes = get_nodes(code, ast.Dict)
self.assertPosition(nodes[0], (2, 5), (4, 8), (4, 8))
self.assertOperation(nodes[0].op_pos[0], (2, 8), (2, 9), (2, 9), ':')
self.assertOperation(nodes[0].op_pos[1], (2, 11), (2, 12), (2, 12), ',')
self.assertOperation(nodes[0].op_pos[2], (3, 3), (3, 4), (3, 4), ':')
self.assertOperation(nodes[0].op_pos[3], (3, 6), (3, 7), (3, 7), ',')
self.assertOperation(nodes[0].op_pos[4], (4, 3), (4, 4), (4, 4), ':')
self.assertSimpleInnerPosition(nodes[0], (2, 6), (4, 7))
def test_if_exp(self):
code = ("#bla\n"
"1 if 2\\\n"
" else 3")
nodes = get_nodes(code, ast.IfExp)
self.assertPosition(nodes[0], (2, 0), (3, 8), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 4), (2, 4), 'if')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 6), (3, 6), 'else')
self.assertNoBeforeInnerAfter(nodes[0])
def test_if_exp2(self):
code = ("#bla\n"
"(1 if 2\n"
" else 3)")
nodes = get_nodes(code, ast.IfExp)
self.assertPosition(nodes[0], (2, 0), (3, 9), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 5), (2, 5), 'if')
self.assertOperation(nodes[0].op_pos[1], (3, 2), (3, 6), (3, 6), 'else')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 8))
def test_if_exp3(self):
code = ("#bla\n"
"((1)if(2)else(3))\n"
"((4)if(5)else(6))")
nodes = get_nodes(code, ast.IfExp)
self.assertPosition(nodes[0], (2, 0), (2, 17), (2, 6))
self.assertOperation(nodes[0].op_pos[0], (2, 4), (2, 6), (2, 6), 'if')
self.assertOperation(nodes[0].op_pos[1], (2, 9), (2, 13), (2, 13), 'else')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 16))
def test_lambda(self):
code = ("#bla\n"
"lambda x, y:\\\n"
"x")
nodes = get_nodes(code, ast.Lambda)
self.assertPosition(nodes[0], (2, 0), (3, 1), (2, 12))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 6), (2, 6), 'lambda')
self.assertOperation(nodes[0].op_pos[1], (2, 11), (2, 12), (2, 12), ':')
self.assertNoBeforeInnerAfter(nodes[0])
def test_lambda2(self):
code = ("#bla\n"
"(lambda x, y:\n"
"x)")
nodes = get_nodes(code, ast.Lambda)
self.assertPosition(nodes[0], (2, 0), (3, 2), (2, 13))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 7), (2, 7), 'lambda')
self.assertOperation(nodes[0].op_pos[1], (2, 12), (2, 13), (2, 13), ':')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 1))
def test_unary_op(self):
code = ("#bla\n"
"- a")
nodes = get_nodes(code, ast.UnaryOp)
self.assertPosition(nodes[0], (2, 0), (2, 3), (2, 1))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 1), (2, 1), '-')
self.assertNoBeforeInnerAfter(nodes[0])
def test_unary_op2(self):
code = ("#bla\n"
"(-\n"
"a)")
nodes = get_nodes(code, ast.UnaryOp)
self.assertPosition(nodes[0], (2, 0), (3, 2), (2, 2))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 2), (2, 2), '-')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 1))
def test_binop(self):
code = ("#bla\n"
"ab+a")
nodes = get_nodes(code, ast.BinOp)
self.assertPosition(nodes[0], (2, 0), (2, 4), (2, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '+')
self.assertNoBeforeInnerAfter(nodes[0])
def test_binop2(self):
code = ("#bla\n"
"a * b + c")
nodes = get_nodes(code, ast.BinOp)
self.assertPosition(nodes[0], (2, 0), (2, 9), (2, 7))
self.assertOperation(nodes[0].op_pos[0], (2, 6), (2, 7), (2, 7), '+')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(nodes[1], (2, 0), (2, 5), (2, 3))
self.assertOperation(nodes[1].op_pos[0], (2, 2), (2, 3), (2, 3), '*')
self.assertNoBeforeInnerAfter(nodes[1])
def test_binop3(self):
code = ("#bla\n"
"(b + a)")
nodes = get_nodes(code, ast.BinOp)
self.assertPosition(nodes[0], (2, 0), (2, 7), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '+')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 6))
def test_bool_op(self):
code = ("#bla\n"
"a and b and c")
nodes = get_nodes(code, ast.BoolOp)
self.assertPosition(nodes[0], (2, 0), (2, 13), (2, 13))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 5), (2, 5), 'and')
self.assertOperation(nodes[0].op_pos[1], (2, 8), (2, 11), (2, 11), 'and')
self.assertNoBeforeInnerAfter(nodes[0])
def test_bool_op2(self):
code = ("#bla\n"
"a and b or c")
nodes = get_nodes(code, ast.BoolOp)
self.assertPosition(nodes[0], (2, 0), (2, 12), (2, 12))
self.assertOperation(nodes[0].op_pos[0], (2, 8), (2, 10), (2, 10), 'or')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(nodes[1], (2, 0), (2, 7), (2, 7))
self.assertOperation(nodes[1].op_pos[0], (2, 2), (2, 5), (2, 5), 'and')
self.assertNoBeforeInnerAfter(nodes[1])
def test_bool_op3(self):
code = ("#bla\n"
"(a and b and c)")
nodes = get_nodes(code, ast.BoolOp)
self.assertPosition(nodes[0], (2, 0), (2, 15), (2, 15))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 6), (2, 6), 'and')
self.assertOperation(nodes[0].op_pos[1], (2, 9), (2, 12), (2, 12), 'and')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 14))
def test_bool_op4(self):
code = ("#bla\n"
"((a)and(b)and(c))\n"
"((d)and(e)and(f))")
nodes = get_nodes(code, ast.BoolOp)
self.assertPosition(nodes[0], (2, 0), (2, 17), (2, 17))
self.assertOperation(nodes[0].op_pos[0], (2, 4), (2, 7), (2, 7), 'and')
self.assertOperation(nodes[0].op_pos[1], (2, 10), (2, 13), (2, 13), 'and')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 16))
self.assertPosition(nodes[1], (3, 0), (3, 17), (3, 17))
self.assertOperation(nodes[1].op_pos[0], (3, 4), (3, 7), (3, 7), 'and')
self.assertOperation(nodes[1].op_pos[1], (3, 10), (3, 13), (3, 13), 'and')
self.assertSimpleInnerPosition(nodes[1], (3, 1), (3, 16))
@only_python3
def test_starred(self):
code = ("#bla\n"
"a, * b = 1, 2, 3")
nodes = get_nodes(code, ast.Starred)
self.assertPosition(nodes[0], (2, 3), (2, 6), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '*')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_starred2(self):
code = ("#bla\n"
"a, (* b) = 1, 2, 3")
nodes = get_nodes(code, ast.Starred)
self.assertPosition(nodes[0], (2, 3), (2, 8), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 4), (2, 5), (2, 5), '*')
self.assertSimpleInnerPosition(nodes[0], (2, 4), (2, 7))
@only_python3
def test_starred3(self):
code = ("#bla\n"
"a, *b = 1, 2, 3")
nodes = get_nodes(code, ast.Starred)
self.assertPosition(nodes[0], (2, 3), (2, 5), (2, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 4), (2, 4), '*')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python35
def test_starred4(self):
code = ("#bla\n"
"f(*a, 5, *b)")
nodes = get_nodes(code, ast.Starred)
self.assertPosition(nodes[0], (2, 2), (2, 4), (2, 3))
self.assertOperation(nodes[0].op_pos[0], (2, 2), (2, 3), (2, 3), '*')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(nodes[1], (2, 9), (2, 11), (2, 10))
self.assertOperation(nodes[1].op_pos[0], (2, 9), (2, 10), (2, 10), '*')
self.assertNoBeforeInnerAfter(nodes[1])
@only_python35
def test_starred5(self):
code = ("#bla\n"
"i, j, k, l, m = *a, 5, *b")
nodes = get_nodes(code, ast.Starred)
self.assertPosition(nodes[0], (2, 16), (2, 18), (2, 17))
self.assertOperation(nodes[0].op_pos[0], (2, 16), (2, 17), (2, 17), '*')
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(nodes[1], (2, 23), (2, 25), (2, 24))
self.assertOperation(nodes[1].op_pos[0], (2, 23), (2, 24), (2, 24), '*')
self.assertNoBeforeInnerAfter(nodes[1])
@only_python3
def test_name_constant(self):
code = ("#bla\n"
"None")
nodes = get_nodes(code, ast.NameConstant)
self.assertPosition(nodes[0], (2, 0), (2, 4), (2, 4))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_name_constant2(self):
code = ("#bla\n"
"True")
nodes = get_nodes(code, ast.NameConstant)
self.assertPosition(nodes[0], (2, 0), (2, 4), (2, 4))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_name_constant3(self):
code = ("#bla\n"
"False")
nodes = get_nodes(code, ast.NameConstant)
self.assertPosition(nodes[0], (2, 0), (2, 5), (2, 5))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_name_constant4(self):
code = ("#bla\n"
"(None)")
nodes = get_nodes(code, ast.NameConstant)
self.assertPosition(nodes[0], (2, 0), (2, 6), (2, 6))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 5))
@only_python3
def test_bytes(self):
code = ("#bla\n"
"b'ab\\\n"
" cd\\\n"
" ef'")
nodes = get_nodes(code, ast.Bytes)
self.assertPosition(nodes[0], (2, 0), (4, 4), (4, 4))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_bytes2(self):
code = ("#bla\n"
"b'abcd'")
nodes = get_nodes(code, ast.Bytes)
self.assertPosition(nodes[0], (2, 0), (2, 7), (2, 7))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_bytes3(self):
code = ("#bla\n"
"(b'ab'\\\n"
" b'cd'\n"
" b'ef')")
nodes = get_nodes(code, ast.Bytes)
self.assertPosition(nodes[0], (2, 0), (4, 7), (4, 7))
self.assertSimpleInnerPosition(nodes[0], (2, 1), (4, 6))
@only_python3
def test_bytes4(self):
code = ("#bla\n"
"b'ab' b'cd' b'ef'")
nodes = get_nodes(code, ast.Bytes)
self.assertPosition(nodes[0], (2, 0), (2, 17), (2, 17))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_yield_from(self):
code = ("#bla\n"
"yield from 2")
nodes = get_nodes(code, ast.YieldFrom)
self.assertPosition(nodes[0], (2, 0), (2, 13), (2, 10))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (2, 10), (2, 10), 'yield from')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_yield_from2(self):
code = ("#bla\n"
"yield \\\n"
" from 2")
nodes = get_nodes(code, ast.YieldFrom)
self.assertPosition(nodes[0], (2, 0), (3, 8), (3, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 0), (3, 5), (3, 5), 'yield from')
self.assertNoBeforeInnerAfter(nodes[0])
@only_python3
def test_yield_from3(self):
code = ("#bla\n"
"(yield \n"
"from 2)")
nodes = get_nodes(code, ast.YieldFrom)
self.assertPosition(nodes[0], (2, 0), (3, 8), (3, 4))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (3, 4), (3, 4), 'yield from')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (3, 7))
@only_python3
def test_yield_from4(self):
code = ("#bla\n"
"(yield from(a))\n"
"(yield from(b))")
nodes = get_nodes(code, ast.YieldFrom)
self.assertPosition(nodes[0], (2, 0), (2, 15), (2, 11))
self.assertOperation(nodes[0].op_pos[0], (2, 1), (2, 11), (2, 11), 'yield from')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 14))
self.assertPosition(nodes[1], (3, 0), (3, 15), (3, 11))
self.assertOperation(nodes[1].op_pos[0], (3, 1), (3, 11), (3, 11), 'yield from')
self.assertSimpleInnerPosition(nodes[1], (3, 1), (3, 14))
@only_python36
def test_joined_str(self):
code = ("#bla\n"
"a = 2\n"
"f'{a}'\n")
nodes = get_nodes(code, ast.JoinedStr)
self.assertPosition(nodes[0], (3, 0), (3, 6), (3, 6))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python36
def test_formatted_value(self):
code = ("#bla\n"
"a = 2\n"
"f'{a}'\n")
nodes = get_nodes(code, ast.FormattedValue)
names = get_nodes(code, ast.Name)
self.assertPosition(nodes[0], (3, 2), (3, 5), (3, 5))
self.assertNoBeforeInnerAfter(nodes[0])
self.assertPosition(names[0], (2, 0), (2, 1), (2, 1))
self.assertNoBeforeInnerAfter(names[0])
self.assertPosition(names[1], (3, 3), (3, 4), (3, 4))
self.assertNoBeforeInnerAfter(names[1])
@only_python36
def test_formatted_value2(self):
code = ("#bla\n"
"import decimal\n"
"width, precision = 10, 4\n"
"value = decimal.Decimal('12.34567')\n"
"f'result: {value:{width}.{precision}}'\n")
nodes = get_nodes(code, ast.FormattedValue)
self.assertPosition(nodes[0], (5, 10), (5, 37), (5, 37))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python36
def test_formatted_value3(self):
code = ("#bla\n"
"a = 1\n"
"b = 2\n"
"d = f'a: {a}; b: {b}'\n"
"# other")
nodes = get_nodes(code, ast.FormattedValue)
self.assertPosition(nodes[0], (4, 9), (4, 12), (4, 12))
self.assertPosition(nodes[1], (4, 17), (4, 20), (4, 20))
self.assertNoBeforeInnerAfter(nodes[0])
self.assertNoBeforeInnerAfter(nodes[1])
@only_python36
def test_constant(self):
code = ("#bla\n"
"x = 2\n")
# Constants are created by optimizers
# Thus, we must simulate an optimizer
tree = ast.parse(code)
for node in ast.walk(tree):
if isinstance(node, ast.Assign) and isinstance(node.value, ast.Num):
node.value = ast.copy_location(
ast.Constant(node.value.n),
node.value
)
nodes = get_nodes(code, ast.Constant, tree=tree)
self.assertPosition(nodes[0], (2, 4), (2, 5), (2, 5))
self.assertNoBeforeInnerAfter(nodes[0])
@only_python38
def test_named_expr(self):
code = ("#bla\n"
"(a := 1)")
nodes = get_nodes(code, ast.NamedExpr)
self.assertPosition(nodes[0], (2, 0), (2, 8), (2, 5))
self.assertOperation(nodes[0].op_pos[0], (2, 3), (2, 5), (2, 5), ':=')
self.assertSimpleInnerPosition(nodes[0], (2, 1), (2, 7))
| 38.779026 | 90 | 0.495726 | 5,558 | 41,416 | 3.619827 | 0.048219 | 0.095432 | 0.047666 | 0.059049 | 0.886973 | 0.853919 | 0.828471 | 0.787514 | 0.752274 | 0.708335 | 0 | 0.083853 | 0.298846 | 41,416 | 1,067 | 91 | 38.81537 | 0.608974 | 0.010672 | 0 | 0.550321 | 0 | 0 | 0.059773 | 0.001441 | 0 | 0 | 0.000147 | 0 | 0.388651 | 1 | 0.114561 | false | 0 | 0.005353 | 0 | 0.120985 | 0.002141 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 6 |
31ef3ee2384fa037ee5878d1f32578cf17d40414 | 77 | py | Python | common/trainers/wikiqa_trainer.py | karkaroff/castor | 881673f3dadb4f757fdfdf5d2ab9031e08512406 | [
"Apache-2.0"
] | 132 | 2017-04-02T12:31:55.000Z | 2019-03-09T07:53:29.000Z | common/trainers/wikiqa_trainer.py | sudipta90/castor | fa2f59535c71a0fb4586afbe543b81ba812c8630 | [
"Apache-2.0"
] | 111 | 2017-04-01T23:00:24.000Z | 2019-03-10T08:29:20.000Z | common/trainers/wikiqa_trainer.py | karkaroff/Castor | 881673f3dadb4f757fdfdf5d2ab9031e08512406 | [
"Apache-2.0"
] | 53 | 2017-04-06T01:17:18.000Z | 2019-02-27T03:10:35.000Z | from .qa_trainer import QATrainer
class WikiQATrainer(QATrainer):
pass
| 12.833333 | 33 | 0.779221 | 9 | 77 | 6.555556 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168831 | 77 | 5 | 34 | 15.4 | 0.921875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 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 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
ee1fde0e35d709d947794857f3737bae80ea81cd | 22 | py | Python | catalogs/ngc2000-mid.py | spake/astrometry.net | 12c76f4a44fe90a009eeb962f2ae28b0791829b8 | [
"BSD-3-Clause"
] | 4 | 2018-02-13T23:11:40.000Z | 2021-09-30T16:02:22.000Z | catalogs/ngc2000-mid.py | spake/astrometry.net | 12c76f4a44fe90a009eeb962f2ae28b0791829b8 | [
"BSD-3-Clause"
] | null | null | null | catalogs/ngc2000-mid.py | spake/astrometry.net | 12c76f4a44fe90a009eeb962f2ae28b0791829b8 | [
"BSD-3-Clause"
] | 1 | 2019-02-11T06:56:30.000Z | 2019-02-11T06:56:30.000Z | ]
ngc2000accurate = [
| 7.333333 | 19 | 0.681818 | 1 | 22 | 15 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 0.181818 | 22 | 2 | 20 | 11 | 0.611111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ee738487bc2da929ac10faf9699fb85e76e3d49c | 41 | py | Python | service/__init__.py | janlingen/command_line_stocks | 06860897d4114104d322486ec6bb86c36b53d637 | [
"MIT"
] | 6 | 2022-02-04T17:08:11.000Z | 2022-02-09T14:04:16.000Z | service/__init__.py | janlingen/command_line_stocks | 06860897d4114104d322486ec6bb86c36b53d637 | [
"MIT"
] | null | null | null | service/__init__.py | janlingen/command_line_stocks | 06860897d4114104d322486ec6bb86c36b53d637 | [
"MIT"
] | null | null | null | from service.information_filter import *
| 20.5 | 40 | 0.853659 | 5 | 41 | 6.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | 41 | 1 | 41 | 41 | 0.918919 | 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 | 1 | 0 | 0 | 6 |
c9be6ae277ceb7221c015bb0ad230b27dcc35a38 | 5,482 | py | Python | 013.py | gconsidine/project-euler | 4b3571b7544c1ebf52c4752e7dde7360aa61fc70 | [
"MIT"
] | 1 | 2017-04-22T11:40:01.000Z | 2017-04-22T11:40:01.000Z | 013.py | gconsidine/project-euler | 4b3571b7544c1ebf52c4752e7dde7360aa61fc70 | [
"MIT"
] | null | null | null | 013.py | gconsidine/project-euler | 4b3571b7544c1ebf52c4752e7dde7360aa61fc70 | [
"MIT"
] | null | null | null | #Greg Considine
#Project Euler -- Problem 13
rawPaste = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
47451445736001306439091167216856844588711603153276
70386486105843025439939619828917593665686757934951
62176457141856560629502157223196586755079324193331
64906352462741904929101432445813822663347944758178
92575867718337217661963751590579239728245598838407
58203565325359399008402633568948830189458628227828
80181199384826282014278194139940567587151170094390
35398664372827112653829987240784473053190104293586
86515506006295864861532075273371959191420517255829
71693888707715466499115593487603532921714970056938
54370070576826684624621495650076471787294438377604
53282654108756828443191190634694037855217779295145
36123272525000296071075082563815656710885258350721
45876576172410976447339110607218265236877223636045
17423706905851860660448207621209813287860733969412
81142660418086830619328460811191061556940512689692
51934325451728388641918047049293215058642563049483
62467221648435076201727918039944693004732956340691
15732444386908125794514089057706229429197107928209
55037687525678773091862540744969844508330393682126
18336384825330154686196124348767681297534375946515
80386287592878490201521685554828717201219257766954
78182833757993103614740356856449095527097864797581
16726320100436897842553539920931837441497806860984
48403098129077791799088218795327364475675590848030
87086987551392711854517078544161852424320693150332
59959406895756536782107074926966537676326235447210
69793950679652694742597709739166693763042633987085
41052684708299085211399427365734116182760315001271
65378607361501080857009149939512557028198746004375
35829035317434717326932123578154982629742552737307
94953759765105305946966067683156574377167401875275
88902802571733229619176668713819931811048770190271
25267680276078003013678680992525463401061632866526
36270218540497705585629946580636237993140746255962
24074486908231174977792365466257246923322810917141
91430288197103288597806669760892938638285025333403
34413065578016127815921815005561868836468420090470
23053081172816430487623791969842487255036638784583
11487696932154902810424020138335124462181441773470
63783299490636259666498587618221225225512486764533
67720186971698544312419572409913959008952310058822
95548255300263520781532296796249481641953868218774
76085327132285723110424803456124867697064507995236
37774242535411291684276865538926205024910326572967
23701913275725675285653248258265463092207058596522
29798860272258331913126375147341994889534765745501
18495701454879288984856827726077713721403798879715
38298203783031473527721580348144513491373226651381
34829543829199918180278916522431027392251122869539
40957953066405232632538044100059654939159879593635
29746152185502371307642255121183693803580388584903
41698116222072977186158236678424689157993532961922
62467957194401269043877107275048102390895523597457
23189706772547915061505504953922979530901129967519
86188088225875314529584099251203829009407770775672
11306739708304724483816533873502340845647058077308
82959174767140363198008187129011875491310547126581
97623331044818386269515456334926366572897563400500
42846280183517070527831839425882145521227251250327
55121603546981200581762165212827652751691296897789
32238195734329339946437501907836945765883352399886
75506164965184775180738168837861091527357929701337
62177842752192623401942399639168044983993173312731
32924185707147349566916674687634660915035914677504
99518671430235219628894890102423325116913619626622
73267460800591547471830798392868535206946944540724
76841822524674417161514036427982273348055556214818
97142617910342598647204516893989422179826088076852
87783646182799346313767754307809363333018982642090
10848802521674670883215120185883543223812876952786
71329612474782464538636993009049310363619763878039
62184073572399794223406235393808339651327408011116
66627891981488087797941876876144230030984490851411
60661826293682836764744779239180335110989069790714
85786944089552990653640447425576083659976645795096
66024396409905389607120198219976047599490197230297
64913982680032973156037120041377903785566085089252
16730939319872750275468906903707539413042652315011
94809377245048795150954100921645863754710598436791
78639167021187492431995700641917969777599028300699
15368713711936614952811305876380278410754449733078
40789923115535562561142322423255033685442488917353
44889911501440648020369068063960672322193204149535
41503128880339536053299340368006977710650566631954
81234880673210146739058568557934581403627822703280
82616570773948327592232845941706525094512325230608
22918802058777319719839450180888072429661980811197
77158542502016545090413245809786882778948721859617
72107838435069186155435662884062257473692284509516
20849603980134001723930671666823555245252804609722
53503534226472524250874054075591789781264330331690"""
sum = 0
for i in range(0, 100):
sum += int(rawPaste[i*50+i:i*50+50+i])
print(sum)
'''
I figured I might as well start off with a brute-force attempt since Python
is capable of working with arbitrarily large values. Turns out no refinement
was necessary -- the correct (non-truncated) sum was found in .024s.
'''
| 46.854701 | 77 | 0.961146 | 165 | 5,482 | 31.933333 | 0.90303 | 0.001139 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.943922 | 0.030646 | 5,482 | 116 | 78 | 47.258621 | 0.04761 | 0.007479 | 0 | 0 | 0 | 0 | 0.978883 | 0.959877 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.009615 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
c9e2ca7e4b70b39a36ea053ebab927f50e548bad | 1,561 | py | Python | src/scs_dfe/interface/interface.py | south-coast-science/scs_dfe_eng | 05708b27ba65438d11fad0d947bcff3df37dc87d | [
"MIT"
] | null | null | null | src/scs_dfe/interface/interface.py | south-coast-science/scs_dfe_eng | 05708b27ba65438d11fad0d947bcff3df37dc87d | [
"MIT"
] | null | null | null | src/scs_dfe/interface/interface.py | south-coast-science/scs_dfe_eng | 05708b27ba65438d11fad0d947bcff3df37dc87d | [
"MIT"
] | 2 | 2017-12-05T12:41:48.000Z | 2019-09-29T14:41:30.000Z | """
Created on 20 Jun 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
An abstract system interface
"""
from abc import ABC, abstractmethod
# --------------------------------------------------------------------------------------------------------------------
class Interface(ABC):
"""
classdocs
"""
# ----------------------------------------------------------------------------------------------------------------
@abstractmethod
def status(self):
pass
@abstractmethod
def null_datum(self):
pass
# ----------------------------------------------------------------------------------------------------------------
@abstractmethod
def gas_sensors(self, host):
pass
@abstractmethod
def pt1000(self, host):
pass
@abstractmethod
def pt1000_adc(self, gain, rate):
pass
# ----------------------------------------------------------------------------------------------------------------
@abstractmethod
def led(self):
pass
# ----------------------------------------------------------------------------------------------------------------
@abstractmethod
def power_gases(self, on): # switches digital component only
pass
@abstractmethod
def power_gps(self, on):
pass
@abstractmethod
def power_modem(self, on):
pass
@abstractmethod
def power_ndir(self, on):
pass
@abstractmethod
def power_opc(self, on):
pass
| 20.012821 | 118 | 0.366432 | 101 | 1,561 | 5.584158 | 0.435644 | 0.33156 | 0.37234 | 0.230496 | 0.294326 | 0.294326 | 0 | 0 | 0 | 0 | 0 | 0.011494 | 0.219731 | 1,561 | 77 | 119 | 20.272727 | 0.45156 | 0.463805 | 0 | 0.628571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.314286 | false | 0.314286 | 0.028571 | 0 | 0.371429 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
a003ef79b149f0f62ae533496392b1cc94c5ef54 | 6 | py | Python | test/parse/t00.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 2,671 | 2015-01-03T08:23:25.000Z | 2022-03-31T06:15:48.000Z | test/parse/t00.py | csev/skulpt | 9aa25b7dbf29f23ee8d3140d01a6f4353d12e66f | [
"MIT"
] | 972 | 2015-01-05T08:11:00.000Z | 2022-03-29T13:47:15.000Z | test/parse/t00.py | csev/skulpt | 9aa25b7dbf29f23ee8d3140d01a6f4353d12e66f | [
"MIT"
] | 845 | 2015-01-03T19:53:36.000Z | 2022-03-29T18:34:22.000Z | y = 1
| 3 | 5 | 0.333333 | 2 | 6 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 0.5 | 6 | 1 | 6 | 6 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 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 | 6 |
4e43e4a9b228e0ea2ab64cc22a467b49e826c52d | 112 | py | Python | omnisonica/clients/test.py | smershon/omnisonica | 0ef3cbabf30d27af227e4bf907ee907dc6445954 | [
"MIT"
] | 1 | 2016-05-12T23:20:40.000Z | 2016-05-12T23:20:40.000Z | omnisonica/clients/test.py | smershon/omnisonica | 0ef3cbabf30d27af227e4bf907ee907dc6445954 | [
"MIT"
] | null | null | null | omnisonica/clients/test.py | smershon/omnisonica | 0ef3cbabf30d27af227e4bf907ee907dc6445954 | [
"MIT"
] | null | null | null | import omni_redis, sys, track_worker
print track_worker.get_original_release(omni_redis.get_track(sys.argv[1])) | 37.333333 | 74 | 0.848214 | 19 | 112 | 4.631579 | 0.631579 | 0.204545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009434 | 0.053571 | 112 | 3 | 74 | 37.333333 | 0.820755 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.5 | null | null | 0.5 | 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 | 1 | 0 | 6 |
14cf442282e87bdb50ea23f3e334c908313c603e | 22 | py | Python | h2o-py/tests/pyunit_utils/__init__.py | huamichaelchen/h2o-3 | 2b52f2240652a1c73c1708762248c0773d0c073e | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/pyunit_utils/__init__.py | huamichaelchen/h2o-3 | 2b52f2240652a1c73c1708762248c0773d0c073e | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/pyunit_utils/__init__.py | huamichaelchen/h2o-3 | 2b52f2240652a1c73c1708762248c0773d0c073e | [
"Apache-2.0"
] | 1 | 2020-01-22T19:10:37.000Z | 2020-01-22T19:10:37.000Z | from utilsPY import *
| 11 | 21 | 0.772727 | 3 | 22 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 22 | 1 | 22 | 22 | 0.944444 | 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 | 1 | 0 | 0 | 6 |
0963a40232962ba676d4cc79730cf1bb0023ce31 | 35 | py | Python | build/lib/instabotpy/__init__.py | Krish-ds/Instagram_Bot | 5404fd876102ad00ff9869f240094c74ae3e615a | [
"MIT"
] | 1 | 2020-07-17T12:48:31.000Z | 2020-07-17T12:48:31.000Z | build/lib/instabotpy/__init__.py | Krish-ds/Instagram_Bot | 5404fd876102ad00ff9869f240094c74ae3e615a | [
"MIT"
] | null | null | null | build/lib/instabotpy/__init__.py | Krish-ds/Instagram_Bot | 5404fd876102ad00ff9869f240094c74ae3e615a | [
"MIT"
] | 1 | 2021-04-10T17:13:25.000Z | 2021-04-10T17:13:25.000Z | from instabotpy.instabotpy import * | 35 | 35 | 0.857143 | 4 | 35 | 7.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085714 | 35 | 1 | 35 | 35 | 0.9375 | 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 | 1 | 0 | 0 | 6 |
1174c1b6a61a4c75d4c0f2b8ae3a28bb82779f4a | 389 | py | Python | deepscratch/models/layers/layer.py | arnaldog12/deeplearning-from-scratch | afa1e3796f73b86d3b17bfbc88b7b57a5346fb9b | [
"MIT"
] | 2 | 2019-03-14T16:08:18.000Z | 2020-12-07T10:00:32.000Z | deepscratch/models/layers/layer.py | arnaldog12/deeplearning-from-scratch | afa1e3796f73b86d3b17bfbc88b7b57a5346fb9b | [
"MIT"
] | null | null | null | deepscratch/models/layers/layer.py | arnaldog12/deeplearning-from-scratch | afa1e3796f73b86d3b17bfbc88b7b57a5346fb9b | [
"MIT"
] | null | null | null | import numpy as np
class Layer(object):
def __init__(self):
self.input_shape = None
def forward(self, data):
return NotImplementedError()
def backward(self, grads):
return NotImplementedError()
def initialize(self, initializer, otimizer, input_shape, **kwargs):
pass
def output_shape(self):
return NotImplementedError() | 21.611111 | 71 | 0.652956 | 41 | 389 | 6.02439 | 0.609756 | 0.303644 | 0.226721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25964 | 389 | 18 | 72 | 21.611111 | 0.857639 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0.083333 | 0.083333 | 0.25 | 0.833333 | 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 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 6 |
119c85d3811d76fb235c7edbe9c30bfb848b2790 | 26 | py | Python | tests/test_bot/src/annofwd/__init__.py | Ketre3/vkquick | 81b19111e2322d277bfbb89dae6a27fb70a9b8c7 | [
"MIT"
] | null | null | null | tests/test_bot/src/annofwd/__init__.py | Ketre3/vkquick | 81b19111e2322d277bfbb89dae6a27fb70a9b8c7 | [
"MIT"
] | null | null | null | tests/test_bot/src/annofwd/__init__.py | Ketre3/vkquick | 81b19111e2322d277bfbb89dae6a27fb70a9b8c7 | [
"MIT"
] | null | null | null | from .main import annofwd
| 13 | 25 | 0.807692 | 4 | 26 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 26 | 1 | 26 | 26 | 0.954545 | 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 | 1 | 0 | 0 | 6 |
eebef1762eb3d8221a93916f6472be7ee79999d3 | 99 | py | Python | scripts/generate_encoder_model.py | beckstev/MachineLearningSeminar | f6aa4affb0be5db40e64ba64236519fb53401b5f | [
"MIT"
] | null | null | null | scripts/generate_encoder_model.py | beckstev/MachineLearningSeminar | f6aa4affb0be5db40e64ba64236519fb53401b5f | [
"MIT"
] | 23 | 2019-04-29T19:08:35.000Z | 2020-09-25T23:46:14.000Z | scripts/generate_encoder_model.py | beckstev/MachineLearningSeminar | f6aa4affb0be5db40e64ba64236519fb53401b5f | [
"MIT"
] | 1 | 2019-05-09T21:17:01.000Z | 2019-05-09T21:17:01.000Z | from dog_classifier.io.create_encoder_model import create_encoder_model
create_encoder_model()
| 24.75 | 71 | 0.868687 | 14 | 99 | 5.642857 | 0.571429 | 0.493671 | 0.683544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 99 | 3 | 72 | 33 | 0.877778 | 0 | 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 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
eeedaa024a82ae2fc948dcfe450974bd9a6e91be | 44 | py | Python | extremecrawler/__init__.py | uehara1414/ExtremeCrawler | 1ee22d82e88405bbc22d6bfd851f584fd4a0fd6c | [
"MIT"
] | null | null | null | extremecrawler/__init__.py | uehara1414/ExtremeCrawler | 1ee22d82e88405bbc22d6bfd851f584fd4a0fd6c | [
"MIT"
] | null | null | null | extremecrawler/__init__.py | uehara1414/ExtremeCrawler | 1ee22d82e88405bbc22d6bfd851f584fd4a0fd6c | [
"MIT"
] | null | null | null | from .extreme_crawler import ExtremeCrawler
| 22 | 43 | 0.886364 | 5 | 44 | 7.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 44 | 1 | 44 | 44 | 0.95 | 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 | 1 | 0 | 0 | 6 |
e108eb54e31c7a70d2c6085b35f5ab086b6e3a74 | 61 | py | Python | buzzni/ai/reco/mlserving/predictors/tensorflow/__init__.py | BuzzniAILab/mlserving | 8b8add9dbe5cdd6392e0c87ee789492de0a1c70e | [
"MIT"
] | 13 | 2020-08-23T17:35:53.000Z | 2022-02-10T14:14:03.000Z | mlserving/predictors/tensorflow/__init__.py | orlevi111/ganesha | 137cc388806fc98f7768298da01ebeddf03f9464 | [
"MIT"
] | 3 | 2020-08-20T21:09:01.000Z | 2021-06-25T15:33:54.000Z | mlserving/predictors/tensorflow/__init__.py | orlevi111/ganesha | 137cc388806fc98f7768298da01ebeddf03f9464 | [
"MIT"
] | 3 | 2021-04-12T01:56:22.000Z | 2021-10-05T12:50:12.000Z | from .http import TFServingPrediction, TFServingRequestError
| 30.5 | 60 | 0.885246 | 5 | 61 | 10.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081967 | 61 | 1 | 61 | 61 | 0.964286 | 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 | 1 | 0 | 0 | 6 |
010c39a8054dae42bdcde14d275c6a2ba4473be5 | 48 | py | Python | tests.py | SykoTheKiD/Cords | aed15a492d116e22690b4fa34ce6c40d662a0aee | [
"MIT"
] | null | null | null | tests.py | SykoTheKiD/Cords | aed15a492d116e22690b4fa34ce6c40d662a0aee | [
"MIT"
] | null | null | null | tests.py | SykoTheKiD/Cords | aed15a492d116e22690b4fa34ce6c40d662a0aee | [
"MIT"
] | null | null | null | # !/usr/local/bin/python3
# TODO: Add unit tests | 24 | 25 | 0.708333 | 8 | 48 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02381 | 0.125 | 48 | 2 | 26 | 24 | 0.785714 | 0.916667 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
010ce9b2c833e3560c460a8e0397591daf485cd4 | 21 | py | Python | cexapi/__init__.py | llazzaro/cex.io-api-python | 654b66672180b7f34fb618b740080e47f9164a29 | [
"MIT"
] | 55 | 2015-01-02T05:24:43.000Z | 2021-04-03T16:20:04.000Z | cexapi/__init__.py | llazzaro/cex.io-api-python | 654b66672180b7f34fb618b740080e47f9164a29 | [
"MIT"
] | 6 | 2015-06-16T21:34:08.000Z | 2020-06-27T18:00:14.000Z | cexapi/__init__.py | llazzaro/cex.io-api-python | 654b66672180b7f34fb618b740080e47f9164a29 | [
"MIT"
] | 42 | 2016-09-16T05:27:17.000Z | 2022-01-03T14:15:33.000Z | from cexapi import *
| 10.5 | 20 | 0.761905 | 3 | 21 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 21 | 1 | 21 | 21 | 0.941176 | 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 | 1 | 0 | 0 | 6 |
011c903e87fadb6fc5eb88b5542f7b8d5bc36081 | 180 | py | Python | metadata-ingestion/src/datahub/metadata/com/linkedin/pegasus2avro/dataplatform/__init__.py | NathanFaught/datahub | f91062d82796cb56909623a5bc4d2d50edbb6a67 | [
"Apache-2.0"
] | null | null | null | metadata-ingestion/src/datahub/metadata/com/linkedin/pegasus2avro/dataplatform/__init__.py | NathanFaught/datahub | f91062d82796cb56909623a5bc4d2d50edbb6a67 | [
"Apache-2.0"
] | 3 | 2022-02-14T13:39:45.000Z | 2022-02-27T17:32:49.000Z | metadata-ingestion/src/datahub/metadata/com/linkedin/pegasus2avro/dataplatform/__init__.py | Jocker08/datahub | 91eb3cc57e183fa1951349177e59df3f3897c8e0 | [
"Apache-2.0"
] | null | null | null | from .....schema_classes import DataPlatformInfoClass
from .....schema_classes import PlatformTypeClass
DataPlatformInfo = DataPlatformInfoClass
PlatformType = PlatformTypeClass
| 25.714286 | 53 | 0.844444 | 14 | 180 | 10.714286 | 0.571429 | 0.133333 | 0.226667 | 0.306667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088889 | 180 | 6 | 54 | 30 | 0.914634 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 1 | 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 | 0 | 0 | 0 | 6 |
6d9b38470c80233044e4a9e90e88974252eaf0d7 | 48 | py | Python | discordbot/bot_utils/__init__.py | rauenzi/discordbot.py | 39bb98dae4e49487e6c6c597f85fc41c74b62bb8 | [
"MIT"
] | 31 | 2017-07-18T21:59:52.000Z | 2021-11-30T10:52:13.000Z | discordbot/bot_utils/__init__.py | Sheeyre/discordbot.py | 39bb98dae4e49487e6c6c597f85fc41c74b62bb8 | [
"MIT"
] | 3 | 2018-04-09T02:36:42.000Z | 2019-04-18T18:46:49.000Z | discordbot/bot_utils/__init__.py | Sheeyre/discordbot.py | 39bb98dae4e49487e6c6c597f85fc41c74b62bb8 | [
"MIT"
] | 22 | 2017-07-24T20:39:16.000Z | 2021-05-17T21:26:17.000Z | from . import checks, config, formats, paginator | 48 | 48 | 0.791667 | 6 | 48 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 48 | 1 | 48 | 48 | 0.904762 | 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 | 1 | 0 | 0 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.