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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e3e80ebc6d85001b8b9fd0bed7cb64cbeed81ef5
| 24
|
py
|
Python
|
pycydemo/__init__.py
|
alexlib/python-cython-ci-example
|
26670b80b832703dcab6a121b52b6f7cad9cb1c2
|
[
"CC0-1.0"
] | 12
|
2017-08-28T07:51:29.000Z
|
2021-03-13T23:26:53.000Z
|
pycydemo/__init__.py
|
alexlib/python-cython-ci-example
|
26670b80b832703dcab6a121b52b6f7cad9cb1c2
|
[
"CC0-1.0"
] | 22
|
2017-08-17T23:25:02.000Z
|
2018-09-18T19:48:16.000Z
|
pycydemo/__init__.py
|
alexlib/python-cython-ci-example
|
26670b80b832703dcab6a121b52b6f7cad9cb1c2
|
[
"CC0-1.0"
] | 8
|
2017-08-17T21:25:11.000Z
|
2020-09-18T09:41:35.000Z
|
"""Pycydemo package."""
| 12
| 23
| 0.625
| 2
| 24
| 7.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 24
| 1
| 24
| 24
| 0.681818
| 0.708333
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e3f8d84abaead193edd359862a5346ad64d72fd2
| 166
|
py
|
Python
|
app/components/component_repository.py
|
Noctiphobia/MissionControl
|
7de0f764f337eb3b619dce0e925d357ed5fdc580
|
[
"MIT"
] | null | null | null |
app/components/component_repository.py
|
Noctiphobia/MissionControl
|
7de0f764f337eb3b619dce0e925d357ed5fdc580
|
[
"MIT"
] | null | null | null |
app/components/component_repository.py
|
Noctiphobia/MissionControl
|
7de0f764f337eb3b619dce0e925d357ed5fdc580
|
[
"MIT"
] | null | null | null |
from app.components.config import Config
class ComponentRepository:
def __init__(self, config: Config) -> None:
self.servers = config.create_servers()
| 20.75
| 47
| 0.728916
| 19
| 166
| 6.105263
| 0.684211
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180723
| 166
| 7
| 48
| 23.714286
| 0.852941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
e3ff67d001465a27a34bfd7c81f2e77de4205721
| 213
|
py
|
Python
|
strings_designer_door_mat.py
|
scriptingHacks/python_HackerRank
|
9aba0c2235980d4992abfa86138e0e954e51c43d
|
[
"MIT"
] | null | null | null |
strings_designer_door_mat.py
|
scriptingHacks/python_HackerRank
|
9aba0c2235980d4992abfa86138e0e954e51c43d
|
[
"MIT"
] | null | null | null |
strings_designer_door_mat.py
|
scriptingHacks/python_HackerRank
|
9aba0c2235980d4992abfa86138e0e954e51c43d
|
[
"MIT"
] | 1
|
2020-02-05T21:11:55.000Z
|
2020-02-05T21:11:55.000Z
|
N, M = map(int, input().split())
for i in range(1, N, 2):
print(''.join(['.|.'] * i).center(M, '-'))
print("WELCOME".center(M, '-'))
for i in range(N-2, -1, -2):
print(''.join(['.|.'] * i).center(M, '-'))
| 30.428571
| 46
| 0.469484
| 35
| 213
| 2.857143
| 0.457143
| 0.21
| 0.12
| 0.22
| 0.36
| 0.36
| 0
| 0
| 0
| 0
| 0
| 0.02809
| 0.164319
| 213
| 6
| 47
| 35.5
| 0.533708
| 0
| 0
| 0.333333
| 0
| 0
| 0.075117
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
58216775d983129c032bf7bfe3ecdfa9f21502de
| 32
|
py
|
Python
|
dajaxice/__init__.py
|
seawaywen/django-dajaxice
|
7cb384e693bca26fc2dd79b1003a1c2a7fc21ac0
|
[
"BSD-3-Clause"
] | 1
|
2015-01-03T18:15:52.000Z
|
2015-01-03T18:15:52.000Z
|
dajaxice/__init__.py
|
seawaywen/django-dajaxice
|
7cb384e693bca26fc2dd79b1003a1c2a7fc21ac0
|
[
"BSD-3-Clause"
] | null | null | null |
dajaxice/__init__.py
|
seawaywen/django-dajaxice
|
7cb384e693bca26fc2dd79b1003a1c2a7fc21ac0
|
[
"BSD-3-Clause"
] | null | null | null |
__version__ = (0, 5, 6, 'beta')
| 16
| 31
| 0.5625
| 5
| 32
| 2.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 0.1875
| 32
| 1
| 32
| 32
| 0.423077
| 0
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5827cdc9313901fbc864609c64243cebf97bdecb
| 164
|
py
|
Python
|
_site/assets/python_con/py_thread/timer.py
|
TrumanStateACM/acm
|
4ab7acd4e41f85db5204cc6c400d26696fdd59b0
|
[
"MIT"
] | 2
|
2018-04-13T00:12:29.000Z
|
2020-10-27T00:15:45.000Z
|
assets/python_con/py_thread/timer.py
|
TrumanStateACM/acm
|
4ab7acd4e41f85db5204cc6c400d26696fdd59b0
|
[
"MIT"
] | null | null | null |
assets/python_con/py_thread/timer.py
|
TrumanStateACM/acm
|
4ab7acd4e41f85db5204cc6c400d26696fdd59b0
|
[
"MIT"
] | null | null | null |
from time import time
class Timer:
def __init__(self):
self.t = time()
def now(self):
print('Elapsed sec: {:.6f}'.format(time() - self.t))
| 20.5
| 60
| 0.573171
| 23
| 164
| 3.913043
| 0.652174
| 0.111111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008264
| 0.262195
| 164
| 7
| 61
| 23.428571
| 0.735537
| 0
| 0
| 0
| 0
| 0
| 0.115854
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.166667
| 0
| 0.666667
| 0.166667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
584ad3a13706f1297230f7b7ea715781ea8caae6
| 290
|
py
|
Python
|
config.py
|
BTENordicBaltic/BTE-Starship
|
7fd35f7330ac7aded2ad73965f4559d540740d40
|
[
"Apache-2.0"
] | null | null | null |
config.py
|
BTENordicBaltic/BTE-Starship
|
7fd35f7330ac7aded2ad73965f4559d540740d40
|
[
"Apache-2.0"
] | null | null | null |
config.py
|
BTENordicBaltic/BTE-Starship
|
7fd35f7330ac7aded2ad73965f4559d540740d40
|
[
"Apache-2.0"
] | 1
|
2020-08-14T12:00:39.000Z
|
2020-08-14T12:00:39.000Z
|
config_prefix = '='
config_description = 'Use =help to get started!'
config_owner_id = 311661241406062592
config_bot_log_channel = 741486105173688351
config_command_log_channel = 741486105173688351
config_error_log_channel = 741486105173688351
config_guild_log_channel = 741486105173688351
| 36.25
| 48
| 0.865517
| 33
| 290
| 7.121212
| 0.545455
| 0.170213
| 0.476596
| 0.434043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.339623
| 0.086207
| 290
| 7
| 49
| 41.428571
| 0.54717
| 0
| 0
| 0
| 0
| 0
| 0.089655
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
58601dc00a4c9b9c3f52407918965767b12cb2e0
| 133
|
py
|
Python
|
Variables/Type conversion/type_cast.py
|
bormaley999/PyCharm_Introduction_to_Python
|
9100bffa1167cff2e78907c890e9baef4dc43351
|
[
"MIT"
] | null | null | null |
Variables/Type conversion/type_cast.py
|
bormaley999/PyCharm_Introduction_to_Python
|
9100bffa1167cff2e78907c890e9baef4dc43351
|
[
"MIT"
] | null | null | null |
Variables/Type conversion/type_cast.py
|
bormaley999/PyCharm_Introduction_to_Python
|
9100bffa1167cff2e78907c890e9baef4dc43351
|
[
"MIT"
] | null | null | null |
number = 9
print(type(number)) # print type of variable "number"
float_number = 9.0
print(float_number)
print(int(float_number))
| 16.625
| 55
| 0.736842
| 21
| 133
| 4.52381
| 0.428571
| 0.347368
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026316
| 0.142857
| 133
| 7
| 56
| 19
| 0.807018
| 0.233083
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.6
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
5861e9fde797d2ddf971b2a7aa8dfda85be86d30
| 59
|
py
|
Python
|
Python/05_TipsTrics_Sync/demo_pro.py
|
esrinederland/DevDay-2020
|
165daf41accb8a7d7bd231969293d59800428e60
|
[
"MIT"
] | 1
|
2021-01-11T11:29:09.000Z
|
2021-01-11T11:29:09.000Z
|
Python/05_TipsTrics_Sync/demo_pro.py
|
esrinederland/DevDay-2020
|
165daf41accb8a7d7bd231969293d59800428e60
|
[
"MIT"
] | null | null | null |
Python/05_TipsTrics_Sync/demo_pro.py
|
esrinederland/DevDay-2020
|
165daf41accb8a7d7bd231969293d59800428e60
|
[
"MIT"
] | null | null | null |
import arcgis
gis = arcgis.GIS("pro")
print(gis.users.me)
| 11.8
| 23
| 0.711864
| 10
| 59
| 4.2
| 0.7
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118644
| 59
| 5
| 24
| 11.8
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0.05
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 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
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
58655035c98f7d82353fe50acafaeddf46188707
| 355
|
py
|
Python
|
torch/_package/__init__.py
|
jsun94/nimble
|
e5c899a69677818b1becc58100577441e15ede13
|
[
"BSD-3-Clause"
] | 206
|
2020-11-28T22:56:38.000Z
|
2022-03-27T02:33:04.000Z
|
torch/_package/__init__.py
|
jsun94/nimble
|
e5c899a69677818b1becc58100577441e15ede13
|
[
"BSD-3-Clause"
] | 19
|
2020-12-09T23:13:14.000Z
|
2022-01-24T23:24:08.000Z
|
torch/_package/__init__.py
|
jsun94/nimble
|
e5c899a69677818b1becc58100577441e15ede13
|
[
"BSD-3-Clause"
] | 28
|
2020-11-29T15:25:12.000Z
|
2022-01-20T02:16:27.000Z
|
"""torch.package: A way to package model data and code.
.. DANGER::
This module is a prototype and should not be used for anything real. The
APIs and package format are subject to change without warning. Issues filed
against this module may not receive support.
"""
from .importer import PackageImporter
from .exporter import PackageExporter
| 35.5
| 79
| 0.76338
| 52
| 355
| 5.211538
| 0.788462
| 0.073801
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185915
| 355
| 9
| 80
| 39.444444
| 0.937716
| 0.76338
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
5880977ea6559593afa1e5d3e92568893a290550
| 140
|
py
|
Python
|
api/apps.py
|
IFRCGo/ifrcgo-api
|
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
|
[
"MIT"
] | 11
|
2018-06-11T06:05:12.000Z
|
2022-03-25T09:31:44.000Z
|
api/apps.py
|
IFRCGo/ifrcgo-api
|
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
|
[
"MIT"
] | 498
|
2017-11-07T21:20:13.000Z
|
2022-03-31T14:37:18.000Z
|
api/apps.py
|
IFRCGo/ifrcgo-api
|
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
|
[
"MIT"
] | 6
|
2018-04-11T13:29:50.000Z
|
2020-07-16T16:52:11.000Z
|
from django.utils.translation import ugettext_lazy as _
from django.apps import AppConfig
class ApiConfig(AppConfig):
name = _('api')
| 20
| 55
| 0.771429
| 18
| 140
| 5.833333
| 0.777778
| 0.190476
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 140
| 6
| 56
| 23.333333
| 0.882353
| 0
| 0
| 0
| 0
| 0
| 0.021429
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
544d4bec2c24487b2838cc6e324ce7ac9c47b514
| 242
|
py
|
Python
|
ui/component/component.py
|
kenganong/goals-and-goblins
|
bd46927028979793c8b0ccd187caad3a7e2e0c53
|
[
"Apache-2.0"
] | null | null | null |
ui/component/component.py
|
kenganong/goals-and-goblins
|
bd46927028979793c8b0ccd187caad3a7e2e0c53
|
[
"Apache-2.0"
] | 14
|
2018-08-07T20:55:31.000Z
|
2019-01-02T13:50:06.000Z
|
ui/component/component.py
|
kenganong/goals-and-goblins
|
bd46927028979793c8b0ccd187caad3a7e2e0c53
|
[
"Apache-2.0"
] | null | null | null |
class Component:
def __init__(self, position):
self.position = position
self.dirty = True
self.focus = False
def update(self, screen):
if self.dirty:
screen.blit(self.surface, self.position)
self.dirty = False
| 24.2
| 46
| 0.665289
| 31
| 242
| 5.064516
| 0.483871
| 0.229299
| 0.203822
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.231405
| 242
| 9
| 47
| 26.888889
| 0.844086
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0
| 0
| 0.333333
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
5457372daabe23763fac556b517684c7abb59731
| 127
|
py
|
Python
|
07 Capstone - Detect breast cancer metastases/gcnn/__init__.py
|
jhorchler/udacity-machine-learning-engineer
|
65b806951c9c0c4faef1ec2db7f0dbb987f11922
|
[
"MIT"
] | null | null | null |
07 Capstone - Detect breast cancer metastases/gcnn/__init__.py
|
jhorchler/udacity-machine-learning-engineer
|
65b806951c9c0c4faef1ec2db7f0dbb987f11922
|
[
"MIT"
] | null | null | null |
07 Capstone - Detect breast cancer metastases/gcnn/__init__.py
|
jhorchler/udacity-machine-learning-engineer
|
65b806951c9c0c4faef1ec2db7f0dbb987f11922
|
[
"MIT"
] | null | null | null |
from .models import AllConvNet, AllGConvNet, GConvNet
from .helpers import train_one_epoch, validate_model, train_and_validate
| 42.333333
| 72
| 0.858268
| 17
| 127
| 6.117647
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094488
| 127
| 2
| 73
| 63.5
| 0.904348
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
54833796995cd5e10f65e72576f230383119499a
| 762
|
py
|
Python
|
snippet/example/python/project/project/main.py
|
yp2800/snippet
|
054af596655007cbec81340bd166489e706fffe6
|
[
"MIT"
] | 94
|
2016-09-22T09:13:19.000Z
|
2022-03-30T07:35:35.000Z
|
snippet/example/python/project/project/main.py
|
yp2800/snippet
|
054af596655007cbec81340bd166489e706fffe6
|
[
"MIT"
] | 1
|
2020-11-22T03:05:05.000Z
|
2020-11-22T03:05:05.000Z
|
snippet/example/python/project/project/main.py
|
yp2800/snippet
|
054af596655007cbec81340bd166489e706fffe6
|
[
"MIT"
] | 38
|
2017-06-11T22:03:04.000Z
|
2022-03-10T07:46:39.000Z
|
#!/usr/bin/python
# encoding: utf-8
from __future__ import absolute_import, print_function, unicode_literals, division
try:
import gevent.monkey
gevent.monkey.patch_all(httplib=True, sys=True, Event=True)
except ImportError:
pass
import logging
from oslo_config.cfg import CONF
from {PROJECT}._option import global_opts
from {PROJECT}.common.logging import init_logging
from {PROJECT}.common import utils
LOG = logging.getLogger(__name__)
CONF.register_cli_opts(global_opts)
def main(project="example", version=None):
CONF(project=project, version=get_version(project, version))
init_logging(logging.getLogger(project), level=CONF.log_level,
log_file=CONF.log_file)
# TODO
if __name__ == '__main__':
main()
| 23.090909
| 82
| 0.751969
| 102
| 762
| 5.303922
| 0.529412
| 0.060998
| 0.062847
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.001541
| 0.148294
| 762
| 32
| 83
| 23.8125
| 0.832049
| 0.048556
| 0
| 0
| 0
| 0
| 0.020776
| 0
| 0
| 0
| 0
| 0.03125
| 0
| 0
| null | null | 0.052632
| 0.421053
| null | null | 0.052632
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
54a93ad8b4fb150ec1936aefbdf2d058cf049272
| 392
|
py
|
Python
|
sudokuextract/exceptions.py
|
s-raza/sudokuextract
|
247ad58a1af3e5db0de38ce33bc5e4ed9d740e6a
|
[
"MIT"
] | 6
|
2016-05-26T04:14:01.000Z
|
2019-07-26T18:03:42.000Z
|
sudokuextract/exceptions.py
|
s-raza/sudokuextract
|
247ad58a1af3e5db0de38ce33bc5e4ed9d740e6a
|
[
"MIT"
] | 3
|
2019-07-08T10:06:38.000Z
|
2020-01-23T06:56:32.000Z
|
sudokuextract/exceptions.py
|
s-raza/sudokuextract
|
247ad58a1af3e5db0de38ce33bc5e4ed9d740e6a
|
[
"MIT"
] | 4
|
2016-04-29T12:19:42.000Z
|
2020-01-20T07:40:06.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`exceptions`
==================
Created by hbldh <henrik.blidh@nedomkull.com>
Created on 2016-02-11
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
class SudokuExtractError(Exception):
"""General error for this package."""
| 19.6
| 45
| 0.721939
| 48
| 392
| 5.5
| 0.770833
| 0.151515
| 0.242424
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.026316
| 0.127551
| 392
| 19
| 46
| 20.631579
| 0.745614
| 0.459184
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.8
| 0
| 1
| 0.2
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
54bb248768aecd7de067c092925fc6ad69247490
| 135
|
py
|
Python
|
py_tdlib/constructors/push_message_content_location.py
|
Mr-TelegramBot/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 24
|
2018-10-05T13:04:30.000Z
|
2020-05-12T08:45:34.000Z
|
py_tdlib/constructors/push_message_content_location.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 3
|
2019-06-26T07:20:20.000Z
|
2021-05-24T13:06:56.000Z
|
py_tdlib/constructors/push_message_content_location.py
|
MrMahdi313/python-tdlib
|
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
|
[
"MIT"
] | 5
|
2018-10-05T14:29:28.000Z
|
2020-08-11T15:04:10.000Z
|
from ..factory import Type
class pushMessageContentLocation(Type):
is_live = None # type: "Bool"
is_pinned = None # type: "Bool"
| 19.285714
| 39
| 0.711111
| 17
| 135
| 5.529412
| 0.647059
| 0.170213
| 0.255319
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.177778
| 135
| 6
| 40
| 22.5
| 0.846847
| 0.185185
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 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
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
49d0842d12d538d883e5361f771ac9ed4c5a7165
| 87
|
py
|
Python
|
sleep_surv/routing.py
|
eboswell/cs04-main
|
32db15ce9300dbd4ef79062a3d363a6a37f718e8
|
[
"MIT"
] | null | null | null |
sleep_surv/routing.py
|
eboswell/cs04-main
|
32db15ce9300dbd4ef79062a3d363a6a37f718e8
|
[
"MIT"
] | null | null | null |
sleep_surv/routing.py
|
eboswell/cs04-main
|
32db15ce9300dbd4ef79062a3d363a6a37f718e8
|
[
"MIT"
] | null | null | null |
from channels.routing import ProtocolTypeRouter
application = ProtocolTypeRouter({})
| 17.4
| 47
| 0.827586
| 7
| 87
| 10.285714
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.103448
| 87
| 4
| 48
| 21.75
| 0.923077
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
49e11e49a725f2cdc772dacb3692915cff6aa6e9
| 1,640
|
py
|
Python
|
tensorflow_federated/python/core/backends/mapreduce/__init__.py
|
iahsanujunda/federated
|
109a5653a305dc9d4bcbafc259257add4dc70365
|
[
"Apache-2.0"
] | 1
|
2020-08-27T14:16:06.000Z
|
2020-08-27T14:16:06.000Z
|
tensorflow_federated/python/core/backends/mapreduce/__init__.py
|
iahsanujunda/federated
|
109a5653a305dc9d4bcbafc259257add4dc70365
|
[
"Apache-2.0"
] | null | null | null |
tensorflow_federated/python/core/backends/mapreduce/__init__.py
|
iahsanujunda/federated
|
109a5653a305dc9d4bcbafc259257add4dc70365
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Libraries for interacting with MapReduce-like backends.
This package contains libraries for using TFF in backend systems that offer
MapReduce-like capabilities, i.e., systems that can perform parallel processing
on a set of clients, and then aggregate the results of such processing on the
server. Systems of this type do not support the full expressiveness of TFF, but
they are common enough in practice to warrant a dedicated set of libraries, and
many examples of TFF computations, including those constructed by
`tff.learning`, can be compiled by TFF into a form that can be deployed on such
systems.
"""
# TODO(b/138261370): Cover this in the general set of guidelines for deployment.
from tensorflow_federated.python.core.backends.mapreduce.canonical_form import CanonicalForm
from tensorflow_federated.python.core.backends.mapreduce.canonical_form_utils import get_canonical_form_for_iterative_process
from tensorflow_federated.python.core.backends.mapreduce.canonical_form_utils import get_iterative_process_for_canonical_form
| 52.903226
| 125
| 0.812195
| 249
| 1,640
| 5.277108
| 0.534137
| 0.045662
| 0.052511
| 0.06621
| 0.165145
| 0.165145
| 0.165145
| 0.165145
| 0.165145
| 0.117199
| 0
| 0.012014
| 0.137195
| 1,640
| 30
| 126
| 54.666667
| 0.916608
| 0.767073
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033333
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b7074dfb74e1416ce20ee43c0e0029605449fec1
| 1,030
|
py
|
Python
|
Result_Modules/Results.py
|
Sayyad828/ByteTrack
|
64405070bbf3dfcbf9d433d89686e98f007f5cb8
|
[
"MIT"
] | null | null | null |
Result_Modules/Results.py
|
Sayyad828/ByteTrack
|
64405070bbf3dfcbf9d433d89686e98f007f5cb8
|
[
"MIT"
] | null | null | null |
Result_Modules/Results.py
|
Sayyad828/ByteTrack
|
64405070bbf3dfcbf9d433d89686e98f007f5cb8
|
[
"MIT"
] | null | null | null |
from Result_Modules.ObjectDetectionResults import ObjectDetectionResults
from Result_Modules.ObjectTrackerResults import ObjectTrackerResults
from Result_Modules.VisualizerResults import VisualizerResults
class Results(object):
"""
This is the Main Results class. The Purpose of this module is to
provide with static functions which return every kind of Result
modules as per the requirement.
This Module will act as the hub to retrieve every other kind of
Results module.
Args:
object (class): [description]
"""
######## GETTING AN OBJECT DETECTION RESULTS CLASS ########
@staticmethod
def get_objectDetection_results():
return ObjectDetectionResults()
######## GETTING A PROCESSOR RESULTS CLASS ########
@staticmethod
def get_visualizer_results():
return VisualizerResults()
######## GETTING AN OBJECT TRACKER RESULTS CLASS ########
@staticmethod
def get_tracker_results():
return ObjectTrackerResults()
| 32.1875
| 72
| 0.697087
| 106
| 1,030
| 6.688679
| 0.443396
| 0.073343
| 0.071932
| 0.114245
| 0.126939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.218447
| 1,030
| 31
| 73
| 33.225806
| 0.880745
| 0.403884
| 0
| 0.230769
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| true
| 0
| 0.230769
| 0.230769
| 0.769231
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
b714e019a83ac3d51b1dc3d34d2411d95b34f995
| 111
|
py
|
Python
|
start_mail.py
|
arikj/Smart-email-client
|
16fb5e8e45392ced7baa9d07b90c3a54fd69860d
|
[
"Apache-2.0"
] | null | null | null |
start_mail.py
|
arikj/Smart-email-client
|
16fb5e8e45392ced7baa9d07b90c3a54fd69860d
|
[
"Apache-2.0"
] | null | null | null |
start_mail.py
|
arikj/Smart-email-client
|
16fb5e8e45392ced7baa9d07b90c3a54fd69860d
|
[
"Apache-2.0"
] | null | null | null |
from py_gui import *
from yahoo import *
import time
start_func()
tk.mainloop()
time.sleep(60)
start_func()
| 10.090909
| 20
| 0.738739
| 18
| 111
| 4.388889
| 0.666667
| 0.227848
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021277
| 0.153153
| 111
| 10
| 21
| 11.1
| 0.819149
| 0
| 0
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.428571
| 0
| 0.428571
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b71607e7f407eef368e317dd0d66bb7a96d0bfb5
| 173
|
py
|
Python
|
contacts/forms.py
|
Nahid71/CloudKitchen
|
49a20859970551d8e31face94cee3e00f0227002
|
[
"Unlicense"
] | null | null | null |
contacts/forms.py
|
Nahid71/CloudKitchen
|
49a20859970551d8e31face94cee3e00f0227002
|
[
"Unlicense"
] | 1
|
2020-06-06T00:04:36.000Z
|
2020-06-06T00:04:36.000Z
|
contacts/forms.py
|
Nahid71/CloudKitchen
|
49a20859970551d8e31face94cee3e00f0227002
|
[
"Unlicense"
] | 1
|
2020-09-04T06:30:21.000Z
|
2020-09-04T06:30:21.000Z
|
from django import forms
from .models import Person
class PersonForm(forms.ModelForm):
class Meta:
model = Person
fields = ('name', 'email', 'phone')
| 17.3
| 43
| 0.647399
| 20
| 173
| 5.6
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.248555
| 173
| 9
| 44
| 19.222222
| 0.861538
| 0
| 0
| 0
| 0
| 0
| 0.080925
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
3fc8a7af160837bee33f81f49ed5688a1dbc4410
| 167
|
py
|
Python
|
nequip/data/__init__.py
|
albertzhu01/nequip
|
63ba41185e7852ebb6f68983ec30d1f569e43271
|
[
"MIT"
] | 1
|
2022-03-13T10:17:53.000Z
|
2022-03-13T10:17:53.000Z
|
nequip/data/__init__.py
|
leoil/nequip
|
83b888797025c94b9963a508bc213a7c98da5bcb
|
[
"MIT"
] | null | null | null |
nequip/data/__init__.py
|
leoil/nequip
|
83b888797025c94b9963a508bc213a7c98da5bcb
|
[
"MIT"
] | null | null | null |
from .AtomicData import AtomicData, PBC
from .dataset import AtomicDataset, AtomicInMemoryDataset, NpzDataset, ASEDataset
from .dataloader import DataLoader, Collater
| 41.75
| 81
| 0.850299
| 17
| 167
| 8.352941
| 0.647059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101796
| 167
| 3
| 82
| 55.666667
| 0.946667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
3fda423c09e03bf69e9a0ddb4daf546d98a9474f
| 132
|
py
|
Python
|
cereal/utils.py
|
istrategylabs/cereal
|
ecdda9a441ee11061b4d94710ed47405370a8af2
|
[
"MIT"
] | 5
|
2018-06-07T04:06:19.000Z
|
2019-05-20T21:17:58.000Z
|
cereal/utils.py
|
marcosmoyano/cereal
|
29c81beb6d0908a676f4ae305833ad733c55ab83
|
[
"MIT"
] | 8
|
2020-06-05T16:42:34.000Z
|
2022-03-25T19:33:24.000Z
|
cereal/utils.py
|
marcosmoyano/cereal
|
29c81beb6d0908a676f4ae305833ad733c55ab83
|
[
"MIT"
] | 1
|
2019-04-01T22:45:02.000Z
|
2019-04-01T22:45:02.000Z
|
def get_attribute_or_key(obj, name):
if isinstance(obj, dict):
return obj.get(name)
return getattr(obj, name, None)
| 26.4
| 36
| 0.674242
| 20
| 132
| 4.3
| 0.65
| 0.162791
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.212121
| 132
| 4
| 37
| 33
| 0.826923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
3fece5ce1a43bfebd23249382d226e2f43d39c66
| 100,436
|
py
|
Python
|
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_asr9k_lc_ethctrl_oper.py
|
CiscoDevNet/ydk-py
|
073731fea50694d0bc6cd8ebf10fec308dcc0aa9
|
[
"ECL-2.0",
"Apache-2.0"
] | 177
|
2016-03-15T17:03:51.000Z
|
2022-03-18T16:48:44.000Z
|
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_asr9k_lc_ethctrl_oper.py
|
CiscoDevNet/ydk-py
|
073731fea50694d0bc6cd8ebf10fec308dcc0aa9
|
[
"ECL-2.0",
"Apache-2.0"
] | 18
|
2016-03-30T10:45:22.000Z
|
2020-07-14T16:28:13.000Z
|
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_asr9k_lc_ethctrl_oper.py
|
CiscoDevNet/ydk-py
|
073731fea50694d0bc6cd8ebf10fec308dcc0aa9
|
[
"ECL-2.0",
"Apache-2.0"
] | 85
|
2016-03-16T20:38:57.000Z
|
2022-02-22T04:26:02.000Z
|
""" Cisco_IOS_XR_asr9k_lc_ethctrl_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR asr9k\-lc\-ethctrl package operational data.
This module contains definitions
for the following management objects\:
mlan\: Management LAN Operational data space
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
import sys
from collections import OrderedDict
from ydk.types import Entity as _Entity_
from ydk.types import EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler import handle_type_error as _handle_type_error
class Mlan(_Entity_):
"""
Management LAN Operational data space
.. attribute:: nodes
Table of nodes
**type**\: :py:class:`Nodes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan, self).__init__()
self._top_entity = None
self.yang_name = "mlan"
self.yang_parent_name = "Cisco-IOS-XR-asr9k-lc-ethctrl-oper"
self.is_top_level_class = True
self.has_list_ancestor = False
self.ylist_key_names = []
self._child_classes = OrderedDict([("nodes", ("nodes", Mlan.Nodes))])
self._leafs = OrderedDict()
self.nodes = Mlan.Nodes()
self.nodes.parent = self
self._children_name_map["nodes"] = "nodes"
self._segment_path = lambda: "Cisco-IOS-XR-asr9k-lc-ethctrl-oper:mlan"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan, [], name, value)
class Nodes(_Entity_):
"""
Table of nodes
.. attribute:: node
Number
**type**\: list of :py:class:`Node <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes, self).__init__()
self.yang_name = "nodes"
self.yang_parent_name = "mlan"
self.is_top_level_class = False
self.has_list_ancestor = False
self.ylist_key_names = []
self._child_classes = OrderedDict([("node", ("node", Mlan.Nodes.Node))])
self._leafs = OrderedDict()
self.node = YList(self)
self._segment_path = lambda: "nodes"
self._absolute_path = lambda: "Cisco-IOS-XR-asr9k-lc-ethctrl-oper:mlan/%s" % self._segment_path()
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes, [], name, value)
class Node(_Entity_):
"""
Number
.. attribute:: node (key)
node number
**type**\: str
**pattern:** ([a\-zA\-Z0\-9\_]\*\\d+/){1,2}([a\-zA\-Z0\-9\_]\*\\d+)
**config**\: False
.. attribute:: port_status_numbers
Table of port status
**type**\: :py:class:`PortStatusNumbers <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers>`
**config**\: False
.. attribute:: switch_status_table
Table of switch status
**type**\: :py:class:`SwitchStatusTable <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable>`
**config**\: False
.. attribute:: port_counters_numbers
Table of port counters
**type**\: :py:class:`PortCountersNumbers <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortCountersNumbers>`
**config**\: False
.. attribute:: atu_entry_numbers
Table of switch ATU
**type**\: :py:class:`AtuEntryNumbers <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.AtuEntryNumbers>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node, self).__init__()
self.yang_name = "node"
self.yang_parent_name = "nodes"
self.is_top_level_class = False
self.has_list_ancestor = False
self.ylist_key_names = ['node']
self._child_classes = OrderedDict([("port-status-numbers", ("port_status_numbers", Mlan.Nodes.Node.PortStatusNumbers)), ("switch-status-table", ("switch_status_table", Mlan.Nodes.Node.SwitchStatusTable)), ("port-counters-numbers", ("port_counters_numbers", Mlan.Nodes.Node.PortCountersNumbers)), ("atu-entry-numbers", ("atu_entry_numbers", Mlan.Nodes.Node.AtuEntryNumbers))])
self._leafs = OrderedDict([
('node', (YLeaf(YType.str, 'node'), ['str'])),
])
self.node = None
self.port_status_numbers = Mlan.Nodes.Node.PortStatusNumbers()
self.port_status_numbers.parent = self
self._children_name_map["port_status_numbers"] = "port-status-numbers"
self.switch_status_table = Mlan.Nodes.Node.SwitchStatusTable()
self.switch_status_table.parent = self
self._children_name_map["switch_status_table"] = "switch-status-table"
self.port_counters_numbers = Mlan.Nodes.Node.PortCountersNumbers()
self.port_counters_numbers.parent = self
self._children_name_map["port_counters_numbers"] = "port-counters-numbers"
self.atu_entry_numbers = Mlan.Nodes.Node.AtuEntryNumbers()
self.atu_entry_numbers.parent = self
self._children_name_map["atu_entry_numbers"] = "atu-entry-numbers"
self._segment_path = lambda: "node" + "[node='" + str(self.node) + "']"
self._absolute_path = lambda: "Cisco-IOS-XR-asr9k-lc-ethctrl-oper:mlan/nodes/%s" % self._segment_path()
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node, ['node'], name, value)
class PortStatusNumbers(_Entity_):
"""
Table of port status
.. attribute:: port_status_number
Number
**type**\: list of :py:class:`PortStatusNumber <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers, self).__init__()
self.yang_name = "port-status-numbers"
self.yang_parent_name = "node"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("port-status-number", ("port_status_number", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber))])
self._leafs = OrderedDict()
self.port_status_number = YList(self)
self._segment_path = lambda: "port-status-numbers"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers, [], name, value)
class PortStatusNumber(_Entity_):
"""
Number
.. attribute:: number (key)
port number
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: port_status
mlan port status info
**type**\: :py:class:`PortStatus <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber, self).__init__()
self.yang_name = "port-status-number"
self.yang_parent_name = "port-status-numbers"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = ['number']
self._child_classes = OrderedDict([("port-status", ("port_status", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus))])
self._leafs = OrderedDict([
('number', (YLeaf(YType.uint32, 'number'), ['int'])),
])
self.number = None
self.port_status = Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus()
self.port_status.parent = self
self._children_name_map["port_status"] = "port-status"
self._segment_path = lambda: "port-status-number" + "[number='" + str(self.number) + "']"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber, ['number'], name, value)
class PortStatus(_Entity_):
"""
mlan port status info
.. attribute:: config
Configuration Data
**type**\: :py:class:`Config <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config>`
**config**\: False
.. attribute:: phy
PHY Registers
**type**\: :py:class:`Phy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy>`
**config**\: False
.. attribute:: serdes
SERDES Registers
**type**\: :py:class:`Serdes <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes>`
**config**\: False
.. attribute:: mac
MAC Registers
**type**\: :py:class:`Mac <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac>`
**config**\: False
.. attribute:: port_num
Port Number
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: phy_valid
PHY data valid
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: serdes_valid
SERDES data valid
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: mac_valid
MAC data valid
**type**\: int
**range:** 0..4294967295
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus, self).__init__()
self.yang_name = "port-status"
self.yang_parent_name = "port-status-number"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("config", ("config", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config)), ("phy", ("phy", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy)), ("serdes", ("serdes", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes)), ("mac", ("mac", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac))])
self._leafs = OrderedDict([
('port_num', (YLeaf(YType.uint32, 'port-num'), ['int'])),
('phy_valid', (YLeaf(YType.uint32, 'phy-valid'), ['int'])),
('serdes_valid', (YLeaf(YType.uint32, 'serdes-valid'), ['int'])),
('mac_valid', (YLeaf(YType.uint32, 'mac-valid'), ['int'])),
])
self.port_num = None
self.phy_valid = None
self.serdes_valid = None
self.mac_valid = None
self.config = Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config()
self.config.parent = self
self._children_name_map["config"] = "config"
self.phy = Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy()
self.phy.parent = self
self._children_name_map["phy"] = "phy"
self.serdes = Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes()
self.serdes.parent = self
self._children_name_map["serdes"] = "serdes"
self.mac = Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac()
self.mac.parent = self
self._children_name_map["mac"] = "mac"
self._segment_path = lambda: "port-status"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus, ['port_num', 'phy_valid', 'serdes_valid', 'mac_valid'], name, value)
class Config(_Entity_):
"""
Configuration Data
.. attribute:: speed
speed
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: duplex
duplex
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: pause
pauseEn
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: my_pause
myPause
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: loopback
loopback
**type**\: int
**range:** 0..4294967295
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config, self).__init__()
self.yang_name = "config"
self.yang_parent_name = "port-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('speed', (YLeaf(YType.uint32, 'speed'), ['int'])),
('duplex', (YLeaf(YType.uint32, 'duplex'), ['int'])),
('pause', (YLeaf(YType.uint16, 'pause'), ['int'])),
('my_pause', (YLeaf(YType.uint16, 'my-pause'), ['int'])),
('loopback', (YLeaf(YType.uint32, 'loopback'), ['int'])),
])
self.speed = None
self.duplex = None
self.pause = None
self.my_pause = None
self.loopback = None
self._segment_path = lambda: "config"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config, ['speed', 'duplex', 'pause', 'my_pause', 'loopback'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Config']['meta_info']
class Phy(_Entity_):
"""
PHY Registers
.. attribute:: reg
reg
**type**\: list of :py:class:`Reg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy.Reg>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy, self).__init__()
self.yang_name = "phy"
self.yang_parent_name = "port-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("reg", ("reg", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy.Reg))])
self._leafs = OrderedDict()
self.reg = YList(self)
self._segment_path = lambda: "phy"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy, [], name, value)
class Reg(_Entity_):
"""
reg
.. attribute:: entry
reg
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy.Reg, self).__init__()
self.yang_name = "reg"
self.yang_parent_name = "phy"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "reg"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy.Reg, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy.Reg']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Phy']['meta_info']
class Serdes(_Entity_):
"""
SERDES Registers
.. attribute:: reg
reg
**type**\: list of :py:class:`Reg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes.Reg>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes, self).__init__()
self.yang_name = "serdes"
self.yang_parent_name = "port-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("reg", ("reg", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes.Reg))])
self._leafs = OrderedDict()
self.reg = YList(self)
self._segment_path = lambda: "serdes"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes, [], name, value)
class Reg(_Entity_):
"""
reg
.. attribute:: entry
reg
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes.Reg, self).__init__()
self.yang_name = "reg"
self.yang_parent_name = "serdes"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "reg"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes.Reg, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes.Reg']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Serdes']['meta_info']
class Mac(_Entity_):
"""
MAC Registers
.. attribute:: reg
reg
**type**\: list of :py:class:`Reg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac.Reg>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac, self).__init__()
self.yang_name = "mac"
self.yang_parent_name = "port-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("reg", ("reg", Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac.Reg))])
self._leafs = OrderedDict()
self.reg = YList(self)
self._segment_path = lambda: "mac"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac, [], name, value)
class Reg(_Entity_):
"""
reg
.. attribute:: entry
reg
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac.Reg, self).__init__()
self.yang_name = "reg"
self.yang_parent_name = "mac"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "reg"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac.Reg, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac.Reg']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus.Mac']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber.PortStatus']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers.PortStatusNumber']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortStatusNumbers']['meta_info']
class SwitchStatusTable(_Entity_):
"""
Table of switch status
.. attribute:: switch_status
mlan switch status info
**type**\: :py:class:`SwitchStatus <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable, self).__init__()
self.yang_name = "switch-status-table"
self.yang_parent_name = "node"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("switch-status", ("switch_status", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus))])
self._leafs = OrderedDict()
self.switch_status = Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus()
self.switch_status.parent = self
self._children_name_map["switch_status"] = "switch-status"
self._segment_path = lambda: "switch-status-table"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable, [], name, value)
class SwitchStatus(_Entity_):
"""
mlan switch status info
.. attribute:: sw_reg_1
Switch Global Registers
**type**\: :py:class:`SwReg1 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1>`
**config**\: False
.. attribute:: sw_reg_2
Switch Global Registers
**type**\: :py:class:`SwReg2 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2>`
**config**\: False
.. attribute:: sw_status
Switch Status Data
**type**\: :py:class:`SwStatus <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus>`
**config**\: False
.. attribute:: rate_limit
CPU Interface Rate Limit
**type**\: int
**range:** \-2147483648..2147483647
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus, self).__init__()
self.yang_name = "switch-status"
self.yang_parent_name = "switch-status-table"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("sw-reg-1", ("sw_reg_1", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1)), ("sw-reg-2", ("sw_reg_2", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2)), ("sw-status", ("sw_status", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus))])
self._leafs = OrderedDict([
('rate_limit', (YLeaf(YType.int32, 'rate-limit'), ['int'])),
])
self.rate_limit = None
self.sw_reg_1 = Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1()
self.sw_reg_1.parent = self
self._children_name_map["sw_reg_1"] = "sw-reg-1"
self.sw_reg_2 = Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2()
self.sw_reg_2.parent = self
self._children_name_map["sw_reg_2"] = "sw-reg-2"
self.sw_status = Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus()
self.sw_status.parent = self
self._children_name_map["sw_status"] = "sw-status"
self._segment_path = lambda: "switch-status"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus, ['rate_limit'], name, value)
class SwReg1(_Entity_):
"""
Switch Global Registers
.. attribute:: reg
reg
**type**\: list of :py:class:`Reg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1.Reg>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1, self).__init__()
self.yang_name = "sw-reg-1"
self.yang_parent_name = "switch-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("reg", ("reg", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1.Reg))])
self._leafs = OrderedDict()
self.reg = YList(self)
self._segment_path = lambda: "sw-reg-1"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1, [], name, value)
class Reg(_Entity_):
"""
reg
.. attribute:: entry
reg
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1.Reg, self).__init__()
self.yang_name = "reg"
self.yang_parent_name = "sw-reg-1"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "reg"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1.Reg, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1.Reg']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg1']['meta_info']
class SwReg2(_Entity_):
"""
Switch Global Registers
.. attribute:: reg
reg
**type**\: list of :py:class:`Reg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2.Reg>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2, self).__init__()
self.yang_name = "sw-reg-2"
self.yang_parent_name = "switch-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("reg", ("reg", Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2.Reg))])
self._leafs = OrderedDict()
self.reg = YList(self)
self._segment_path = lambda: "sw-reg-2"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2, [], name, value)
class Reg(_Entity_):
"""
reg
.. attribute:: entry
reg
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2.Reg, self).__init__()
self.yang_name = "reg"
self.yang_parent_name = "sw-reg-2"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "reg"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2.Reg, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2.Reg']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwReg2']['meta_info']
class SwStatus(_Entity_):
"""
Switch Status Data
.. attribute:: ppu
ppu
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: mtu
mtu
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: mac
mac
**type**\: str
**length:** 0..6
**config**\: False
.. attribute:: cpu_port
cpu port
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: cpu_mac
cpu mac
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: initialized
initialized
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: restarted
restarted
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus, self).__init__()
self.yang_name = "sw-status"
self.yang_parent_name = "switch-status"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('ppu', (YLeaf(YType.uint32, 'ppu'), ['int'])),
('mtu', (YLeaf(YType.uint32, 'mtu'), ['int'])),
('mac', (YLeaf(YType.str, 'mac'), ['str'])),
('cpu_port', (YLeaf(YType.uint16, 'cpu-port'), ['int'])),
('cpu_mac', (YLeaf(YType.uint16, 'cpu-mac'), ['int'])),
('initialized', (YLeaf(YType.uint16, 'initialized'), ['int'])),
('restarted', (YLeaf(YType.uint16, 'restarted'), ['int'])),
])
self.ppu = None
self.mtu = None
self.mac = None
self.cpu_port = None
self.cpu_mac = None
self.initialized = None
self.restarted = None
self._segment_path = lambda: "sw-status"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus, ['ppu', 'mtu', 'mac', 'cpu_port', 'cpu_mac', 'initialized', 'restarted'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus.SwStatus']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable.SwitchStatus']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.SwitchStatusTable']['meta_info']
class PortCountersNumbers(_Entity_):
"""
Table of port counters
.. attribute:: port_counters_number
Number
**type**\: list of :py:class:`PortCountersNumber <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortCountersNumbers, self).__init__()
self.yang_name = "port-counters-numbers"
self.yang_parent_name = "node"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("port-counters-number", ("port_counters_number", Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber))])
self._leafs = OrderedDict()
self.port_counters_number = YList(self)
self._segment_path = lambda: "port-counters-numbers"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortCountersNumbers, [], name, value)
class PortCountersNumber(_Entity_):
"""
Number
.. attribute:: number (key)
port number
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: port_counters
mlan port counters info
**type**\: :py:class:`PortCounters <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber, self).__init__()
self.yang_name = "port-counters-number"
self.yang_parent_name = "port-counters-numbers"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = ['number']
self._child_classes = OrderedDict([("port-counters", ("port_counters", Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters))])
self._leafs = OrderedDict([
('number', (YLeaf(YType.uint32, 'number'), ['int'])),
])
self.number = None
self.port_counters = Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters()
self.port_counters.parent = self
self._children_name_map["port_counters"] = "port-counters"
self._segment_path = lambda: "port-counters-number" + "[number='" + str(self.number) + "']"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber, ['number'], name, value)
class PortCounters(_Entity_):
"""
mlan port counters info
.. attribute:: mlan_stats
Switch Port Statistics
**type**\: :py:class:`MlanStats <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats>`
**config**\: False
.. attribute:: port_num
Port Number
**type**\: int
**range:** 0..4294967295
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters, self).__init__()
self.yang_name = "port-counters"
self.yang_parent_name = "port-counters-number"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("mlan-stats", ("mlan_stats", Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats))])
self._leafs = OrderedDict([
('port_num', (YLeaf(YType.uint32, 'port-num'), ['int'])),
])
self.port_num = None
self.mlan_stats = Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats()
self.mlan_stats.parent = self
self._children_name_map["mlan_stats"] = "mlan-stats"
self._segment_path = lambda: "port-counters"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters, ['port_num'], name, value)
class MlanStats(_Entity_):
"""
Switch Port Statistics
.. attribute:: in_good_octets_hi
inGoodOctets hi
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_good_octets
inGoodOctets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_bad_octets
inBadOctets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_unicast_pkt
inUnicastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_bcast_pkt
inBcastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_mcast_pkt
inMcastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_pause_pkt
inPausePkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_undersize_pkt
inUndersizePkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_fragments
inFragments
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_oversize
inOversize
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_jabber
inJabber
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_rx_err
inRxErr
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_fcs_err
inFcsErr
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_octets_hi
outOctets hi
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_octets
outOctets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_unicast_pkt
outUnicastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_bcast_pkt
outBcastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_mcast_pkt
outMcastPkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_pause_pkt
outPausePkt
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: excessive
excessive
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: collisions
collisions
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: deferred
deferred
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: single
single
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: multiple
multiple
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_fcs_err
outFcsErr
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: late
late
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_64_octets
rx tx 64 Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_65_127_octets
rx tx 65 127 Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_128_255_octets
rx tx 128 255 Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_256_511_octets
rx tx 256 511 Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_512_1023_octets
rx tx 512 1023 Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: rx_tx_1024_max_octets
rx tx 1024 Max Octets
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_discards
inDiscards
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: in_filtered
inFiltered
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: out_filtered
outFiltered
**type**\: int
**range:** 0..4294967295
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats, self).__init__()
self.yang_name = "mlan-stats"
self.yang_parent_name = "port-counters"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('in_good_octets_hi', (YLeaf(YType.uint32, 'in-good-octets-hi'), ['int'])),
('in_good_octets', (YLeaf(YType.uint32, 'in-good-octets'), ['int'])),
('in_bad_octets', (YLeaf(YType.uint32, 'in-bad-octets'), ['int'])),
('in_unicast_pkt', (YLeaf(YType.uint32, 'in-unicast-pkt'), ['int'])),
('in_bcast_pkt', (YLeaf(YType.uint32, 'in-bcast-pkt'), ['int'])),
('in_mcast_pkt', (YLeaf(YType.uint32, 'in-mcast-pkt'), ['int'])),
('in_pause_pkt', (YLeaf(YType.uint32, 'in-pause-pkt'), ['int'])),
('in_undersize_pkt', (YLeaf(YType.uint32, 'in-undersize-pkt'), ['int'])),
('in_fragments', (YLeaf(YType.uint32, 'in-fragments'), ['int'])),
('in_oversize', (YLeaf(YType.uint32, 'in-oversize'), ['int'])),
('in_jabber', (YLeaf(YType.uint32, 'in-jabber'), ['int'])),
('in_rx_err', (YLeaf(YType.uint32, 'in-rx-err'), ['int'])),
('in_fcs_err', (YLeaf(YType.uint32, 'in-fcs-err'), ['int'])),
('out_octets_hi', (YLeaf(YType.uint32, 'out-octets-hi'), ['int'])),
('out_octets', (YLeaf(YType.uint32, 'out-octets'), ['int'])),
('out_unicast_pkt', (YLeaf(YType.uint32, 'out-unicast-pkt'), ['int'])),
('out_bcast_pkt', (YLeaf(YType.uint32, 'out-bcast-pkt'), ['int'])),
('out_mcast_pkt', (YLeaf(YType.uint32, 'out-mcast-pkt'), ['int'])),
('out_pause_pkt', (YLeaf(YType.uint32, 'out-pause-pkt'), ['int'])),
('excessive', (YLeaf(YType.uint32, 'excessive'), ['int'])),
('collisions', (YLeaf(YType.uint32, 'collisions'), ['int'])),
('deferred', (YLeaf(YType.uint32, 'deferred'), ['int'])),
('single', (YLeaf(YType.uint32, 'single'), ['int'])),
('multiple', (YLeaf(YType.uint32, 'multiple'), ['int'])),
('out_fcs_err', (YLeaf(YType.uint32, 'out-fcs-err'), ['int'])),
('late', (YLeaf(YType.uint32, 'late'), ['int'])),
('rx_tx_64_octets', (YLeaf(YType.uint32, 'rx-tx-64-octets'), ['int'])),
('rx_tx_65_127_octets', (YLeaf(YType.uint32, 'rx-tx-65-127-octets'), ['int'])),
('rx_tx_128_255_octets', (YLeaf(YType.uint32, 'rx-tx-128-255-octets'), ['int'])),
('rx_tx_256_511_octets', (YLeaf(YType.uint32, 'rx-tx-256-511-octets'), ['int'])),
('rx_tx_512_1023_octets', (YLeaf(YType.uint32, 'rx-tx-512-1023-octets'), ['int'])),
('rx_tx_1024_max_octets', (YLeaf(YType.uint32, 'rx-tx-1024-max-octets'), ['int'])),
('in_discards', (YLeaf(YType.uint32, 'in-discards'), ['int'])),
('in_filtered', (YLeaf(YType.uint32, 'in-filtered'), ['int'])),
('out_filtered', (YLeaf(YType.uint32, 'out-filtered'), ['int'])),
])
self.in_good_octets_hi = None
self.in_good_octets = None
self.in_bad_octets = None
self.in_unicast_pkt = None
self.in_bcast_pkt = None
self.in_mcast_pkt = None
self.in_pause_pkt = None
self.in_undersize_pkt = None
self.in_fragments = None
self.in_oversize = None
self.in_jabber = None
self.in_rx_err = None
self.in_fcs_err = None
self.out_octets_hi = None
self.out_octets = None
self.out_unicast_pkt = None
self.out_bcast_pkt = None
self.out_mcast_pkt = None
self.out_pause_pkt = None
self.excessive = None
self.collisions = None
self.deferred = None
self.single = None
self.multiple = None
self.out_fcs_err = None
self.late = None
self.rx_tx_64_octets = None
self.rx_tx_65_127_octets = None
self.rx_tx_128_255_octets = None
self.rx_tx_256_511_octets = None
self.rx_tx_512_1023_octets = None
self.rx_tx_1024_max_octets = None
self.in_discards = None
self.in_filtered = None
self.out_filtered = None
self._segment_path = lambda: "mlan-stats"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats, ['in_good_octets_hi', 'in_good_octets', 'in_bad_octets', 'in_unicast_pkt', 'in_bcast_pkt', 'in_mcast_pkt', 'in_pause_pkt', 'in_undersize_pkt', 'in_fragments', 'in_oversize', 'in_jabber', 'in_rx_err', 'in_fcs_err', 'out_octets_hi', 'out_octets', 'out_unicast_pkt', 'out_bcast_pkt', 'out_mcast_pkt', 'out_pause_pkt', 'excessive', 'collisions', 'deferred', 'single', 'multiple', 'out_fcs_err', 'late', 'rx_tx_64_octets', 'rx_tx_65_127_octets', 'rx_tx_128_255_octets', 'rx_tx_256_511_octets', 'rx_tx_512_1023_octets', 'rx_tx_1024_max_octets', 'in_discards', 'in_filtered', 'out_filtered'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters.MlanStats']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber.PortCounters']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortCountersNumbers.PortCountersNumber']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.PortCountersNumbers']['meta_info']
class AtuEntryNumbers(_Entity_):
"""
Table of switch ATU
.. attribute:: atu_entry_number
Entry number
**type**\: list of :py:class:`AtuEntryNumber <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.AtuEntryNumbers, self).__init__()
self.yang_name = "atu-entry-numbers"
self.yang_parent_name = "node"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("atu-entry-number", ("atu_entry_number", Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber))])
self._leafs = OrderedDict()
self.atu_entry_number = YList(self)
self._segment_path = lambda: "atu-entry-numbers"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.AtuEntryNumbers, [], name, value)
class AtuEntryNumber(_Entity_):
"""
Entry number
.. attribute:: entry (key)
entry number
**type**\: int
**range:** 0..4294967295
**config**\: False
.. attribute:: switch_counters
mlan switch counters info
**type**\: :py:class:`SwitchCounters <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber, self).__init__()
self.yang_name = "atu-entry-number"
self.yang_parent_name = "atu-entry-numbers"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = ['entry']
self._child_classes = OrderedDict([("switch-counters", ("switch_counters", Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters))])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint32, 'entry'), ['int'])),
])
self.entry = None
self.switch_counters = Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters()
self.switch_counters.parent = self
self._children_name_map["switch_counters"] = "switch-counters"
self._segment_path = lambda: "atu-entry-number" + "[entry='" + str(self.entry) + "']"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber, ['entry'], name, value)
class SwitchCounters(_Entity_):
"""
mlan switch counters info
.. attribute:: atu
Switch ATU Data
**type**\: :py:class:`Atu <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu>`
**config**\: False
.. attribute:: entry_num
Index of ATU Entry
**type**\: int
**range:** 0..4294967295
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters, self).__init__()
self.yang_name = "switch-counters"
self.yang_parent_name = "atu-entry-number"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("atu", ("atu", Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu))])
self._leafs = OrderedDict([
('entry_num', (YLeaf(YType.uint32, 'entry-num'), ['int'])),
])
self.entry_num = None
self.atu = Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu()
self.atu.parent = self
self._children_name_map["atu"] = "atu"
self._segment_path = lambda: "switch-counters"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters, ['entry_num'], name, value)
class Atu(_Entity_):
"""
Switch ATU Data
.. attribute:: db_num
dbNum
**type**\: int
**range:** 0..65535
**config**\: False
.. attribute:: priority
priority
**type**\: int
**range:** 0..255
**config**\: False
.. attribute:: trunk
trunk
**type**\: bool
**config**\: False
.. attribute:: dpv
dpv
**type**\: int
**range:** 0..255
**config**\: False
.. attribute:: es
es
**type**\: int
**range:** 0..255
**config**\: False
.. attribute:: macaddr
macaddr
**type**\: list of :py:class:`Macaddr <ydk.models.cisco_ios_xr.Cisco_IOS_XR_asr9k_lc_ethctrl_oper.Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu.Macaddr>`
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu, self).__init__()
self.yang_name = "atu"
self.yang_parent_name = "switch-counters"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([("macaddr", ("macaddr", Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu.Macaddr))])
self._leafs = OrderedDict([
('db_num', (YLeaf(YType.uint16, 'db-num'), ['int'])),
('priority', (YLeaf(YType.uint8, 'priority'), ['int'])),
('trunk', (YLeaf(YType.boolean, 'trunk'), ['bool'])),
('dpv', (YLeaf(YType.uint8, 'dpv'), ['int'])),
('es', (YLeaf(YType.uint8, 'es'), ['int'])),
])
self.db_num = None
self.priority = None
self.trunk = None
self.dpv = None
self.es = None
self.macaddr = YList(self)
self._segment_path = lambda: "atu"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu, ['db_num', 'priority', 'trunk', 'dpv', 'es'], name, value)
class Macaddr(_Entity_):
"""
macaddr
.. attribute:: entry
macaddr
**type**\: int
**range:** 0..65535
**config**\: False
"""
_prefix = 'asr9k-lc-ethctrl-oper'
_revision = '2015-11-09'
def __init__(self):
if sys.version_info > (3,):
super().__init__()
else:
super(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu.Macaddr, self).__init__()
self.yang_name = "macaddr"
self.yang_parent_name = "atu"
self.is_top_level_class = False
self.has_list_ancestor = True
self.ylist_key_names = []
self._child_classes = OrderedDict([])
self._leafs = OrderedDict([
('entry', (YLeaf(YType.uint16, 'entry'), ['int'])),
])
self.entry = None
self._segment_path = lambda: "macaddr"
self._is_frozen = True
def __setattr__(self, name, value):
self._perform_setattr(Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu.Macaddr, ['entry'], name, value)
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu.Macaddr']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters.Atu']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber.SwitchCounters']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.AtuEntryNumbers.AtuEntryNumber']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node.AtuEntryNumbers']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes.Node']['meta_info']
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan.Nodes']['meta_info']
def clone_ptr(self):
self._top_entity = Mlan()
return self._top_entity
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_asr9k_lc_ethctrl_oper as meta
return meta._meta_table['Mlan']['meta_info']
| 46.910789
| 731
| 0.388048
| 7,183
| 100,436
| 5.104552
| 0.035918
| 0.039028
| 0.053892
| 0.044674
| 0.807369
| 0.768178
| 0.725359
| 0.68974
| 0.640184
| 0.581574
| 0
| 0.028836
| 0.524543
| 100,436
| 2,140
| 732
| 46.93271
| 0.73899
| 0.15592
| 0
| 0.567148
| 0
| 0
| 0.108554
| 0.040121
| 0
| 0
| 0
| 0
| 0
| 1
| 0.097669
| false
| 0
| 0.041065
| 0
| 0.206437
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 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
| 4
|
3ff0d3ece85c4837f209fcfd0370a17946a411df
| 165
|
py
|
Python
|
tests/test_settings/start_size.py
|
malcolmsailor/midani
|
3dc5ed38188d372a36df405a142a1185676dba6e
|
[
"MIT"
] | 1
|
2020-12-28T19:52:52.000Z
|
2020-12-28T19:52:52.000Z
|
tests/test_settings/start_size.py
|
malcolmsailor/midani
|
3dc5ed38188d372a36df405a142a1185676dba6e
|
[
"MIT"
] | null | null | null |
tests/test_settings/start_size.py
|
malcolmsailor/midani
|
3dc5ed38188d372a36df405a142a1185676dba6e
|
[
"MIT"
] | null | null | null |
{
"midi_fname": "sample_music/effrhy_131.mid",
"video_fname": "tests/test_out/start_size.mp4",
"note_start_height": 0.0,
# "note_end_height": 0.0,
}
| 23.571429
| 51
| 0.654545
| 25
| 165
| 3.92
| 0.72
| 0.142857
| 0.163265
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.057971
| 0.163636
| 165
| 6
| 52
| 27.5
| 0.652174
| 0.139394
| 0
| 0
| 0
| 0
| 0.671429
| 0.4
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3ffda9914df1b7b4c453a87f59178b5cf7b000d7
| 137
|
py
|
Python
|
twitch_project/youtube_bot/apps.py
|
tejesh95/livecoding
|
327114d67d613ef7300528d62b5165cd215bc1b4
|
[
"MIT"
] | null | null | null |
twitch_project/youtube_bot/apps.py
|
tejesh95/livecoding
|
327114d67d613ef7300528d62b5165cd215bc1b4
|
[
"MIT"
] | null | null | null |
twitch_project/youtube_bot/apps.py
|
tejesh95/livecoding
|
327114d67d613ef7300528d62b5165cd215bc1b4
|
[
"MIT"
] | null | null | null |
from __future__ import unicode_literals
from django.apps import AppConfig
class YoutubeBotConfig(AppConfig):
name = 'youtube_bot'
| 17.125
| 39
| 0.80292
| 16
| 137
| 6.5
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.145985
| 137
| 7
| 40
| 19.571429
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0.080292
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b209b6246083de04a12f72e0e4ec7cd211f77c70
| 430
|
py
|
Python
|
tests/utils/__init__.py
|
DavidBerdik/dictances
|
7b804b62032bbdecc8e73946cf74b171681fe4f5
|
[
"MIT"
] | 30
|
2018-08-30T16:00:14.000Z
|
2022-03-14T14:36:17.000Z
|
tests/utils/__init__.py
|
DavidBerdik/dictances
|
7b804b62032bbdecc8e73946cf74b171681fe4f5
|
[
"MIT"
] | 6
|
2019-06-18T15:37:23.000Z
|
2021-04-15T12:40:42.000Z
|
tests/utils/__init__.py
|
DavidBerdik/dictances
|
7b804b62032bbdecc8e73946cf74b171681fe4f5
|
[
"MIT"
] | 6
|
2019-02-10T23:22:25.000Z
|
2020-10-01T16:25:40.000Z
|
from .compare_metrics import compare_metrics
from .bhattacharyya_reference import bhattacharyya_distance
from .chi_square_reference import chi_square_distance
from .jensen_shannon_divergence import jensen_shannon_divergence
from .normal_chi_square_reference import normal_chi_square_distance
__all__ = ["compare_metrics", "bhattacharyya_distance", "chi_square_distance", "jensen_shannon_divergence", "normal_chi_square_distance"]
| 61.428571
| 137
| 0.886047
| 53
| 430
| 6.603774
| 0.264151
| 0.154286
| 0.194286
| 0.137143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.062791
| 430
| 7
| 137
| 61.428571
| 0.868486
| 0
| 0
| 0
| 0
| 0
| 0.24826
| 0.169374
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.833333
| 0
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b20a6c767f23aeb911ffb0a9c9562b489a20dad7
| 221
|
py
|
Python
|
liegroups/__init__.py
|
neutrinoyu/liegroups
|
8f6666086b236cf801240046870c94789e87efc2
|
[
"MIT"
] | null | null | null |
liegroups/__init__.py
|
neutrinoyu/liegroups
|
8f6666086b236cf801240046870c94789e87efc2
|
[
"MIT"
] | null | null | null |
liegroups/__init__.py
|
neutrinoyu/liegroups
|
8f6666086b236cf801240046870c94789e87efc2
|
[
"MIT"
] | null | null | null |
"""Numpy implementations of Special Euclidean and Special Orthogonal Lie groups."""
from .so2 import SO2Matrix as SO2
from .se2 import SE2Matrix as SE2
from .so3 import SO3Matrix as SO3
from .se3 import SE3Matrix as SE3
| 31.571429
| 83
| 0.791855
| 34
| 221
| 5.147059
| 0.588235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064516
| 0.158371
| 221
| 6
| 84
| 36.833333
| 0.876344
| 0.348416
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
b750979d17fb103b739509935d4fadb93c51553f
| 173
|
py
|
Python
|
tests/test_about.py
|
tachyondecay/quickpaste
|
880de852b45e0b3b2bbfdff93888bf54b19a416e
|
[
"MIT"
] | null | null | null |
tests/test_about.py
|
tachyondecay/quickpaste
|
880de852b45e0b3b2bbfdff93888bf54b19a416e
|
[
"MIT"
] | null | null | null |
tests/test_about.py
|
tachyondecay/quickpaste
|
880de852b45e0b3b2bbfdff93888bf54b19a416e
|
[
"MIT"
] | null | null | null |
def test_about_should_return_200(client):
rv = client.get('/about')
assert rv.status_code == 200
assert rv.headers['Content-type'] == 'text/html; charset=utf-8'
| 34.6
| 67
| 0.693642
| 26
| 173
| 4.423077
| 0.769231
| 0.13913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.047619
| 0.150289
| 173
| 4
| 68
| 43.25
| 0.734694
| 0
| 0
| 0
| 0
| 0
| 0.242775
| 0
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b76df7fcc32393bae74b9bfd7f0cd22c6fe9eaee
| 167
|
py
|
Python
|
scripts/deploy.py
|
stegos/ERC20
|
768f5dd4c6075e5bc4a03a9d4f6c329b56067555
|
[
"MIT"
] | null | null | null |
scripts/deploy.py
|
stegos/ERC20
|
768f5dd4c6075e5bc4a03a9d4f6c329b56067555
|
[
"MIT"
] | null | null | null |
scripts/deploy.py
|
stegos/ERC20
|
768f5dd4c6075e5bc4a03a9d4f6c329b56067555
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python3
from brownie import Token, accounts
def main():
acct = accounts.load('stg')
return Token.deploy("Stegos", "STG", 6, 1e15, {'from': acct})
| 20.875
| 65
| 0.646707
| 23
| 167
| 4.695652
| 0.782609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035971
| 0.167665
| 167
| 7
| 66
| 23.857143
| 0.741007
| 0.101796
| 0
| 0
| 0
| 0
| 0.107383
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
b76e4548eb4ff8acf0f40bd879cefa38ed98e180
| 1,562
|
py
|
Python
|
apps/erp/templatetags/erp_tags.py
|
gvizquel/pyerp
|
c859f7293cabd1003f79112463cee93ac89fccba
|
[
"MIT"
] | null | null | null |
apps/erp/templatetags/erp_tags.py
|
gvizquel/pyerp
|
c859f7293cabd1003f79112463cee93ac89fccba
|
[
"MIT"
] | 11
|
2020-06-05T22:50:37.000Z
|
2022-02-10T09:05:56.000Z
|
apps/erp/templatetags/erp_tags.py
|
gvizquel/pyerp
|
c859f7293cabd1003f79112463cee93ac89fccba
|
[
"MIT"
] | null | null | null |
# Librerias Django
from django import template
# Librerias en carpetas locales
from ...base.models import BaseConfig
from ...website.models import WebsiteConfig
register = template.Library()
@register.filter
def get_obj_attr(obj, attr):
return getattr(obj, attr)
@register.filter
def get_online(obj):
return BaseConfig.objects.get(pk=1).online
@register.filter
def get_company_name(obj):
return BaseConfig.objects.get(pk=1).main_company_id.name
@register.filter
def get_company_email(obj):
return BaseConfig.objects.get(pk=1).main_company_id.email
@register.filter
def get_company_slogan(obj):
return BaseConfig.objects.get(pk=1).main_company_id.slogan
@register.filter
def get_company_rut(obj):
return BaseConfig.objects.get(pk=1).main_company_id.rut
@register.filter
def get_company_facebook(obj):
return BaseConfig.objects.get(pk=1).main_company_id.social_facebook
@register.filter
def get_company_instagram(obj):
return BaseConfig.objects.get(pk=1).main_company_id.social_instagram
@register.filter
def get_company_linkedin(obj):
return BaseConfig.objects.get(pk=1).main_company_id.social_linkedin
@register.filter
def get_sidebar_collapse(obj):
return BaseConfig.objects.get(pk=1).open_menu
# WEB
@register.filter
def web_show_blog(obj):
return WebsiteConfig.objects.get(pk=1).show_blog
@register.filter
def web_show_shop(obj):
return WebsiteConfig.objects.get(pk=1).show_shop
@register.filter
def web_under_construction(obj):
return WebsiteConfig.objects.get(pk=1).under_construction
| 23.313433
| 72
| 0.790653
| 231
| 1,562
| 5.147186
| 0.203463
| 0.15307
| 0.18587
| 0.131203
| 0.628259
| 0.428932
| 0.428932
| 0.345669
| 0.280067
| 0.280067
| 0
| 0.008584
| 0.104994
| 1,562
| 66
| 73
| 23.666667
| 0.841917
| 0.03201
| 0
| 0.302326
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.302326
| false
| 0
| 0.069767
| 0.302326
| 0.674419
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
b77499777a300b7ce94d01c5dcfa1020a80cb02f
| 121
|
py
|
Python
|
arbitrage/public_markets/okcoincny.py
|
donnydevito/bitcoin-arbitrage
|
eeadb186f703827e3daba3322b7f724270d379eb
|
[
"Unlicense"
] | 126
|
2017-06-23T09:10:58.000Z
|
2021-12-21T19:06:35.000Z
|
arbitrage/public_markets/okcoincny.py
|
knoguchi/bitcoin-arbitrage
|
99cdb14225cceeb14e4d02046a484fa26eff76e0
|
[
"Unlicense"
] | 1
|
2020-06-04T11:05:45.000Z
|
2020-06-04T11:05:45.000Z
|
arbitrage/public_markets/okcoincny.py
|
knoguchi/bitcoin-arbitrage
|
99cdb14225cceeb14e4d02046a484fa26eff76e0
|
[
"Unlicense"
] | 65
|
2017-06-23T09:11:03.000Z
|
2021-11-20T04:11:20.000Z
|
from ._okcoin import OKCoin
class OKCoinCNY(OKCoin):
def __init__(self):
super().__init__("CNY", "btc_cny")
| 20.166667
| 42
| 0.669421
| 15
| 121
| 4.733333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190083
| 121
| 5
| 43
| 24.2
| 0.72449
| 0
| 0
| 0
| 0
| 0
| 0.082645
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
b77e6e9be5784aa28d664f31cbd9f66d6cc67aca
| 105
|
py
|
Python
|
apps/othercontents/apps.py
|
Sunbird-Ed/evolve-api
|
371b39422839762e32401340456c13858cb8e1e9
|
[
"MIT"
] | 1
|
2019-02-27T15:26:11.000Z
|
2019-02-27T15:26:11.000Z
|
apps/othercontents/apps.py
|
Sunbird-Ed/evolve-api
|
371b39422839762e32401340456c13858cb8e1e9
|
[
"MIT"
] | 9
|
2019-12-16T10:09:46.000Z
|
2022-03-11T23:42:12.000Z
|
apps/othercontents/apps.py
|
Sunbird-Ed/evolve-api
|
371b39422839762e32401340456c13858cb8e1e9
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class OthercontributorsConfig(AppConfig):
name = 'othercontents'
| 17.5
| 41
| 0.790476
| 10
| 105
| 8.3
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 105
| 5
| 42
| 21
| 0.922222
| 0
| 0
| 0
| 0
| 0
| 0.12381
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b7a4f15fac565aeed10e70445f5d4f3fde22b0bd
| 251
|
py
|
Python
|
etc/katana/nodegraph.py
|
PaulDoessel/coconodz
|
a1a8a8852497f964380d5cc1052ca4554f1bbbab
|
[
"MIT"
] | 30
|
2017-08-10T00:11:50.000Z
|
2022-03-07T03:24:41.000Z
|
etc/katana/nodegraph.py
|
PaulDoessel/coconodz
|
a1a8a8852497f964380d5cc1052ca4554f1bbbab
|
[
"MIT"
] | 36
|
2017-08-05T14:20:41.000Z
|
2017-12-30T15:49:55.000Z
|
etc/katana/nodegraph.py
|
PaulDoessel/coconodz
|
a1a8a8852497f964380d5cc1052ca4554f1bbbab
|
[
"MIT"
] | 7
|
2018-02-14T13:33:37.000Z
|
2021-08-18T13:50:01.000Z
|
import coconodz.nodegraph as nodegraph
from coconodz.etc.katana.qtutilities import get_katana_main_window
class Nodzgraph(nodegraph.Nodegraph):
def __init__(self, parent=get_katana_main_window()):
super(Nodzgraph, self).__init__(parent)
| 31.375
| 66
| 0.800797
| 32
| 251
| 5.84375
| 0.5625
| 0.096257
| 0.139037
| 0.203209
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115538
| 251
| 8
| 67
| 31.375
| 0.842342
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b7aae519f835619c71c836a3923ba155bef3b0f0
| 80
|
py
|
Python
|
src/oscar/apps/dashboard/offers/__init__.py
|
akiyoko/oscar_sandbox
|
b384f1c0b5f297fd4b84509a575f6766a48630a5
|
[
"BSD-3-Clause"
] | 68
|
2016-11-06T05:07:57.000Z
|
2021-12-17T09:17:38.000Z
|
src/oscar/apps/dashboard/offers/__init__.py
|
akiyoko/oscar_sandbox
|
b384f1c0b5f297fd4b84509a575f6766a48630a5
|
[
"BSD-3-Clause"
] | 10
|
2020-05-11T20:33:31.000Z
|
2022-03-12T00:24:28.000Z
|
src/oscar/apps/dashboard/offers/__init__.py
|
akiyoko/oscar_sandbox
|
b384f1c0b5f297fd4b84509a575f6766a48630a5
|
[
"BSD-3-Clause"
] | 28
|
2016-12-04T07:12:50.000Z
|
2021-02-06T21:13:15.000Z
|
default_app_config = 'oscar.apps.dashboard.offers.config.OffersDashboardConfig'
| 40
| 79
| 0.8625
| 9
| 80
| 7.444444
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0375
| 80
| 1
| 80
| 80
| 0.87013
| 0
| 0
| 0
| 0
| 0
| 0.7
| 0.7
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b7ad7225db750af1186f10e325cdf41d4c016ba5
| 2,317
|
py
|
Python
|
code/metrics.py
|
RecoHut-Stanzas/S593234
|
9bb0e037e43267abb4f31466d80ba4934b82177b
|
[
"MIT"
] | null | null | null |
code/metrics.py
|
RecoHut-Stanzas/S593234
|
9bb0e037e43267abb4f31466d80ba4934b82177b
|
[
"MIT"
] | null | null | null |
code/metrics.py
|
RecoHut-Stanzas/S593234
|
9bb0e037e43267abb4f31466d80ba4934b82177b
|
[
"MIT"
] | null | null | null |
import numpy as np
def hit_rate(recommended_list, bought_list):
bought_list = np.array(bought_list)
recommended_list = np.array(recommended_list)
flags = np.isin(bought_list, recommended_list)
return (flags.sum() > 0) * 1
def hit_rate_at_k(recommended_list, bought_list, k=5):
return hit_rate(recommended_list[:k], bought_list)
def precision(recommended_list, bought_list):
bought_list = np.array(bought_list)
recommended_list = np.array(recommended_list)
flags = np.isin(bought_list, recommended_list)
return flags.sum() / len(recommended_list)
def precision_at_k(recommended_list, bought_list, k=5):
return precision(recommended_list[:k], bought_list)
def money_precision_at_k(recommended_list, bought_list, prices_recommended, k=5):
recommended_list = np.array(recommended_list)[:k]
prices_recommended = np.array(prices_recommended)[:k]
flags = np.isin(recommended_list, bought_list)
return np.dot(flags, prices_recommended).sum() / prices_recommended.sum()
def recall(recommended_list, bought_list):
bought_list = np.array(bought_list)
recommended_list = np.array(recommended_list)
flags = np.isin(bought_list, recommended_list)
return flags.sum() / len(bought_list)
def recall_at_k(recommended_list, bought_list, k=5):
return recall(recommended_list[:k], bought_list)
def money_recall_at_k(recommended_list, bought_list, prices_recommended, prices_bought, k=5):
bought_list = np.array(bought_list)
recommended_list = np.array(recommended_list)[:k]
prices_recommended = np.array(prices_recommended)[:k]
prices_bought = np.array(prices_bought)
flags = np.isin(recommended_list, bought_list)
return np.dot(flags, prices_recommended).sum() / prices_bought.sum()
def ap_k(recommended_list, bought_list, k=5):
bought_list = np.array(bought_list)
recommended_list = np.array(recommended_list)
recommended_list = recommended_list[recommended_list <= k]
relevant_indexes = np.nonzero(np.isin(recommended_list, bought_list))[0]
if len(relevant_indexes) == 0:
return 0
amount_relevant = len(relevant_indexes)
sum_ = sum(
[precision_at_k(recommended_list, bought_list, k=index_relevant + 1) for index_relevant in relevant_indexes])
return sum_ / amount_relevant
| 38.616667
| 117
| 0.754424
| 326
| 2,317
| 5.03681
| 0.107362
| 0.319732
| 0.136419
| 0.197929
| 0.791108
| 0.791108
| 0.727162
| 0.657125
| 0.573691
| 0.507917
| 0
| 0.006042
| 0.142857
| 2,317
| 60
| 118
| 38.616667
| 0.820745
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.022222
| 0.066667
| 0.444444
| 0
| 0
| 0
| 0
| null | 1
| 0
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b7c7305e543bcca91282d56b4fdc3392f8a9cfee
| 88
|
py
|
Python
|
9/9.12/my_admin.py
|
singi2016cn/python-scaffold
|
274e508d1919da67e599aa73be139800c043bce4
|
[
"MIT"
] | null | null | null |
9/9.12/my_admin.py
|
singi2016cn/python-scaffold
|
274e508d1919da67e599aa73be139800c043bce4
|
[
"MIT"
] | null | null | null |
9/9.12/my_admin.py
|
singi2016cn/python-scaffold
|
274e508d1919da67e599aa73be139800c043bce4
|
[
"MIT"
] | null | null | null |
from admin import Admin
admin = Admin('sin', 'gi')
admin.privileges.show_privileges()
| 14.666667
| 34
| 0.738636
| 12
| 88
| 5.333333
| 0.583333
| 0.3125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 88
| 5
| 35
| 17.6
| 0.831169
| 0
| 0
| 0
| 0
| 0
| 0.056818
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b7f7c6aea308ebc0d15a8f4175f2a3bf88efc928
| 116
|
py
|
Python
|
bot.py
|
flyare1337/Elysta-Source
|
fff59a3bf533e2e9d9fe540643d4ab3ac1338419
|
[
"MIT"
] | null | null | null |
bot.py
|
flyare1337/Elysta-Source
|
fff59a3bf533e2e9d9fe540643d4ab3ac1338419
|
[
"MIT"
] | null | null | null |
bot.py
|
flyare1337/Elysta-Source
|
fff59a3bf533e2e9d9fe540643d4ab3ac1338419
|
[
"MIT"
] | null | null | null |
import time
print("Never gonna give you up")
print("https://youtu.be/dQw4w9WgXcQ")
time.sleep(5)
print("🤣😂🤣😂🤣😂😂😂🤣")
| 19.333333
| 37
| 0.663793
| 18
| 116
| 4.777778
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028302
| 0.086207
| 116
| 5
| 38
| 23.2
| 0.698113
| 0
| 0
| 0
| 0
| 0
| 0.517241
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0.6
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
4d12f76ab20afc96c1774eaf7eaf96b7d9d49365
| 100
|
py
|
Python
|
commodity_app/apps.py
|
SeulYoung/second_hand_trading_platform
|
7dec80384d116fb9bde3f67f456b405c12b991c5
|
[
"BSD-3-Clause"
] | null | null | null |
commodity_app/apps.py
|
SeulYoung/second_hand_trading_platform
|
7dec80384d116fb9bde3f67f456b405c12b991c5
|
[
"BSD-3-Clause"
] | 13
|
2020-02-12T00:18:12.000Z
|
2022-03-11T23:48:42.000Z
|
commodity_app/apps.py
|
SeulYoung/second_hand_trading_platform
|
7dec80384d116fb9bde3f67f456b405c12b991c5
|
[
"BSD-3-Clause"
] | 1
|
2019-05-28T14:17:50.000Z
|
2019-05-28T14:17:50.000Z
|
from django.apps import AppConfig
class CommodityAppConfig(AppConfig):
name = 'commodity_app'
| 16.666667
| 36
| 0.78
| 11
| 100
| 7
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 100
| 5
| 37
| 20
| 0.905882
| 0
| 0
| 0
| 0
| 0
| 0.13
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
4d3424dc3f30b7da8619ccf1a3b8b6aab6fc662f
| 10,499
|
py
|
Python
|
core/tests/test_forms.py
|
softwaydev/ca
|
7bf730b9aec9e1c27dc0dff2de286ff83a3cc954
|
[
"MIT"
] | 8
|
2017-06-16T10:45:27.000Z
|
2020-01-01T14:51:27.000Z
|
core/tests/test_forms.py
|
softwaydev/ca
|
7bf730b9aec9e1c27dc0dff2de286ff83a3cc954
|
[
"MIT"
] | 66
|
2017-05-12T14:33:00.000Z
|
2020-05-13T13:04:13.000Z
|
core/tests/test_forms.py
|
softwaydev/ca
|
7bf730b9aec9e1c27dc0dff2de286ff83a3cc954
|
[
"MIT"
] | 4
|
2017-05-16T17:48:17.000Z
|
2021-02-12T09:44:22.000Z
|
from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from core.tests import factories
root_crt_without_required_subj = b"""-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJAOlwYLIJGowlMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
BAYTAnJ1MRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTcwNTMwMDkwNDA0WhcNNDQxMDE1MDkwNDA0WjBF
MQswCQYDVQQGEwJydTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAsKy/7Gx5FMnuZcW/ZYrvVFeVUODYoO7L9LF6ST3dyYttehQMjosWMJrG
yWg2TxTbXmEC6ESvQfbvIKOM5AvR9jXd4+pLK5kUcc90X6J97weOui2mPL78rOmk
zaIc0fCdtOCBVmTpVTTa+bjDHKcC3rAOckxAafrXxzmbIcdsFNu11ai5hveaPokP
E3HjNUYyxG8+cvsYVcY6eZ4qaUQaXOtamBwq7BQx3qkAcCs2xMLsEevhelDShOef
hk4oBcOP8w2mww2aKhyUgaNoKhCT5AlwWV11s6RADE9E6Jcyd5cDUXJZb8DOSdM4
dVNxHAPuFbkapFsz7qy20bwd4vNBfQIDAQABo1AwTjAdBgNVHQ4EFgQUY+65I8yK
Jl36TYHnCKzpcsdYS70wHwYDVR0jBBgwFoAUY+65I8yKJl36TYHnCKzpcsdYS70w
DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAGZUyt3qJLbvV8WDBLvLL
XMyQWOlkPovGV9KA/es5tfCVeTuE5NCIZ8wtTNZ/09VA8lPOEmoPFdqHlfrURO1/
yqpJzSGXxlUbVOZJx67FN7q+gp0rvVd/6OsvNjbrdFPHC3RgU33E/qeBPgDhapDj
XzbIQcMFuUOIaSLg2B259Y6IOMGt4iAJHgwqSImjYrpcL8FbiWKon24DX65qncqf
IB2BXirAXlbj5EuLLfv0yik6vk1UCbdMH5CE0mCDbrTYWJpbPU7bKfiUFN5l7Wo2
R6ALVaDbdJI4fsWLT3mmHFcjoD6dZauIHNEqUEO5puI6iNbGxUPq/jaPVmAocO/+
iw==
-----END CERTIFICATE-----
"""
root_key_without_required_sub = b"""-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAsKy/7Gx5FMnuZcW/ZYrvVFeVUODYoO7L9LF6ST3dyYttehQM
josWMJrGyWg2TxTbXmEC6ESvQfbvIKOM5AvR9jXd4+pLK5kUcc90X6J97weOui2m
PL78rOmkzaIc0fCdtOCBVmTpVTTa+bjDHKcC3rAOckxAafrXxzmbIcdsFNu11ai5
hveaPokPE3HjNUYyxG8+cvsYVcY6eZ4qaUQaXOtamBwq7BQx3qkAcCs2xMLsEevh
elDShOefhk4oBcOP8w2mww2aKhyUgaNoKhCT5AlwWV11s6RADE9E6Jcyd5cDUXJZ
b8DOSdM4dVNxHAPuFbkapFsz7qy20bwd4vNBfQIDAQABAoIBAHNppkaP5dkKwM2D
DLEMvaNfQ49+EoWu+VVzyuqlm4jZqD6jckB745cExO81QKUQfu18eiW5GLQC19t+
e79NaW9paPZGS6zDZ3OhjegbgiDv0vEUeRAdw3pBdwNN733FrYBHWLZTXYnn6VRQ
ukSxZVKLuCQ6Y6nXz7W5j/nVCGnmtzhbevkdF+GidbpiEVbTUDKf9YCgvP+KH62u
zQHrwLxBWdY7QJ8zEmeDROuUTLDkN7lA5aCyuJ4DTQ66H5dSny2v/Ibv56/4hvt6
J4UlNPop2Hmeh0MskQmaHamxjXvRcr8Tg6/FIHMtlquLkFUm8j0n0VpmnGkk5Rau
f4DwfgECgYEA22BeWOH2fKCWoW8nFsmGWDfuDeZXP1EbkXsoLqEi04lFZCfdYDzp
dUANin2iqfpJ2tccvw+YTSH3xcRf5p7fUR/hb5nyrQl7Be5IIYNYPLeMvKP8ocKW
F9AvZYD5ksAXg0MBRQzedyWI5yTpNpwAChn/VVJk3pcdVtexQ3QmdB0CgYEAzitp
+ldpibyAOJv+YWdwsHDOWZ0tofTEHTcb6genLj0LddreGJJ9jpvYvMbsMWQev0zK
ybeqI10sTFzteemqNEBFJjVxzn0TLRuKtmD+Q/6wr2HolY1KyhQdJn3jeI3QfzdU
MYX3vwSiR2eywA6MzclLCXNmitNIZTGJLYd1xOECgYABvL6ih4+TJxZqSt4NYSUu
N6sr8wIH31WPjmEgFWiYMkMZavNm2rSimBJDYYFTRUcmc4Onw7DaE4XJzCdSRTnR
g6YeYyK32hZeUqfBlC+zs2Rq7gWHJmpX3+8wJ5hSYDEPeg1dhZ+RY/u0kOdD5nJd
oh0SiOeBl8LEuEqQFTBkxQKBgQDF9xfnAyJa2H7CXL9xJhMlyNvLXsqfddkOOIl8
OecE1ib3/rY+IAOh+PGvqs7HSlzf0cvyz4H2PRQ5Kw34fy8oxwHfA3iJDr5oFMco
ApCEF73uWfQsDiTfT1sCR+UxL/MhBK66cuoGKFvudptEIXSAcSW1KHMxIFmmmV8g
Ma8a4QKBgQCS+IKxOTVGCvJaw99mhGuAun+amKWy3LalXtBIsDcyn0/0TVJ9LZQt
QNITqfd43y2I2boK/9QIY68gmVBytfPz6tcGyqW/unfVa72FO2VKgoqc9NHB8G/+
rvRLUXTNxllTbnA0EmCgBDzSzNYBJ12fIAKL+6WK/YR4FvTxXcpkaA==
-----END RSA PRIVATE KEY-----
"""
site_crt_not_unique_cn = b"""-----BEGIN CERTIFICATE-----
MIIDkDCCAngCAQAwDQYJKoZIhvcNAQELBQAwgY0xCzAJBgNVBAYTAnJ1MRIwEAYD
VQQDDAkxMjcuMC4wLjExDzANBgNVBAgMBm1vc2NvdzEiMCAGCSqGSIb3DQEJARYT
bXIuYXJzMTU2QGdtYWlsLmNvbTERMA8GA1UECgwIU29mdC13YXkxETAPBgNVBAsM
CFNvZnQtd2F5MQ8wDQYDVQQHDAZtb3Njb3cwHhcNMTcwNTI5MTMwODMzWhcNMTkw
NTI5MTMwODMzWjCBjTEPMA0GA1UEBwwGbW9zY293MQswCQYDVQQGEwJydTERMA8G
A1UECgwIU29mdC13YXkxIjAgBgkqhkiG9w0BCQEWE21yLmFyczE1NkBnbWFpbC5j
b20xDzANBgNVBAgMBm1vc2NvdzERMA8GA1UECwwIU29mdC13YXkxEjAQBgNVBAMM
CTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKkN4JvZ
3QuR1nxZVXy9LUQ5JslnT/3+iZ0WJydsDznpcVIFKV1pmy8WSL1NOE1XlHqqS3xk
9Odlu40NsqTBW/WtizKwv/WTc4RUPfbk46PBzkGiGZuThZ8EfvSA7d/ydHefD1l9
Mi1zBMg8LSGBFvqRwAQuPvCQIsarZe01tyie9gQ2FkvWbYaBiwKiTJZbdZhEPR7F
CgjlxdEVgXtsJ5JIUr2xHpR0Z5AeHhbXkD5nxcJfwk5XCVOa2NcMj+I12zgZJHJL
VEF8CHLy4od80HcJ2RKkwF5rurRAURGqrGs6Yu3O6qvFZjk54YmR9SJzq2AdIkx9
SR0gMnTXYPPe6tECAwEAATANBgkqhkiG9w0BAQsFAAOCAQEALEMKo0pNsej4SBZ0
NsKi+WbWgN7hRkMIsw+RmzPl+L+1jhDp6I48M5b65B+FsUlTdViM8gPN7AuW1uLv
Dq9ZNXHFLXeu0znegIryu857K5XJqUz8W/K01BWyZfgOfWpZsaYmMnMtsiI/j6l/
PU/cHWvYnuRaZuKxUcjRdBdKEdR16XC47KnJKt7eXucJOK0U4zXLfEQZQ2dUVAUt
NNcDUtvlz/BVCnz5v0aYRkW6k1K0wDgqcOIKsZGXm+55mazQXv96QQ2ylThioCaT
sZ/xLSK1cn4n1EXUzHn3sy0nz0wauQwYL09Wg6uesZBHgWceVAR7uKN0lmg6TY47
w6QCaw==
-----END CERTIFICATE-----
"""
site_key_not_unique_cn = b"""-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCpDeCb2d0LkdZ8
WVV8vS1EOSbJZ0/9/omdFicnbA856XFSBSldaZsvFki9TThNV5R6qkt8ZPTnZbuN
DbKkwVv1rYsysL/1k3OEVD325OOjwc5Bohmbk4WfBH70gO3f8nR3nw9ZfTItcwTI
PC0hgRb6kcAELj7wkCLGq2XtNbconvYENhZL1m2GgYsCokyWW3WYRD0exQoI5cXR
FYF7bCeSSFK9sR6UdGeQHh4W15A+Z8XCX8JOVwlTmtjXDI/iNds4GSRyS1RBfAhy
8uKHfNB3CdkSpMBea7q0QFERqqxrOmLtzuqrxWY5OeGJkfUic6tgHSJMfUkdIDJ0
12Dz3urRAgMBAAECggEARB9keEkliuj8vmUdTsPIvuos2BH6qQZuG8/2fStNQ2/v
izarQYoxz5qyOx4n5vq4yWlgO8NO8QQMvL1dVIjabri9E/Mnl2UQsq1jvt7jYHTT
kZ0ppoie2sJsCkj+EjVYe2+sNsp9ctUbgzjEkvC6+sPK1aRxFm1uphIhY6I2qXYl
PzPejE0wwImFPztGzizuPerrsDJrzBboOkAzNqTY8+bdxB2xWQWUq7yyUHzwHC3u
S2a4R8TTmnJb2L8b8A1axYnJigtNk5CTH/Zo4OjDyZ5iLV70AKwSni0ObJAZ7CnB
h2WOV8M3jZP3mIhLoE1C3COSlupA4KbAaUVISDds8QKBgQDWL/VaXEsXxTFR2MBf
Cs85C36rsDCn8HBsIKzrfmxBkNSv5MqMwPTWfwK3D6GN82Ob4/rdULrSPJx7g/4Q
Mzf4yn5kcSZLR7IkiFbxc4roe73T+T+PJmoXDNpyhVIw4LENw6HGwc2a1ZRrGNgA
8a7ftinykgan0CcVww0IBK1SRQKBgQDKDmJ4cl9dLuDTZuOunoBgiz+Oly9xb4ee
rWi3lA4uXw40b8S3AQ8pcrp3Hiw93AX9tfsouaqRYjeBgAuc9PUw48PNS86Ky2ml
GKYcpdkGhcxiqjKvROXzi/LZIhaZh+Itl/66w3+As5g6p5f05uxpeQ0ISjFha5vR
1IGjudBFHQKBgQCO2Wt8uYNHtjefi705Zh8wv47a+OZqizyfkOdjJG0VCYAgU6oX
V/WzPQBVkTJBVyt+4/0DL/15i/0dj7mZml9hKcREPwa4PHf+T4QVAueJCEZhoqGW
Wpt1BhiHOo3HlYPgVzKFOepjssCK8QXXE1l7UKYHZwbTU0tOA0mkqGHkNQKBgEAD
nKjiO1pPTsVLFJku+CceFq27MjmzBvl7oPCARJnmXZ65Rk5gVIhiI7c3ZPbYLUG7
FO5LHEHhJwqtIYDBjqjFkDQLb01Dsp2umHn9BSvu2djsaRBkOKIXVYH7LcPIbBzb
ycUryMpim7kBfcAGJSIpSrq0nr5plD0/IS9Y4CX1AoGBAKhECGpbeQBUXtvAqx3v
tc3tMYXmlG4D5+P2gvhhc0kTjawFHVkVIZdaLncPCbYfp74lxZnCN7L9gOV9nXyK
UI8MAatj7MfJeWXyGYZv0jefP1Qp2GSe8vs499rgejrQAE5lTtsveBgnrYZBQKit
nd9JKxdGrDkWBPgnzxE4m9mU
-----END PRIVATE KEY-----
"""
class RootCrtForm(TestCase):
def setUp(self):
self.user = User.objects.create(
username='Serega',
password='passwd'
)
def test_upload_random_file(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('root_crt_upload_existing'), {'crt': SimpleUploadedFile('test.txt', b'test'),
'key': SimpleUploadedFile('tests.txt', b'test')})
self.assertContains(response, 'Please load valid certificate and key')
def test_upload_crt_without_required_subj(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('root_crt_upload_existing'), {'crt': SimpleUploadedFile('rootCA.crt',
root_crt_without_required_subj),
'key': SimpleUploadedFile('rootCA.key',
root_key_without_required_sub)})
self.assertContains(response,
'Please enter required field in certificate: Country, State, Location, Organization')
class CertificatesCreateForm(TestCase):
def setUp(self):
self.user = User.objects.create(
username='Serega',
password='passwd'
)
factories.RootCrt.create()
factories.SiteCrt.create()
def test_certificates_create_not_unique_cn(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('certificates_create'), {'cn': '127.0.0.1', 'validity_period': '2019-05-30'})
self.assertContains(response, 'Common name 127.0.0.1 not unique')
class CertificatesUploadExistingForm(TestCase):
def setUp(self):
self.user = User.objects.create(
username='Serega',
password='passwd'
)
factories.RootCrt.create()
factories.SiteCrt.create()
def test_upload_random_files(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('certificates_upload_existing'), {'crt_file': SimpleUploadedFile('test.txt',
b'test'),
'key_file': SimpleUploadedFile('tests.txt',
b'test')})
self.assertContains(response, 'Please load valid certificate and key')
def test_upload_crt_file_not_unique_cn(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('certificates_upload_existing'), {'crt_file': SimpleUploadedFile('site.crt',
site_crt_not_unique_cn),
'key_file': SimpleUploadedFile('site.key',
site_key_not_unique_cn)})
self.assertContains(response, 'Certificate with Common name 127.0.0.1 already exists in db')
def test_upload_random_text(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('certificates_upload_existing'), {'crt_text': 'test', 'key_text': 'test'})
self.assertContains(response, 'Please load valid certificate and key')
def test_upload_crt_text_not_unique_cn(self):
self.client.force_login(user=self.user)
response = self.client.post(reverse('certificates_upload_existing'), {'crt_text': site_crt_not_unique_cn.decode(),
'key_text': site_key_not_unique_cn.decode()})
self.assertContains(response, 'Certificate with Common name 127.0.0.1 already exists in db')
| 51.214634
| 134
| 0.772836
| 657
| 10,499
| 12.194825
| 0.420091
| 0.017474
| 0.012356
| 0.0166
| 0.221792
| 0.194084
| 0.188342
| 0.188342
| 0.188342
| 0.188342
| 0
| 0.091834
| 0.167159
| 10,499
| 204
| 135
| 51.465686
| 0.824451
| 0
| 0
| 0.201183
| 0
| 0
| 0.63568
| 0.5471
| 0
| 1
| 0
| 0
| 0.04142
| 1
| 0.059172
| false
| 0.017751
| 0.029586
| 0
| 0.106509
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4d507f7dec6f2e09a4c415f50b4cc4f055dfee9e
| 213
|
py
|
Python
|
libhdhomerun/common/__init__.py
|
fugf123d/astrilchukj
|
966e6f85789b9eac554a93320a62d98d517015ea
|
[
"MIT"
] | null | null | null |
libhdhomerun/common/__init__.py
|
fugf123d/astrilchukj
|
966e6f85789b9eac554a93320a62d98d517015ea
|
[
"MIT"
] | null | null | null |
libhdhomerun/common/__init__.py
|
fugf123d/astrilchukj
|
966e6f85789b9eac554a93320a62d98d517015ea
|
[
"MIT"
] | null | null | null |
__author__ = 'Adrian Strilchuk'
from channel import Channel
from device import Device
from discovereddevice import DiscoveredDevice
from discovereddevicelist import DiscoveredDeviceList
from lineup import Lineup
| 26.625
| 53
| 0.868545
| 23
| 213
| 7.869565
| 0.434783
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117371
| 213
| 7
| 54
| 30.428571
| 0.962766
| 0
| 0
| 0
| 0
| 0
| 0.075117
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.833333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
4d74493ad5e58cf71039bab54cc6b89d878ea421
| 167
|
py
|
Python
|
raddar/lib/exception.py
|
opayelle/raddar
|
c164813ea6dae0bfa51b6aa7f2afe0caa1e0d6fe
|
[
"MIT"
] | 4
|
2020-04-07T21:14:44.000Z
|
2020-12-14T09:06:38.000Z
|
raddar/lib/exception.py
|
opayelle/raddar
|
c164813ea6dae0bfa51b6aa7f2afe0caa1e0d6fe
|
[
"MIT"
] | 28
|
2020-10-19T19:58:21.000Z
|
2020-12-24T15:10:35.000Z
|
raddar/lib/exception.py
|
opayelle/raddar
|
c164813ea6dae0bfa51b6aa7f2afe0caa1e0d6fe
|
[
"MIT"
] | 1
|
2020-12-11T12:38:34.000Z
|
2020-12-11T12:38:34.000Z
|
class RaddarException(Exception):
pass
class FailedToCloneRepoException(RaddarException):
pass
class FailedToWriteRepoException(RaddarException):
pass
| 15.181818
| 50
| 0.796407
| 12
| 167
| 11.083333
| 0.5
| 0.135338
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149701
| 167
| 10
| 51
| 16.7
| 0.93662
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
4d8c036a64583a46badd10f7b7897681d3352c0d
| 528
|
py
|
Python
|
page/index_page.py
|
imzengyang/appiumexample
|
5bb0898f831103d5564ec4766141d41f99eb5712
|
[
"MIT"
] | null | null | null |
page/index_page.py
|
imzengyang/appiumexample
|
5bb0898f831103d5564ec4766141d41f99eb5712
|
[
"MIT"
] | null | null | null |
page/index_page.py
|
imzengyang/appiumexample
|
5bb0898f831103d5564ec4766141d41f99eb5712
|
[
"MIT"
] | null | null | null |
from util.get_by_local import GetByLocal
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class IndexPage:
def __init__(self,driver,i):
self.driver = driver
self.get_by_local = GetByLocal(self.driver)
# 首页侧边栏按钮
def get_traggle_button(self):
return self.get_by_local.get_element('traggle_button')
# 头像
def get_avatar_button(self):
return self.get_by_local.get_element('avatar')
| 25.142857
| 64
| 0.727273
| 71
| 528
| 5.126761
| 0.43662
| 0.054945
| 0.10989
| 0.115385
| 0.21978
| 0.21978
| 0.21978
| 0.21978
| 0.21978
| 0
| 0
| 0
| 0.198864
| 528
| 20
| 65
| 26.4
| 0.86052
| 0.018939
| 0
| 0
| 0
| 0
| 0.038835
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.333333
| 0.166667
| 0.833333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
4de58a342cb1d28e898db44251cc401ef798cfa4
| 325
|
py
|
Python
|
management/models.py
|
SashaPoraiko/academy-storage
|
387f236971085fde605c2a12b53b1734a925759a
|
[
"Unlicense",
"MIT"
] | null | null | null |
management/models.py
|
SashaPoraiko/academy-storage
|
387f236971085fde605c2a12b53b1734a925759a
|
[
"Unlicense",
"MIT"
] | 7
|
2020-06-05T23:54:27.000Z
|
2022-02-10T10:36:29.000Z
|
management/models.py
|
SashaPoraiko/academy-storage
|
387f236971085fde605c2a12b53b1734a925759a
|
[
"Unlicense",
"MIT"
] | null | null | null |
from django.db import models
class Feedback(models.Model):
message = models.CharField(max_length=2048)
name = models.CharField(max_length=80)
email = models.CharField(max_length=50)
phone = models.CharField(max_length=50)
def __str__(self):
return ' '.join((self.name, self.email, self.phone))
| 27.083333
| 60
| 0.704615
| 44
| 325
| 5.022727
| 0.522727
| 0.271493
| 0.325792
| 0.434389
| 0.235294
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037175
| 0.172308
| 325
| 11
| 61
| 29.545455
| 0.784387
| 0
| 0
| 0
| 0
| 0
| 0.003077
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.125
| 0.125
| 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
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 4
|
15006cda601cfc3e1ba119a7033abce340055750
| 1,241
|
py
|
Python
|
linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-1.1.2/Tutorial/Extend/vbxtest.py
|
mdavid/nuxleus
|
653f1310d8bf08eaa5a7e3326c2349e56a6abdc2
|
[
"BSD-3-Clause"
] | 1
|
2017-03-28T06:41:51.000Z
|
2017-03-28T06:41:51.000Z
|
linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-1.1.2/Tutorial/Extend/vbxtest.py
|
mdavid/nuxleus
|
653f1310d8bf08eaa5a7e3326c2349e56a6abdc2
|
[
"BSD-3-Clause"
] | null | null | null |
linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-1.1.2/Tutorial/Extend/vbxtest.py
|
mdavid/nuxleus
|
653f1310d8bf08eaa5a7e3326c2349e56a6abdc2
|
[
"BSD-3-Clause"
] | 1
|
2016-12-13T21:08:58.000Z
|
2016-12-13T21:08:58.000Z
|
#####################################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Microsoft Public
# License. A copy of the license can be found in the License.html file at the
# root of this distribution. If you cannot locate the Microsoft Public
# License, please send an email to dlr@microsoft.com. By using this source
# code in any fashion, you are agreeing to be bound by the terms of the
# Microsoft Public License.
#
# You must not remove this notice, or any other, from this software.
#
#####################################################################################
# Task 1
import clr
clr.AddReferenceToFile("vbextend.dll")
import Simple
dir(Simple)
s = Simple(10)
print s
# Task 2
import clr
clr.AddReferenceToFile("vbextend.dll")
import Simple
dir(Simple)
s = Simple(10)
for i in s: print i
# Task 3
import clr
clr.AddReferenceToFile("vbextend.dll")
import Simple
dir(Simple)
a = Simple(10)
b = Simple(20)
a + b
# Task 4
import clr
clr.AddReferenceToFile("vbextend.dll")
import Simple
a = Simple(10)
def X(i):
return i + 100
a.Transform(X)
| 22.563636
| 86
| 0.601128
| 167
| 1,241
| 4.467066
| 0.461078
| 0.048257
| 0.064343
| 0.160858
| 0.41689
| 0.344504
| 0.344504
| 0.344504
| 0.273458
| 0.273458
| 0
| 0.016983
| 0.193392
| 1,241
| 54
| 87
| 22.981481
| 0.728272
| 0.424658
| 0
| 0.730769
| 0
| 0
| 0.10148
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.307692
| null | null | 0.076923
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
150bd061ea810c85ea5d99815bf1a08eda06e29c
| 1,607
|
py
|
Python
|
theseus/base/augmentations/albumentation.py
|
lannguyen0910/food-recognition-baseline
|
8901ffa5d6545da1552661f41b4388199b2273a4
|
[
"MIT"
] | 7
|
2022-03-08T03:15:31.000Z
|
2022-03-28T03:31:49.000Z
|
theseus/base/augmentations/albumentation.py
|
lannguyen0910/food-recognition-baseline
|
8901ffa5d6545da1552661f41b4388199b2273a4
|
[
"MIT"
] | 2
|
2022-03-08T08:48:36.000Z
|
2022-03-13T01:44:55.000Z
|
theseus/base/augmentations/albumentation.py
|
lannguyen0910/food-recognition-baseline
|
8901ffa5d6545da1552661f41b4388199b2273a4
|
[
"MIT"
] | 3
|
2022-03-15T23:19:27.000Z
|
2022-03-30T08:18:59.000Z
|
from albumentations import (Compose, Normalize, RandomBrightnessContrast,
RandomCrop, Resize, RGBShift, ShiftScaleRotate,
SmallestMaxSize, MotionBlur, GaussianBlur, MedianBlur,
Blur, RandomRotate90, HorizontalFlip, VerticalFlip,
HueSaturationValue, RandomSizedCrop, IAASharpen, BboxParams)
from albumentations.pytorch.transforms import ToTensorV2
from . import TRANSFORM_REGISTRY
TRANSFORM_REGISTRY.register(RandomCrop, prefix='Alb')
TRANSFORM_REGISTRY.register(RGBShift, prefix='Alb')
TRANSFORM_REGISTRY.register(Normalize, prefix='Alb')
TRANSFORM_REGISTRY.register(Resize, prefix='Alb')
TRANSFORM_REGISTRY.register(Compose, prefix='Alb')
TRANSFORM_REGISTRY.register(RandomBrightnessContrast, prefix='Alb')
TRANSFORM_REGISTRY.register(ShiftScaleRotate, prefix='Alb')
TRANSFORM_REGISTRY.register(SmallestMaxSize, prefix='Alb')
TRANSFORM_REGISTRY.register(MotionBlur, prefix='Alb')
TRANSFORM_REGISTRY.register(GaussianBlur, prefix='Alb')
TRANSFORM_REGISTRY.register(MedianBlur, prefix='Alb')
TRANSFORM_REGISTRY.register(Blur, prefix='Alb')
TRANSFORM_REGISTRY.register(RandomRotate90, prefix='Alb')
TRANSFORM_REGISTRY.register(HorizontalFlip, prefix='Alb')
TRANSFORM_REGISTRY.register(VerticalFlip, prefix='Alb')
TRANSFORM_REGISTRY.register(HueSaturationValue, prefix='Alb')
TRANSFORM_REGISTRY.register(RandomSizedCrop, prefix='Alb')
TRANSFORM_REGISTRY.register(IAASharpen, prefix='Alb')
TRANSFORM_REGISTRY.register(ToTensorV2, prefix='Alb')
TRANSFORM_REGISTRY.register(BboxParams, prefix='Alb')
| 55.413793
| 88
| 0.784692
| 152
| 1,607
| 8.157895
| 0.197368
| 0.287903
| 0.403226
| 0.398387
| 0.520968
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004213
| 0.113877
| 1,607
| 29
| 89
| 55.413793
| 0.866573
| 0
| 0
| 0
| 0
| 0
| 0.037313
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.111111
| 0
| 0.111111
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1511e0523adc4de2e1aa279c8075f8657747e769
| 8,979
|
py
|
Python
|
tests/shap/test_shap.py
|
jamaliki/mlflux
|
2708e7f3d4d6a3467a0a045d1c8494a560e2dfb8
|
[
"Apache-2.0"
] | null | null | null |
tests/shap/test_shap.py
|
jamaliki/mlflux
|
2708e7f3d4d6a3467a0a045d1c8494a560e2dfb8
|
[
"Apache-2.0"
] | 4
|
2021-07-12T19:13:15.000Z
|
2021-07-12T20:09:22.000Z
|
tests/shap/test_shap.py
|
jamaliki/mlflux
|
2708e7f3d4d6a3467a0a045d1c8494a560e2dfb8
|
[
"Apache-2.0"
] | null | null | null |
from collections import namedtuple
import os
import numpy as np
import matplotlib.pyplot as plt
import shap
from sklearn.datasets import load_boston, load_iris
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
import pandas as pd
import pytest
import mlflow
ModelWithExplanation = namedtuple(
"ModelWithExplanation", ["model", "X", "shap_values", "base_values"]
)
def yield_artifacts(run_id, path=None):
"""
Yields all artifacts in the specified run.
"""
client = mlflow.tracking.MlflowClient()
for item in client.list_artifacts(run_id, path):
if item.is_dir:
yield from yield_artifacts(run_id, item.path)
else:
yield item.path
def get_iris():
data = load_iris()
return (
pd.DataFrame(data.data, columns=data.feature_names),
pd.Series(data.target, name="target"),
)
def get_boston():
data = load_boston()
return (
pd.DataFrame(data.data[:100, :4], columns=data.feature_names[:4]),
pd.Series(data.target[:100], name="target"),
)
@pytest.fixture(scope="module")
def regressor():
X, y = get_boston()
model = RandomForestRegressor()
model.fit(X, y)
explainer = shap.KernelExplainer(model.predict, shap.kmeans(X, 100))
shap_values = explainer.shap_values(X)
return ModelWithExplanation(model, X, shap_values, explainer.expected_value)
@pytest.fixture(scope="module")
def classifier():
X, y = get_iris()
model = RandomForestClassifier()
model.fit(X, y)
explainer = shap.KernelExplainer(model.predict_proba, shap.kmeans(X, 100))
shap_values = explainer.shap_values(X)
return ModelWithExplanation(model, X, shap_values, explainer.expected_value)
@pytest.mark.large
@pytest.mark.parametrize("np_obj", [float(0.0), np.array([0.0])])
def test_log_numpy(np_obj):
with mlflow.start_run() as run:
mlflow.shap._log_numpy(np_obj, "test.npy")
mlflow.shap._log_numpy(np_obj, "test.npy", artifact_path="dir")
artifacts = set(yield_artifacts(run.info.run_id))
assert artifacts == {"test.npy", "dir/test.npy"}
@pytest.mark.large
def test_log_matplotlib_figure():
fig, ax = plt.subplots()
ax.plot([0, 1], [2, 3])
with mlflow.start_run() as run:
mlflow.shap._log_matplotlib_figure(fig, "test.png")
mlflow.shap._log_matplotlib_figure(fig, "test.png", artifact_path="dir")
artifacts = set(yield_artifacts(run.info.run_id))
assert artifacts == {"test.png", "dir/test.png"}
@pytest.mark.large
def test_log_explanation_with_regressor(regressor):
model = regressor.model
X = regressor.X
with mlflow.start_run() as run:
explanation_path = mlflow.shap.log_explanation(model.predict, X)
# Assert no figure is open
assert len(plt.get_fignums()) == 0
artifact_path = "model_explanations_shap"
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_path == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
shap_values = np.load(os.path.join(explanation_path, "shap_values.npy"))
base_values = np.load(os.path.join(explanation_path, "base_values.npy"))
np.testing.assert_array_equal(shap_values, regressor.shap_values)
np.testing.assert_array_equal(base_values, regressor.base_values)
@pytest.mark.large
def test_log_explanation_with_classifier(classifier):
model = classifier.model
X = classifier.X
with mlflow.start_run() as run:
explanation_uri = mlflow.shap.log_explanation(model.predict_proba, X)
# Assert no figure is open
assert len(plt.get_fignums()) == 0
artifact_path = "model_explanations_shap"
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_uri == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
shap_values = np.load(os.path.join(explanation_uri, "shap_values.npy"))
base_values = np.load(os.path.join(explanation_uri, "base_values.npy"))
np.testing.assert_array_equal(shap_values, classifier.shap_values)
np.testing.assert_array_equal(base_values, classifier.base_values)
@pytest.mark.large
@pytest.mark.parametrize("artifact_path", ["dir", "dir1/dir2"])
def test_log_explanation_with_artifact_path(regressor, artifact_path):
model = regressor.model
X = regressor.X
with mlflow.start_run() as run:
explanation_path = mlflow.shap.log_explanation(model.predict, X, artifact_path)
# Assert no figure is open
assert len(plt.get_fignums()) == 0
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_path == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
shap_values = np.load(os.path.join(explanation_path, "shap_values.npy"))
base_values = np.load(os.path.join(explanation_path, "base_values.npy"))
np.testing.assert_array_equal(shap_values, regressor.shap_values)
np.testing.assert_array_equal(base_values, regressor.base_values)
@pytest.mark.large
def test_log_explanation_without_active_run(regressor):
model = regressor.model
X = regressor.X.values
try:
explanation_uri = mlflow.shap.log_explanation(model.predict, X)
finally:
run = mlflow.active_run()
mlflow.end_run()
# Assert no figure is open
assert len(plt.get_fignums()) == 0
artifact_path = "model_explanations_shap"
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_uri == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
shap_values = np.load(os.path.join(explanation_uri, "shap_values.npy"))
base_values = np.load(os.path.join(explanation_uri, "base_values.npy"))
np.testing.assert_array_equal(shap_values, regressor.shap_values)
np.testing.assert_array_equal(base_values, regressor.base_values)
@pytest.mark.large
def test_log_explanation_with_numpy_array(regressor):
model = regressor.model
X = regressor.X.values
with mlflow.start_run() as run:
explanation_uri = mlflow.shap.log_explanation(model.predict, X)
# Assert no figure is open
assert len(plt.get_fignums()) == 0
artifact_path = "model_explanations_shap"
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_uri == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
shap_values = np.load(os.path.join(explanation_uri, "shap_values.npy"))
base_values = np.load(os.path.join(explanation_uri, "base_values.npy"))
np.testing.assert_array_equal(shap_values, regressor.shap_values)
np.testing.assert_array_equal(base_values, regressor.base_values)
@pytest.mark.large
def test_log_explanation_with_small_features():
"""
Verifies that `log_explanation` does not fail even when `features` has less records than
`_MAXIMUM_BACKGROUND_DATA_SIZE`.
"""
num_rows = 50
assert num_rows < mlflow.shap._MAXIMUM_BACKGROUND_DATA_SIZE
X, y = get_boston()
X, y = X.iloc[:num_rows], y[:num_rows]
model = RandomForestRegressor()
model.fit(X, y)
with mlflow.start_run() as run:
explanation_uri = mlflow.shap.log_explanation(model.predict, X)
artifact_path = "model_explanations_shap"
artifacts = set(yield_artifacts(run.info.run_id))
assert explanation_uri == os.path.join(run.info.artifact_uri, artifact_path)
assert artifacts == {
os.path.join(artifact_path, "base_values.npy"),
os.path.join(artifact_path, "shap_values.npy"),
os.path.join(artifact_path, "summary_bar_plot.png"),
}
explainer = shap.KernelExplainer(model.predict, shap.kmeans(X, num_rows))
shap_values_expected = explainer.shap_values(X)
base_values = np.load(os.path.join(explanation_uri, "base_values.npy"))
shap_values = np.load(os.path.join(explanation_uri, "shap_values.npy"))
np.testing.assert_array_equal(base_values, explainer.expected_value)
np.testing.assert_array_equal(shap_values, shap_values_expected)
| 33.132841
| 92
| 0.708988
| 1,230
| 8,979
| 4.930894
| 0.114634
| 0.064303
| 0.059357
| 0.053421
| 0.784171
| 0.756307
| 0.73108
| 0.718054
| 0.66958
| 0.623413
| 0
| 0.004163
| 0.17062
| 8,979
| 270
| 93
| 33.255556
| 0.810259
| 0.032298
| 0
| 0.582888
| 0
| 0
| 0.089711
| 0.013295
| 0
| 0
| 0
| 0
| 0.171123
| 1
| 0.069519
| false
| 0
| 0.053476
| 0
| 0.144385
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1515e0a851ff995d7b215189411abfe58a193eb0
| 317
|
py
|
Python
|
Parte1/Cap3/exercicios/names_friends.py
|
fabianoflorentino/python-CursoIntensivoDePython
|
822288cc4b382936dde1bc647e3f8c2b925ced70
|
[
"Apache-2.0"
] | null | null | null |
Parte1/Cap3/exercicios/names_friends.py
|
fabianoflorentino/python-CursoIntensivoDePython
|
822288cc4b382936dde1bc647e3f8c2b925ced70
|
[
"Apache-2.0"
] | null | null | null |
Parte1/Cap3/exercicios/names_friends.py
|
fabianoflorentino/python-CursoIntensivoDePython
|
822288cc4b382936dde1bc647e3f8c2b925ced70
|
[
"Apache-2.0"
] | 1
|
2020-02-05T13:07:08.000Z
|
2020-02-05T13:07:08.000Z
|
names = ['Felipe','Celina','Jullyana','Lucas','Bryanda']
print(f'\nOlá {names[0]}\n')
print(f'{names[1]}\n')
print(f'{names[2]}\n')
print(f'{names[3]}\n')
print(f'{names[4]}\n')
print('=-'* 30)
print(f'\n{names[-1]}\n')
print(f'{names[-2]}\n')
print(f'{names[-3]}\n')
print(f'{names[-4]}\n')
print(f'{names[-5]}\n')
| 22.642857
| 56
| 0.564669
| 60
| 317
| 2.983333
| 0.283333
| 0.335196
| 0.312849
| 0.536313
| 0.569832
| 0.569832
| 0.569832
| 0.569832
| 0.569832
| 0.569832
| 0
| 0.04
| 0.053628
| 317
| 13
| 57
| 24.384615
| 0.556667
| 0
| 0
| 0
| 0
| 0
| 0.526814
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.916667
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
12b0cfef7b93a191bbc7a67c3ed64db5ebf1be68
| 583
|
py
|
Python
|
src/cwfollowup/admin.py
|
gravitationalwavedc/gwlab_cwfollowup
|
7bc9ab125c8336f5ac86ca24c24d02001e918b5e
|
[
"MIT"
] | null | null | null |
src/cwfollowup/admin.py
|
gravitationalwavedc/gwlab_cwfollowup
|
7bc9ab125c8336f5ac86ca24c24d02001e918b5e
|
[
"MIT"
] | null | null | null |
src/cwfollowup/admin.py
|
gravitationalwavedc/gwlab_cwfollowup
|
7bc9ab125c8336f5ac86ca24c24d02001e918b5e
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import CWFollowupJob, CWJob, CWJobCandidate
@admin.register(CWFollowupJob)
class CWFollowupJobAdmin(admin.ModelAdmin):
pass
class CWJobCandidateAdmin(admin.TabularInline):
model = CWJobCandidate
def has_change_permission(self, request, obj=None):
return False
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
@admin.register(CWJob)
class CWJobAdmin(admin.ModelAdmin):
inlines = [CWJobCandidateAdmin, ]
| 22.423077
| 56
| 0.746141
| 64
| 583
| 6.703125
| 0.484375
| 0.041958
| 0.146853
| 0.167832
| 0.300699
| 0.300699
| 0.300699
| 0.20979
| 0.20979
| 0
| 0
| 0
| 0.173242
| 583
| 25
| 57
| 23.32
| 0.890041
| 0
| 0
| 0.1875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.1875
| false
| 0.0625
| 0.125
| 0.1875
| 0.8125
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
12c1311df3df03b383a0c827dfc6f96da5824b1d
| 70
|
py
|
Python
|
BAMF_Detect/modules/yara/__init__.py
|
bwall/bamfdetect
|
3b0b96a8b2285a1a4b3e3cf5ed1b5ad422b91ed1
|
[
"MIT"
] | 152
|
2015-02-04T16:34:53.000Z
|
2021-07-27T19:00:40.000Z
|
BAMF_Detect/modules/yara/__init__.py
|
bwall/bamfdetect
|
3b0b96a8b2285a1a4b3e3cf5ed1b5ad422b91ed1
|
[
"MIT"
] | null | null | null |
BAMF_Detect/modules/yara/__init__.py
|
bwall/bamfdetect
|
3b0b96a8b2285a1a4b3e3cf5ed1b5ad422b91ed1
|
[
"MIT"
] | 30
|
2015-03-31T10:20:32.000Z
|
2022-02-09T16:17:04.000Z
|
# I would like to take advantage of this non-empty file to say 'hello'
| 70
| 70
| 0.757143
| 14
| 70
| 3.785714
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185714
| 70
| 1
| 70
| 70
| 0.929825
| 0.971429
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
12d9cfe139816209d51040b4016728c1dbabd8a7
| 48
|
py
|
Python
|
webapi/__init__.py
|
nnsnodnb/training_webapi
|
a0f82f13c1d29848ad4d48dfb789e0bcc46f681f
|
[
"MIT"
] | null | null | null |
webapi/__init__.py
|
nnsnodnb/training_webapi
|
a0f82f13c1d29848ad4d48dfb789e0bcc46f681f
|
[
"MIT"
] | 22
|
2021-11-26T09:00:10.000Z
|
2022-03-29T13:54:26.000Z
|
webapi/__init__.py
|
nnsnodnb/training_webapi
|
a0f82f13c1d29848ad4d48dfb789e0bcc46f681f
|
[
"MIT"
] | null | null | null |
default_app_config = "webapi.apps.WebapiConfig"
| 24
| 47
| 0.833333
| 6
| 48
| 6.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 48
| 1
| 48
| 48
| 0.844444
| 0
| 0
| 0
| 0
| 0
| 0.5
| 0.5
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
12daee3b44cb56fb1e4e78d60484f963d1ebe602
| 340
|
py
|
Python
|
scripts/get_list_of_subject_ids.py
|
sarahbald/BIG_2021_microbiome_evolution
|
8adb48e9596a30f2db5b49a0f47f0ddc1188fcdf
|
[
"BSD-2-Clause"
] | 2
|
2020-08-09T06:19:11.000Z
|
2021-08-18T17:12:23.000Z
|
scripts/get_list_of_subject_ids.py
|
sarahbald/BIG_2021_microbiome_evolution
|
8adb48e9596a30f2db5b49a0f47f0ddc1188fcdf
|
[
"BSD-2-Clause"
] | null | null | null |
scripts/get_list_of_subject_ids.py
|
sarahbald/BIG_2021_microbiome_evolution
|
8adb48e9596a30f2db5b49a0f47f0ddc1188fcdf
|
[
"BSD-2-Clause"
] | 8
|
2019-02-20T22:21:55.000Z
|
2021-02-13T00:55:40.000Z
|
import os
import sys
import parse_midas_data
outFile=open('/pollard/home/ngarud/BenNanditaProject/MIDAS_intermediate_files_hmp/subject_ids_hmp.txt','w')
subject_sample_time_map = parse_midas_data.parse_subject_sample_time_map()
for subject in subject_sample_time_map.keys(): # loop over subjects (hosts)
outFile.write(subject +'\n')
| 34
| 107
| 0.820588
| 51
| 340
| 5.098039
| 0.607843
| 0.15
| 0.196154
| 0.230769
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.082353
| 340
| 9
| 108
| 37.777778
| 0.833333
| 0.076471
| 0
| 0
| 0
| 0
| 0.288462
| 0.278846
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.428571
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
42060dba978c1885ae9b9411689b4cd030a17ab6
| 543
|
py
|
Python
|
dist/py/hidmouse.py
|
microsoft/jacdac
|
2c6548b7e55ac34141e5152c664ca268e873cf09
|
[
"CC-BY-4.0",
"MIT"
] | 31
|
2020-07-24T14:49:32.000Z
|
2022-03-20T12:20:56.000Z
|
dist/py/hidmouse.py
|
QPC-database/jacdac
|
74e9f7cebdb1db4c24f211aceb657b5125d0fd40
|
[
"CC-BY-4.0",
"MIT"
] | 747
|
2020-07-31T22:05:45.000Z
|
2022-03-31T23:27:35.000Z
|
dist/py/hidmouse.py
|
QPC-database/jacdac
|
74e9f7cebdb1db4c24f211aceb657b5125d0fd40
|
[
"CC-BY-4.0",
"MIT"
] | 17
|
2020-07-31T10:49:01.000Z
|
2022-03-15T03:21:43.000Z
|
# Autogenerated file for HID Mouse
# Add missing from ... import const
_JD_SERVICE_CLASS_HID_MOUSE = const(0x1885dc1c)
_JD_HID_MOUSE_BUTTON_LEFT = const(0x1)
_JD_HID_MOUSE_BUTTON_RIGHT = const(0x2)
_JD_HID_MOUSE_BUTTON_MIDDLE = const(0x4)
_JD_HID_MOUSE_BUTTON_EVENT_UP = const(0x1)
_JD_HID_MOUSE_BUTTON_EVENT_DOWN = const(0x2)
_JD_HID_MOUSE_BUTTON_EVENT_CLICK = const(0x3)
_JD_HID_MOUSE_BUTTON_EVENT_DOUBLE_CLICK = const(0x4)
_JD_HID_MOUSE_CMD_SET_BUTTON = const(0x80)
_JD_HID_MOUSE_CMD_MOVE = const(0x81)
_JD_HID_MOUSE_CMD_WHEEL = const(0x82)
| 41.769231
| 52
| 0.847145
| 93
| 543
| 4.290323
| 0.365591
| 0.240602
| 0.250627
| 0.280702
| 0.43609
| 0.240602
| 0
| 0
| 0
| 0
| 0
| 0.058233
| 0.082873
| 543
| 13
| 53
| 41.769231
| 0.742972
| 0.121547
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0.090526
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
420ce7345320f17a523b8c97df2bc0eff63da854
| 171
|
py
|
Python
|
example-plugin/src/flake8_example_plugin/__init__.py
|
jouve/flake8
|
79626c7020a0b0fda363d6b9df74e84ff36e6295
|
[
"MIT"
] | null | null | null |
example-plugin/src/flake8_example_plugin/__init__.py
|
jouve/flake8
|
79626c7020a0b0fda363d6b9df74e84ff36e6295
|
[
"MIT"
] | null | null | null |
example-plugin/src/flake8_example_plugin/__init__.py
|
jouve/flake8
|
79626c7020a0b0fda363d6b9df74e84ff36e6295
|
[
"MIT"
] | null | null | null |
"""Module for an example Flake8 plugin."""
from .off_by_default import ExampleTwo
from .on_by_default import ExampleOne
__all__ = (
'ExampleOne',
'ExampleTwo',
)
| 19
| 42
| 0.725146
| 21
| 171
| 5.52381
| 0.714286
| 0.155172
| 0.258621
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007042
| 0.169591
| 171
| 8
| 43
| 21.375
| 0.809859
| 0.210526
| 0
| 0
| 0
| 0
| 0.155039
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
4220b4f9e99459a2cff88a057d8be151264de695
| 29
|
py
|
Python
|
Autokey/CapsKeybinds/base/escape.py
|
MisaghM/Capslock-Keybindings
|
00332c7d39cf776c43fe13aa08e1c2969747425d
|
[
"MIT"
] | 1
|
2021-11-05T19:39:36.000Z
|
2021-11-05T19:39:36.000Z
|
Autokey/CapsKeybinds/base/escape.py
|
MisaghM/Capslock-Keybindings
|
00332c7d39cf776c43fe13aa08e1c2969747425d
|
[
"MIT"
] | null | null | null |
Autokey/CapsKeybinds/base/escape.py
|
MisaghM/Capslock-Keybindings
|
00332c7d39cf776c43fe13aa08e1c2969747425d
|
[
"MIT"
] | null | null | null |
keyboard.send_key("<escape>")
| 29
| 29
| 0.758621
| 4
| 29
| 5.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 29
| 1
| 29
| 29
| 0.724138
| 0
| 0
| 0
| 0
| 0
| 0.266667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
424c3f4f3cdca435b469ef0853b809d876d6d575
| 70
|
py
|
Python
|
examples/example_proj/dependency_app_o2o/__init__.py
|
philsupertramp/dj-migration-test
|
97ec4513b9848d96436907de7940841866895e3c
|
[
"MIT"
] | 4
|
2019-07-05T19:32:07.000Z
|
2020-02-07T00:47:15.000Z
|
examples/example_proj/dependency_app_o2o/__init__.py
|
philsupertramp/dj-migration-test
|
97ec4513b9848d96436907de7940841866895e3c
|
[
"MIT"
] | 17
|
2019-08-23T07:21:23.000Z
|
2021-09-22T18:44:26.000Z
|
examples/example_proj/dependency_app_o2o/__init__.py
|
philsupertramp/dj-migration-test
|
97ec4513b9848d96436907de7940841866895e3c
|
[
"MIT"
] | null | null | null |
default_app_config = 'dependency_app_o2o.apps.DependencyAppO2OConfig'
| 35
| 69
| 0.885714
| 8
| 70
| 7.25
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029851
| 0.042857
| 70
| 1
| 70
| 70
| 0.835821
| 0
| 0
| 0
| 0
| 0
| 0.657143
| 0.657143
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4262c8a07319658392fb3737ca998142cc6f96d2
| 576
|
py
|
Python
|
crypto_primitives/block_ciphers.py
|
wkta/ReadableCryptoReader
|
a09c92a9ac4c526cc4bda1508f661fbaeff4fef4
|
[
"MIT"
] | 14
|
2018-05-13T20:15:57.000Z
|
2021-09-28T18:12:24.000Z
|
crypto_primitives/block_ciphers.py
|
ArdeshirV/ReadableCryptoMiner
|
a09c92a9ac4c526cc4bda1508f661fbaeff4fef4
|
[
"MIT"
] | 2
|
2019-05-07T14:19:45.000Z
|
2021-08-16T14:10:47.000Z
|
crypto_primitives/block_ciphers.py
|
ArdeshirV/ReadableCryptoMiner
|
a09c92a9ac4c526cc4bda1508f661fbaeff4fef4
|
[
"MIT"
] | 7
|
2018-07-25T22:42:35.000Z
|
2021-12-16T16:50:05.000Z
|
"""
A block cipher is a method of encrypting text,
in which a cryptographic key and algorithm are applied to a block of data
(for example, 64 contiguous bits) at once as a group rather than to one bit at a time.
A block cipher is a deterministic algorithm operating on fixed-length groups of bits,
called a block, with an unvarying transformation that is specified by a symmetric key.
Block ciphers operate as important elementary components in the design of many cryptographic protocols,
and are widely used to implement encryption of bulk data.
"""
def dummy():
pass
| 38.4
| 103
| 0.784722
| 96
| 576
| 4.708333
| 0.666667
| 0.053097
| 0.053097
| 0.061947
| 0.066372
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004237
| 0.180556
| 576
| 14
| 104
| 41.142857
| 0.95339
| 0.942708
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
42830c6055749c59dc801d25666f04dafdde2160
| 321
|
py
|
Python
|
lookyloo/modules/__init__.py
|
OladeleO/lookyloo
|
f1f9cab2a946639332fd0526be361e1b43d094e4
|
[
"BSD-3-Clause"
] | 148
|
2020-06-14T06:55:42.000Z
|
2022-03-19T05:37:02.000Z
|
lookyloo/modules/__init__.py
|
OladeleO/lookyloo
|
f1f9cab2a946639332fd0526be361e1b43d094e4
|
[
"BSD-3-Clause"
] | 261
|
2020-06-16T22:29:27.000Z
|
2022-03-31T10:40:52.000Z
|
lookyloo/modules/__init__.py
|
OladeleO/lookyloo
|
f1f9cab2a946639332fd0526be361e1b43d094e4
|
[
"BSD-3-Clause"
] | 27
|
2020-06-08T12:28:33.000Z
|
2022-02-15T18:50:50.000Z
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .misp import MISP # noqa
from .pi import PhishingInitiative # noqa
from .sanejs import SaneJavaScript # noqa
from .urlscan import UrlScan # noqa
from .uwhois import UniversalWhois # noqa
from .vt import VirusTotal # noqa
from .phishtank import Phishtank # noqa
| 29.181818
| 42
| 0.735202
| 42
| 321
| 5.619048
| 0.5
| 0.20339
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007576
| 0.17757
| 321
| 10
| 43
| 32.1
| 0.886364
| 0.242991
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
4284e8db0023cf54565aa1363c6ac6cca6e8b69d
| 4,248
|
py
|
Python
|
jogoDaForca.py
|
celioroberto06/cursopythonexercicios
|
0a3f1b59395720760216b8e98767deb55e26f0d8
|
[
"MIT"
] | null | null | null |
jogoDaForca.py
|
celioroberto06/cursopythonexercicios
|
0a3f1b59395720760216b8e98767deb55e26f0d8
|
[
"MIT"
] | null | null | null |
jogoDaForca.py
|
celioroberto06/cursopythonexercicios
|
0a3f1b59395720760216b8e98767deb55e26f0d8
|
[
"MIT"
] | null | null | null |
import random
from random import randint
def msg_abertura():
print('\033[31m==' * 13)
print('BEM VINDO AO JOGO DA FORCA')
print('==' * 13, '\033[m')
def diversas_palavras():
palavras = ['BANANA', 'MAÇA', 'MORANGO', 'MELANCIA']
for c in range(1, 4):
palavras.append(str(input(f'Digite a {c}ª palavra: ')))
sorteio = random.choice(palavras)
palavra_secreta = sorteio.upper()
return palavra_secreta
def inicializa_letras_acertadas(palavra):
lista = ['_' for letra in palavra]
return lista
def pede_chute():
chute = input('Qual o seu chute? ').upper().strip()[0]
return chute
def marca_chute_correto(chute, letras_acertadas, palavra_secreta):
index = 0
for letra in palavra_secreta:
if (chute == letra):
letras_acertadas[index] = letra
index += 1
def msg_perdeu(palavra_secreta):
print("Puxa, você foi enforcado!")
print(f"A palavra era {palavra_secreta}")
print(" _______________ ")
print(" / \ ")
print(" / \ ")
print("// \/\ ")
print("\| XXXX XXXX | / ")
print(" | XXXX XXXX |/ ")
print(" | XXX XXX | ")
print(" | | ")
print(" \__ XXX __/ ")
print(" |\ XXX /| ")
print(" | | | | ")
print(" | I I I I I I I | ")
print(" | I I I I I I | ")
print(" \_ _/ ")
print(" \_ _/ ")
print(" \_______/ ")
def msg_ganhou():
print("Parabéns, você ganhou!")
print(" ___________ ")
print(" '._==_==_=_.' ")
print(" .-\ /-. ")
print(" | (|:. |) | ")
print(" '-|:. |-' ")
print(" \::. / ")
print(" '::. .' ")
print(" ) ( ")
print(" _.' '._ ")
print(" '-------' ")
def desenha_forca(erros):
print(" _______ ")
print(" |/ | ")
if (erros == 1):
print(" | (_) ")
print(" | ")
print(" | ")
print(" | ")
if (erros == 2):
print(" | (_) ")
print(" | \ ")
print(" | ")
print(" | ")
if (erros == 3):
print(" | (_) ")
print(" | \| ")
print(" | ")
print(" | ")
if (erros == 4):
print(" | (_) ")
print(" | \|/ ")
print(" | ")
print(" | ")
if (erros == 5):
print(" | (_) ")
print(" | \|/ ")
print(" | | ")
print(" | ")
if (erros == 6):
print(" | (_) ")
print(" | \|/ ")
print(" | | ")
print(" | / ")
if (erros == 7):
print(" | (_) ")
print(" | \|/ ")
print(" | | ")
print(" | / \ ")
print(" | ")
print("_|___ ")
print()
def jogar():
msg_abertura()
palavra_secreta = diversas_palavras()
letras_acertadas = inicializa_letras_acertadas(palavra_secreta)
print(letras_acertadas)
enforcou = False
acertou = False
erros = 0
while (not enforcou and not acertou):
chute = pede_chute()
if(chute in palavra_secreta):
marca_chute_correto(chute, letras_acertadas, palavra_secreta)
else:
erros += 1
desenha_forca(erros)
enforcou = erros == 7
acertou = '_' not in letras_acertadas
print(letras_acertadas)
letras_faltando = str(letras_acertadas.count('_'))
print(f'Ainda esta faltando {letras_faltando} letras')
if(acertou):
msg_ganhou()
else:
msg_perdeu(palavra_secreta)
print('FIM DO JOGO')
if (__name__== "__main__"):
jogar()
| 27.057325
| 73
| 0.397128
| 333
| 4,248
| 4.714715
| 0.276276
| 0.267516
| 0.27707
| 0.242038
| 0.295541
| 0.243949
| 0.140764
| 0.12293
| 0.031847
| 0
| 0
| 0.011558
| 0.450094
| 4,248
| 156
| 74
| 27.230769
| 0.660531
| 0
| 0
| 0.274194
| 0
| 0
| 0.325165
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.072581
| false
| 0
| 0.016129
| 0
| 0.112903
| 0.556452
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
4299e2acd56667e8aba3d20744defa6336387f9d
| 466
|
py
|
Python
|
Praktikum/Modul3/Aritmatika.py
|
raddox7/19104027_TeoriGUI
|
8f62b71e339c6244c9b27259f402408426df0f85
|
[
"MIT"
] | null | null | null |
Praktikum/Modul3/Aritmatika.py
|
raddox7/19104027_TeoriGUI
|
8f62b71e339c6244c9b27259f402408426df0f85
|
[
"MIT"
] | null | null | null |
Praktikum/Modul3/Aritmatika.py
|
raddox7/19104027_TeoriGUI
|
8f62b71e339c6244c9b27259f402408426df0f85
|
[
"MIT"
] | null | null | null |
class Aritmatika:
@staticmethod
def tambah(a, b):
return a + b
@staticmethod
def kurang(a, b):
return a - b
@staticmethod
def bagi(a, b):
return a / b
@staticmethod
def bagi_int(a, b):
return a // b
@staticmethod
def pangkat(a, b):
return a ** b
# Langsung call class dan method
print(Aritmatika.tambah(5, 5))
# Bikin object dlu
objekA = Aritmatika()
print(objekA.pangkat(2, 3))
| 16.068966
| 32
| 0.579399
| 63
| 466
| 4.269841
| 0.380952
| 0.074349
| 0.148699
| 0.167286
| 0.438662
| 0.401487
| 0.401487
| 0.215613
| 0
| 0
| 0
| 0.0125
| 0.313305
| 466
| 29
| 33
| 16.068966
| 0.828125
| 0.100858
| 0
| 0.263158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.263158
| false
| 0
| 0
| 0.263158
| 0.578947
| 0.105263
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
c4029269d012fe0271c61d34124cd173abac980a
| 314
|
py
|
Python
|
logbunker/apps/bunker/routes/__init__.py
|
parada3desu/logbunker
|
1cc3f197c0d1662946ef65bb9f97a89f625d0c1b
|
[
"MIT"
] | null | null | null |
logbunker/apps/bunker/routes/__init__.py
|
parada3desu/logbunker
|
1cc3f197c0d1662946ef65bb9f97a89f625d0c1b
|
[
"MIT"
] | null | null | null |
logbunker/apps/bunker/routes/__init__.py
|
parada3desu/logbunker
|
1cc3f197c0d1662946ef65bb9f97a89f625d0c1b
|
[
"MIT"
] | 1
|
2021-12-28T15:20:20.000Z
|
2021-12-28T15:20:20.000Z
|
from fastapi import APIRouter
from logbunker.apps.bunker.routes.status_routes import register as register_status_routes
from logbunker.apps.bunker.routes.log_routes import register as register_log_routes
def register_routes(router: APIRouter):
register_status_routes(router)
register_log_routes(router)
| 31.4
| 89
| 0.847134
| 43
| 314
| 5.930233
| 0.325581
| 0.141176
| 0.133333
| 0.180392
| 0.462745
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101911
| 314
| 9
| 90
| 34.888889
| 0.904255
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.5
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c45e8bf8f5117a3680e00a2cded67f15c98e2c8c
| 317
|
py
|
Python
|
CasStereoNet/models/__init__.py
|
wsAndy/cascade-stereo
|
c5140963b3c7e2fffcbc2b0e475f4f4aca7389df
|
[
"MIT"
] | 329
|
2019-12-17T13:55:54.000Z
|
2022-03-30T11:51:15.000Z
|
CasStereoNet/models/__init__.py
|
wsAndy/cascade-stereo
|
c5140963b3c7e2fffcbc2b0e475f4f4aca7389df
|
[
"MIT"
] | 32
|
2020-01-09T09:55:07.000Z
|
2022-01-10T03:57:26.000Z
|
CasStereoNet/models/__init__.py
|
wsAndy/cascade-stereo
|
c5140963b3c7e2fffcbc2b0e475f4f4aca7389df
|
[
"MIT"
] | 90
|
2019-12-19T08:34:35.000Z
|
2022-03-24T06:53:35.000Z
|
from models.gwcnet import GwcNet
from models.loss import model_psmnet_loss, stereo_psmnet_loss
from models.loss import model_gwcnet_loss
from models.psmnet import PSMNet
__models__ = {
"gwcnet": GwcNet,
"gwcnet-c": PSMNet
}
__loss__ = {
"gwcnet": stereo_psmnet_loss,
"gwcnet-c": stereo_psmnet_loss
}
| 22.642857
| 61
| 0.757098
| 43
| 317
| 5.162791
| 0.209302
| 0.225225
| 0.216216
| 0.18018
| 0.225225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157729
| 317
| 14
| 62
| 22.642857
| 0.831461
| 0
| 0
| 0
| 0
| 0
| 0.08805
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
c46ec93de4a3c22da44b5f89fec2d4da00f682d8
| 4,721
|
py
|
Python
|
cogs/moderation.py
|
EatSleepCode-Repeat/pantomath-bot
|
e58c7591c7bff9713529b3df5ef2050745f22d1d
|
[
"MIT"
] | null | null | null |
cogs/moderation.py
|
EatSleepCode-Repeat/pantomath-bot
|
e58c7591c7bff9713529b3df5ef2050745f22d1d
|
[
"MIT"
] | null | null | null |
cogs/moderation.py
|
EatSleepCode-Repeat/pantomath-bot
|
e58c7591c7bff9713529b3df5ef2050745f22d1d
|
[
"MIT"
] | null | null | null |
import discord
from discord.ext import tasks, commands
import asyncio
import datetime
import sqlite3
from time import sleep
import json
class ModerationsCog(commands.Cog, name="Moderations"):
def __init__(self, bot):
self.bot = bot
self.red = 0xfc0322
self.yellow = 0xeef21e
self.green = 0x36d233
def get_perms(self, user):
db = sqlite3.connect("main.db")
cursor = db.cursor()
cursor.execute(f"SELECT role_id, perm FROM rolePerms")
results = cursor.fetchall()
perms = []
if results is not None:
for role in user.roles:
for id, perm in results:
if str(role.id) == id and perm not in perms:
perms.append(perm)
return perms
@commands.command()
async def ban(self , ctx, id:int, *, reason="None set"):
if "mod.ban" in self.get_perms(ctx.author):
user = ctx.guild.get_member(id)
if user is None:
await ctx.send("Invalid id.")
else:
if "mod.ban_bypass" in self.get_perms(user):
await ctx.send("Cant ban that user.")
return
await user.ban(reason=f"{reason} | issued by: {ctx.author}")
await ctx.send(f"Banned {user}")
db = sqlite3.connect("main.db")
cursor = db.cursor()
cursor.execute(f"SELECT channel_id FROM channels WHERE channel_type = 'mod.output'")
result = cursor.fetchone()
channel = ctx.guild.get_channel(int(result[0]))
embed = discord.Embed(title="User ban", color=self.red)
embed.add_field(name="**User**", value=f"{user}\n({user.id})")
embed.add_field(name="**Moderator**", value=f"{ctx.author}\n({ctx.author.id})")
embed.add_field(inline=False, name="**Reason**", value=reason)
await channel.send(embed=embed)
else:
await ctx.send("You do not have the required permissions to run this command.")
@commands.command()
async def unban(self , ctx, id:int):
if "mod.unban" in self.get_perms(ctx.author):
user = discord.Object(id=id)
if user is None:
await ctx.send("Invalid id.")
else:
try:
await ctx.guild.unban(user)
except:
await ctx.send("User is not banned")
return
await ctx.send(f"Unbanned {user.id}")
db = sqlite3.connect("main.db")
cursor = db.cursor()
cursor.execute(f"SELECT channel_id FROM channels WHERE channel_type = 'mod.output'")
result = cursor.fetchone()
channel = ctx.guild.get_channel(int(result[0]))
embed = discord.Embed(title="User unban", color=self.green)
embed.add_field(name="**User**", value=f"{user.id}")
embed.add_field(name="**Moderator**", value=f"{ctx.author}\n({ctx.author.id})")
await channel.send(embed=embed)
else:
await ctx.send("You do not have the required permissions to run this command.")
@commands.command()
async def kick(self , ctx, id:int, *, reason="None set"):
if "mod.kick" in self.get_perms(ctx.author):
user = ctx.guild.get_member(id)
if user is None:
await ctx.send("Invalid id.")
else:
if "mod.kick_bypass" in self.get_perms(user):
await ctx.send("Cant ban that user.")
return
await user.kick(reason=f"{reason} | issued by: {ctx.author}")
await ctx.send(f"Kicked {user}")
db = sqlite3.connect("main.db")
cursor = db.cursor()
cursor.execute(f"SELECT channel_id FROM channels WHERE channel_type = 'mod.output'")
result = cursor.fetchone()
channel = ctx.guild.get_channel(int(result[0]))
embed = discord.Embed(title="User kick", color=self.yellow)
embed.add_field(name="**User**", value=f"{user}\n({user.id})")
embed.add_field(name="**Moderator**", value=f"{ctx.author}\n({ctx.author.id})")
embed.add_field(inline=False, name="**Reason**", value=reason)
await channel.send(embed=embed)
else:
await ctx.send("You do not have the required permissions to run this command.")
def setup(bot):
bot.add_cog(ModerationsCog(bot))
print("Moderations is loaded")
| 37.173228
| 100
| 0.543953
| 576
| 4,721
| 4.401042
| 0.194444
| 0.041026
| 0.056805
| 0.040237
| 0.716765
| 0.716765
| 0.716765
| 0.706114
| 0.695464
| 0.671795
| 0
| 0.006969
| 0.331286
| 4,721
| 126
| 101
| 37.468254
| 0.796009
| 0
| 0
| 0.52
| 0
| 0
| 0.210337
| 0.019699
| 0
| 0
| 0.005084
| 0
| 0
| 1
| 0.03
| false
| 0.02
| 0.07
| 0
| 0.15
| 0.01
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
6725668aba435db2a6fc560f645df86a3d9b855f
| 192
|
py
|
Python
|
angstrom/geometry/__init__.py
|
kbsezginel/angstrom
|
793fd05b9bf27cab50d5c292fe63f685ea767d6d
|
[
"BSD-3-Clause"
] | 15
|
2018-04-26T18:34:02.000Z
|
2022-01-25T09:37:35.000Z
|
angstrom/geometry/__init__.py
|
kbsezginel/angstrom
|
793fd05b9bf27cab50d5c292fe63f685ea767d6d
|
[
"BSD-3-Clause"
] | 13
|
2018-07-31T17:26:10.000Z
|
2020-05-15T05:07:05.000Z
|
angstrom/geometry/__init__.py
|
kbsezginel/angstrom
|
793fd05b9bf27cab50d5c292fe63f685ea767d6d
|
[
"BSD-3-Clause"
] | 4
|
2020-01-15T08:31:54.000Z
|
2022-03-03T16:43:15.000Z
|
"""
--- Ångström ---
Geometric operations for Ångström Python package.
"""
from .geometry import get_molecule_center, align_vectors
from .quaternion import Quaternion
from .plane import Plane
| 24
| 56
| 0.786458
| 23
| 192
| 6.434783
| 0.695652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 192
| 7
| 57
| 27.428571
| 0.880952
| 0.34375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6760f944504178e83f795a6146dafed27381aa97
| 2,917
|
py
|
Python
|
radtraq/tests/test_proc.py
|
cgodine/RadTraQ
|
023e170d993e316bb5ff5d816b70499710f7f8a3
|
[
"BSD-3-Clause"
] | null | null | null |
radtraq/tests/test_proc.py
|
cgodine/RadTraQ
|
023e170d993e316bb5ff5d816b70499710f7f8a3
|
[
"BSD-3-Clause"
] | null | null | null |
radtraq/tests/test_proc.py
|
cgodine/RadTraQ
|
023e170d993e316bb5ff5d816b70499710f7f8a3
|
[
"BSD-3-Clause"
] | null | null | null |
import radtraq
import pytest
import act
import numpy as np
@pytest.mark.mpl_image_compare(tolerance=10)
def test_cloud_mask():
f = radtraq.tests.sample_files.EXAMPLE_KAZR
ge = act.io.armfiles.read_netcdf(f)
ge = radtraq.proc.cloud_mask.calc_cloud_mask(ge, 'reflectivity_copol')
ge = ge.where(ge['cloud_mask_2'] == 1)
display = act.plotting.TimeSeriesDisplay(ge)
display.plot('reflectivity_copol', cmap='jet')
display.axes[0].set_ylim([0, 20000])
ge.close()
return display.fig
def test_calc_avg_profile():
variables = ['reflectivity_copol', 'reflectivity_xpol']
profile_variables = [var + '_avg_prof' for var in variables]
f = radtraq.tests.sample_files.EXAMPLE_KAZR
ge = act.io.armfiles.read_netcdf(f)
ge = radtraq.proc.profile.calc_avg_profile(ge, variables)
assert np.isclose(np.nansum(ge[profile_variables[0]].values), -1316.9692)
assert np.isclose(np.nansum(ge[profile_variables[1]].values), -3882.646)
def test_extract_profile():
drop_variables = ['base_time', 'time_offset', 'longitude', 'latitude',
'altitued', 'altitude_agl']
drop_variables = []
f = radtraq.tests.sample_files.EXAMPLE_PPI
obj = act.io.armfiles.read_netcdf(f, drop_variables=drop_variables)
profile_obj = radtraq.proc.profile.extract_profile(obj, azimuth=124, ground_dist=13094,
ground_range_units='m')
assert np.isclose(np.nansum(profile_obj['co_to_crosspol_correlation_coeff'].values), 0.7470845)
assert np.isclose(np.nansum(profile_obj['mean_doppler_velocity'].values), 5.9618464)
variables = ['reflectivity', 'co_to_crosspol_correlation_coeff', 'mean_doppler_velocity']
profile_obj = radtraq.proc.profile.extract_profile(obj, azimuth=124,
ground_dist=13094, variables=variables)
assert (set(profile_obj.keys()) - set(variables)) == set(['lat', 'lon', 'alt'])
def test_extract_profile_at_lat_lon():
drop_variables = ['base_time', 'time_offset', 'longitude', 'latitude',
'altitued', 'altitude_agl']
drop_variables = []
f = radtraq.tests.sample_files.EXAMPLE_PPI
obj = act.io.armfiles.read_netcdf(f, drop_variables=drop_variables)
profile_obj = radtraq.proc.profile.extract_profile_at_lat_lon(obj, 29.68, -95.08)
assert np.isclose(np.nansum(profile_obj['co_to_crosspol_correlation_coeff'].values), 2.6366916)
assert np.isclose(np.nansum(profile_obj['mean_doppler_velocity'].values), -11.544132)
variables = ['reflectivity', 'co_to_crosspol_correlation_coeff', 'mean_doppler_velocity']
profile_obj = radtraq.proc.profile.extract_profile_at_lat_lon(obj, 29.68, -95.08,
variables=variables)
assert (set(profile_obj.keys()) - set(variables)) == set(['lat', 'lon', 'alt'])
| 47.819672
| 99
| 0.684607
| 378
| 2,917
| 5.005291
| 0.285714
| 0.063425
| 0.047569
| 0.053911
| 0.725687
| 0.714059
| 0.714059
| 0.709302
| 0.665962
| 0.665962
| 0
| 0.038769
| 0.186493
| 2,917
| 60
| 100
| 48.616667
| 0.758534
| 0
| 0
| 0.36
| 0
| 0
| 0.159068
| 0.072677
| 0
| 0
| 0
| 0
| 0.16
| 1
| 0.08
| false
| 0
| 0.08
| 0
| 0.18
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
676106b9a9d19536976dfbf668b91830add123e5
| 9,947
|
py
|
Python
|
TasteModel/logger/iv.py
|
ESROCOS/control-mc_watchdog
|
62ffb1f1843b0be0b780a0186f0d0ef7f27a58e5
|
[
"CECILL-B"
] | null | null | null |
TasteModel/logger/iv.py
|
ESROCOS/control-mc_watchdog
|
62ffb1f1843b0be0b780a0186f0d0ef7f27a58e5
|
[
"CECILL-B"
] | null | null | null |
TasteModel/logger/iv.py
|
ESROCOS/control-mc_watchdog
|
62ffb1f1843b0be0b780a0186f0d0ef7f27a58e5
|
[
"CECILL-B"
] | null | null | null |
#! /usr/bin/python
Ada, C, GUI, SIMULINK, VHDL, OG, RTDS, SYSTEM_C, SCADE6, VDM, CPP = range(11)
thread, passive, unknown = range(3)
PI, RI = range(2)
synch, asynch = range(2)
param_in, param_out = range(2)
UPER, NATIVE, ACN = range(3)
cyclic, sporadic, variator, protected, unprotected = range(5)
enumerated, sequenceof, sequence, set, setof, integer, boolean, real, choice, octetstring, string = range(11)
functions = {}
functions['joystickdriver'] = {
'name_with_case' : 'JoystickDriver',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['joystickdriver']['interfaces']['step'] = {
'port_name': 'step',
'parent_fv': 'joystickdriver',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': cyclic,
'period': 100,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['joystickdriver']['interfaces']['step']['paramsInOrdered'] = []
functions['joystickdriver']['interfaces']['step']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd'] = {
'port_name': 'cmd',
'parent_fv': 'joystickdriver',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'cmddispatcher',
'calling_threads': {},
'distant_name': 'cmd',
'queue_size': 1
}
functions['joystickdriver']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['joystickdriver']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'cmd',
'param_direction': param_in
}
functions['cmddispatcher'] = {
'name_with_case' : 'CmdDispatcher',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['cmddispatcher']['interfaces']['cmd'] = {
'port_name': 'cmd',
'parent_fv': 'cmddispatcher',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'cmd',
'param_direction': param_in
}
functions['cmddispatcher']['interfaces']['log_cmd'] = {
'port_name': 'log_cmd',
'parent_fv': 'cmddispatcher',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'logger',
'calling_threads': {},
'distant_name': 'log_cmd',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['log_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'log_cmd',
'param_direction': param_in
}
functions['cmddispatcher']['interfaces']['test_cmd'] = {
'port_name': 'test_cmd',
'parent_fv': 'cmddispatcher',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'watchdog',
'calling_threads': {},
'distant_name': 'test_cmd',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['test_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'test_cmd',
'param_direction': param_in
}
functions['watchdog'] = {
'name_with_case' : 'Watchdog',
'runtime_nature': thread,
'language': CPP,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['watchdog']['interfaces']['test_cmd'] = {
'port_name': 'test_cmd',
'parent_fv': 'watchdog',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['watchdog']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['test_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'test_cmd',
'param_direction': param_in
}
functions['watchdog']['interfaces']['purge'] = {
'port_name': 'purge',
'parent_fv': 'watchdog',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': cyclic,
'period': 80,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['watchdog']['interfaces']['purge']['paramsInOrdered'] = []
functions['watchdog']['interfaces']['purge']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd'] = {
'port_name': 'mot_cmd',
'parent_fv': 'watchdog',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'blsclient',
'calling_threads': {},
'distant_name': 'mot_cmd',
'queue_size': 1
}
functions['watchdog']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'mot_cmd',
'param_direction': param_in
}
functions['logger'] = {
'name_with_case' : 'Logger',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['logger']['interfaces']['log_cmd'] = {
'port_name': 'log_cmd',
'parent_fv': 'logger',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['logger']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['logger']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['logger']['interfaces']['log_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'log_cmd',
'param_direction': param_in
}
functions['blsclient'] = {
'name_with_case' : 'BLSClient',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['blsclient']['interfaces']['mot_cmd'] = {
'port_name': 'mot_cmd',
'parent_fv': 'blsclient',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['blsclient']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['blsclient']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['blsclient']['interfaces']['mot_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'mot_cmd',
'param_direction': param_in
}
| 27.103542
| 109
| 0.610837
| 1,026
| 9,947
| 5.643275
| 0.11306
| 0.02418
| 0.019344
| 0.037997
| 0.845769
| 0.764076
| 0.725216
| 0.631952
| 0.629706
| 0.584456
| 0
| 0.010725
| 0.175128
| 9,947
| 366
| 110
| 27.177596
| 0.694942
| 0.001709
| 0
| 0.70405
| 0
| 0
| 0.505489
| 0.075738
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.003115
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 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
| 4
|
6787d1404eb21c6fe5d73ebd1bd89ba45243b3f1
| 706
|
py
|
Python
|
miniworld/model/spatial/Point.py
|
miniworld-project/miniworld_core
|
c591bad232b78eae99e8f55cb1b907c1e228484b
|
[
"MIT"
] | 5
|
2019-05-11T14:57:15.000Z
|
2021-07-05T00:35:25.000Z
|
miniworld/model/spatial/Point.py
|
miniworld-project/miniworld_core
|
c591bad232b78eae99e8f55cb1b907c1e228484b
|
[
"MIT"
] | 27
|
2017-03-17T07:11:02.000Z
|
2019-05-26T23:36:56.000Z
|
miniworld/model/spatial/Point.py
|
miniworld-project/miniworld_core
|
c591bad232b78eae99e8f55cb1b907c1e228484b
|
[
"MIT"
] | 6
|
2017-05-03T12:11:33.000Z
|
2020-04-03T11:44:27.000Z
|
# encoding: utf-8
__author__ = "Patrick Lampe"
__email__ = "uni at lampep.de"
class Point:
def __init__(self, id, location):
self.id = id
self.location = location
def getId(self):
return self.id
def get_distance_in_m(self, snd_node):
return self.get_distance_in_km(snd_node) * 1000
def get_distance_in_km(self, snd_node):
return self.location.get_distance_in_km(snd_node.location)
def get_heading(self, snd_node):
return self.location.get_heading(snd_node.location)
def get_lat(self):
return self.location.get_lat_lon().to_string()[0]
def get_lon(self):
return self.location.get_lat_lon().to_string()[1]
| 23.533333
| 66
| 0.675637
| 105
| 706
| 4.161905
| 0.333333
| 0.1373
| 0.118993
| 0.19222
| 0.546911
| 0.418764
| 0.324943
| 0.17849
| 0.17849
| 0
| 0
| 0.012704
| 0.219547
| 706
| 29
| 67
| 24.344828
| 0.780399
| 0.021246
| 0
| 0
| 0
| 0
| 0.042151
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.388889
| false
| 0
| 0
| 0.333333
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
67c2efb13b24392ee063d32d46776a793e628926
| 1,489
|
py
|
Python
|
api/tacticalrmm/checks/migrations/0028_auto_20220401_2301.py
|
v2cloud/tacticalrmm
|
12f599f9749985f66ff9b559c5e5abd36064b182
|
[
"MIT"
] | null | null | null |
api/tacticalrmm/checks/migrations/0028_auto_20220401_2301.py
|
v2cloud/tacticalrmm
|
12f599f9749985f66ff9b559c5e5abd36064b182
|
[
"MIT"
] | null | null | null |
api/tacticalrmm/checks/migrations/0028_auto_20220401_2301.py
|
v2cloud/tacticalrmm
|
12f599f9749985f66ff9b559c5e5abd36064b182
|
[
"MIT"
] | null | null | null |
# Generated by Django 3.2.12 on 2022-04-01 23:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('checks', '0027_auto_20220401_2248'),
]
operations = [
migrations.RemoveField(
model_name='check',
name='execution_time',
),
migrations.RemoveField(
model_name='check',
name='extra_details',
),
migrations.RemoveField(
model_name='check',
name='fail_count',
),
migrations.RemoveField(
model_name='check',
name='history',
),
migrations.RemoveField(
model_name='check',
name='last_run',
),
migrations.RemoveField(
model_name='check',
name='more_info',
),
migrations.RemoveField(
model_name='check',
name='outage_history',
),
migrations.RemoveField(
model_name='check',
name='parent_check',
),
migrations.RemoveField(
model_name='check',
name='retcode',
),
migrations.RemoveField(
model_name='check',
name='status',
),
migrations.RemoveField(
model_name='check',
name='stderr',
),
migrations.RemoveField(
model_name='check',
name='stdout',
),
]
| 24.016129
| 48
| 0.496306
| 119
| 1,489
| 6.02521
| 0.378151
| 0.351464
| 0.435146
| 0.502092
| 0.672245
| 0.672245
| 0.128312
| 0
| 0
| 0
| 0
| 0.035242
| 0.390195
| 1,489
| 61
| 49
| 24.409836
| 0.754405
| 0.030893
| 0
| 0.654545
| 1
| 0
| 0.139486
| 0.015961
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.018182
| 0
| 0.072727
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
67c8c7d01e27d0208820ac881f16a2777e158282
| 23
|
py
|
Python
|
gui/__init__.py
|
JAEBuckingham/World-Builder
|
525c08734c72cbba46d2bbfa437b6a6cf3d1c78c
|
[
"MIT"
] | null | null | null |
gui/__init__.py
|
JAEBuckingham/World-Builder
|
525c08734c72cbba46d2bbfa437b6a6cf3d1c78c
|
[
"MIT"
] | null | null | null |
gui/__init__.py
|
JAEBuckingham/World-Builder
|
525c08734c72cbba46d2bbfa437b6a6cf3d1c78c
|
[
"MIT"
] | null | null | null |
"""code for the gui"""
| 11.5
| 22
| 0.565217
| 4
| 23
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 23
| 1
| 23
| 23
| 0.684211
| 0.695652
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
67d050c1af6770196909f1ed593636cea6804290
| 162
|
py
|
Python
|
tests/testapp/forms.py
|
schwartzmx/django-s3file
|
370e5cf1eae4339c38e32e4b4f955e27509bd27f
|
[
"MIT"
] | null | null | null |
tests/testapp/forms.py
|
schwartzmx/django-s3file
|
370e5cf1eae4339c38e32e4b4f955e27509bd27f
|
[
"MIT"
] | null | null | null |
tests/testapp/forms.py
|
schwartzmx/django-s3file
|
370e5cf1eae4339c38e32e4b4f955e27509bd27f
|
[
"MIT"
] | null | null | null |
from django import forms
from .models import FileModel
class UploadForm(forms.ModelForm):
class Meta:
model = FileModel
fields = ('file',)
| 16.2
| 34
| 0.666667
| 18
| 162
| 6
| 0.722222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.253086
| 162
| 9
| 35
| 18
| 0.892562
| 0
| 0
| 0
| 0
| 0
| 0.024691
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
db35c9dd7f7a7aec76bd33ccefbba99ca5540780
| 93
|
py
|
Python
|
FormsTest/apps.py
|
zhangjiang1203/AuthModuleModel
|
04a8ebcba131643595127c254098bc4cfd14dea8
|
[
"MIT"
] | null | null | null |
FormsTest/apps.py
|
zhangjiang1203/AuthModuleModel
|
04a8ebcba131643595127c254098bc4cfd14dea8
|
[
"MIT"
] | null | null | null |
FormsTest/apps.py
|
zhangjiang1203/AuthModuleModel
|
04a8ebcba131643595127c254098bc4cfd14dea8
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class FormstestConfig(AppConfig):
name = 'FormsTest'
| 15.5
| 33
| 0.763441
| 10
| 93
| 7.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 93
| 5
| 34
| 18.6
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0.096774
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
e1d5338681d4565b31048accc0f5cccd917d5762
| 241
|
py
|
Python
|
src/controllers/__init__.py
|
HDUAIS/MARL_Bench
|
f592d20ddbcb2039453cf56221083d4ac64dee46
|
[
"Apache-2.0"
] | null | null | null |
src/controllers/__init__.py
|
HDUAIS/MARL_Bench
|
f592d20ddbcb2039453cf56221083d4ac64dee46
|
[
"Apache-2.0"
] | null | null | null |
src/controllers/__init__.py
|
HDUAIS/MARL_Bench
|
f592d20ddbcb2039453cf56221083d4ac64dee46
|
[
"Apache-2.0"
] | null | null | null |
REGISTRY = {}
from .basic_controller import BasicMAC
from .separate_controller import SeparateMAC
from .noise_controller import NoiseMAC
REGISTRY["basic_mac"] = BasicMAC
REGISTRY["separate_mac"]=SeparateMAC
REGISTRY["noise_mac"] = NoiseMAC
| 26.777778
| 44
| 0.817427
| 28
| 241
| 6.821429
| 0.392857
| 0.251309
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095436
| 241
| 9
| 45
| 26.777778
| 0.876147
| 0
| 0
| 0
| 0
| 0
| 0.123967
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.428571
| 0
| 0.428571
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
e1e30c9b03ee596e5a4012e41de82e2aa9ec2315
| 1,202
|
py
|
Python
|
src/media_server/migrations/0009_auto_20190522_1548.py
|
nefarius/portfolio-backend
|
f595041354eedee71a4aa5b761501be030b81d09
|
[
"Apache-2.0"
] | 6
|
2019-06-19T12:56:42.000Z
|
2021-12-26T07:22:47.000Z
|
src/media_server/migrations/0009_auto_20190522_1548.py
|
nefarius/portfolio-backend
|
f595041354eedee71a4aa5b761501be030b81d09
|
[
"Apache-2.0"
] | 13
|
2019-12-20T10:39:44.000Z
|
2022-02-10T09:11:09.000Z
|
src/media_server/migrations/0009_auto_20190522_1548.py
|
nefarius/portfolio-backend
|
f595041354eedee71a4aa5b761501be030b81d09
|
[
"Apache-2.0"
] | 1
|
2021-12-01T12:03:29.000Z
|
2021-12-01T12:03:29.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-22 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('media_server', '0008_auto_20190409_1429'),
]
operations = [
migrations.AlterField(
model_name='audio',
name='license',
field=models.CharField(default=None, max_length=255, null=True),
),
migrations.AlterField(
model_name='document',
name='license',
field=models.CharField(default=None, max_length=255, null=True),
),
migrations.AlterField(
model_name='image',
name='license',
field=models.CharField(default=None, max_length=255, null=True),
),
migrations.AlterField(
model_name='other',
name='license',
field=models.CharField(default=None, max_length=255, null=True),
),
migrations.AlterField(
model_name='video',
name='license',
field=models.CharField(default=None, max_length=255, null=True),
),
]
| 29.317073
| 76
| 0.581531
| 123
| 1,202
| 5.528455
| 0.414634
| 0.147059
| 0.183824
| 0.213235
| 0.626471
| 0.626471
| 0.626471
| 0.626471
| 0.626471
| 0.626471
| 0
| 0.058057
| 0.297837
| 1,202
| 40
| 77
| 30.05
| 0.74763
| 0.057404
| 0
| 0.606061
| 1
| 0
| 0.086726
| 0.020354
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.060606
| 0
| 0.151515
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 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
| 4
|
e1f7a03eb790b88bd53a288e9f8c661128227703
| 216
|
py
|
Python
|
cogs/utils/Checks.py
|
LBlend/osu--player-voting-bot
|
62214c787a4857ecbacd9a284894a252ffd39124
|
[
"MIT"
] | null | null | null |
cogs/utils/Checks.py
|
LBlend/osu--player-voting-bot
|
62214c787a4857ecbacd9a284894a252ffd39124
|
[
"MIT"
] | null | null | null |
cogs/utils/Checks.py
|
LBlend/osu--player-voting-bot
|
62214c787a4857ecbacd9a284894a252ffd39124
|
[
"MIT"
] | null | null | null |
from discord.ext import commands
def is_guild_member():
def predicate(ctx):
guild = ctx.bot.get_guild(565230012366848000)
return ctx.author in guild.members
return commands.check(predicate)
| 24
| 53
| 0.722222
| 28
| 216
| 5.464286
| 0.678571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104046
| 0.199074
| 216
| 8
| 54
| 27
| 0.780347
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c01153f0bb0429efbab94e04c1d5aaf333c23950
| 371
|
py
|
Python
|
pipeline/config.py
|
martin-fabbri/nlp-behavioral-testing
|
352cab74f5d62561e08d92135e4609db1fe38fd5
|
[
"Apache-2.0"
] | null | null | null |
pipeline/config.py
|
martin-fabbri/nlp-behavioral-testing
|
352cab74f5d62561e08d92135e4609db1fe38fd5
|
[
"Apache-2.0"
] | 1
|
2021-02-19T08:08:52.000Z
|
2021-02-19T08:08:52.000Z
|
pipeline/config.py
|
martin-fabbri/nlp-behavioral-testing
|
352cab74f5d62561e08d92135e4609db1fe38fd5
|
[
"Apache-2.0"
] | null | null | null |
from pathlib import Path
class Config:
RANDOM_SEED = 47
ARTIFACTS_PATH = Path("./artifacts")
DATASET_PATH = Path("./dataset")
RAW_DATA = str(DATASET_PATH / "data_raw.txt")
TEST_SET = str(ARTIFACTS_PATH / "test_set.tsv")
TOP_PERTURBATIONS = str(ARTIFACTS_PATH / "top_perturbations.txt")
TEST_SCORES = str(ARTIFACTS_PATH / "test_scores.json")
| 30.916667
| 69
| 0.706199
| 49
| 371
| 5.040816
| 0.44898
| 0.210526
| 0.194332
| 0.161943
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006536
| 0.175202
| 371
| 11
| 70
| 33.727273
| 0.800654
| 0
| 0
| 0
| 0
| 0
| 0.218329
| 0.056604
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.111111
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
c0164f180897c1dfcfada1703dc63e5cb407b8dd
| 422
|
py
|
Python
|
iris_sdk/models/data/sip_peer_hosts.py
|
NumberAI/python-bandwidth-iris
|
0e05f79d68b244812afb97e00fd65b3f46d00aa3
|
[
"MIT"
] | 2
|
2020-04-13T13:47:59.000Z
|
2022-02-23T20:32:41.000Z
|
iris_sdk/models/data/sip_peer_hosts.py
|
bandwidthcom/python-bandwidth-iris
|
dbcb30569631395041b92917252d913166f7d3c9
|
[
"MIT"
] | 5
|
2020-09-18T20:59:24.000Z
|
2021-08-25T16:51:42.000Z
|
iris_sdk/models/data/sip_peer_hosts.py
|
bandwidthcom/python-bandwidth-iris
|
dbcb30569631395041b92917252d913166f7d3c9
|
[
"MIT"
] | 5
|
2018-12-12T14:39:50.000Z
|
2020-11-17T21:42:29.000Z
|
#!/usr/bin/env python
from iris_sdk.models.base_resource import BaseData, BaseResourceList
from iris_sdk.models.data.sip_peer_host import SipPeerHost
from iris_sdk.models.maps.sip_peer_hosts import SipPeerHostsMap
class SipPeerHosts(SipPeerHostsMap, BaseData):
@property
def items(self):
return self.sip_peer_host.items
def __init__(self):
self.sip_peer_host = BaseResourceList(SipPeerHost)
| 30.142857
| 68
| 0.78673
| 56
| 422
| 5.642857
| 0.517857
| 0.088608
| 0.10443
| 0.161392
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13981
| 422
| 14
| 69
| 30.142857
| 0.870523
| 0.047393
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.333333
| 0.111111
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
|
0
| 4
|
c03b2c33a6a485ee1634c9c6b156ab841d5d717f
| 650
|
py
|
Python
|
src/utils/doubly_circular_array_list.py
|
paolopertino/TasteIt
|
1e5a3de432c1c1868ffb1e52ebf0661dbc2980d1
|
[
"MIT"
] | null | null | null |
src/utils/doubly_circular_array_list.py
|
paolopertino/TasteIt
|
1e5a3de432c1c1868ffb1e52ebf0661dbc2980d1
|
[
"MIT"
] | null | null | null |
src/utils/doubly_circular_array_list.py
|
paolopertino/TasteIt
|
1e5a3de432c1c1868ffb1e52ebf0661dbc2980d1
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod, abstractproperty
class DoublyCircularArrayList(ABC):
@abstractmethod
def add(self, newElement):
pass
@abstractmethod
def remove(self):
pass
@abstractmethod
def setCurrentElementWithHisNext(self):
pass
@abstractmethod
def setCurrentElementWithHisPrev(self):
pass
@abstractmethod
def clone(self):
pass
@abstractproperty
def next(self):
pass
@abstractproperty
def prev(self):
pass
@abstractproperty
def current(self):
pass
@abstractproperty
def size(self):
pass
| 16.25
| 53
| 0.629231
| 55
| 650
| 7.436364
| 0.363636
| 0.156479
| 0.205379
| 0.264059
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.306154
| 650
| 39
| 54
| 16.666667
| 0.906874
| 0
| 0
| 0.62069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.310345
| false
| 0.310345
| 0.034483
| 0
| 0.37931
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
c06432191a4afa40de1971e98ec567f3f234506d
| 207
|
py
|
Python
|
spec/health/microhealth/healthcheck.py
|
tikal-fuseday/python-microprofile
|
3700db5ca0be6a31df7d8aac8a523f9199484e76
|
[
"Apache-2.0"
] | 10
|
2020-02-17T14:44:13.000Z
|
2021-07-01T11:11:39.000Z
|
spec/health/microhealth/healthcheck.py
|
tikalk/python-microprofile
|
3700db5ca0be6a31df7d8aac8a523f9199484e76
|
[
"Apache-2.0"
] | null | null | null |
spec/health/microhealth/healthcheck.py
|
tikalk/python-microprofile
|
3700db5ca0be6a31df7d8aac8a523f9199484e76
|
[
"Apache-2.0"
] | 1
|
2020-03-05T09:57:55.000Z
|
2020-03-05T09:57:55.000Z
|
from abc import abstractmethod
from spec.health.microhealth.healthcheck_response import HealthcheckResponse
class Healthcheck:
@abstractmethod
def call(self) -> HealthcheckResponse:
pass
| 18.818182
| 76
| 0.777778
| 20
| 207
| 8
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 207
| 10
| 77
| 20.7
| 0.935673
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0.166667
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
c0689b8ee904c3fd1f5f0bc32884bc696f664c3b
| 750
|
py
|
Python
|
looking_for_group/games/admin.py
|
andrlik/looking-for-group
|
0b1cecb37ef0f6d75692fd188130e2c60d09b7d2
|
[
"BSD-3-Clause"
] | null | null | null |
looking_for_group/games/admin.py
|
andrlik/looking-for-group
|
0b1cecb37ef0f6d75692fd188130e2c60d09b7d2
|
[
"BSD-3-Clause"
] | null | null | null |
looking_for_group/games/admin.py
|
andrlik/looking-for-group
|
0b1cecb37ef0f6d75692fd188130e2c60d09b7d2
|
[
"BSD-3-Clause"
] | null | null | null |
from django.contrib import admin
from . import models
# Register your models here.
class GamePostingAdmin(admin.ModelAdmin):
pass
class GameSessionAdmin(admin.ModelAdmin):
pass
class PlayerAdmin(admin.ModelAdmin):
pass
class CharacterAdmin(admin.ModelAdmin):
pass
class AdventureLogAdmin(admin.ModelAdmin):
pass
class GameApplicantAdmin(admin.ModelAdmin):
pass
admin.site.register(models.GamePosting, GamePostingAdmin)
admin.site.register(models.GameSession, GameSessionAdmin)
admin.site.register(models.AdventureLog, AdventureLogAdmin)
admin.site.register(models.Player, PlayerAdmin)
admin.site.register(models.Character, CharacterAdmin)
admin.site.register(models.GamePostingApplication, GameApplicantAdmin)
| 19.736842
| 70
| 0.804
| 78
| 750
| 7.730769
| 0.320513
| 0.149254
| 0.189055
| 0.228856
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.110667
| 750
| 37
| 71
| 20.27027
| 0.904048
| 0.034667
| 0
| 0.3
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.3
| 0.1
| 0
| 0.4
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
c06948c1f4a500c0afedf3fec27cba801edfe99d
| 583
|
py
|
Python
|
ingestion/src/metadata/generated/schema/api/catalogVersion.py
|
jbuoncri1/OpenMetadata
|
df1c197e1f2b3016402ca5d32ea8bf7a3f626352
|
[
"Apache-2.0"
] | null | null | null |
ingestion/src/metadata/generated/schema/api/catalogVersion.py
|
jbuoncri1/OpenMetadata
|
df1c197e1f2b3016402ca5d32ea8bf7a3f626352
|
[
"Apache-2.0"
] | null | null | null |
ingestion/src/metadata/generated/schema/api/catalogVersion.py
|
jbuoncri1/OpenMetadata
|
df1c197e1f2b3016402ca5d32ea8bf7a3f626352
|
[
"Apache-2.0"
] | null | null | null |
# generated by datamodel-codegen:
# filename: schema/api/catalogVersion.json
# timestamp: 2021-10-01T19:50:55+00:00
from __future__ import annotations
from typing import Optional
from pydantic import BaseModel, Field
from ..type import basic
class CatalogApplicationSoftwareVersion(BaseModel):
version: Optional[str] = Field(None, description='Software version of the catalog')
revision: Optional[str] = Field(
None, description='Software revision of the catalog'
)
timestamp: Optional[basic.Timestamp] = Field(None, description='Build timestamp')
| 29.15
| 87
| 0.754717
| 68
| 583
| 6.411765
| 0.573529
| 0.061927
| 0.137615
| 0.091743
| 0.178899
| 0.178899
| 0
| 0
| 0
| 0
| 0
| 0.036511
| 0.154374
| 583
| 19
| 88
| 30.684211
| 0.84787
| 0.19554
| 0
| 0
| 1
| 0
| 0.167742
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
fbe80216e7adcb8db678918ba2ca1790bc513d3d
| 4,773
|
py
|
Python
|
shamiko/gdb_rpc.py
|
bonprosoft/shamiko
|
1d7188d02f03c9d80dfa122de6f1e7cf3cff71e7
|
[
"MIT"
] | 12
|
2019-12-01T23:37:25.000Z
|
2022-02-07T10:34:20.000Z
|
shamiko/gdb_rpc.py
|
bonprosoft/shamiko
|
1d7188d02f03c9d80dfa122de6f1e7cf3cff71e7
|
[
"MIT"
] | null | null | null |
shamiko/gdb_rpc.py
|
bonprosoft/shamiko
|
1d7188d02f03c9d80dfa122de6f1e7cf3cff71e7
|
[
"MIT"
] | null | null | null |
import os
from typing import List, Optional, Tuple, Union
from shamiko.simple_rpc.client import RPCClient
from shamiko.simple_rpc.serializer import SerializationPromise
class FrameWrapper(SerializationPromise):
def run_simple_string(self, py_str):
# type: (str) -> None
return self._call_rpc("run_simple_string", [py_str])
def run_file(self, file_path):
# type: (str) -> None
# NOTE: In order to avoid confusion, we use an absolute path for file_path
file_path = os.path.abspath(file_path)
return self._call_rpc("run_file", [file_path])
def is_evalframe(self):
# type: () -> bool
return self._call_rpc("is_evalframe")
def is_other_python_frame(self):
# type: () -> Union[bool, str]
return self._call_rpc("is_other_python_frame")
@property
def is_optimized_out(self):
# type: () -> bool
return self._call_rpc("is_optimized_out")
@property
def filename(self):
# type: () -> Optional[str]
return self._call_rpc("filename")
@property
def current_line_num(self):
# type: () -> Optional[int]
return self._call_rpc("current_line_num")
@property
def current_line(self):
# type: () -> Optional[str]
return self._call_rpc("current_line")
def get_index(self):
# type: () -> int
return self._call_rpc("get_index")
def check_selected(self):
# type: () -> bool
return self._call_rpc("check_selected")
def select(self):
# type: () -> bool
return self._call_rpc("select")
def list_local_variables(self):
# type: () -> List[str]
return self._call_rpc("list_local_variables")
def list_global_variables(self):
# type: () -> List[str]
return self._call_rpc("list_global_variables")
def get_variable_repr(self, variable_name, repr_max_len=1024):
# type: (str, Optional[int]) -> Optional[Tuple[str, str]]
return self._call_rpc(
"get_variable_repr", [variable_name, repr_max_len]
)
class ThreadWrapper(SerializationPromise):
@property
def global_num(self):
# type: () -> int
return self._call_rpc("global_num")
@property
def num(self):
# type: () -> int
return self._call_rpc("num")
@property
def ptid(self):
# type: () -> Tuple[int, int, int]
return self._call_rpc("ptid")
@property
def name(self):
# type: () -> str
return self._call_rpc("name")
@property
def is_exited(self):
# type: () -> bool
return self._call_rpc("is_exited")
@property
def is_running(self):
# type: () -> bool
return self._call_rpc("is_running")
@property
def is_stopped(self):
# type: () -> bool
return self._call_rpc("is_stopped")
@property
def is_valid(self):
# type: () -> bool
return self._call_rpc("is_valid")
@property
def is_selected(self):
# type: () -> bool
return self._call_rpc("is_selected")
def switch(self):
# type: () -> None
return self._call_rpc("switch")
def get_python_frames(self):
# type: () -> List[FrameWrapper]
return self._call_rpc("get_python_frames")
class InferiorWrapper(SerializationPromise):
@property
def threads(self):
# type: () -> List[ThreadWrapper]
return self._call_rpc("threads")
@property
def pid(self):
# type: () -> int
return self._call_rpc("pid")
@property
def num(self):
# type: () -> int
return self._call_rpc("num")
@property
def was_attached(self):
# type: () -> bool
return self._call_rpc("was_attached")
@property
def is_valid(self):
# type: () -> bool
return self._call_rpc("is_valid")
class GdbWrapper(SerializationPromise):
def get_inferior(self):
# type: () -> List[InferiorWrapper]
return self._call_rpc("get_inferior")
def get_selected_inferior(self):
# type: () -> InferiorWrapper
return self._call_rpc("get_selected_inferior")
def get_selected_thread(self):
# type: () -> ThreadWrapper
return self._call_rpc("get_selected_thread")
def execute(self, cmd):
# type: (str) -> str
return self._call_rpc("execute", [cmd])
def create_rpc_client(socket_path):
# type: (str) -> RPCClient
client = RPCClient(socket_path)
client.register_promise_class(GdbWrapper)
client.register_promise_class(InferiorWrapper)
client.register_promise_class(ThreadWrapper)
client.register_promise_class(FrameWrapper)
return client
| 25.940217
| 82
| 0.611565
| 562
| 4,773
| 4.900356
| 0.161922
| 0.123457
| 0.17284
| 0.209877
| 0.432825
| 0.34459
| 0.275236
| 0.233842
| 0.112564
| 0.112564
| 0
| 0.001138
| 0.263775
| 4,773
| 183
| 83
| 26.081967
| 0.782584
| 0.177666
| 0
| 0.25
| 0
| 0
| 0.097994
| 0.016204
| 0
| 0
| 0
| 0
| 0
| 1
| 0.336538
| false
| 0
| 0.038462
| 0.317308
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
fbe8f208369a4c3ff2bacddca96f27710c2960e6
| 2,762
|
py
|
Python
|
Python/microsoft_bonsai_api/simulator/generated/models/__init__.py
|
ForrestTrepte/microsoft-bonsai-api
|
c8ac5829aa39fe5fd0362bfd68a0698b86e0bd0a
|
[
"MIT"
] | 3
|
2021-06-16T22:05:13.000Z
|
2021-12-18T14:42:57.000Z
|
Python/microsoft_bonsai_api/simulator/generated/models/__init__.py
|
dbbevan/microsoft-bonsai-api
|
ecbab2c575450010339c07241db992ccc1629f66
|
[
"MIT"
] | 10
|
2021-05-27T23:34:53.000Z
|
2022-03-25T20:36:59.000Z
|
Python/microsoft_bonsai_api/simulator/generated/models/__init__.py
|
dbbevan/microsoft-bonsai-api
|
ecbab2c575450010339c07241db992ccc1629f66
|
[
"MIT"
] | 4
|
2021-06-09T13:42:28.000Z
|
2022-02-17T22:07:25.000Z
|
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import EpisodeFinish
from ._models_py3 import EpisodeStart
from ._models_py3 import EpisodeStep
from ._models_py3 import Event
from ._models_py3 import Idle
from ._models_py3 import ProblemDetails
from ._models_py3 import Purpose
from ._models_py3 import PurposeTarget
from ._models_py3 import SimulatorContext
from ._models_py3 import SimulatorInterface
from ._models_py3 import SimulatorSessionMilestone
from ._models_py3 import SimulatorSessionProgress
from ._models_py3 import SimulatorSessionResponse
from ._models_py3 import SimulatorSessionSummary
from ._models_py3 import SimulatorState
from ._models_py3 import Unregister
except (SyntaxError, ImportError):
from ._models import EpisodeFinish # type: ignore
from ._models import EpisodeStart # type: ignore
from ._models import EpisodeStep # type: ignore
from ._models import Event # type: ignore
from ._models import Idle # type: ignore
from ._models import ProblemDetails # type: ignore
from ._models import Purpose # type: ignore
from ._models import PurposeTarget # type: ignore
from ._models import SimulatorContext # type: ignore
from ._models import SimulatorInterface # type: ignore
from ._models import SimulatorSessionMilestone # type: ignore
from ._models import SimulatorSessionProgress # type: ignore
from ._models import SimulatorSessionResponse # type: ignore
from ._models import SimulatorSessionSummary # type: ignore
from ._models import SimulatorState # type: ignore
from ._models import Unregister # type: ignore
from ._simulator_api_enums import (
EpisodeFinishReason,
EventType,
PurposeTypesAction,
SimulatorContextTypesDeploymentMode,
SimulatorSessionTypesStatus,
UnregisterReason,
)
__all__ = [
"EpisodeFinish",
"EpisodeStart",
"EpisodeStep",
"Event",
"Idle",
"ProblemDetails",
"Purpose",
"PurposeTarget",
"SimulatorContext",
"SimulatorInterface",
"SimulatorSessionMilestone",
"SimulatorSessionProgress",
"SimulatorSessionResponse",
"SimulatorSessionSummary",
"SimulatorState",
"Unregister",
"EpisodeFinishReason",
"EventType",
"PurposeTypesAction",
"SimulatorContextTypesDeploymentMode",
"SimulatorSessionTypesStatus",
"UnregisterReason",
]
| 36.826667
| 102
| 0.701665
| 245
| 2,762
| 7.685714
| 0.253061
| 0.169942
| 0.110462
| 0.161445
| 0.338821
| 0.131705
| 0
| 0
| 0
| 0
| 0
| 0.010213
| 0.184649
| 2,762
| 74
| 103
| 37.324324
| 0.825933
| 0.200217
| 0
| 0
| 1
| 0
| 0.163237
| 0.072245
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.515152
| 0
| 0.515152
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
fbf936e0ae70176f3e939f2154ed78e730c0048c
| 101
|
py
|
Python
|
src/dataprocessor/apps.py
|
chinmay-hegde/Smart-Options
|
8c85e393c6f1f0197d6bbc39a64e6847c0b409ca
|
[
"MIT"
] | null | null | null |
src/dataprocessor/apps.py
|
chinmay-hegde/Smart-Options
|
8c85e393c6f1f0197d6bbc39a64e6847c0b409ca
|
[
"MIT"
] | null | null | null |
src/dataprocessor/apps.py
|
chinmay-hegde/Smart-Options
|
8c85e393c6f1f0197d6bbc39a64e6847c0b409ca
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class DataprocessorConfig(AppConfig):
name = 'dataprocessor'
| 16.833333
| 37
| 0.782178
| 10
| 101
| 7.9
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148515
| 101
| 5
| 38
| 20.2
| 0.918605
| 0
| 0
| 0
| 0
| 0
| 0.128713
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
22187993f7189cc5ec7f4da830e7d78dc557cafd
| 8,947
|
py
|
Python
|
tests/test_find_top_level.py
|
robbat2/gemato
|
883662241ce7ab45515484e7b53a2e967408d203
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_find_top_level.py
|
robbat2/gemato
|
883662241ce7ab45515484e7b53a2e967408d203
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_find_top_level.py
|
robbat2/gemato
|
883662241ce7ab45515484e7b53a2e967408d203
|
[
"BSD-2-Clause"
] | null | null | null |
# gemato: Top-level Manifest finding tests
# vim:fileencoding=utf-8
# (c) 2017 Michał Górny
# Licensed under the terms of 2-clause BSD license
import gzip
import os
import os.path
import unittest
import gemato.find_top_level
from tests.testutil import TempDirTestCase
class TestCurrentDirectory(TempDirTestCase):
"""
Test for finding top-level Manifest in a plain tree.
"""
DIRS = ['suba', 'subb', 'subc', 'subc/sub']
FILES = {
'Manifest': u'',
'subb/Manifest': u'',
'subc/sub/Manifest': u'',
}
def test_find_top_level_manifest(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(self.dir),
self.dir),
'Manifest')
def test_find_top_level_manifest_from_empty_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'suba')),
self.dir),
'Manifest')
def test_find_top_level_manifest_from_manifest_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subb')),
self.dir),
'Manifest')
def test_find_top_level_manifest_from_deep_manifest_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subc', 'sub')),
self.dir),
'Manifest')
class TestUnreadableManifest(TempDirTestCase):
"""
Test whether the function fails correctly when it can not read
a Manifest file.
"""
FILES = {
'Manifest': u'',
}
def setUp(self):
super(TestUnreadableManifest, self).setUp()
os.chmod(os.path.join(self.dir, 'Manifest'), 0)
def test_find_top_level_manifest(self):
self.assertRaises(IOError,
gemato.find_top_level.find_top_level_manifest, self.dir)
class TestIgnoredSubdir(TempDirTestCase):
"""
Test for ignoring irrelevant Manifest.
"""
DIRS = ['sub', 'sub/sub', 'subb', 'subempty']
FILES = {
'Manifest': u'''
IGNORE sub
IGNORE subempty
''',
'sub/Manifest': u'',
}
def test_find_top_level_manifest(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(self.dir),
self.dir),
'Manifest')
def test_find_top_level_manifest_from_ignored_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'sub')),
self.dir),
'sub/Manifest')
def test_find_top_level_manifest_from_sub_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'sub/sub')),
self.dir),
'sub/Manifest')
def test_find_top_level_manifest_from_non_ignored_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subb')),
self.dir),
'Manifest')
def test_find_top_level_manifest_from_ignored_empty_subdir(self):
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subempty')))
class TestEmptyTree(TempDirTestCase):
"""
Test for finding top-level Manifest in a tree without a Manifest
"""
def test_find_top_level_manifest(self):
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest(self.dir))
class TestRootDirectory(unittest.TestCase):
"""
Test behavior when run on the system root directory.
"""
def test_find_top_level_manifest(self):
if os.path.exists('/Manifest'):
raise unittest.SkipTest('/Manifest is present')
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest('/'))
class TestCrossDevice(TempDirTestCase):
"""
Test behavior when attempting to cross device boundary.
"""
FILES = {
'Manifest': u'',
}
def setUp(self):
if not os.path.exists('/proc'):
raise unittest.SkipTest('/proc does not exist')
super(TestCrossDevice, self).setUp()
os.symlink('/proc', os.path.join(self.dir, 'test'))
def test_find_top_level_manifest(self):
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'test')))
class TestCrossDeviceManifest(TempDirTestCase):
"""
Test behavior when attempting to use a Manifest from other device
(symlinked).
"""
DIRS = ['sub']
def setUp(self):
if not os.path.exists('/proc/version'):
raise unittest.SkipTest('/proc/version does not exist')
super(TestCrossDeviceManifest, self).setUp()
os.symlink('/proc/version', os.path.join(self.dir, 'Manifest'))
def test_find_top_level_manifest(self):
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'sub')))
class TestCompressedManifest(TempDirTestCase):
"""
Test for finding compressed Manifest in a plain tree.
"""
DIRS = ['suba', 'subb', 'subc', 'subc/sub']
FILES = {
'subb/Manifest': u'',
}
def setUp(self):
super(TestCompressedManifest, self).setUp()
with gzip.GzipFile(os.path.join(self.dir, 'Manifest.gz'), 'wb'):
pass
with gzip.GzipFile(os.path.join(self.dir, 'subc/sub/Manifest.gz'), 'wb'):
pass
def test_find_top_level_manifest(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(self.dir),
self.dir),
'Manifest.gz')
def test_find_top_level_manifest_from_empty_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'suba')),
self.dir),
'Manifest.gz')
def test_find_top_level_manifest_from_manifest_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subb')),
self.dir),
'Manifest.gz')
def test_find_top_level_manifest_from_deep_manifest_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subc', 'sub')),
self.dir),
'Manifest.gz')
class TestCompressedManifestWithIgnore(TempDirTestCase):
DIRS = ['suba', 'subb', 'subc', 'subc/sub']
FILES = {
'subb/Manifest': u'',
}
def setUp(self):
super(TestCompressedManifestWithIgnore, self).setUp()
with gzip.GzipFile(os.path.join(self.dir, 'Manifest.gz'), 'wb') as f:
f.write(b'IGNORE suba\n')
f.write(b'IGNORE subc\n')
with gzip.GzipFile(os.path.join(self.dir, 'subc/sub/Manifest.gz'), 'wb'):
pass
def test_find_top_level_manifest(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(self.dir),
self.dir),
'Manifest.gz')
def test_find_top_level_manifest_from_ignored_empty_subdir(self):
self.assertIsNone(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'suba')))
def test_find_top_level_manifest_from_manifest_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subb')),
self.dir),
'Manifest.gz')
def test_find_top_level_manifest_from_deep_ignored_subdir(self):
self.assertEqual(
os.path.relpath(
gemato.find_top_level.find_top_level_manifest(
os.path.join(self.dir, 'subc', 'sub')),
self.dir),
'subc/sub/Manifest.gz')
| 31.614841
| 81
| 0.5793
| 1,003
| 8,947
| 4.92323
| 0.124626
| 0.113406
| 0.162819
| 0.17821
| 0.755367
| 0.746456
| 0.704334
| 0.698056
| 0.690968
| 0.658971
| 0
| 0.001138
| 0.312731
| 8,947
| 282
| 82
| 31.72695
| 0.801919
| 0.068626
| 0
| 0.686869
| 0
| 0
| 0.082307
| 0
| 0
| 0
| 0
| 0
| 0.111111
| 1
| 0.136364
| false
| 0.015152
| 0.030303
| 0
| 0.267677
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
22210d198c8bb457fda54f6b8be2914d9298813d
| 586
|
py
|
Python
|
tests/test_plugins.py
|
failedguidedog/django-health-check
|
4759596101bb944eef1d22e5f89798395619436f
|
[
"MIT"
] | 2
|
2018-04-30T09:57:09.000Z
|
2018-05-02T11:05:41.000Z
|
tests/test_plugins.py
|
failedguidedog/django-health-check
|
4759596101bb944eef1d22e5f89798395619436f
|
[
"MIT"
] | null | null | null |
tests/test_plugins.py
|
failedguidedog/django-health-check
|
4759596101bb944eef1d22e5f89798395619436f
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import pytest
from health_check.backends import BaseHealthCheckBackend
from health_check.plugins import plugin_dir
class FakePlugin(BaseHealthCheckBackend):
def check_status(self):
pass
class Plugin(BaseHealthCheckBackend):
def check_status(self):
pass
class TestPlugin(object):
@pytest.yield_fixture(autouse=True)
def setup(self):
plugin_dir.reset()
plugin_dir.register(FakePlugin)
yield
plugin_dir.reset()
def test_register_plugin(self):
assert len(plugin_dir._registry) == 1
| 20.928571
| 56
| 0.701365
| 67
| 586
| 5.940299
| 0.492537
| 0.113065
| 0.075377
| 0.180905
| 0.246231
| 0.246231
| 0.246231
| 0
| 0
| 0
| 0
| 0.004329
| 0.211604
| 586
| 27
| 57
| 21.703704
| 0.857143
| 0.035836
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 1
| 0.222222
| false
| 0.111111
| 0.166667
| 0
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
2227054ee90e043cc96fa6c4e9885146a8f75c61
| 84
|
py
|
Python
|
Python/Tests/GlassTests/PythonTests/Python/StepPythonToNative_PropertyGetSet/py_mod.py
|
techkey/PTVS
|
8355e67eedd8e915ca49bd38a2f36172696fd903
|
[
"Apache-2.0"
] | 404
|
2019-05-07T02:21:57.000Z
|
2022-03-31T17:03:04.000Z
|
Python/Tests/GlassTests/PythonTests/Python/StepPythonToNative_PropertyGetSet/py_mod.py
|
techkey/PTVS
|
8355e67eedd8e915ca49bd38a2f36172696fd903
|
[
"Apache-2.0"
] | 1,672
|
2019-05-06T21:09:38.000Z
|
2022-03-31T23:16:04.000Z
|
Python/Tests/GlassTests/PythonTests/Python/StepPythonToNative_PropertyGetSet/py_mod.py
|
techkey/PTVS
|
8355e67eedd8e915ca49bd38a2f36172696fd903
|
[
"Apache-2.0"
] | 186
|
2019-05-13T03:17:37.000Z
|
2022-03-31T16:24:05.000Z
|
import cpp_mod
cpp_obj = cpp_mod.CppObj()
x = cpp_obj.property
cpp_obj.property = x
| 16.8
| 26
| 0.77381
| 16
| 84
| 3.75
| 0.4375
| 0.3
| 0.466667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130952
| 84
| 4
| 27
| 21
| 0.821918
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
222ee73a97fe4f7d49877853ad566fd9281570bf
| 493
|
py
|
Python
|
mammoth/document_matchers.py
|
akkana/python-mammoth
|
abc07c40f2a80468292b13ddb6714972bb73b7af
|
[
"BSD-2-Clause"
] | null | null | null |
mammoth/document_matchers.py
|
akkana/python-mammoth
|
abc07c40f2a80468292b13ddb6714972bb73b7af
|
[
"BSD-2-Clause"
] | null | null | null |
mammoth/document_matchers.py
|
akkana/python-mammoth
|
abc07c40f2a80468292b13ddb6714972bb73b7af
|
[
"BSD-2-Clause"
] | 1
|
2020-11-01T17:04:56.000Z
|
2020-11-01T17:04:56.000Z
|
import collections
def paragraph(style_id=None, style_name=None, numbering=None):
return ParagraphMatcher(style_id, style_name, numbering)
ParagraphMatcher = collections.namedtuple("ParagraphMatcher", ["style_id", "style_name", "numbering"])
ParagraphMatcher.element_type = "paragraph"
def run(style_id=None, style_name=None):
return RunMatcher(style_id, style_name)
RunMatcher = collections.namedtuple("RunMatcher", ["style_id", "style_name"])
RunMatcher.element_type = "run"
| 27.388889
| 102
| 0.778905
| 58
| 493
| 6.37931
| 0.275862
| 0.113514
| 0.12973
| 0.172973
| 0.632432
| 0.632432
| 0.308108
| 0
| 0
| 0
| 0
| 0
| 0.099391
| 493
| 17
| 103
| 29
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0.168357
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.222222
| 0.555556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
222ef04cf60b4e885d05da078a4ef3c1fdb0be87
| 833
|
py
|
Python
|
hat/vector_control/migrations/0010_auto_20181218_1457.py
|
ekhalilbsq/iaso
|
e6400c52aeb4f67ce1ca83b03efa3cb11ef235ee
|
[
"MIT"
] | 29
|
2020-12-26T07:22:19.000Z
|
2022-03-07T13:40:09.000Z
|
hat/vector_control/migrations/0010_auto_20181218_1457.py
|
ekhalilbsq/iaso
|
e6400c52aeb4f67ce1ca83b03efa3cb11ef235ee
|
[
"MIT"
] | 150
|
2020-11-09T15:03:27.000Z
|
2022-03-07T15:36:07.000Z
|
hat/vector_control/migrations/0010_auto_20181218_1457.py
|
ekhalilbsq/iaso
|
e6400c52aeb4f67ce1ca83b03efa3cb11ef235ee
|
[
"MIT"
] | 4
|
2020-11-09T10:38:13.000Z
|
2021-10-04T09:42:47.000Z
|
# Generated by Django 2.0 on 2018-12-18 14:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("vector_control", "0009_auto_20181218_1438")]
operations = [
migrations.RenameField(model_name="catch", old_name="endAccuracy", new_name="end_accuracy"),
migrations.RenameField(model_name="catch", old_name="endAltitude", new_name="end_altitude"),
migrations.RenameField(model_name="catch", old_name="endLocation", new_name="end_location"),
migrations.RenameField(model_name="catch", old_name="startAccuracy", new_name="start_accuracy"),
migrations.RenameField(model_name="catch", old_name="startAltitude", new_name="start_altitude"),
migrations.RenameField(model_name="catch", old_name="startLocation", new_name="start_location"),
]
| 46.277778
| 104
| 0.738295
| 100
| 833
| 5.87
| 0.42
| 0.214651
| 0.265758
| 0.306644
| 0.483816
| 0.483816
| 0.483816
| 0.340716
| 0
| 0
| 0
| 0.041209
| 0.12605
| 833
| 17
| 105
| 49
| 0.76511
| 0.051621
| 0
| 0
| 1
| 0
| 0.275381
| 0.029188
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.090909
| 0
| 0.363636
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
223643867a53b2cd25f30f9a63425c0201f81af9
| 37
|
py
|
Python
|
foiamachine/local/lib/python2.7/encodings/cp424.py
|
dwillis/foiamachine
|
26d3b02870227696cdaab639c39d47b2a7a42ae5
|
[
"Unlicense",
"MIT"
] | 3
|
2021-08-07T04:01:55.000Z
|
2021-08-07T05:12:11.000Z
|
foiamachine/local/lib/python2.7/encodings/cp424.py
|
dwillis/foiamachine
|
26d3b02870227696cdaab639c39d47b2a7a42ae5
|
[
"Unlicense",
"MIT"
] | null | null | null |
foiamachine/local/lib/python2.7/encodings/cp424.py
|
dwillis/foiamachine
|
26d3b02870227696cdaab639c39d47b2a7a42ae5
|
[
"Unlicense",
"MIT"
] | 1
|
2021-08-05T22:51:14.000Z
|
2021-08-05T22:51:14.000Z
|
/usr/lib/python2.7/encodings/cp424.py
| 37
| 37
| 0.810811
| 7
| 37
| 4.285714
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135135
| 0
| 37
| 1
| 37
| 37
| 0.675676
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
97ec006ea9d61ceff044b81aa1d36cbf344a4d7f
| 269
|
py
|
Python
|
menpodetect/dlib/__init__.py
|
jabooth/menpodetect
|
fd3c52a87a2327a2f0ad17fdd1fd1861bc9f4330
|
[
"BSD-3-Clause"
] | 27
|
2015-03-14T22:54:13.000Z
|
2021-03-14T04:37:12.000Z
|
menpodetect/dlib/__init__.py
|
jabooth/menpodetect
|
fd3c52a87a2327a2f0ad17fdd1fd1861bc9f4330
|
[
"BSD-3-Clause"
] | 11
|
2015-04-13T08:31:36.000Z
|
2021-03-09T06:14:45.000Z
|
menpodetect/dlib/__init__.py
|
jabooth/menpodetect
|
fd3c52a87a2327a2f0ad17fdd1fd1861bc9f4330
|
[
"BSD-3-Clause"
] | 28
|
2015-02-02T16:50:03.000Z
|
2020-05-14T06:51:17.000Z
|
from menpo.base import MenpoMissingDependencyError
try:
from .detect import load_dlib_frontal_face_detector, DlibDetector
from .train import train_dlib_detector
except MenpoMissingDependencyError:
pass
# Remove from scope
del MenpoMissingDependencyError
| 22.416667
| 69
| 0.832714
| 29
| 269
| 7.517241
| 0.655172
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.141264
| 269
| 11
| 70
| 24.454545
| 0.943723
| 0.063197
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.142857
| 0.428571
| 0
| 0.428571
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 4
|
3f0e38d1fb5b1ac150d0d3b50f8088cb9ac23bba
| 11
|
py
|
Python
|
tests/modules/aa/afile.py
|
AboudFayad/coveragepy
|
b9c84eb813ad23f053120b8dad31b635c81376ae
|
[
"Apache-2.0"
] | 2,254
|
2015-01-05T01:28:03.000Z
|
2022-03-29T10:37:10.000Z
|
tests/modules/aa/afile.py
|
AboudFayad/coveragepy
|
b9c84eb813ad23f053120b8dad31b635c81376ae
|
[
"Apache-2.0"
] | 707
|
2015-02-07T01:32:02.000Z
|
2022-03-31T18:00:14.000Z
|
tests/modules/aa/afile.py
|
AboudFayad/coveragepy
|
b9c84eb813ad23f053120b8dad31b635c81376ae
|
[
"Apache-2.0"
] | 439
|
2015-01-16T15:06:08.000Z
|
2022-03-30T06:19:12.000Z
|
# afile.py
| 5.5
| 10
| 0.636364
| 2
| 11
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 11
| 1
| 11
| 11
| 0.777778
| 0.727273
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3f3772a8cf96b092cef49b0c285885a721ca662b
| 280
|
py
|
Python
|
src/630G.py
|
viing937/codeforces
|
d694eb6967cd56af02963c3a662066048cb78d07
|
[
"MIT"
] | 2
|
2016-08-19T09:47:03.000Z
|
2016-10-01T10:15:03.000Z
|
src/630G.py
|
viing937/codeforces
|
d694eb6967cd56af02963c3a662066048cb78d07
|
[
"MIT"
] | null | null | null |
src/630G.py
|
viing937/codeforces
|
d694eb6967cd56af02963c3a662066048cb78d07
|
[
"MIT"
] | 1
|
2015-07-01T23:57:32.000Z
|
2015-07-01T23:57:32.000Z
|
from functools import reduce
def c(n, m):
return 0 if n>m or n<0 else reduce(lambda a,b: a*b, range(m-n+1, m+1), 1)//reduce(lambda a,b: a*b, range(1,n+1), 1)
n = int(input())
print(sum([c(i, n)*c(i-1, 2) for i in range(1, 4)])*sum([c(i, n)*c(i-1, 4) for i in range(1, 6)]))
| 35
| 119
| 0.578571
| 73
| 280
| 2.219178
| 0.383562
| 0.049383
| 0.160494
| 0.17284
| 0.518519
| 0.37037
| 0.37037
| 0
| 0
| 0
| 0
| 0.068966
| 0.171429
| 280
| 7
| 120
| 40
| 0.62931
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 0.6
| 0.2
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
3f5a86d306dd5aad8a8759e43bcc3fe92db03c7b
| 550
|
py
|
Python
|
tests/test_device_status.py
|
argysamo/BoT-Python-SDK
|
92152dd6ef971862af2eef51bd0543db37b62b59
|
[
"Apache-2.0"
] | null | null | null |
tests/test_device_status.py
|
argysamo/BoT-Python-SDK
|
92152dd6ef971862af2eef51bd0543db37b62b59
|
[
"Apache-2.0"
] | null | null | null |
tests/test_device_status.py
|
argysamo/BoT-Python-SDK
|
92152dd6ef971862af2eef51bd0543db37b62b59
|
[
"Apache-2.0"
] | null | null | null |
from bot_python_sdk.device_status import DeviceStatus
def test_device_status_length():
assert len(DeviceStatus) == 4
def test_device_status_names():
assert DeviceStatus.NEW.name == 'NEW'
assert DeviceStatus.PAIRED.name == 'PAIRED'
assert DeviceStatus.ACTIVE.name == 'ACTIVE'
assert DeviceStatus.MULTIPAIR.name == 'MULTIPAIR'
def test_device_status_values():
assert DeviceStatus.NEW.value == 'NEW'
assert DeviceStatus.PAIRED.value == 'PAIRED'
assert DeviceStatus.ACTIVE.value == 'ACTIVE'
assert DeviceStatus.MULTIPAIR.value == 'MULTIPAIR'
| 32.352941
| 53
| 0.781818
| 67
| 550
| 6.238806
| 0.328358
| 0.344498
| 0.093301
| 0.136364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002033
| 0.105455
| 550
| 16
| 54
| 34.375
| 0.847561
| 0
| 0
| 0
| 0
| 0
| 0.087273
| 0
| 0
| 0
| 0
| 0
| 0.692308
| 1
| 0.230769
| true
| 0
| 0.076923
| 0
| 0.307692
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
58bc014d8a982fe0f0e2c9c596ba943f42240527
| 156
|
py
|
Python
|
django_related_models/apps.py
|
nicknelson/django-related-models
|
de2f48d6b3f83bcb0a4fff949d77be045bcfcccc
|
[
"BSD-3-Clause"
] | null | null | null |
django_related_models/apps.py
|
nicknelson/django-related-models
|
de2f48d6b3f83bcb0a4fff949d77be045bcfcccc
|
[
"BSD-3-Clause"
] | 1
|
2020-05-17T13:20:24.000Z
|
2020-05-17T13:20:24.000Z
|
django_related_models/apps.py
|
nicknelson/django-related-models
|
de2f48d6b3f83bcb0a4fff949d77be045bcfcccc
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import unicode_literals
from django.apps import AppConfig
class DjagnoRelatedModelsConfig(AppConfig):
name = 'djagno_related_models'
| 19.5
| 43
| 0.826923
| 17
| 156
| 7.176471
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128205
| 156
| 7
| 44
| 22.285714
| 0.897059
| 0
| 0
| 0
| 0
| 0
| 0.134615
| 0.134615
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
58e1304d3949fc8fa30ec8fc304d9c6f22d5cce0
| 122
|
py
|
Python
|
src/dipdup/__main__.py
|
arrijabba/dipdup-py
|
fa90bfd889c473966e0d5aed98cec90a575fcb90
|
[
"MIT"
] | 39
|
2021-04-13T10:53:27.000Z
|
2022-02-11T00:53:44.000Z
|
src/dipdup/__main__.py
|
arrijabba/dipdup-py
|
fa90bfd889c473966e0d5aed98cec90a575fcb90
|
[
"MIT"
] | 113
|
2021-06-01T18:16:42.000Z
|
2022-03-28T06:12:58.000Z
|
src/dipdup/__main__.py
|
arrijabba/dipdup-py
|
fa90bfd889c473966e0d5aed98cec90a575fcb90
|
[
"MIT"
] | 16
|
2021-05-26T07:04:40.000Z
|
2022-03-29T06:50:25.000Z
|
from dipdup.cli import cli
if __name__ == '__main__':
cli(prog_name='dipdup', standalone_mode=False) # type: ignore
| 24.4
| 66
| 0.721311
| 17
| 122
| 4.588235
| 0.764706
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.155738
| 122
| 4
| 67
| 30.5
| 0.757282
| 0.098361
| 0
| 0
| 0
| 0
| 0.12963
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
453baadabcdecbd164441358793c18b298ceb0eb
| 97,678
|
py
|
Python
|
src/nifake/unit_tests/test_session.py
|
phindman/nimi-python
|
8428334e2b49645fa5d452349825e317c20f09c7
|
[
"MIT"
] | null | null | null |
src/nifake/unit_tests/test_session.py
|
phindman/nimi-python
|
8428334e2b49645fa5d452349825e317c20f09c7
|
[
"MIT"
] | null | null | null |
src/nifake/unit_tests/test_session.py
|
phindman/nimi-python
|
8428334e2b49645fa5d452349825e317c20f09c7
|
[
"MIT"
] | null | null | null |
import array
import ctypes
import datetime
import hightime
import math
import nifake
import nifake.errors
import numpy
import warnings
from mock import patch
import _matchers
import _mock_helper
# from mock import ANY
# Tests
SESSION_NUM_FOR_TEST = 42
class TestSession(object):
def setup_method(self, method):
self.patched_library_patcher = patch('nifake._library.Library', autospec=True)
self.patched_library = self.patched_library_patcher.start()
self.patched_library_singleton_get = patch('nifake.session._library_singleton.get', return_value=self.patched_library)
self.patched_library_singleton_get.start()
# We don't actually call into the nitclk DLL, but we do need to mock the function since it is called
self.tclk_patched_library_singleton_get = patch('nitclk.session._library_singleton.get', return_value=None)
self.tclk_patched_library_singleton_get.start()
self.side_effects_helper = _mock_helper.SideEffectsHelper()
self.side_effects_helper.set_side_effects_and_return_values(self.patched_library)
self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions
self.disallow_close = self.patched_library.niFake_close.side_effect
self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close
self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
self.get_ctypes_pointer_for_buffer_side_effect_items = []
# Mock lock/unlock
self.LockSession_side_effect_cache = self.patched_library.niFake_LockSession.side_effect
self.patched_library.niFake_LockSession.side_effect = self.side_effects_helper.niFake_LockSession
self.side_effects_helper['LockSession']['callerHasLock'] = True
self.UnlockSession_side_effect_cache = self.patched_library.niFake_UnlockSession.side_effect
self.patched_library.niFake_UnlockSession.side_effect = self.side_effects_helper.niFake_UnlockSession
self.side_effects_helper['UnlockSession']['callerHasLock'] = False
def teardown_method(self, method):
self.patched_library_singleton_get.stop()
self.patched_library_patcher.stop()
self.tclk_patched_library_singleton_get.stop()
def niFake_read_warning(self, vi, maximum_time, reading): # noqa: N802
reading.contents.value = self.reading
return self.error_code_return
def get_ctypes_pointer_for_buffer_side_effect(self, value, library_type=None):
ret_val = self.get_ctypes_pointer_for_buffer_side_effect_items[self.get_ctypes_pointer_for_buffer_side_effect_count]
self.get_ctypes_pointer_for_buffer_side_effect_count += 1
return ret_val
# Session management
def test_init_with_options_and_close(self):
errors_patcher = patch('nifake.session.errors', spec_set=['handle_error', '_is_error'])
patched_errors = errors_patcher.start()
patched_errors._is_error.return_value = 0
session = nifake.Session('dev1')
self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher())
patched_errors.handle_error.assert_called_once_with(session, self.patched_library.niFake_InitWithOptions.return_value, ignore_warnings=False, is_error_handling=False)
session.close()
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
errors_patcher.stop()
def test_init_with_options_nondefault_and_close(self):
session = nifake.Session('FakeDevice', 'Some string', True, True)
self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('FakeDevice'), _matchers.ViBooleanMatcher(True), _matchers.ViBooleanMatcher(True), _matchers.ViStringMatcher('Some string'), _matchers.ViSessionPointerMatcher())
session.close()
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_close(self):
session = nifake.Session('dev1')
session.close()
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_session_context_manager(self):
with nifake.Session('dev1') as session:
assert type(session) == nifake.Session
self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher())
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_init_with_error(self):
test_error_code = -1
test_error_desc = 'Test'
self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions
self.side_effects_helper['InitWithOptions']['return'] = test_error_code
self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
try:
nifake.Session('dev1')
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_close_with_error(self):
test_error_code = -1
test_error_desc = 'Test'
self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close
session = nifake.Session('dev1')
self.side_effects_helper['close']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
try:
session.close()
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
assert session._vi == 0
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_session_context_manager_init_with_error(self):
test_error_code = -1
test_error_desc = 'Test'
self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions
self.side_effects_helper['InitWithOptions']['return'] = test_error_code
self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
try:
with nifake.Session('dev1') as session:
assert type(session) == nifake.Session
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_session_context_manager_close_with_error(self):
test_error_code = -1
test_error_desc = 'Test'
self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close
self.side_effects_helper['close']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
try:
with nifake.Session('dev1') as session:
assert type(session) == nifake.Session
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
# Session locking
def test_lock_session_none(self):
with nifake.Session('dev1') as session:
session.lock()
self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
def test_unlock_session_none(self):
with nifake.Session('dev1') as session:
session.unlock()
self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
def test_lock_context_manager(self):
with nifake.Session('dev1') as session:
with session.lock():
pass
self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
def test_lock_context_manager_abnormal_exit(self):
with nifake.Session('dev1') as session:
try:
with session.lock():
raise nifake.Error('Fake exception')
except nifake.Error:
pass
self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None)
# Methods
def test_simple_function(self):
self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction
with nifake.Session('dev1') as session:
session.simple_function()
self.patched_library.niFake_PoorlyNamedSimpleFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_self_test(self):
self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test
test_error_code = 0
self.side_effects_helper['self_test']['selfTestResult'] = test_error_code
self.side_effects_helper['self_test']['selfTestMessage'] = ''
with nifake.Session('dev1') as session:
session.self_test()
def test_self_test_fail(self):
self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test
test_error_code = 1
test_error_message = 'error message'
self.side_effects_helper['self_test']['selfTestResult'] = test_error_code
self.side_effects_helper['self_test']['selfTestMessage'] = test_error_message
with nifake.Session('dev1') as session:
try:
session.self_test()
assert False
except nifake.errors.SelfTestError as e:
assert e.code == test_error_code
assert e.message == test_error_message
def test_get_a_number(self):
test_number = 16
self.patched_library.niFake_GetANumber.side_effect = self.side_effects_helper.niFake_GetANumber
self.side_effects_helper['GetANumber']['aNumber'] = test_number
with nifake.Session('dev1') as session:
test_result = session.get_a_number()
assert isinstance(test_result, int)
assert test_result == test_number
self.patched_library.niFake_GetANumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher())
def test_one_input_function(self):
test_number = 1
self.patched_library.niFake_OneInputFunction.side_effect = self.side_effects_helper.niFake_OneInputFunction
with nifake.Session('dev1') as session:
session.one_input_function(test_number)
self.patched_library.niFake_OneInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_number))
def test_vi_int_64_function(self):
input_value = 1099511627776 # 2^40
output_value = 2199023255552 # 2^41
self.patched_library.niFake_Use64BitNumber.side_effect = self.side_effects_helper.niFake_Use64BitNumber
self.side_effects_helper['Use64BitNumber']['output'] = output_value
with nifake.Session('dev1') as session:
assert session.use64_bit_number(input_value) == output_value
self.patched_library.niFake_Use64BitNumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt64Matcher(input_value), _matchers.ViInt64PointerMatcher())
def test_two_input_function(self):
test_number = 1.5
test_string = 'test'
self.patched_library.niFake_TwoInputFunction.side_effect = self.side_effects_helper.niFake_TwoInputFunction
with nifake.Session('dev1') as session:
session.two_input_function(test_number, test_string)
self.patched_library.niFake_TwoInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_number), _matchers.ViStringMatcher(test_string))
def test_get_enum_value(self):
test_number = 1
test_turtle = nifake.Turtle.LEONARDO
self.patched_library.niFake_GetEnumValue.side_effect = self.side_effects_helper.niFake_GetEnumValue
self.side_effects_helper['GetEnumValue']['aQuantity'] = test_number
self.side_effects_helper['GetEnumValue']['aTurtle'] = 0
with nifake.Session('dev1') as session:
test_result_number, test_result_enum = session.get_enum_value()
assert isinstance(test_result_number, int)
assert test_result_number == test_number
assert isinstance(test_result_enum, nifake.Turtle)
assert test_result_enum == test_turtle
self.patched_library.niFake_GetEnumValue.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32PointerMatcher(), _matchers.ViInt16PointerMatcher())
def test_get_a_list_enums(self):
self.patched_library.niFake_EnumArrayOutputFunction.side_effect = self.side_effects_helper.niFake_EnumArrayOutputFunction
test_list = [1, 1, 0]
self.side_effects_helper['EnumArrayOutputFunction']['anArray'] = test_list
with nifake.Session('dev1') as session:
test_result = session.enum_array_output_function(len(test_list))
assert len(test_list) == len(test_result)
for expected_value, actual_value in zip(test_list, test_result):
assert isinstance(actual_value, nifake.Turtle)
assert actual_value.value == expected_value
self.patched_library.niFake_EnumArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViInt16BufferMatcher(len(test_list)))
def test_get_a_boolean(self):
self.patched_library.niFake_GetABoolean.side_effect = self.side_effects_helper.niFake_GetABoolean
self.side_effects_helper['GetABoolean']['aBoolean'] = 1
with nifake.Session('dev1') as session:
test_result = session.get_a_boolean()
assert isinstance(test_result, bool)
assert test_result
self.patched_library.niFake_GetABoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanPointerMatcher())
def test_get_a_list_booleans(self):
self.patched_library.niFake_BoolArrayOutputFunction.side_effect = self.side_effects_helper.niFake_BoolArrayOutputFunction
test_list = [1, 1, 0]
self.side_effects_helper['BoolArrayOutputFunction']['anArray'] = test_list
with nifake.Session('dev1') as session:
test_result = session.bool_array_output_function(len(test_list))
assert len(test_list) == len(test_result)
for expected_value, actual_value in zip(test_list, test_result):
assert isinstance(actual_value, bool)
assert actual_value == bool(expected_value)
self.patched_library.niFake_BoolArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViBooleanBufferMatcher(len(test_list)))
def test_acquisition_context_manager(self):
self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate
self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort
with nifake.Session('dev1') as session:
with session.initiate():
self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_acquisition_no_context_manager(self):
self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate
self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort
with nifake.Session('dev1') as session:
session.initiate()
self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
session.abort()
self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST))
def test_single_point_read_timedelta(self):
test_maximum_time_ns = 1 # nanoseconds
test_maximum_time_s = 1e-9 # seconds
test_maximum_time_timedelta = hightime.timedelta(nanoseconds=test_maximum_time_ns)
test_reading = 5
self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read
self.side_effects_helper['Read']['reading'] = test_reading
with nifake.Session('dev1') as session:
assert test_reading == session.read(test_maximum_time_timedelta)
self.patched_library.niFake_Read.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_maximum_time_s), _matchers.ViReal64PointerMatcher())
def test_single_point_read_nan(self):
test_maximum_time_s = 10.0
test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s)
test_reading = float('NaN')
self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read
self.side_effects_helper['Read']['reading'] = test_reading
with nifake.Session('dev1') as session:
assert math.isnan(session.read(test_maximum_time))
def test_enum_input_function_with_defaults(self):
test_turtle = nifake.Turtle.DONATELLO
self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults
with nifake.Session('dev1') as session:
session.enum_input_function_with_defaults()
session.enum_input_function_with_defaults(test_turtle)
from mock import call
calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(0)), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(1))] # 0 is the value of the default of nifake.Turtle.LEONARDO, 1 is the value of nifake.Turtle.DONATELLO
self.patched_library.niFake_EnumInputFunctionWithDefaults.assert_has_calls(calls)
def test_string_valued_enum_input_function_with_defaults(self):
test_mobile_os_name = nifake.MobileOSNames.IOS
self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_StringValuedEnumInputFunctionWithDefaults
with nifake.Session('dev1') as session:
session.string_valued_enum_input_function_with_defaults()
session.string_valued_enum_input_function_with_defaults(test_mobile_os_name)
from mock import call
calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('Android')), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('iOS'))] # 'ANDROID' is the value of the default of nifake.MobileOSNames.Android, 'iOS' is the value of nifake.MobileOSNames.IOS
self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.assert_has_calls(calls)
def test_fetch_waveform(self):
expected_waveform_list = [1.0, 0.1, 42, .42]
self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform
self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform_list
self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform_list)
# Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here
# and have the mock return them. These are the ones that are actually filled in by the function.
expected_waveform = array.array('d', [0] * len(expected_waveform_list))
expected_waveform_ctypes = ctypes.cast(expected_waveform.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViReal64 * len(expected_waveform_list)))
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform_ctypes]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
# Because we have mocked away get_ctypes_pointer_for_buffer(), we ignore the return values here and look at our already allocated arrays to make
# sure they are filled in correctly
session.fetch_waveform(len(expected_waveform_list))
assert isinstance(expected_waveform[0], float)
assert len(expected_waveform) == len(expected_waveform_list)
for i in range(len(expected_waveform)):
assert expected_waveform[i] == expected_waveform_list[i]
self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher())
def test_fetch_waveform_into(self):
expected_waveform = [1.0, 0.1, 42, .42]
self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform
self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform
self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform)
with nifake.Session('dev1') as session:
waveform = numpy.empty(len(expected_waveform), numpy.float64)
session.fetch_waveform_into(waveform)
assert numpy.array_equal(waveform, expected_waveform)
self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher())
def test_fetch_waveform_into_wrong_type(self):
length = 10
with nifake.Session('dev1') as session:
waveforms = [
10,
10.5,
"Not a numpy.ndarray",
range(length),
[i + 0.0 for i in range(length)],
numpy.empty(length, numpy.int32),
numpy.empty(length, numpy.uint8)
]
for w in waveforms:
try:
session.fetch_waveform_into(w)
assert False
except TypeError:
pass
def test_write_waveform(self):
expected_waveform = [1.1, 2.2, 3.3, 4.4]
expected_array = array.array('d', expected_waveform)
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.write_waveform(expected_array)
self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_array))
def test_write_waveform_numpy(self):
expected_waveform = numpy.array([1.1, 2.2, 3.3, 4.4], order='C')
self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform
with nifake.Session('dev1') as session:
session.write_waveform_numpy(expected_waveform)
self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform))
def test_return_multiple_types(self):
self.patched_library.niFake_ReturnMultipleTypes.side_effect = self.side_effects_helper.niFake_ReturnMultipleTypes
boolean_val = True
int32_val = 32
int64_val = 6000000000
enum_val = nifake.Turtle.LEONARDO
float_val = 1.23
float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE
array_val = [0, 1, 2]
array_size = len(array_val)
string_val = 'Testing is fun?'
self.side_effects_helper['ReturnMultipleTypes']['return'] = len(string_val)
self.side_effects_helper['ReturnMultipleTypes']['aBoolean'] = boolean_val
self.side_effects_helper['ReturnMultipleTypes']['anInt32'] = int32_val
self.side_effects_helper['ReturnMultipleTypes']['anInt64'] = int64_val
self.side_effects_helper['ReturnMultipleTypes']['anIntEnum'] = enum_val.value
self.side_effects_helper['ReturnMultipleTypes']['aFloat'] = float_val
self.side_effects_helper['ReturnMultipleTypes']['aFloatEnum'] = float_enum_val.value
self.side_effects_helper['ReturnMultipleTypes']['anArray'] = array_val
self.side_effects_helper['ReturnMultipleTypes']['aString'] = string_val
self.side_effects_helper['ReturnMultipleTypes']['return'] = 0
with nifake.Session('dev1') as session:
result_boolean, result_int32, result_int64, result_enum, result_float, result_float_enum, result_array, result_string = session.return_multiple_types(array_size)
assert result_boolean == boolean_val
assert isinstance(result_boolean, bool)
assert result_int32 == int32_val
assert isinstance(result_int32, int)
assert result_int64 == int64_val
assert isinstance(result_int64, int)
assert result_enum == enum_val
assert isinstance(result_enum, nifake.Turtle)
assert result_float == float_val
assert isinstance(result_float, float)
assert result_float_enum == float_enum_val
assert isinstance(result_float_enum, nifake.FloatEnum)
assert result_array == array_val
assert isinstance(result_array, list)
assert isinstance(result_array[0], float)
assert result_string == string_val
assert isinstance(result_string, str)
assert self.patched_library.niFake_ReturnMultipleTypes.call_count == 2
def test_multiple_array_types(self):
self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes
expected_output_array = [0.2, 0.4]
expected_output_array_of_fixed_length = [-6, -7, -8]
output_array_size = len(expected_output_array)
input_array_of_integers = [1, 2]
input_array_of_floats = [-1.0, -2.0]
self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array
self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length
with nifake.Session('dev1') as session:
output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats, input_array_of_integers)
assert output_array == output_array
assert expected_output_array_of_fixed_length == output_array_of_fixed_length
self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(output_array_size),
_matchers.ViReal64BufferMatcher(output_array_size),
_matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)),
_matchers.ViInt32Matcher(len(input_array_of_integers)),
_matchers.ViReal64BufferMatcher(input_array_of_floats),
_matchers.ViInt16BufferMatcher(input_array_of_integers),
)
def test_multiple_array_types_none_input(self):
self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes
expected_output_array = [0.2, 0.4]
expected_output_array_of_fixed_length = [-6, -7, -8]
output_array_size = len(expected_output_array)
input_array_of_floats = [0.1, 0.2]
self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array
self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length
with nifake.Session('dev1') as session:
output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats)
assert output_array == output_array
assert expected_output_array_of_fixed_length == output_array_of_fixed_length
self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(output_array_size),
_matchers.ViReal64BufferMatcher(output_array_size),
_matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)),
_matchers.ViInt32Matcher(len(input_array_of_floats)),
_matchers.ViReal64BufferMatcher(input_array_of_floats),
None
)
def test_multiple_arrays_same_size(self):
self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize
input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044]
input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440]
input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400]
input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00]
with nifake.Session('dev1') as session:
session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4)
self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViReal64BufferMatcher(input_array_of_floats1),
_matchers.ViReal64BufferMatcher(input_array_of_floats2),
_matchers.ViReal64BufferMatcher(input_array_of_floats3),
_matchers.ViReal64BufferMatcher(input_array_of_floats4),
_matchers.ViInt32Matcher(len(input_array_of_floats1)),
)
def test_multiple_arrays_same_size_none_input(self):
self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize
input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044]
with nifake.Session('dev1') as session:
session.multiple_arrays_same_size(input_array_of_floats1, None, None, None)
self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViReal64BufferMatcher(input_array_of_floats1),
None,
None,
None,
_matchers.ViInt32Matcher(len(input_array_of_floats1)),
)
def test_multiple_arrays_same_size_wrong_size_2(self):
self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize
input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044]
input_array_of_floats2 = [0.410, 0.420, 0.430]
input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400]
input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00]
with nifake.Session('dev1') as session:
try:
session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4)
assert False
except ValueError:
pass
def test_multiple_arrays_same_size_wrong_size_3(self):
self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize
input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044]
input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440]
input_array_of_floats3 = [4.100, 4.200, 4.400]
input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00]
with nifake.Session('dev1') as session:
try:
session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4)
assert False
except ValueError:
pass
def test_multiple_arrays_same_size_wrong_size_4(self):
self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize
input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044]
input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440]
input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400]
input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00, 45.00]
with nifake.Session('dev1') as session:
try:
session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4)
assert False
except ValueError:
pass
def test_parameters_are_multiple_types(self):
self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes
boolean_val = True
int32_val = 32
int64_val = 6000000000
enum_val = nifake.Turtle.LEONARDO
float_val = 1.23
float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE
string_val = 'Testing is fun?'
with nifake.Session('dev1') as session:
session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, float_enum_val, string_val)
self.patched_library.niFake_ParametersAreMultipleTypes.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanMatcher(boolean_val), _matchers.ViInt32Matcher(int32_val), _matchers.ViInt64Matcher(int64_val), _matchers.ViInt16Matcher(enum_val.value), _matchers.ViReal64Matcher(float_val), _matchers.ViReal64Matcher(float_enum_val.value), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViStringMatcher(string_val))
def test_parameters_are_multiple_types_error(self):
test_error_code = -42
test_error_desc = "The answer to the ultimate question"
self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes
self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes
self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
boolean_val = True
int32_val = 32
int64_val = 6000000000
enum_val = nifake.Turtle.LEONARDO
float_val = 1.23
float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE
string_val = 'Testing is fun?'
with nifake.Session('dev1') as session:
try:
session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, 123, float_val, float_enum_val, string_val)
assert False
except TypeError:
pass
try:
session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, 0.123, string_val)
assert False
except TypeError:
pass
def test_method_with_error(self):
test_error_code = -42
test_error_desc = "The answer to the ultimate question"
self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction
self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.simple_function()
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_error_with_rep_cap(self):
test_error_code = -42
test_error_desc = "The answer to the ultimate question"
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.channels['100'].read_write_double = 5.0
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_call_not_enough_parameters_error(self):
with nifake.Session('dev1') as session:
try:
session.multiple_array_types(10)
assert False
except TypeError:
pass
def test_invalid_method_call_wrong_type_error(self):
with nifake.Session('dev1') as session:
try:
session.multiple_array_types('potato', [0.0, 0.1, 0.2])
assert False
except TypeError:
pass
def test_enum_input_function_with_defaults_bad_type_error(self):
test_turtle = 123
self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults
with nifake.Session('dev1') as session:
try:
session.enum_input_function_with_defaults(test_turtle)
assert False
except TypeError:
pass
def test_method_with_warning(self):
# We want to capture all of our warnings, not just the first one
warnings.filterwarnings("always", category=nifake.DriverWarning)
test_error_code = 42
test_error_desc = "The answer to the ultimate question, only positive"
self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction
self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
with warnings.catch_warnings(record=True) as w:
session.simple_function()
assert len(w) == 1
assert issubclass(w[0].category, nifake.DriverWarning)
assert test_error_desc in str(w[0].message)
def test_read_with_warning(self):
# We want to capture all of our warnings, not just the first one
warnings.filterwarnings("always", category=nifake.DriverWarning)
test_maximum_time_s = 10.0
test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s)
test_reading = float('nan')
test_error_code = 42
test_error_desc = "The answer to the ultimate question, only positive"
self.patched_library.niFake_Read.side_effect = self.niFake_read_warning
self.error_code_return = test_error_code
self.reading = test_reading
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
with warnings.catch_warnings(record=True) as w:
assert math.isnan(session.read(test_maximum_time))
assert len(w) == 1
assert issubclass(w[0].category, nifake.DriverWarning)
assert test_error_desc in str(w[0].message)
# Retrieving buffers and strings
def test_get_a_string_of_fixed_maximum_size(self):
test_string = "A string no larger than the max size of 256 allowed by the function."
self.patched_library.niFake_GetAStringOfFixedMaximumSize.side_effect = self.side_effects_helper.niFake_GetAStringOfFixedMaximumSize
self.side_effects_helper['GetAStringOfFixedMaximumSize']['aString'] = test_string
with nifake.Session('dev1') as session:
returned_string = session.get_a_string_of_fixed_maximum_size()
assert returned_string == test_string
self.patched_library.niFake_GetAStringOfFixedMaximumSize.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViCharBufferMatcher(256))
def test_get_a_string_of_size_python_code(self):
test_size = 4
expected_string_size = test_size - 1
test_string = "A string that is larger than test_size."
expected_string = test_string[:expected_string_size]
self.patched_library.niFake_GetAStringUsingPythonCode.side_effect = self.side_effects_helper.niFake_GetAStringUsingPythonCode
self.side_effects_helper['GetAStringUsingPythonCode']['aString'] = expected_string
with nifake.Session('dev1') as session:
returned_string = session.get_a_string_using_python_code(test_size)
assert returned_string == expected_string
self.patched_library.niFake_GetAStringUsingPythonCode.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(test_size), _matchers.ViCharBufferMatcher(test_size))
def test_return_a_number_and_a_string(self):
test_string = "this string"
test_number = 13
self.patched_library.niFake_ReturnANumberAndAString.side_effect = self.side_effects_helper.niFake_ReturnANumberAndAString
self.side_effects_helper['ReturnANumberAndAString']['aString'] = test_string
self.side_effects_helper['ReturnANumberAndAString']['aNumber'] = test_number
with nifake.Session('dev1') as session:
returned_number, returned_string = session.return_a_number_and_a_string()
assert (returned_string == test_string)
assert (returned_number == test_number)
self.patched_library.niFake_ReturnANumberAndAString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher(), _matchers.ViCharBufferMatcher(256))
def test_get_an_ivi_dance_string(self):
self.patched_library.niFake_GetAnIviDanceString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceString
string_val = 'Testing is fun?'
self.side_effects_helper['GetAnIviDanceString']['aString'] = string_val
with nifake.Session('dev1') as session:
result_string = session.get_an_ivi_dance_string()
assert result_string == string_val
from mock import call
calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)))]
self.patched_library.niFake_GetAnIviDanceString.assert_has_calls(calls)
assert self.patched_library.niFake_GetAnIviDanceString.call_count == 2
def test_get_string_ivi_dance_error(self):
test_error_code = -1234
test_error_desc = "ascending order"
self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString
self.side_effects_helper['GetAttributeViString']['attributeValue'] = 'Testing is fun?'
self.side_effects_helper['GetAttributeViString']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.read_write_string
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_get_an_ivi_dance_with_a_twist_string(self):
self.patched_library.niFake_GetAnIviDanceWithATwistString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceWithATwistString
string_val = 'Testing is fun?'
self.side_effects_helper['GetAnIviDanceWithATwistString']['aString'] = string_val
self.side_effects_helper['GetAnIviDanceWithATwistString']['actualSize'] = len(string_val)
with nifake.Session('dev1') as session:
result_string = session.get_an_ivi_dance_with_a_twist_string()
assert result_string == string_val
from mock import call
calls = [
call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None, _matchers.ViInt32PointerMatcher()),
call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)), _matchers.ViInt32PointerMatcher())
]
self.patched_library.niFake_GetAnIviDanceWithATwistString.assert_has_calls(calls)
assert self.patched_library.niFake_GetAnIviDanceWithATwistString.call_count == 2
def test_get_array_using_ivi_dance(self):
self.patched_library.niFake_GetArrayUsingIviDance.side_effect = self.side_effects_helper.niFake_GetArrayUsingIviDance
self.side_effects_helper['GetArrayUsingIviDance']['arrayOut'] = [1.1, 2.2]
with nifake.Session('dev1') as session:
result_array = session.get_array_using_ivi_dance()
assert result_array == [1.1, 2.2]
# Repeated Capabilities
def test_repeated_capability_method_on_session_timedelta(self):
test_maximum_time_ms = 10 # milliseconds
test_maximum_time_timedelta = hightime.timedelta(milliseconds=test_maximum_time_ms)
test_reading = 5
self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel
self.side_effects_helper['ReadFromChannel']['reading'] = test_reading
with nifake.Session('dev1') as session:
value = session.read_from_channel(test_maximum_time_timedelta)
self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher())
assert value == test_reading
def test_repeated_capability_method_on_specific_channel(self):
test_maximum_time_ms = 10 # milliseconds
test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms)
test_reading = 5
self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel
self.side_effects_helper['ReadFromChannel']['reading'] = test_reading
with nifake.Session('dev1') as session:
value = session.channels['3'].read_from_channel(test_maximum_time)
self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher())
assert value == test_reading
def test_device_method_not_exist_on_repeated_capability_error(self):
with nifake.Session('dev1') as session:
try:
session.channels['3'].simple_function()
assert False, 'Method has no repeated capability so it shouldn\'t exist on _RepeatedCapability'
except AttributeError:
pass
def test_repeated_capabilities_list(self):
with nifake.Session('dev1') as session:
assert session.channels['r0']._repeated_capability_list == ['r0']
def test_chained_repeated_capabilities_list(self):
with nifake.Session('dev1') as session:
assert session.sites[0, 1].channels[2, 3]._repeated_capability_list == ['site0/2', 'site0/3', 'site1/2', 'site1/3']
def test_chained_repeated_capability_method_on_specific_channel(self):
test_maximum_time_ms = 10 # milliseconds
test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms)
test_reading = 5
self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel
self.side_effects_helper['ReadFromChannel']['reading'] = test_reading
with nifake.Session('dev1') as session:
value = session.sites[0, 1].channels[2, 3].read_from_channel(test_maximum_time)
self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('site0/2,site0/3,site1/2,site1/3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher())
assert value == test_reading
# Attributes
def test_get_attribute_int32(self):
self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32
test_number = 3
self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number
with nifake.Session('dev1') as session:
attr_int = session.read_write_integer
assert(attr_int == test_number)
self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher())
def test_set_attribute_int32(self):
self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32
attribute_id = 1000004
test_number = -10
with nifake.Session('dev1') as session:
session.read_write_integer = test_number
self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number))
def test_get_attribute_int32_with_converter(self):
self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32
attribute_id = 1000008
test_number_ms = 3
test_number_s = 0.003
self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number_ms
with nifake.Session('dev1') as session:
attr_timedelta = session.read_write_integer_with_converter
assert(attr_timedelta.total_seconds() == test_number_s)
self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher())
def test_set_attribute_int32_with_converter(self):
self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32
attribute_id = 1000008
test_number_ms = -10000
with nifake.Session('dev1') as session:
session.read_write_integer_with_converter = hightime.timedelta(milliseconds=test_number_ms)
self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number_ms))
def test_get_attribute_real64(self):
self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64
test_number = 1.5
self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number
with nifake.Session('dev1') as session:
attr_double = session.read_write_double
assert attr_double == test_number
self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64PointerMatcher())
def test_set_attribute_real64(self):
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
attribute_id = 1000001
test_number = 10.1
with nifake.Session('dev1') as session:
session.read_write_double = test_number
self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number))
def test_get_attribute_real64_with_converter(self):
self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64
attribute_id = 1000007
test_number = 1e-9
self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number
with nifake.Session('dev1') as session:
attr_timedelta = session.read_write_double_with_converter
assert attr_timedelta.total_seconds() == test_number
self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher())
def test_set_attribute_real64_with_converter(self):
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
attribute_id = 1000007
test_number = 1e-9
with nifake.Session('dev1') as session:
session.read_write_double_with_converter = hightime.timedelta(nanoseconds=1)
self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number))
def test_get_attribute_string(self):
self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString
string = 'Testing is fun?'
self.side_effects_helper['GetAttributeViString']['attributeValue'] = string
with nifake.Session('dev1') as session:
attr_string = session.read_write_string
assert attr_string == string
from mock import call
calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(15), _matchers.ViCharBufferMatcher(len(string)))]
self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls)
assert self.patched_library.niFake_GetAttributeViString.call_count == 2
def test_set_attribute_string(self):
self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString
attribute_id = 1000002
attrib_string = 'This is test string'
with nifake.Session('dev1') as session:
session.read_write_string = attrib_string
self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('This is test string'))
def test_get_attribute_string_with_converter(self):
self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString
string = 'not that interesting'
self.side_effects_helper['GetAttributeViString']['attributeValue'] = string
with nifake.Session('dev1') as session:
attr_string = session.read_write_string_repeated_capability
assert attr_string == string
from mock import call
calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(20), _matchers.ViCharBufferMatcher(len(string)))]
self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls)
assert self.patched_library.niFake_GetAttributeViString.call_count == 2
def test_set_attribute_string_with_converter(self):
self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString
attribute_id = 1000010
with nifake.Session('dev1') as session:
session.read_write_string_repeated_capability = 42
self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('42'))
def test_get_attribute_boolean(self):
self.patched_library.niFake_GetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_GetAttributeViBoolean
self.side_effects_helper['GetAttributeViBoolean']['attributeValue'] = 1
with nifake.Session('dev1') as session:
assert session.read_write_bool
self.patched_library.niFake_GetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000000), _matchers.ViBooleanPointerMatcher())
def test_set_attribute_boolean(self):
self.patched_library.niFake_SetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_SetAttributeViBoolean
attribute_id = 1000000
attrib_bool = True
with nifake.Session('dev1') as session:
session.read_write_bool = attrib_bool
self.patched_library.niFake_SetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViBooleanMatcher(True))
def test_get_attribute_enum_int32(self):
self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32
self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = nifake.Color.BLUE.value
with nifake.Session('dev1') as session:
assert session.read_write_color == nifake.Color.BLUE
attribute_id = 1000003
self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher())
def test_set_attribute_enum_int32(self):
self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32
enum_value = nifake.Color.RED
with nifake.Session('dev1') as session:
session.read_write_color = enum_value
attribute_id = 1000003
self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(enum_value.value))
def test_get_attribute_enum_real64(self):
self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64
enum_value = nifake.FloatEnum.SIX_POINT_FIVE
self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = enum_value.value
with nifake.Session('dev1') as session:
assert session.float_enum == enum_value
attribute_id = 1000005
self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher())
def test_set_attribute_enum_real64(self):
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
enum_value = nifake.FloatEnum.FIVE_POINT_FIVE
with nifake.Session('dev1') as session:
session.float_enum = enum_value
attribute_id = 1000005
self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(enum_value.value))
def test_get_attribute_channel(self):
self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32
test_number = 100
self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number
with nifake.Session('dev1') as session:
attr_int = session.channels[['0', '1']].read_write_integer
assert(attr_int == test_number)
self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1'), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher())
def test_set_attribute_channel(self):
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
attribute_id = 1000001
test_number = 0.001
with nifake.Session('dev1') as session:
session.channels[range(24)].read_write_double = test_number
self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23'), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number))
def test_get_attribute_int64(self):
self.patched_library.niFake_GetAttributeViInt64.side_effect = self.side_effects_helper.niFake_GetAttributeViInt64
attribute_id = 1000006
test_number = 6000000000
self.side_effects_helper['GetAttributeViInt64']['attributeValue'] = test_number
with nifake.Session('dev1') as session:
attr_int = session.read_write_int64
assert(attr_int == test_number)
self.patched_library.niFake_GetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64PointerMatcher())
def test_set_attribute_int64(self):
self.patched_library.niFake_SetAttributeViInt64.side_effect = self.side_effects_helper.niFake_SetAttributeViInt64
attribute_id = 1000006
test_number = -6000000000
with nifake.Session('dev1') as session:
session.read_write_int64 = test_number
self.patched_library.niFake_SetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64Matcher(test_number))
def test_get_attribute_error(self):
test_error_code = -123
test_error_desc = "ascending order"
self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64
self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = 'Testing is fun?'
self.side_effects_helper['GetAttributeViReal64']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.read_write_double
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
def test_set_attribute_error(self):
test_error_code = -1
test_error_desc = 'Test'
self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64
self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = test_error_code
self.side_effects_helper['GetError']['description'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.read_write_double = -42.0
assert False
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64Matcher(-42.0))
def test_add_properties_to_session_error_set(self):
with nifake.Session('dev1') as session:
try:
session.non_existent_property = 5
assert False
except AttributeError as e:
assert str(e) == "'Session' object has no attribute 'non_existent_property'"
def test_add_properties_to_session_error_get(self):
with nifake.Session('dev1') as session:
try:
value = session.non_existent_property # noqa: F841
assert False
except AttributeError as e:
assert str(e) == "'Session' object has no attribute 'non_existent_property'"
def test_add_properties_to_repeated_capability_error_set(self):
with nifake.Session('dev1') as session:
try:
session.channels['0'].non_existent_property = 5
assert False
except AttributeError as e:
assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'"
def test_add_properties_to_repeated_capability_error_get(self):
with nifake.Session('dev1') as session:
try:
value = session.channels['0'].non_existent_property # noqa: F841
assert False
except AttributeError as e:
assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'"
def test_set_enum_attribute_int32_error(self):
with nifake.Session('dev1') as session:
try:
session.read_write_color = 5
except TypeError as e:
assert str(e) == 'must be Color not int'
def test_set_wrong_enum_attribute_int32_error(self):
with nifake.Session('dev1') as session:
try:
session.read_write_color = nifake.FloatEnum.SIX_POINT_FIVE
except TypeError as e:
assert str(e) == 'must be Color not FloatEnum'
# Error descriptions
def test_get_error_and_error_message_returns_error(self):
test_error_code = -42
self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction
self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = -1
self.side_effects_helper['GetError']['description'] = "Shouldn't get this"
self.side_effects_helper['GetError']['return'] = -2
self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message
self.side_effects_helper['error_message']['errorMessage'] = "Also shouldn't get this"
self.side_effects_helper['error_message']['return'] = -3
with nifake.Session('dev1') as session:
try:
session.simple_function()
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == 'Failed to retrieve error description.'
def test_get_error_description_error_message_error(self):
test_error_code = -42
test_error_desc = "The answer to the ultimate question"
self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction
self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code
self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError
self.side_effects_helper['GetError']['errorCode'] = -1
self.side_effects_helper['GetError']['description'] = "Shouldn't get this"
self.side_effects_helper['GetError']['return'] = -2
self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message
self.side_effects_helper['error_message']['errorMessage'] = test_error_desc
with nifake.Session('dev1') as session:
try:
session.simple_function()
except nifake.Error as e:
assert e.code == test_error_code
assert e.description == test_error_desc
self.patched_library.niFake_error_message.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_error_code), _matchers.ViCharBufferMatcher(256))
# Custom types
def test_set_custom_type(self):
self.patched_library.niFake_SetCustomType.side_effect = self.side_effects_helper.niFake_SetCustomType
cs = nifake.CustomStruct(struct_int=42, struct_double=4.2)
with nifake.Session('dev1') as session:
session.set_custom_type(cs)
self.patched_library.niFake_SetCustomType.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs)))
def test_get_custom_type(self):
self.patched_library.niFake_GetCustomType.side_effect = self.side_effects_helper.niFake_GetCustomType
cs_ctype = nifake.struct_CustomStruct(struct_int=42, struct_double=4.2)
self.side_effects_helper['GetCustomType']['cs'] = cs_ctype
with nifake.Session('dev1') as session:
cs = session.get_custom_type()
assert cs.struct_int == cs_ctype.struct_int
assert cs.struct_double == cs_ctype.struct_double
def test_set_custom_type_array(self):
self.patched_library.niFake_SetCustomTypeArray.side_effect = self.side_effects_helper.niFake_SetCustomTypeArray
cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)]
cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs])
with nifake.Session('dev1') as session:
session.set_custom_type_array(cs)
self.patched_library.niFake_SetCustomTypeArray.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(cs)), _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype))
def test_get_custom_type_array(self):
self.patched_library.niFake_GetCustomTypeArray.side_effect = self.side_effects_helper.niFake_GetCustomTypeArray
cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)]
cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs])
self.side_effects_helper['GetCustomTypeArray']['cs'] = cs_ctype
with nifake.Session('dev1') as session:
cs_test = session.get_custom_type_array(len(cs_ctype))
assert len(cs_test) == len(cs_ctype)
for actual, expected in zip(cs_test, cs):
assert actual.struct_int == expected.struct_int
assert actual.struct_double == expected.struct_double
# python-code size mechanism
def test_get_array_using_python_code_double(self):
import nifake._visatype
self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode
self.patched_library.niFake_GetArrayForPythonCodeDouble.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeDouble
array_out = [42.0, 43.0, 44.0]
array_out_ctype = (nifake._visatype.ViReal64 * len(array_out))(*array_out)
self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(array_out)
self.side_effects_helper['GetArrayForPythonCodeDouble']['arrayOut'] = array_out_ctype
with nifake.Session('dev1') as session:
array_out_test = session.get_array_for_python_code_double()
assert len(array_out_test) == len(array_out)
for actual, expected in zip(array_out_test, array_out):
assert actual == expected
def test_get_array_using_python_code_custom_type(self):
import nifake._visatype
self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode
self.patched_library.niFake_GetArrayForPythonCodeCustomType.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeCustomType
cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)]
cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs])
self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(cs)
self.side_effects_helper['GetArrayForPythonCodeCustomType']['arrayOut'] = cs_ctype
with nifake.Session('dev1') as session:
cs_test = session.get_array_for_python_code_custom_type()
assert len(cs_test) == len(cs)
for actual, expected in zip(cs_test, cs):
assert actual.struct_int == expected.struct_int
assert actual.struct_double == expected.struct_double
def test_get_cal_date_time(self):
self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime
month = 12
day = 30
year = 1988
hour = 10
minute = 15
self.side_effects_helper['GetCalDateAndTime']['return'] = 0
self.side_effects_helper['GetCalDateAndTime']['month'] = month
self.side_effects_helper['GetCalDateAndTime']['day'] = day
self.side_effects_helper['GetCalDateAndTime']['year'] = year
self.side_effects_helper['GetCalDateAndTime']['hour'] = hour
self.side_effects_helper['GetCalDateAndTime']['minute'] = minute
with nifake.Session('dev1') as session:
last_cal = session.get_cal_date_and_time(0)
assert isinstance(last_cal, hightime.datetime)
assert hightime.datetime(year, month, day, hour, minute) == last_cal
def test_get_cal_interval(self):
self.patched_library.niFake_GetCalInterval = self.side_effects_helper.niFake_GetCalInterval
self.side_effects_helper['GetCalInterval']['months'] = 24
with nifake.Session('dev1') as session:
last_cal = session.get_cal_interval()
assert isinstance(last_cal, hightime.timedelta)
assert 730 == last_cal.days
# Import/Export functions
def test_import_attribute_configuration_buffer_list_i8(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a'), ord('b'), ord('c'), ord('d')]
configuration = expected_list
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.import_attribute_configuration_buffer(configuration)
self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list))
def test_import_attribute_configuration_buffer_bytes(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a'), ord('b'), ord('c'), ord('d')]
configuration = b'abcd'
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.import_attribute_configuration_buffer(configuration)
self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list))
def test_import_attribute_configuration_buffer_bytearray(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a'), ord('b'), ord('c'), ord('d')]
configuration = bytearray(b'abcd')
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.import_attribute_configuration_buffer(configuration)
self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list))
def test_import_attribute_configuration_buffer_array_bytes(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a'), ord('b'), ord('c'), ord('d')]
configuration = array.array('b', b'abcd')
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.import_attribute_configuration_buffer(configuration)
self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list))
def test_import_attribute_configuration_buffer_str(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a'), ord('b'), ord('c'), ord('d')]
configuration = 'abcd'
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
session.import_attribute_configuration_buffer(configuration)
self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list))
# Invalid types
def test_import_attribute_configuration_buffer_list_i8_big(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a') * 100, ord('b') * 100, ord('c') * 100, ord('d') * 100]
configuration = expected_list
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
try:
session.import_attribute_configuration_buffer(configuration)
assert False
except ValueError:
pass
def test_import_attribute_configuration_buffer_list_i8_float(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a') * 1.0, ord('b') * 1.0, ord('c') * 1.0, ord('d') * 1.0]
configuration = expected_list
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
try:
session.import_attribute_configuration_buffer(configuration)
assert False
except TypeError:
pass
def test_import_attribute_configuration_buffer_list_i8_big_float(self):
self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer
expected_list = [ord('a') * 100.0, ord('b') * 100.0, ord('c') * 100.0, ord('d') * 100.0]
configuration = expected_list
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
try:
session.import_attribute_configuration_buffer(configuration)
assert False
except TypeError:
pass
def test_export_attribute_configuration_buffer(self):
self.patched_library.niFake_ExportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ExportAttributeConfigurationBuffer
expected_buffer_list = [ord('a'), ord('b'), ord('c'), ord('d'), ]
# Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here
# and have the mock return them. These are the ones that are actually filled in by the function.
expected_buffer = array.array('b', [0] * len(expected_buffer_list))
expected_buffer_ctypes = ctypes.cast(expected_buffer.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViInt8 * len(expected_buffer_list)))
self.side_effects_helper['ExportAttributeConfigurationBuffer']['configuration'] = expected_buffer_list
with nifake.Session('dev1') as session:
self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_buffer_ctypes]
self.get_ctypes_pointer_for_buffer_side_effect_count = 0
with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect):
actual_configuration = session.export_attribute_configuration_buffer()
assert type(actual_configuration) is bytes
assert len(actual_configuration) == len(expected_buffer_list)
# Since we mocked get_ctypes_pointer_for_buffer, we didn't actually fill in actual_configuration. Instead we look for the expected values to
# be in the expected buffer that we returned from the mock
for i in range(len(expected_buffer)):
assert expected_buffer[i] == expected_buffer_list[i]
def test_matcher_prints(self):
assert _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViSessionMatcher(" + str(nifake._visatype.ViSession) + ", 42)"
assert _matchers.ViAttrMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViAttrMatcher(" + str(nifake._visatype.ViAttr) + ", 42)"
assert _matchers.ViInt32Matcher(4).__repr__() == "ViInt32Matcher(" + str(nifake._visatype.ViInt32) + ", 4)"
assert _matchers.ViStringMatcher('0-24').__repr__() == "ViStringMatcher('0-24')"
assert _matchers.ViReal64Matcher(-42.0).__repr__() == "ViReal64Matcher(" + str(nifake._visatype.ViReal64) + ", -42.0)"
assert _matchers.ViReal64PointerMatcher().__repr__() == "ViReal64PointerMatcher(" + str(nifake._visatype.ViReal64) + ")"
assert _matchers.ViInt32PointerMatcher().__repr__() == "ViInt32PointerMatcher(" + str(nifake._visatype.ViInt32) + ")"
cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)]
cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs])
assert _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs[0])).__repr__() == "CustomTypeMatcher(<class 'nifake.custom_struct.struct_CustomStruct'>, struct_CustomStruct(data=None, struct_int=42, struct_double=4.2))"
assert _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype).__repr__() == "CustomTypeBufferMatcher(<class 'nifake.custom_struct.struct_CustomStruct'>, [struct_CustomStruct(data=None, struct_int=42, struct_double=4.2), struct_CustomStruct(data=None, struct_int=43, struct_double=4.3), struct_CustomStruct(data=None, struct_int=42, struct_double=4.3)])"
def test_channel_on_session(self):
with nifake.Session('dev1') as session:
try:
session['100'].read_write_double = 5.0
assert False
except TypeError:
pass
def test_function_name(self):
with nifake.Session('dev1') as session:
# Pick a function that uses @ivi_synchronized
assert session.bool_array_output_function.__name__ == 'bool_array_output_function'
# Pick several functions that do not use @ivi_synchronized to make sure they don't break in the future
assert session.lock.__name__ == 'lock'
assert session._error_message.__name__ == '_error_message'
assert session.initiate.__name__ == 'initiate'
# Cannot use session.<property>.__name__ since that invokes the get attribute value and the returned value
# (string, int, float) don't have __name__ properties
def test_buffer_converter(self):
self.patched_library.niFake_DoubleAllTheNums.side_effect = self.side_effects_helper.niFake_DoubleAllTheNums
nums = [1, 2, 3, 4.2]
nums_x2 = [x * 2 for x in nums]
with nifake.Session('dev1') as session:
session.double_all_the_nums(nums)
self.patched_library.niFake_DoubleAllTheNums.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(nums)), _matchers.ViReal64BufferMatcher(nums_x2))
def test_nitclk_integration(self):
with nifake.Session('dev1') as session:
assert str(type(session.tclk)) == "<class 'nitclk.session.SessionReference'>"
def test_accept_list_of_time_values_as_floats(self):
self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds
delays = [-1.5, 2.0]
with nifake.Session('dev1') as session:
session.accept_list_of_durations_in_seconds(delays)
self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(len(delays)),
_matchers.ViReal64BufferMatcher(delays)
)
def test_accept_array_of_time_values_as_floats(self):
self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds
time_values = [-1.5, 2.0]
delays = array.array('d', time_values)
with nifake.Session('dev1') as session:
session.accept_list_of_durations_in_seconds(delays)
self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(len(delays)),
_matchers.ViReal64BufferMatcher(time_values)
)
def test_accept_list_of_time_values_as_timedelta_instances(self):
self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds
time_values = [-1.5, 2e-9]
delays = [datetime.timedelta(seconds=-1.5), hightime.timedelta(nanoseconds=2)]
with nifake.Session('dev1') as session:
session.accept_list_of_durations_in_seconds(delays)
self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(len(delays)),
_matchers.ViReal64BufferMatcher(time_values)
)
def test_return_timedelta(self):
self.patched_library.niFake_ReturnDurationInSeconds.side_effect = self.side_effects_helper.niFake_ReturnDurationInSeconds
time_value = -1.5
expected_timedelta = hightime.timedelta(seconds=time_value)
self.side_effects_helper['ReturnDurationInSeconds']['timedelta'] = time_value
with nifake.Session('dev1') as session:
returned_timedelta = session.return_duration_in_seconds()
assert returned_timedelta == expected_timedelta
self.patched_library.niFake_ReturnDurationInSeconds.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViReal64PointerMatcher()
)
def test_return_timedeltas(self):
self.patched_library.niFake_ReturnListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_ReturnListOfDurationsInSeconds
time_values = [-1.5, 2.0]
time_values_ctype = (nifake._visatype.ViReal64 * len(time_values))(*time_values)
expected_timedeltas = [hightime.timedelta(seconds=i) for i in time_values]
self.side_effects_helper['ReturnListOfDurationsInSeconds']['timedeltas'] = time_values_ctype
with nifake.Session('dev1') as session:
returned_timedeltas = session.return_list_of_durations_in_seconds(len(expected_timedeltas))
assert len(returned_timedeltas) == len(expected_timedeltas)
assert returned_timedeltas == expected_timedeltas
self.patched_library.niFake_ReturnListOfDurationsInSeconds.assert_called_once_with(
_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST),
_matchers.ViInt32Matcher(len(time_values)),
_matchers.ViReal64BufferMatcher(len(time_values))
)
# not session tests per se
def test_diagnostic_information():
info = nifake.print_diagnostic_information()
assert isinstance(info, dict)
def test_dunder_version():
print('Version = {}'.format(nifake.__version__))
assert type(nifake.__version__) is str
| 64.051148
| 466
| 0.734526
| 11,348
| 97,678
| 5.920867
| 0.050317
| 0.04142
| 0.056258
| 0.078762
| 0.837178
| 0.778836
| 0.739158
| 0.688004
| 0.65989
| 0.629394
| 0
| 0.021737
| 0.183788
| 97,678
| 1,524
| 467
| 64.093176
| 0.821025
| 0.020506
| 0
| 0.530735
| 0
| 0.018741
| 0.065063
| 0.019439
| 0
| 0
| 0
| 0
| 0.196402
| 1
| 0.096702
| false
| 0.011994
| 0.036732
| 0
| 0.135682
| 0.002249
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
454320f554f2379a245ca5dfcecd50fdfe764c57
| 1,339
|
py
|
Python
|
manga_py/providers/readms_net.py
|
paulolimac/manga-py
|
3d180846750a4e770b5024eb8cd15629362875b1
|
[
"MIT"
] | null | null | null |
manga_py/providers/readms_net.py
|
paulolimac/manga-py
|
3d180846750a4e770b5024eb8cd15629362875b1
|
[
"MIT"
] | null | null | null |
manga_py/providers/readms_net.py
|
paulolimac/manga-py
|
3d180846750a4e770b5024eb8cd15629362875b1
|
[
"MIT"
] | null | null | null |
from manga_py.provider import Provider
from .helpers.std import Std
class ReadMsNet(Provider, Std):
def get_archive_name(self) -> str:
idx = self.re.search('/r/[^/]+/([^/]+)/([^/]+)', self.chapter).groups()
return self.normal_arc_name(idx)
def get_chapter_index(self) -> str:
idx = self.re.search('/r/[^/]+/[^/]+/([^/]+)', self.chapter)
return idx.group(1)
def get_main_content(self):
return self._get_content('{}/manga/{}')
def get_manga_name(self) -> str:
return self._get_name(r'\.net/(?:manga|r)/([^/]+)')
def get_chapters(self):
return self._elements('.table-striped td > a')
def get_files(self):
img_selector = 'img#manga-page'
parser = self.html_fromstring(self.chapter)
img = self._images_helper(parser, img_selector)
images = []
img and images.append(img)
pages = parser.cssselect('.btn-reader-page .dropdown-menu li + li a')
for i in pages:
parser = self.html_fromstring(self.http().normalize_uri(i.get('href')))
img = self._images_helper(parser, img_selector)
img and images.append(img)
return images
def get_cover(self):
pass # FIXME HOME
def book_meta(self) -> dict:
# todo meta
pass
main = ReadMsNet
| 29.108696
| 83
| 0.59522
| 172
| 1,339
| 4.459302
| 0.401163
| 0.054759
| 0.028683
| 0.036506
| 0.3103
| 0.182529
| 0.182529
| 0.088657
| 0.088657
| 0
| 0
| 0.000993
| 0.247946
| 1,339
| 45
| 84
| 29.755556
| 0.760675
| 0.014937
| 0
| 0.1875
| 0
| 0
| 0.1231
| 0.053951
| 0
| 0
| 0
| 0.022222
| 0
| 1
| 0.25
| false
| 0.0625
| 0.0625
| 0.09375
| 0.53125
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
1891245d086dd330a0082734d921645a1d9e776b
| 83
|
py
|
Python
|
backend/omdb/apps.py
|
tiagodomp/tiagoflix
|
87b36450e55d0c9b8de9321b6cb4d44bb9fe31ce
|
[
"MIT"
] | null | null | null |
backend/omdb/apps.py
|
tiagodomp/tiagoflix
|
87b36450e55d0c9b8de9321b6cb4d44bb9fe31ce
|
[
"MIT"
] | 9
|
2020-06-05T20:17:54.000Z
|
2022-02-26T21:54:45.000Z
|
backend/omdb/apps.py
|
tiagodomp/tiagoflix
|
87b36450e55d0c9b8de9321b6cb4d44bb9fe31ce
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class OmdbConfig(AppConfig):
name = 'omdb'
| 13.833333
| 33
| 0.73494
| 10
| 83
| 6.1
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180723
| 83
| 5
| 34
| 16.6
| 0.897059
| 0
| 0
| 0
| 0
| 0
| 0.048193
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
18960eb9735a85e3cefa9ad6f2ed9aee2cf8e919
| 6,959
|
py
|
Python
|
tests/test_cmd.py
|
fruch/pytest-diff-selector
|
acb33a5ce9db6851f8fbcc8e48d2218b9ff14051
|
[
"MIT"
] | 5
|
2022-02-23T22:40:33.000Z
|
2022-02-24T16:34:35.000Z
|
tests/test_cmd.py
|
fruch/pytest-diff-selector
|
acb33a5ce9db6851f8fbcc8e48d2218b9ff14051
|
[
"MIT"
] | null | null | null |
tests/test_cmd.py
|
fruch/pytest-diff-selector
|
acb33a5ce9db6851f8fbcc8e48d2218b9ff14051
|
[
"MIT"
] | null | null | null |
import pytest
from pytest_diff_selector.main import run
from conftest import append_file, write_file
def test_simple_scan(test_repo):
append_file(
test_repo,
"test_a.py",
"""
# comment
def test_func2():
assert True
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert ret == set()
def test_find_change_in_test_function(test_repo):
write_file(
test_repo,
"test_a.py",
"""
def test_func1():
call_something()
call_something_else()
assert True
# comment
def test_func2():
assert True
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::test_func1" in ret
def test_find_change_in_test_method(test_repo):
write_file(
test_repo,
"test_a.py",
"""
class TestSomething:
def test_method():
call_something()
call_something_else()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_not_in_test_file(test_repo):
write_file(
test_repo,
"helper.py",
"""
def call_something():
print('doing some changes')
""",
)
test_repo.run("git add *.py")
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::test_func1" in ret
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_not_in_test_file_nested(test_repo):
write_file(
test_repo,
"test_a.py",
"""
from utils.helper import call_something
class TestSomething:
def test_method():
global_var = global_var + 1
call_something()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
write_file(test_repo, "utils/__init__.py", """# just comment""")
write_file(
test_repo,
"utils/helper.py",
"""
def call_something():
print('doing')
""",
)
test_repo.run("git add utils/*.py")
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::test_func1" in ret
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_in_test_module_scope(test_repo):
write_file(
test_repo,
"test_a.py",
"""
global_var = 20
class TestSomething:
def test_method():
global_var = global_var + 1
call_something()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_in_method_decorator(test_repo):
write_file(
test_repo,
"test_a.py",
"""
from helpers import call_something
import pytest
class TestSomething:
@pytest.mark.skip
def test_method():
global_var = global_var + 1
call_something()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_with_no_python_file(test_repo):
write_file(
test_repo,
"README.md",
"""
# Just updating the docs
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert ret == []
def test_find_change_nested_calls(test_repo):
write_file(
test_repo,
"helpers.py",
"""
def call_something():
print('doing')
func1()
def func1():
print('doing B')
""",
)
test_repo.run("git add *.py")
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert ret == set()
@pytest.mark.skip(
reason="Not sure there's a way to detect this one, not without scanning before change took place"
)
def test_find_change_removal_from_end_of_func(test_repo): # pragma: no cover
write_file(
test_repo,
"helper.py",
"""
def call_something():
print('doing')
""",
)
test_repo.run("git add *.py")
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert "test_a.py::test_func1" in ret
assert "test_a.py::TestSomething::test_method" in ret
def test_find_change_in_inherited_class(test_repo):
write_file(
test_repo,
"test_a.py",
"""
from helpers import call_something
class FatherClass:
def father_method(self):
call_something()
class TestSomething(FatherClass):
def test_method(self):
global_var = global_var + 1
call_something()
self.father_method()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert {"test_a.py::TestSomething::test_method"} == ret
def test_find_change_in_new_file(test_repo):
write_file(
test_repo,
"test_b.py",
"""
def test_func1():
call_something()
assert False
""",
)
test_repo.run("git add *.py")
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert {"test_b.py::test_func1"} == ret
def test_find_change_in_inherited_class_tests(test_repo):
"""
* test the removal of test methods from class with __test__=False
* test the copy of test methods based on inheritance
"""
write_file(
test_repo,
"test_a.py",
"""
from helpers import call_something
class FatherClass:
__test__ = False
def father_method(self):
call_something()
def test_method_C(self):
do_something_important()
pass
class TestSomething(FatherClass):
def test_method(self):
global_var = global_var + 1
call_something()
self.father_method()
assert 0/1
def test_func1():
call_something()
assert False
""",
)
ret = run(git_diff="HEAD", root_path=test_repo.workspace)
assert {
"test_a.py::TestSomething::test_method_C",
"test_a.py::TestSomething::test_method",
} == ret
| 22.966997
| 101
| 0.564736
| 826
| 6,959
| 4.427361
| 0.130751
| 0.100629
| 0.040197
| 0.065081
| 0.812688
| 0.787531
| 0.716981
| 0.678151
| 0.657096
| 0.630845
| 0
| 0.007749
| 0.332375
| 6,959
| 302
| 102
| 23.043046
| 0.77938
| 0.019543
| 0
| 0.519685
| 0
| 0
| 0.212431
| 0.115395
| 0
| 0
| 0
| 0
| 0.125984
| 1
| 0.102362
| false
| 0
| 0.023622
| 0
| 0.125984
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
189eba5d5db8d2c6a8d7c20824fdbeaa68bc63e2
| 140
|
py
|
Python
|
allauth/socialaccount/providers/persona/urls.py
|
wisr/django-allauth
|
f30dd72e47cb75feb755d15e332f76ca0ce03bd9
|
[
"MIT"
] | 2
|
2020-10-22T08:39:50.000Z
|
2021-02-02T08:41:03.000Z
|
allauth/socialaccount/providers/persona/urls.py
|
CZZLEGEND/django-allauth
|
ef0774318993c2f7757df6ca2b962bc0df1d5674
|
[
"MIT"
] | 11
|
2021-04-08T19:05:56.000Z
|
2022-03-12T00:10:25.000Z
|
allauth/socialaccount/providers/persona/urls.py
|
CZZLEGEND/django-allauth
|
ef0774318993c2f7757df6ca2b962bc0df1d5674
|
[
"MIT"
] | 17
|
2020-03-03T08:42:17.000Z
|
2020-10-03T16:08:49.000Z
|
from django.urls import path
from . import views
urlpatterns = [
path('persona/login/', views.persona_login, name="persona_login")
]
| 15.555556
| 69
| 0.721429
| 18
| 140
| 5.5
| 0.555556
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157143
| 140
| 8
| 70
| 17.5
| 0.838983
| 0
| 0
| 0
| 0
| 0
| 0.192857
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
18a3f54ff61ed0feb9bac17d9f1d652e99365759
| 527
|
py
|
Python
|
webpreview/excepts.py
|
illing2005/webpreview
|
e84f7a277965d00b494335a3ab0a5d7c7876d8b0
|
[
"MIT"
] | 85
|
2015-03-07T13:14:49.000Z
|
2022-01-29T23:55:58.000Z
|
webpreview/excepts.py
|
illing2005/webpreview
|
e84f7a277965d00b494335a3ab0a5d7c7876d8b0
|
[
"MIT"
] | 19
|
2015-04-08T05:23:58.000Z
|
2020-08-04T10:47:50.000Z
|
webpreview/excepts.py
|
illing2005/webpreview
|
e84f7a277965d00b494335a3ab0a5d7c7876d8b0
|
[
"MIT"
] | 25
|
2015-04-09T15:17:24.000Z
|
2022-02-22T09:54:16.000Z
|
class WebpreviewException(Exception):
"""
Base Webpreview Exception.
"""
pass
class EmptyURL(WebpreviewException):
"""
WebpreviewException for empty URL.
"""
pass
class EmptyProperties(WebpreviewException):
"""
WebpreviewException for empty properties.
"""
pass
class URLNotFound(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass
class URLUnreachable(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass
| 15.5
| 45
| 0.654649
| 39
| 527
| 8.846154
| 0.410256
| 0.104348
| 0.475362
| 0.266667
| 0.301449
| 0.301449
| 0
| 0
| 0
| 0
| 0
| 0.01519
| 0.250474
| 527
| 33
| 46
| 15.969697
| 0.858228
| 0.324478
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.