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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c043580bbcdc0c2f77182410aa8186718aedc9eb
| 402
|
py
|
Python
|
TPs/TP1/luces_afuera_niveles.py
|
FdelMazo/7540rw-Algo1
|
8900604873195df9e902ead6bcb67723a8b654c8
|
[
"MIT"
] | 1
|
2021-11-20T18:41:34.000Z
|
2021-11-20T18:41:34.000Z
|
TPs/TP1/luces_afuera_niveles.py
|
FdelMazo/7540rw-Algo1
|
8900604873195df9e902ead6bcb67723a8b654c8
|
[
"MIT"
] | null | null | null |
TPs/TP1/luces_afuera_niveles.py
|
FdelMazo/7540rw-Algo1
|
8900604873195df9e902ead6bcb67723a8b654c8
|
[
"MIT"
] | null | null | null |
nivel1 = [[1,1,0,1,1],[1,0,1,0,1],[0,1,1,1,0],[1,0,1,0,1],[1,1,0,1,1]]
nivel2 = [[0,1,0,1,0],[1,1,0,1,1],[0,1,0,1,0],[1,0,1,0,1],[1,0,1,0,1]]
nivel3 = [[1,0,0,0,1],[1,1,0,1,1],[0,0,1,0,0],[1,0,1,0,0],[1,0,1,1,0]]
nivel4 = [[1,1,0,1,1],[0,0,0,0,0],[1,1,0,1,1],[0,0,0,0,1],[1,1,0,0,0]]
nivel5 = [[0,0,0,1,1],[0,0,0,1,1],[0,0,0,0,0],[1,1,0,0,0],[1,1,0,0,0]]
niveles = [nivel1,nivel2,nivel3,nivel4,nivel5]
| 57.428571
| 70
| 0.477612
| 136
| 402
| 1.411765
| 0.058824
| 0.364583
| 0.359375
| 0.270833
| 0.651042
| 0.635417
| 0.619792
| 0.479167
| 0.46875
| 0.307292
| 0
| 0.351563
| 0.044776
| 402
| 6
| 71
| 67
| 0.148438
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
c049a381075ab6a9ed267b639cc43e78befceb50
| 169
|
py
|
Python
|
tests/parser/keys.test.py
|
veltri/DLV2
|
944aaef803aa75e7ec51d7e0c2b0d964687fdd0e
|
[
"Apache-2.0"
] | null | null | null |
tests/parser/keys.test.py
|
veltri/DLV2
|
944aaef803aa75e7ec51d7e0c2b0d964687fdd0e
|
[
"Apache-2.0"
] | null | null | null |
tests/parser/keys.test.py
|
veltri/DLV2
|
944aaef803aa75e7ec51d7e0c2b0d964687fdd0e
|
[
"Apache-2.0"
] | null | null | null |
input = """
d :- a.
b :- c,d.
c :- b,e.
ok :- a, b, c, d, e, f.
"""
output = """
d :- a.
b :- c,d.
c :- b,e.
ok :- a, b, c, d, e, f.
"""
| 9.941176
| 26
| 0.254438
| 32
| 169
| 1.34375
| 0.28125
| 0.186047
| 0.27907
| 0.372093
| 0.744186
| 0.744186
| 0.744186
| 0.744186
| 0.744186
| 0.744186
| 0
| 0
| 0.43787
| 169
| 16
| 27
| 10.5625
| 0.452632
| 0
| 0
| 0.833333
| 0
| 0
| 0.802548
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
c06027a0f498f29be5f93d0e2a22f2bfb54ad988
| 79
|
py
|
Python
|
scripts/update_front_end.py
|
bm-commit/defi-stake-yield-brownie
|
27e873208d386baa035d2c2bb00130726bd3cc6f
|
[
"MIT"
] | null | null | null |
scripts/update_front_end.py
|
bm-commit/defi-stake-yield-brownie
|
27e873208d386baa035d2c2bb00130726bd3cc6f
|
[
"MIT"
] | null | null | null |
scripts/update_front_end.py
|
bm-commit/defi-stake-yield-brownie
|
27e873208d386baa035d2c2bb00130726bd3cc6f
|
[
"MIT"
] | null | null | null |
from scripts.deploy import update_front_end
def main():
update_front_end()
| 19.75
| 43
| 0.78481
| 12
| 79
| 4.833333
| 0.75
| 0.37931
| 0.482759
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139241
| 79
| 4
| 44
| 19.75
| 0.852941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
225852c7551773c3b8ca47a2070af7d662b54c71
| 11,514
|
py
|
Python
|
tests/test_table_aggregation/test_evaluate.py
|
afcarl/corvid
|
e257074edeac1e8dce4a737b60e93a9bea37b6b9
|
[
"Apache-2.0"
] | 1
|
2019-04-15T13:49:39.000Z
|
2019-04-15T13:49:39.000Z
|
tests/test_table_aggregation/test_evaluate.py
|
afcarl/corvid
|
e257074edeac1e8dce4a737b60e93a9bea37b6b9
|
[
"Apache-2.0"
] | null | null | null |
tests/test_table_aggregation/test_evaluate.py
|
afcarl/corvid
|
e257074edeac1e8dce4a737b60e93a9bea37b6b9
|
[
"Apache-2.0"
] | 1
|
2020-09-02T13:49:52.000Z
|
2020-09-02T13:49:52.000Z
|
"""
"""
import unittest
from corvid.table_aggregation.evaluate import count_matching_cells, \
row_level_recall, cell_level_recall, evaluate
from corvid.types.table import Token, Cell, Table
class TestComputeMetrics(unittest.TestCase):
def setUp(self):
"""
gold:
subject, header1, header2
x, 1, 2
y, 3, 4
z, 5, 6
"""
self.gold_table = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='5')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='6')], rowspan=1, colspan=1)
], nrow=4, ncol=3)
self.gold_table_empty = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1)
], nrow=1, ncol=3)
self.pred_table_perfect = self.gold_table
self.pred_table_empty = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1)
], nrow=1, ncol=3)
self.pred_table_permute_rows = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='5')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='6')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1)
], nrow=4, ncol=3)
self.pred_table_extra_rows = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='5')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='6')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='w')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='7')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='8')], rowspan=1, colspan=1)
], nrow=5, ncol=3)
self.pred_table_missing_rows = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1)
], nrow=3, ncol=3)
self.pred_table_partial_credit = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1)
], nrow=4, ncol=3)
def test_count_matching_cells(self):
self.assertEqual(count_matching_cells(
row1=[
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1)
],
row2=[
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1)
]), 3.0)
self.assertEqual(count_matching_cells(
row1=[
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1)
],
row2=[
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1)
]), 1.0)
def test_row_level_recall(self):
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_perfect), 1.0)
with self.assertRaises(Exception):
row_level_recall(gold_table=self.gold_table_empty,
pred_table=self.pred_table_perfect)
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_empty), 0.0)
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_permute_rows), 1.0)
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_extra_rows), 1.0)
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_missing_rows), 2 / 3)
self.assertEqual(
row_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_partial_credit), 0.0)
def test_cell_level_recall(self):
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_perfect), 1.0)
with self.assertRaises(Exception):
cell_level_recall(gold_table=self.gold_table_empty,
pred_table=self.pred_table_perfect)
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_permute_rows), 1.0)
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_extra_rows), 1.0)
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_missing_rows), 2 / 3)
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_partial_credit), 1 / 3)
def test_compute_metrics(self):
pred_table_missing_header = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='5')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='6')], rowspan=1, colspan=1)
], nrow=3, ncol=3)
with self.assertRaises(Exception):
compute_metrics(gold_table=self.gold_table,
pred_table=pred_table_missing_header)
self.assertEqual(
cell_level_recall(gold_table=self.gold_table,
pred_table=self.pred_table_empty), 0.0)
pred_table_permuted_header = Table.create_from_cells(
cells=[
Cell(tokens=[Token(text='subject')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='header1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='x')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='2')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='1')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='y')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='4')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='3')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='z')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='6')], rowspan=1, colspan=1),
Cell(tokens=[Token(text='5')], rowspan=1, colspan=1)
], nrow=4, ncol=3)
with self.assertRaises(Exception):
compute_metrics(gold_table=self.gold_table,
pred_table=pred_table_permuted_header)
| 48.378151
| 80
| 0.544468
| 1,401
| 11,514
| 4.340471
| 0.047109
| 0.162802
| 0.244203
| 0.309324
| 0.933892
| 0.909883
| 0.909883
| 0.909883
| 0.892945
| 0.888999
| 0
| 0.040177
| 0.295293
| 11,514
| 237
| 81
| 48.582278
| 0.709268
| 0.006166
| 0
| 0.815385
| 0
| 0
| 0.021357
| 0
| 0
| 0
| 0
| 0
| 0.092308
| 1
| 0.025641
| false
| 0
| 0.015385
| 0
| 0.046154
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
97d7925ca4f2ccd922fa5c11455c91ad26787b54
| 8,465
|
py
|
Python
|
clayful/models/wish_list.py
|
Clayful/clayful-python
|
ddd5f1f986fb0079d5128e17f4b0fdce83b4cec1
|
[
"MIT"
] | null | null | null |
clayful/models/wish_list.py
|
Clayful/clayful-python
|
ddd5f1f986fb0079d5128e17f4b0fdce83b4cec1
|
[
"MIT"
] | 3
|
2020-04-17T05:24:06.000Z
|
2022-02-10T09:00:22.000Z
|
clayful/models/wish_list.py
|
Clayful/clayful-python
|
ddd5f1f986fb0079d5128e17f4b0fdce83b4cec1
|
[
"MIT"
] | null | null | null |
class WishList:
Clayful = None
name = 'WishList'
path = 'wishlists'
@staticmethod
def config(clayful):
WishList.Clayful = clayful
return WishList
@staticmethod
def add_item(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'add_item',
'http_method': 'POST',
'path': '/v1/wishlists/{wishListId}/items',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def add_item_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'add_item_for_me',
'http_method': 'POST',
'path': '/v1/me/wishlists/{wishListId}/items',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def count(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'count',
'http_method': 'GET',
'path': '/v1/wishlists/count',
'params': (),
'args': args
})
@staticmethod
def count_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'count_for_me',
'http_method': 'GET',
'path': '/v1/me/wishlists/count',
'params': (),
'args': args
})
@staticmethod
def count_products(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'count_products',
'http_method': 'GET',
'path': '/v1/wishlists/{wishListId}/products/count',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def count_products_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'count_products_for_me',
'http_method': 'GET',
'path': '/v1/me/wishlists/{wishListId}/products/count',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def create(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'create',
'http_method': 'POST',
'path': '/v1/wishlists',
'params': (),
'args': args
})
@staticmethod
def create_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'create_for_me',
'http_method': 'POST',
'path': '/v1/me/wishlists',
'params': (),
'args': args
})
@staticmethod
def delete(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'delete',
'http_method': 'DELETE',
'path': '/v1/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def delete_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'delete_for_me',
'http_method': 'DELETE',
'path': '/v1/me/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def delete_item(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'delete_item',
'http_method': 'DELETE',
'path': '/v1/wishlists/{wishListId}/items/{productId}',
'params': ('wishListId', 'productId', ),
'args': args
})
@staticmethod
def delete_item_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'delete_item_for_me',
'http_method': 'DELETE',
'path': '/v1/me/wishlists/{wishListId}/items/{productId}',
'params': ('wishListId', 'productId', ),
'args': args
})
@staticmethod
def delete_metafield(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'delete_metafield',
'http_method': 'DELETE',
'path': '/v1/wishlists/{wishListId}/meta/{field}',
'params': ('wishListId', 'field', ),
'args': args
})
@staticmethod
def empty(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'empty',
'http_method': 'DELETE',
'path': '/v1/wishlists/{wishListId}/items',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def empty_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'empty_for_me',
'http_method': 'DELETE',
'path': '/v1/me/wishlists/{wishListId}/items',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def get(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'get',
'http_method': 'GET',
'path': '/v1/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def get_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'get_for_me',
'http_method': 'GET',
'path': '/v1/me/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def increase_metafield(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'increase_metafield',
'http_method': 'POST',
'path': '/v1/wishlists/{wishListId}/meta/{field}/inc',
'params': ('wishListId', 'field', ),
'args': args
})
@staticmethod
def list(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'list',
'http_method': 'GET',
'path': '/v1/wishlists',
'params': (),
'args': args
})
@staticmethod
def list_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'list_for_me',
'http_method': 'GET',
'path': '/v1/me/wishlists',
'params': (),
'args': args
})
@staticmethod
def list_products(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'list_products',
'http_method': 'GET',
'path': '/v1/wishlists/{wishListId}/products',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def list_products_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'list_products_for_me',
'http_method': 'GET',
'path': '/v1/me/wishlists/{wishListId}/products',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def pull_from_metafield(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'pull_from_metafield',
'http_method': 'POST',
'path': '/v1/wishlists/{wishListId}/meta/{field}/pull',
'params': ('wishListId', 'field', ),
'args': args
})
@staticmethod
def push_to_metafield(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'push_to_metafield',
'http_method': 'POST',
'path': '/v1/wishlists/{wishListId}/meta/{field}/push',
'params': ('wishListId', 'field', ),
'args': args
})
@staticmethod
def update(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'update',
'http_method': 'PUT',
'path': '/v1/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
@staticmethod
def update_for_me(*args):
return WishList.Clayful.call_api({
'model_name': WishList.name,
'method_name': 'update_for_me',
'http_method': 'PUT',
'path': '/v1/me/wishlists/{wishListId}',
'params': ('wishListId', ),
'args': args
})
| 25.966258
| 73
| 0.542233
| 823
| 8,465
| 5.363305
| 0.054678
| 0.095152
| 0.106026
| 0.147259
| 0.95401
| 0.938151
| 0.924785
| 0.860444
| 0.812188
| 0.72406
| 0
| 0.004361
| 0.295688
| 8,465
| 325
| 74
| 26.046154
| 0.735995
| 0
| 0
| 0.735075
| 0
| 0
| 0.31699
| 0.08991
| 0
| 0
| 0
| 0
| 0
| 1
| 0.100746
| false
| 0
| 0
| 0.097015
| 0.216418
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
97de8991e732a8b29228f10430f5ca2604b0c29b
| 32,386
|
py
|
Python
|
ppirl-userstudy/data_display.py
|
pinformatics/MINDFIRL-userstudy
|
20bc447d359fea6ffcaf3bd8a58137831ba488fd
|
[
"MIT"
] | null | null | null |
ppirl-userstudy/data_display.py
|
pinformatics/MINDFIRL-userstudy
|
20bc447d359fea6ffcaf3bd8a58137831ba488fd
|
[
"MIT"
] | 1
|
2018-05-10T22:38:02.000Z
|
2018-05-10T22:38:02.000Z
|
ppirl-userstudy/data_display.py
|
pinformatics/MINDFIRL-userstudy
|
20bc447d359fea6ffcaf3bd8a58137831ba488fd
|
[
"MIT"
] | null | null | null |
#! /usr/bin/python
# encoding=utf-8
# this module is for formatting raw data into html-friendly data
DATA_MODE_BASE = ['base', 'base', 'base', 'base', 'base', 'base']
DATA_MODE_FULL = ['full', 'full', 'full', 'full', 'full', 'full']
DATA_MODE_MASKED = ['masked', 'masked', 'masked', 'masked', 'masked', 'masked']
DATA_MODE_MINIMUM = ['masked', 'partial', 'partial', 'partial', 'full', 'masked']
DATA_MODE_MODERATE = ['partial', 'partial', 'partial', 'partial', 'full', 'masked']
def get_string_display(attr1, attr2, helper1, helper2, attribute_mode):
"""
get the attribute mode for string
attribute mode can be:
'base', 'full', 'partial', 'masked'
Note that some attribute does not have partial mode, in this case, partial mode will return masked mode
Remeber to call has_partial_mode function to check if it actually has partial mode!
Example:
Input:
attr1: '1000151475'
attr2: '1000151575'
helper1: '*******4**'
helper2: '*******5**'
attribute_mode: 'partial'
Output:
['*******<span style="color:red">4</span>**', '*******<span style="color:red">5</span>**']
"""
if attribute_mode == 'base':
attr1_display = attr1
attr2_display = attr2
return [attr1_display, attr2_display]
elif attribute_mode == 'full':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = attr1
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = attr2
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = attr1
attr2_display = attr2
else:
attr1_display = ''
attr2_display = ''
i = 0
j = 0
k = 0
while k < len(helper1):
if helper1[k] == '*':
attr1_display += attr1[i]
attr2_display += attr2[j]
k += 1
i += 1
j += 1
elif k+1 < len(helper1) and i+1 < len(attr1) and j+1 < len(attr2) and \
helper1[k] not in ['*', '_', '?'] and helper1[k+1] not in ['*', '_', '?'] and attr1[i] == attr2[j+1] and attr1[i+1] == attr2[j]:
attr1_display += '<span class="transpose_text">' + attr1[i] + attr1[i+1] + '</span>'
attr2_display += '<span class="transpose_text">' + attr2[j] + attr2[j+1] + '</span>'
k += 2
i += 2
j += 2
elif helper1[k] == '_' or helper1[k] == '?':
attr2_display += '<span class="indel_text">' + attr2[j] + '</span>'
k += 1
j += 1
elif helper2[k] == '_' or helper2[k] == '?':
attr1_display += '<span class="indel_text">' + attr1[i] + '</span>'
k += 1
i += 1
else:
attr1_display += '<span class="replace_text">' + attr1[i] + '</span>'
attr2_display += '<span class="replace_text">' + attr2[j] + '</span>'
k += 1
i += 1
j += 1
return [attr1_display, attr2_display]
elif attribute_mode == 'partial':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = '*'*len(attr1)
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = '*'*len(attr2)
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = len(attr1)*'@'
attr2_display = len(attr2)*'&'
elif helper1 == helper2:
attr1_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
attr2_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
else:
attr1_display = ''
attr2_display = ''
i = 0
j = 0
k = 0
while k < len(helper1):
if helper1[k] == '*':
attr1_display += '*'
attr2_display += '*'
k += 1
i += 1
j += 1
elif k+1 < len(helper1) and i+1 < len(attr1) and j+1 < len(attr2) and \
helper1[k] not in ['*', '_', '?'] and helper1[k+1] not in ['*', '_', '?'] and attr1[i] == attr2[j+1] and attr1[i+1] == attr2[j]:
attr1_display += '<span class="transpose_text">' + attr1[i] + attr1[i+1] + '</span>'
attr2_display += '<span class="transpose_text">' + attr2[j] + attr2[j+1] + '</span>'
k += 2
i += 2
j += 2
elif helper1[k] == '_' or helper1[k] == '?':
attr2_display += '<span class="indel_text">' + attr2[j] + '</span>'
k += 1
j += 1
elif helper2[k] == '_' or helper2[k] == '?':
attr1_display += '<span class="indel_text">' + attr1[i] + '</span>'
k += 1
i += 1
else:
attr1_display += '<span class="replace_text">' + attr1[i] + '</span>'
attr2_display += '<span class="replace_text">' + attr2[j] + '</span>'
k += 1
i += 1
j += 1
return [attr1_display, attr2_display]
elif attribute_mode == 'masked':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = '*'*len(attr1)
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = '*'*len(attr2)
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = len(attr1)*'@'
attr2_display = len(attr2)*'&'
elif helper1 == helper2:
attr1_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
attr2_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
else:
attr1_display = ''
attr2_display = ''
i = 0
j = 0
k = 0
while k < len(helper1):
if helper1[k] == '*':
attr1_display += '*'
attr2_display += '*'
k += 1
i += 1
j += 1
elif k+1 < len(helper1) and i+1 < len(attr1) and j+1 < len(attr2) and \
helper1[k] not in ['*', '_', '?'] and helper1[k+1] not in ['*', '_', '?'] and attr1[i] == attr2[j+1] and attr1[i+1] == attr2[j]:
attr1_display += '<span class="transpose_text">' + '@&' + '</span>'
attr2_display += '<span class="transpose_text">' + '&@' + '</span>'
k += 2
i += 2
j += 2
elif helper1[k] == '_' or helper1[k] == '?':
attr2_display += '<span class="indel_text">' + '&' + '</span>'
k += 1
j += 1
elif helper2[k] == '_' or helper2[k] == '?':
attr1_display += '<span class="indel_text">' + '@' + '</span>'
k += 1
i += 1
else:
attr1_display += '<span class="replace_text">' + '@' + '</span>'
attr2_display += '<span class="replace_text">' + '&' + '</span>'
k += 1
i += 1
j += 1
return [attr1_display, attr2_display]
def get_date_display(attr1, attr2, helper1, helper2, attribute_mode):
"""
get the attribute mode for date
attribute mode can be:
'base', 'full', 'partial', 'masked'
Note that some attribute does not have partial mode, in this case, partial mode will return masked mode
Remeber to call has_partial_mode function to check if it actually has partial mode!
Example:
Input:
attr1 = '12/28/1950'
attr2 = '12/28/1905'
helper1 = '**/**/**50'
helper2 = '**/**/**05'
attribute_mode: 'partial'
Output:
['**/**/**<span style="color:blue">50</span>', '**/**/**<span style="color:blue">05</span>']
"""
if attribute_mode == 'base':
attr1_display = attr1
attr2_display = attr2
return [attr1_display, attr2_display]
elif attribute_mode == 'full':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = attr1
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = attr2
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = attr1
attr2_display = attr2
elif helper1 == helper2:
attr1_display = attr1
attr2_display = attr2
else:
attr1_display = ''
attr2_display = ''
M1 = helper1[0:2]
M2 = helper2[0:2]
D1 = helper1[3:5]
D2 = helper2[3:5]
Y1 = helper1[6:]
Y2 = helper2[6:]
k = 0
if M1 != '**' and D1 != '**' and M1 == D2 and M2 == D1:
attr1_display += attr1[0:6]
attr2_display += attr2[0:6]
k = 6
while k < 10:
if helper1[k] == '/':
attr1_display += '/'
attr2_display += '/'
k += 1
elif k+1 < 10 and helper1[k] != '*' and helper1[k+1] != '*' and helper1[k] == helper2[k+1] and helper1[k+1] == helper2[k]:
attr1_display += '<span class="transpose_text">' + helper1[k:k+2] + '</span>'
attr2_display += '<span class="transpose_text">' + helper2[k:k+2] + '</span>'
k += 2
elif helper1[k] != '*':
attr1_display += '<span class="replace_text">' + attr1[k] + '</span>'
attr2_display += '<span class="replace_text">' + attr2[k] + '</span>'
k += 1
else:
attr1_display += attr1[k]
attr2_display += attr2[k]
k += 1
return [attr1_display, attr2_display]
elif attribute_mode == 'partial':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = '**/**/****'
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = '**/**/****'
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = '@@/@@/@@@@'
attr2_display = '&&/&&/&&&&'
elif helper1 == helper2:
attr1_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
attr2_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
else:
attr1_display = ''
attr2_display = ''
M1 = helper1[0:2]
M2 = helper2[0:2]
D1 = helper1[3:5]
D2 = helper2[3:5]
Y1 = helper1[6:]
Y2 = helper2[6:]
k = 0
if M1 != '**' and D1 != '**' and M1 == D2 and M2 == D1:
attr1_display += attr1[0:6]
attr2_display += attr2[0:6]
k = 6
while k < 10:
if helper1[k] == '/':
attr1_display += '/'
attr2_display += '/'
k += 1
elif k+1 < 10 and helper1[k] != '*' and helper1[k+1] != '*' and helper1[k] == helper2[k+1] and helper1[k+1] == helper2[k]:
attr1_display += '<span class="transpose_text">' + helper1[k:k+2] + '</span>'
attr2_display += '<span class="transpose_text">' + helper2[k:k+2] + '</span>'
k += 2
elif helper1[k] != '*':
attr1_display += '<span class="replace_text">' + attr1[k] + '</span>'
attr2_display += '<span class="replace_text">' + attr2[k] + '</span>'
k += 1
else:
attr1_display += '*'
attr2_display += '*'
k += 1
return [attr1_display, attr2_display]
elif attribute_mode == 'masked':
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = '**/**/****'
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = '**/**/****'
else:
if '*' not in helper1 and '*' not in helper2:
attr1_display = '@@/@@/@@@@'
attr2_display = '&&/&&/&&&&'
elif helper1 == helper2:
attr1_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
attr2_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
else:
attr1_display = ''
attr2_display = ''
M1 = helper1[0:2]
M2 = helper2[0:2]
D1 = helper1[3:5]
D2 = helper2[3:5]
Y1 = helper1[6:]
Y2 = helper2[6:]
k = 0
if M1 != '**' and D1 != '**' and M1 == D2 and M2 == D1:
attr1_display += '@@/&&/'
attr2_display += '&&/@@/'
k = 6
while k < 10:
if helper1[k] == '/':
attr1_display += '/'
attr2_display += '/'
k += 1
elif k+1 < 10 and helper1[k] != '*' and helper1[k+1] != '*' and helper1[k] == helper2[k+1] and helper1[k+1] == helper2[k]:
attr1_display += '<span class="transpose_text">' + '@&' + '</span>'
attr2_display += '<span class="transpose_text">' + '&@' + '</span>'
k += 2
elif helper1[k] != '*':
attr1_display += '<span class="replace_text">' + '@' + '</span>'
attr2_display += '<span class="replace_text">' + '&' + '</span>'
k += 1
else:
attr1_display += '*'
attr2_display += '*'
k += 1
return [attr1_display, attr2_display]
def get_character_display(attr1, attr2, helper1, helper2, attribute_mode):
"""
"""
if attribute_mode == 'base' or attribute_mode == 'full':
if not attr1:
attr1 = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
if not attr2:
attr2 = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
return [attr1, attr2]
else:
if not attr1 or not attr2:
if not attr1:
attr1_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr1_display = '*'
if not attr2:
attr2_display = '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">'
else:
attr2_display = '*'
elif attr1 == attr2:
attr1_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
attr2_display = '<img src="../static/images/site/checkmark.png" alt="checkmark" class="freq_icon">'
else:
attr1_display = '@'
attr2_display = '&'
return [attr1_display, attr2_display]
def get_name_freq(freq, mode):
if mode == 'base':
return ''
freq = int(freq)
if freq == 1:
return '<img src="../static/images/site/unique.png" alt="unique" class="freq_icon">'
elif freq <= 5:
return '<img src="../static/images/site/rare.png" alt="rare" class="freq_icon">'
elif freq <= 100:
return '<img src="../static/images/site/common.png" alt="common" class="freq_icon">'
else:
return '<img src="../static/images/site/infinity.png" alt="infinity" class="freq_icon">'
def get_ffreq(freq, mode='full'):
return get_name_freq(freq, mode)
def get_lfreq(freq, mode='full'):
return get_name_freq(freq, mode)
def format_pair(p1, p2, data_mode):
result1 = list()
result2 = list()
if data_mode == 'base':
mode = DATA_MODE_BASE
elif data_mode == 'full':
mode = DATA_MODE_FULL
elif data_mode == 'masked':
mode = DATA_MODE_MASKED
elif data_mode == 'minimum':
mode = DATA_MODE_MINIMUM
elif data_mode == 'moderate':
mode = DATA_MODE_MODERATE
# pair id
result1.append(p1[0])
result2.append(p2[0])
# record attribute ID
id_format = get_string_display(p1[1], p2[1], p1[9], p2[9], mode[0])
result1.append(id_format[0])
result2.append(id_format[1])
# first name frequency
freq_mode = 'full'
if data_mode == 'base':
freq_mode = 'base'
result1.append(get_ffreq(p1[2], mode=freq_mode))
result2.append(get_ffreq(p2[2], mode=freq_mode))
# first name
first_name_format = get_string_display(p1[3], p2[3], p1[10], p2[10], mode[1])
result1.append(first_name_format[0])
result2.append(first_name_format[1])
# last name
last_name_format = get_string_display(p1[4], p2[4], p1[11], p2[11], mode[2])
result1.append(last_name_format[0])
result2.append(last_name_format[1])
# special case: first name and last name swap
if mode[1] in ['partial', 'masked'] and mode[2] in ['partial', 'masked']:
if p1[3] != p2[3] and p1[4] != p2[4] and p1[3] == p2[4] and p1[4] == p2[3]:
result1[3] = '@'*len(p1[3])
result2[3] = '&'*len(p2[3])
result1[4] = '&'*len(p1[4])
result2[4] = '@'*len(p2[4])
# last name frequency
result1.append(get_lfreq(p1[5], mode=freq_mode))
result2.append(get_lfreq(p2[5], mode=freq_mode))
# DoB
DoB_format = get_date_display(p1[6], p2[6], p1[12], p2[12], mode[3])
result1.append(DoB_format[0])
result2.append(DoB_format[1])
# gender
gender_format = get_character_display(attr1=p1[7], attr2=p2[7], helper1='', helper2='', attribute_mode=mode[4])
result1.append(gender_format[0])
result2.append(gender_format[1])
# race
race_format = get_character_display(attr1=p1[8], attr2=p2[8], helper1='', helper2='', attribute_mode=mode[5])
result1.append(race_format[0])
result2.append(race_format[1])
return [result1, result2]
def format_data(data, data_mode):
"""
INPUT:
data - raw data
data_mode - 'base', 'full', 'masked', 'minimum', 'moderate'
OUTPUT: data for display
Example:
input:
data = [
['1','','206','NELSON','MITCHELL','1459','03/13/1975','M','B','','******','********___','03/13/1975','*','*','34','6','0'],
['1','1000142704,174','NELSON','MITCHELL SR','1314','07/03/1949','M','B','1000142704','******','******** SR','07/03/1949','*','*','34','6','0']
]
data_mode = full
output: [
['1', '<img src="../static/images/site/missing.png" alt="missing" class="missing_icon">', '<img src="../static/images/site/infinity.png" alt="infinity" class="freq_icon">', 'NELSON', 'MITCHELL', '<img src="../static/images/site/infinity.png" alt="infinity" class="freq_icon">', '03/13/1975','M','B'],
['1', '1000142704', '<img src="../static/images/site/infinity.png" alt="infinity" class="freq_icon">', 'NELSON', 'MITCHELL <span style="color:green">SR</span>', '<img src="../static/images/site/infinity.png" alt="infinity" class="freq_icon">', '07/03/1949','M','B']
]
"""
ret = list()
for i in range(0, len(data), 2):
result = format_pair(data[i], data[i+1], data_mode)
ret += result
return ret
def get_icon_string(s1, s2, helper1, helper2):
if not s1 or not s2:
return ''
else:
if s1 == s2:
return ''
else:
if '*' not in helper1 and '*' not in helper2:
return '<embed class="diff_icon" src="../static/images/site/diff.svg" type="image/svg+xml" />'
else:
ret = ''
i = 0
j = 0
k = 0
while k < len(helper1):
if helper1[k] == '*':
ret += '<span class="hidden_element">*</span>'
k += 1
i += 1
j += 1
elif k+1 < len(helper1) and i+1 < len(s1) and j+1 < len(s2) and helper1[k] not in ['*', '_', '?'] and helper1[k+1] not in ['*', '_', '?'] and s1[i] == s2[j+1] and s1[i+1] == s2[j]:
ret += '<img class="transpose_icon" src="../static/images/site/transpose.png" alt="transpose">'
k += 2
i += 2
j += 2
elif helper1[k] == '_' or helper1[k] == '?':
ret += '<img class="indel_icon" src="../static/images/site/indel.png" alt="indel">'
k += 1
j += 1
elif helper2[k] == '_' or helper2[k] == '?':
ret += '<img class="indel_icon" src="../static/images/site/indel.png" alt="indel">'
k += 1
i += 1
else:
ret += '<img class="replace_icon" src="../static/images/site/replace.png" alt="replace">'
k += 1
i += 1
j += 1
return ret
def get_icon_nameswap(n11, n12, n21, n22):
if n11 != n21 and n12 != n22 and n11 == n22 and n21 == n12:
return '<embed class="name_swap_icon" src="../static/images/site/name_swap.svg" type="image/svg+xml" />'
else:
return ''
def get_icon_date(d1, d2, helper1, helper2):
if not d1 or not d2:
return ''
else:
if d1 == d2:
return ''
else:
if '*' not in helper1 and '*' not in helper2:
return '<embed class="diff_icon" src="../static/images/site/diff.svg" type="image/svg+xml" />'
else:
ret = ''
M1 = helper1[0:2]
M2 = helper2[0:2]
D1 = helper1[3:5]
D2 = helper2[3:5]
Y1 = helper1[6:]
Y2 = helper2[6:]
k = 0
if M1 != '**' and D1 != '**' and M1 == D2 and M2 == D1:
ret += '<embed class="swap_date_icon" src="../static/images/site/swap_date.svg" type="image/svg+xml" />'
k = 6
while k < 10:
if helper1[k] == '/':
ret += '<span class="hidden_element">/</span>'
k += 1
elif k+1 < 10 and helper1[k] != '*' and helper1[k+1] != '*' and helper1[k] == helper2[k+1] and helper1[k+1] == helper2[k]:
ret += '<img class="transpose_icon" src="../static/images/site/transpose.png" alt="transpose">'
k += 2
elif helper1[k] != '*':
ret += '<img class="replace_icon" src="../static/images/site/replace.png" alt="replace">'
k += 1
else:
ret += '<span class="hidden_element">*</span>'
k += 1
return ret
def get_icon_character(c1, c2):
if c1 and c2 and c1 != c2:
return '<embed class="diff_icon" src="../static/images/site/diff.svg" type="image/svg+xml" />'
else:
return ''
def get_icon_for_pair(p1, p2):
icon = list()
# icon for ID
icon.append(get_icon_string(p1[1], p2[1], p1[9], p2[9]))
# icon for firstname
icon.append(get_icon_string(p1[3], p2[3], p1[10], p2[10]))
# icon for name swap
icon.append(get_icon_nameswap(p1[3], p1[4], p2[3], p2[4]))
# icon for lastname
icon.append(get_icon_string(p1[4], p2[4], p1[11], p2[11]))
# icon for DoB
icon.append(get_icon_date(p1[6], p2[6], p1[12], p2[12]))
# icon for sex
icon.append(get_icon_character(p1[7], p2[7]))
# icon for race
icon.append(get_icon_character(p1[8], p2[8]))
if icon[2] != '':
icon[1] = ''
icon[3] = ''
return icon
def generate_icon(data):
"""
INPUT:
data - raw data
OUTPUT:
icon - the markup icons : [id, firstname, name_swap, lastname, DoB, gender, race]
Example:
input:
data = [
['1','','206','NELSON','MITCHELL','1459','03/13/1975','M','B','','******','********___','03/13/1975','*','*','34','6','0'],
['1','1000142704,174','NELSON','MITCHELL SR','1314','07/03/1949','M','B','1000142704','******','******** SR','07/03/1949','*','*','34','6','0']
]
output: [
['', '', '<span class="hidden_element">MITCHELL</span><img class="indel_icon" src="../static/images/site/indel.png" alt="indel"><img class="indel_icon" src="../static/images/site/indel.png" alt="indel"><img class="indel_icon" src="../static/images/site/indel.png" alt="indel">', '<embed class="diff_icon" src="../static/images/site/diff.svg" type="image/svg+xml" />', '', '']
]
"""
ret = list()
for i in range(0, len(data), 2):
result = get_icon_for_pair(data[i], data[i+1])
ret.append(result)
return ret
if __name__ == '__main__':
attr1 = 'AUSTIN'
attr2 = 'AUTWELL'
helper1 = attr1
helper2 = attr2
res = get_string_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '1022119365'
attr2 = '1022119365'
helper1 = '**********'
helper2 = '**********'
res = get_string_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '1000151475'
attr2 = '1000151575'
helper1 = '*******4**'
helper2 = '*******5**'
res = get_string_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = 'SHIESHA'
attr2 = 'SHAMEESHA'
helper1 = '**I__****'
helper2 = '**AME****'
res = get_string_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '1530042971'
attr2 = '1350082931'
helper1 = '*53**4**7*'
helper2 = '*35**8**3*'
res = get_string_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_string_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '12/27/1944'
attr2 = '12/27/1904'
helper1 = '**/**/**4*'
helper2 = '**/**/**0*'
res = get_date_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '12/28/1950'
attr2 = '12/28/1905'
helper1 = '**/**/**50'
helper2 = '**/**/**05'
res = get_date_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '01/09/1960'
attr2 = '09/01/1960'
helper1 = '01/09/****'
helper2 = '09/01/****'
res = get_date_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '01/09/1935'
attr2 = '01/09/1935'
helper1 = '**/**/****'
helper2 = '**/**/****'
res = get_date_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'masked')
print res
attr1 = '10/01/1990'
attr2 = '09/19/1995'
helper1 = '10/01/1990'
helper2 = '09/19/1995'
res = get_date_display(attr1, attr2, helper1, helper2, 'full')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'partial')
print res
res = get_date_display(attr1, attr2, helper1, helper2, 'masked')
print res
pairs = list()
pairs.append(['1','1002415935','303','DARIUS','FLOWE','163','05/11/1994','M','B','*********5','***IUS','*****','**/**/****','*','*','8','2','0'])
pairs.append(['1','1002415936','270','DARREN','FLOWE','184','05/11/1994','M','B','*********6','***REN','*****','**/**/****','*','*','8','2','0'])
pairs.append(['2','1000255792','10','SOL','BADAME','1','07/16/1914','M','W','1000255792','SOL','BADAME','**/**/****','*','*','33','6','1'])
pairs.append(['2','','1','BADAME','SOL','1','07/16/1914','M','W','','BADAME','SOL','**/**/****','*','*','33','6','1'])
data = format_data(pairs, 'base')
print data
data = format_data(pairs, 'full')
print data
print data[0][2]
| 41.896507
| 383
| 0.481412
| 3,694
| 32,386
| 4.093665
| 0.061451
| 0.056342
| 0.049597
| 0.062822
| 0.809946
| 0.781312
| 0.741172
| 0.72907
| 0.713001
| 0.713001
| 0
| 0.075115
| 0.349688
| 32,386
| 772
| 384
| 41.950777
| 0.642894
| 0.0109
| 0
| 0.736334
| 0
| 0.065916
| 0.201166
| 0.092117
| 0.016077
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.053055
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
97e1b9061afb738dd9e5f8b3b6a9c9a123c6aac6
| 23,683
|
py
|
Python
|
python/paddle/fluid/tests/unittests/test_fused_elemwise_activation_op.py
|
Meiyim/Paddle
|
515a756a3cbe20a55d9a80941c221daa48ca6446
|
[
"Apache-2.0"
] | null | null | null |
python/paddle/fluid/tests/unittests/test_fused_elemwise_activation_op.py
|
Meiyim/Paddle
|
515a756a3cbe20a55d9a80941c221daa48ca6446
|
[
"Apache-2.0"
] | null | null | null |
python/paddle/fluid/tests/unittests/test_fused_elemwise_activation_op.py
|
Meiyim/Paddle
|
515a756a3cbe20a55d9a80941c221daa48ca6446
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import unittest
import numpy as np
import paddle.fluid.core as core
from op_test import OpTest
# scale + add
# TestElementwiseAddOp
# TestFusedOperatorsOp_scalar
# TestFusedOperatorsOp_scalar2
# TestFusedOperatorsOp_Vector
# TestFusedOperatorsOp_broadcast_0
# TestFusedOperatorsOp_broadcast_1
# TestFusedOperatorsOp_broadcast_2
# TestFusedOperatorsOp_broadcast_3
# TestFusedOperatorsOp_broadcast_4
# TestFusedOperatorsOp_rowwise_add_0
# TestFusedOperatorsOp_rowwise_add_1
# TestFusedOperatorsOp_channelwise_add
class TestElementwiseAddOp(OpTest):
def setUp(self):
self.op_type = "fused_elemwise_activation"
self.dtype = np.float32
self.axis = -1
self.init_axis()
self.init_dtype()
self.init_input()
self.init_output()
self.init_attr()
self.inputs = {
'X': OpTest.np_dtype_to_fluid_dtype(self.x),
'Y': OpTest.np_dtype_to_fluid_dtype(self.y)
}
self.outputs = {'Out': self.out}
def init_input(self):
self.x = np.random.uniform(0.1, 1, [13, 17]).astype(self.dtype)
self.y = np.random.uniform(0.1, 1, [13, 17]).astype(self.dtype)
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["scale", "elementwise_add"]
}
def init_dtype(self):
pass
def init_axis(self):
pass
def test_check_output(self):
self.check_output()
def test_check_grad_normal(self):
self.check_grad(['X', 'Y'], 'Out', max_relative_error=0.005)
def test_check_grad_ingore_x(self):
self.check_grad(
['Y'], 'Out', max_relative_error=0.005, no_grad_set=set("X"))
def test_check_grad_ingore_y(self):
self.check_grad(
['X'], 'Out', max_relative_error=0.005, no_grad_set=set('Y'))
class TestFusedOperatorsOp_scalar(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(1).astype(self.dtype)
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y) * self.scale
class TestFusedOperatorsOp_scalar2(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(1, 1).astype(self.dtype)
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y) * self.scale
class TestFusedOperatorsOp_Vector(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.random((32, )).astype(self.dtype)
self.y = np.random.random((32, )).astype(self.dtype)
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y) * self.scale
class TestFusedOperatorsOp_broadcast_0(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(2).astype(self.dtype)
def init_axis(self):
self.axis = 0
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(2, 1, 1)) * self.scale
class TestFusedOperatorsOp_broadcast_1(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(3).astype(self.dtype)
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(1, 3, 1)) * self.scale
class TestFusedOperatorsOp_broadcast_2(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(4).astype(self.dtype)
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(1, 1, 4)) * self.scale
class TestFusedOperatorsOp_broadcast_3(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4, 5).astype(self.dtype)
self.y = np.random.rand(3, 4).astype(self.dtype)
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(1, 3, 4, 1)) * self.scale
class TestFusedOperatorsOp_broadcast_4(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4, 5).astype(self.dtype)
self.y = np.random.rand(2, 1).astype(self.dtype)
def init_axis(self):
self.axis = 0
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(2, 1, 1, 1)) * self.scale
class TestFusedOperatorsOp_rowwise_add_0(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 3, 4).astype(self.dtype)
self.y = np.random.rand(3, 4).astype(self.dtype)
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(1, 3, 4)) * self.scale
class TestFusedOperatorsOp_rowwise_add_1(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(2, 1).astype(self.dtype)
self.y = np.random.rand(1).astype(self.dtype)
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y.reshape(1, 1)) * self.scale
class TestFusedOperatorsOp_channelwise_add(TestElementwiseAddOp):
def init_input(self):
self.x = np.random.rand(3, 20, 20).astype(self.dtype)
self.y = np.random.rand(3, 1, 1).astype(self.dtype)
def init_axis(self):
self.axis = -1
def init_output(self):
self.scale = 0.1
self.out = (self.x + self.y) * self.scale
# add + scale
# TestElementwiseAddOp_f_add_scale
# TestFusedOperatorsOp_scalar_f_add_scale
# TestFusedOperatorsOp_scalar2_f_add_scale
# TestFusedOperatorsOp_Vector_f_add_scale
# TestFusedOperatorsOp_broadcast_0_f_add_scale
# TestFusedOperatorsOp_broadcast_1_f_add_scale
# TestFusedOperatorsOp_broadcast_2_f_add_scale
# TestFusedOperatorsOp_broadcast_3_f_add_scale
# TestFusedOperatorsOp_broadcast_4_f_add_scale
# TestFusedOperatorsOp_rowwise_add_0_f_add_scale
# TestFusedOperatorsOp_rowwise_add_1_f_add_scale
# TestFusedOperatorsOp_channelwise_add_f_add_scale
class TestFusedOperatorsOp_f_add_scale(TestElementwiseAddOp):
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_scalar_f_add_scale(TestFusedOperatorsOp_scalar):
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_scalar2_f_add_scale(TestFusedOperatorsOp_scalar2):
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_Vector_f_add_scale(TestFusedOperatorsOp_Vector):
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_broadcast_0_f_add_scale(
TestFusedOperatorsOp_broadcast_0):
def init_axis(self):
self.axis = 0
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y.reshape(2, 1, 1) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_broadcast_1_f_add_scale(
TestFusedOperatorsOp_broadcast_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y.reshape(1, 3, 1) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_broadcast_2_f_add_scale(
TestFusedOperatorsOp_broadcast_2):
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y.reshape(1, 1, 4) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_broadcast_3_f_add_scale(
TestFusedOperatorsOp_broadcast_3):
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y.reshape(1, 3, 4, 1) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_broadcast_4_f_add_scale(
TestFusedOperatorsOp_broadcast_4):
def init_axis(self):
self.axis = 0
def init_output(self):
self.scale = 0.2
self.out = self.x + self.y.reshape(2, 1, 1, 1) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_rowwise_add_0_f_add_scale(
TestFusedOperatorsOp_rowwise_add_0):
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.1
self.out = self.x + self.y.reshape(1, 3, 4) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_rowwise_add_1_f_add_scale(
TestFusedOperatorsOp_rowwise_add_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.scale = 0.2
self.out = self.x + self.y.reshape(1, 1) * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
class TestFusedOperatorsOp_channelwise_add_f_add_scale(
TestFusedOperatorsOp_channelwise_add):
def init_axis(self):
self.axis = -1
def init_output(self):
self.scale = 0.2
self.out = self.x + self.y * self.scale
def init_attr(self):
self.attrs = {
'axis': self.axis,
'scale': self.scale,
'functor_list': ["elementwise_add", "scale"]
}
# add + relu
# TestElementwiseAddOp_f_add_relu
# TestFusedOperatorsOp_scalar_f_add_relu
# TestFusedOperatorsOp_scalar2_f_add_relu
# TestFusedOperatorsOp_Vector_f_add_relu
# TestFusedOperatorsOp_broadcast_0_f_add_relu
# TestFusedOperatorsOp_broadcast_1_f_add_relu
# TestFusedOperatorsOp_broadcast_2_f_add_relu
# TestFusedOperatorsOp_broadcast_3_f_add_relu
# TestFusedOperatorsOp_broadcast_4_f_add_relu
# TestFusedOperatorsOp_rowwise_add_0_f_add_relu
# TestFusedOperatorsOp_rowwise_add_1_f_add_relu
# TestFusedOperatorsOp_channelwise_add_f_add_relu
class TestFusedOperatorsOp_f_add_relu(TestElementwiseAddOp):
def init_output(self):
# Copy from test_activation_op.py
# Because we set delta = 0.005 in calculating numeric gradient,
# if x is too small, such as 0.002, x_neg will be -0.003
# x_pos will be 0.007, so the numeric gradient is inaccurate.
# we should avoid this
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y, 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_scalar_f_add_relu(TestFusedOperatorsOp_scalar):
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y, 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_scalar2_f_add_relu(TestFusedOperatorsOp_scalar2):
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y, 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_Vector_f_add_relu(TestFusedOperatorsOp_Vector):
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y, 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_broadcast_0_f_add_relu(
TestFusedOperatorsOp_broadcast_0):
def init_axis(self):
self.axis = 0
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(2, 1, 1), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_broadcast_1_f_add_relu(
TestFusedOperatorsOp_broadcast_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(1, 3, 1), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_broadcast_2_f_add_relu(
TestFusedOperatorsOp_broadcast_2):
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(1, 1, 4), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_broadcast_3_f_add_relu(
TestFusedOperatorsOp_broadcast_3):
def init_axis(self):
self.axis = 1
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(1, 3, 4, 1), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_broadcast_4_f_add_relu(
TestFusedOperatorsOp_broadcast_4):
def init_axis(self):
self.axis = 0
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(2, 1, 1, 1), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_rowwise_add_0_f_add_relu(
TestFusedOperatorsOp_rowwise_add_0):
def init_axis(self):
self.axis = 1
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(1, 3, 4), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_rowwise_add_1_f_add_relu(
TestFusedOperatorsOp_rowwise_add_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y.reshape(1, 1), 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
class TestFusedOperatorsOp_channelwise_add_f_add_relu(
TestFusedOperatorsOp_channelwise_add):
def init_axis(self):
self.axis = -1
def init_output(self):
self.y[np.abs(self.y) < 0.005] = 0.02
self.out = self.x + np.maximum(self.y, 0)
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["elementwise_add", "relu"]
}
# relu + add
# TestElementwiseAddOp_f_relu_add
# TestFusedOperatorsOp_scalar_f_relu_add
# TestFusedOperatorsOp_scalar2_f_relu_add
# TestFusedOperatorsOp_Vector_f_relu_add
# TestFusedOperatorsOp_broadcast_0_f_relu_add
# TestFusedOperatorsOp_broadcast_1_f_relu_add
# TestFusedOperatorsOp_broadcast_2_f_relu_add
# TestFusedOperatorsOp_broadcast_3_f_relu_add
# TestFusedOperatorsOp_broadcast_4_f_relu_add
# TestFusedOperatorsOp_rowwise_add_0_f_relu_add
# TestFusedOperatorsOp_rowwise_add_1_f_relu_add
# TestFusedOperatorsOp_channelwise_add_f_relu_add
class TestFusedOperatorsOp_f_relu_add(TestElementwiseAddOp):
def init_output(self):
# Copy from test_activation_op.py
# Because we set delta = 0.005 in calculating numeric gradient,
# if x is too small, such as 0.002, x_neg will be -0.003
# x_pos will be 0.007, so the numeric gradient is inaccurate.
# we should avoid this
self.out = self.x + self.y
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_scalar_f_relu_add(TestFusedOperatorsOp_scalar):
def init_output(self):
self.out = self.x + self.y
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_scalar2_f_relu_add(TestFusedOperatorsOp_scalar2):
def init_output(self):
self.out = self.x + self.y
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_Vector_f_relu_add(TestFusedOperatorsOp_Vector):
def init_output(self):
self.out = self.x + self.y
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_broadcast_0_f_relu_add(
TestFusedOperatorsOp_broadcast_0):
def init_axis(self):
self.axis = 0
def init_output(self):
self.out = self.x + self.y.reshape(2, 1, 1)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_broadcast_1_f_relu_add(
TestFusedOperatorsOp_broadcast_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.out = self.x + self.y.reshape(1, 3, 1)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_broadcast_2_f_relu_add(
TestFusedOperatorsOp_broadcast_2):
def init_output(self):
self.out = self.x + self.y.reshape(1, 1, 4)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_broadcast_3_f_relu_add(
TestFusedOperatorsOp_broadcast_3):
def init_axis(self):
self.axis = 1
def init_output(self):
self.out = self.x + self.y.reshape(1, 3, 4, 1)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_broadcast_4_f_relu_add(
TestFusedOperatorsOp_broadcast_4):
def init_axis(self):
self.axis = 0
def init_output(self):
self.out = self.x + self.y.reshape(2, 1, 1, 1)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_rowwise_add_0_f_relu_add(
TestFusedOperatorsOp_rowwise_add_0):
def init_axis(self):
self.axis = 1
def init_output(self):
self.out = self.x + self.y.reshape(1, 3, 4)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_rowwise_add_1_f_relu_add(
TestFusedOperatorsOp_rowwise_add_1):
def init_axis(self):
self.axis = 1
def init_output(self):
self.out = self.x + self.y.reshape(1, 1)
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
class TestFusedOperatorsOp_channelwise_add_f_relu_add(
TestFusedOperatorsOp_channelwise_add):
def init_axis(self):
self.axis = -1
def init_output(self):
self.out = self.x + self.y
self.out = np.maximum(self.out, 0)
self.out[np.abs(self.out) < 0.005] = 0.02
def init_attr(self):
self.attrs = {
'axis': self.axis,
'functor_list': ["relu", "elementwise_add"]
}
if __name__ == '__main__':
unittest.main()
| 28.846529
| 77
| 0.623274
| 3,149
| 23,683
| 4.461099
| 0.05335
| 0.072893
| 0.048833
| 0.058087
| 0.891871
| 0.878702
| 0.823462
| 0.793138
| 0.729997
| 0.724018
| 0
| 0.032181
| 0.257358
| 23,683
| 820
| 78
| 28.881707
| 0.766545
| 0.131064
| 0
| 0.719711
| 0
| 0
| 0.069554
| 0.001219
| 0
| 0
| 0
| 0
| 0
| 1
| 0.238698
| false
| 0.003617
| 0.009042
| 0
| 0.334539
| 0.001808
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
97f764fba52dd8fe34670d03cb900a621522e69d
| 206
|
py
|
Python
|
django/myvenv/lib/python3.8/site-packages/krwordrank/sentence/__init__.py
|
mu1616/relay_06
|
9db6385c88d06cad861245f80c2b1799170be905
|
[
"MIT"
] | 4
|
2020-07-27T02:50:37.000Z
|
2021-04-06T09:48:30.000Z
|
django/myvenv/lib/python3.8/site-packages/krwordrank/sentence/__init__.py
|
mu1616/relay_06
|
9db6385c88d06cad861245f80c2b1799170be905
|
[
"MIT"
] | 2
|
2020-08-07T07:33:37.000Z
|
2020-08-16T14:50:56.000Z
|
django/myvenv/lib/python3.8/site-packages/krwordrank/sentence/__init__.py
|
mu1616/relay_06
|
9db6385c88d06cad861245f80c2b1799170be905
|
[
"MIT"
] | 11
|
2020-07-31T08:20:43.000Z
|
2020-08-21T04:08:29.000Z
|
from ._tokenizer import MaxScoreTokenizer
from ._sentence import KeywordVectorizer
from ._sentence import keysentence
from ._sentence import make_vocab_score
from ._sentence import summarize_with_sentences
| 34.333333
| 47
| 0.878641
| 24
| 206
| 7.166667
| 0.541667
| 0.27907
| 0.418605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097087
| 206
| 5
| 48
| 41.2
| 0.924731
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
3f074a4aee321418d4318d3b76066c12dce4db2f
| 93,324
|
py
|
Python
|
clif/python/class_test.py
|
blackwer/clif
|
59640dc3db47495e1e0c41070eafaf97da094902
|
[
"Apache-2.0"
] | 2
|
2019-05-24T10:02:18.000Z
|
2019-06-10T08:00:52.000Z
|
clif/python/class_test.py
|
blackwer/clif
|
59640dc3db47495e1e0c41070eafaf97da094902
|
[
"Apache-2.0"
] | 3
|
2018-02-02T02:50:33.000Z
|
2018-09-06T19:50:40.000Z
|
clif/python/class_test.py
|
blackwer/clif
|
59640dc3db47495e1e0c41070eafaf97da094902
|
[
"Apache-2.0"
] | 7
|
2018-02-02T01:53:44.000Z
|
2022-03-17T11:01:16.000Z
|
# Copyright 2017 Google Inc.
#
# 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.
"""Tests for clif.python.generator."""
import itertools
import textwrap
from google.protobuf import text_format
import unittest
from clif.protos import ast_pb2
from clif.python import pyext
PATH = 'path.to.ext.module.test'
class ClassTest(unittest.TestCase):
def setUp(self):
self.m = pyext.Module(PATH)
self.code = (dict(tochar='PyUnicode_AsUTF8', f='',
frchar='PyUnicode_FromString') if self.m.py3output
else
dict(tochar='PyString_AS_STRING',
frchar='PyString_FromString',
f=' | Py_TPFLAGS_CHECKTYPES'))
def assertClassEqual(self, proto, class_code, mod_code):
ast = ast_pb2.ClassDecl()
text_format.Parse(proto, ast)
out = '\n'.join(self.m.WrapClass(ast, -1, ''))+'\n'
self.assertMultiLineEqual(out, textwrap.dedent(class_code))
out = '\n'.join(itertools.chain(
self.m.GenTypesReady(),
self.m.GenInitFunction('test.h'),
))+'\n'
self.assertMultiLineEqual(out, textwrap.dedent(mod_code))
def assertEnumEqual(self, proto, base_code, mod_code):
ast = ast_pb2.EnumDecl()
text_format.Parse(proto, ast)
out = '\n'.join(self.m.WrapEnum(ast, -1, ''))+'\n'
self.assertMultiLineEqual(out, textwrap.dedent(base_code))
out = '\n'.join(itertools.chain(
self.m.GenTypesReady(),
self.m.GenInitFunction('test.h'),
))+'\n'
self.assertMultiLineEqual(out, textwrap.dedent(mod_code))
def testStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
cpp_has_trivial_dtor: true
members {
decltype: VAR
var {
name {
native: "a"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
}
}
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static StructTy* ThisPtr(PyObject*);
static PyObject* get_a(PyObject* self, void* xdata) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->a, {});
}
static int set_a(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the a attribute");
return -1;
}
auto cpp = ThisPtr(self); if (!cpp) return -1;
if (Clif_PyObjAs(value, &cpp->a)) return 0;
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for a:int", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
static PyGetSetDef Properties[] = {
{C("a"), get_a, set_a, C("C++ int StructTy.a")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructTy"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructTy"));
if (!PyErr_Occurred()) {
StructTy* c = static_cast<StructTy*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructTy*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testCppDerivedStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
bases {
cpp_name: "::Base<Foo*, const Bar&>"
}
members {
decltype: VAR
var {
name {
native: "a"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
}
}
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static StructTy* ThisPtr(PyObject*);
static PyObject* get_a(PyObject* self, void* xdata) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->a, {});
}
static int set_a(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the a attribute");
return -1;
}
auto cpp = ThisPtr(self); if (!cpp) return -1;
if (Clif_PyObjAs(value, &cpp->a)) return 0;
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for a:int", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
static PyGetSetDef Properties[] = {
{C("a"), get_a, set_a, C("C++ int StructTy.a")},
{}
};
// Implicit cast this as ::Base<Foo*, const Bar&>*
static PyObject* as_Base_Foo_ptr_constBar_ref(PyObject* self) {
::Base<Foo*, const Bar&>* p = ::clif::python::Get(reinterpret_cast<wrapper*>(self)->cpp);
if (p == nullptr) return nullptr;
return PyCapsule_New(p, C("::Base<Foo*, const Bar&>"), nullptr);
}
static PyMethodDef Methods[] = {
{C("as_Base_Foo_ptr_constBar_ref"), (PyCFunction)as_Base_Foo_ptr_constBar_ref, METH_NOARGS, C("Upcast to ::Base<Foo*, const Bar&>*")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _dtor(PyObject* self) {
Py_BEGIN_ALLOW_THREADS
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_END_ALLOW_THREADS
Py_TYPE(self)->tp_free(self);
}
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
_dtor, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
Methods, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructTy"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructTy"));
if (!PyErr_Occurred()) {
StructTy* c = static_cast<StructTy*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructTy*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testPythonDerivedStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
bases {
native: "path.python.Base"
}
members {
decltype: VAR
var {
name {
native: "a"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
}
}
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static StructTy* ThisPtr(PyObject*);
static PyObject* get_a(PyObject* self, void* xdata) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->a, {});
}
static int set_a(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the a attribute");
return -1;
}
auto cpp = ThisPtr(self); if (!cpp) return -1;
if (Clif_PyObjAs(value, &cpp->a)) return 0;
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for a:int", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
static PyGetSetDef Properties[] = {
{C("a"), get_a, set_a, C("C++ int StructTy.a")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _dtor(PyObject* self) {
Py_BEGIN_ALLOW_THREADS
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_END_ALLOW_THREADS
Py_TYPE(self)->tp_free(self);
}
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
_dtor, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructTy"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructTy"));
if (!PyErr_Occurred()) {
StructTy* c = static_cast<StructTy*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructTy*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
PyObject* base_cls = ImportFQName("path.python.Base");
if (base_cls == nullptr) return false;
if (!PyObject_TypeCheck(base_cls, &PyType_Type)) {
Py_DECREF(base_cls);
PyErr_SetString(PyExc_TypeError, "Base class path.python.Base is not a new style class inheriting from object.");
return false;
}
pyStruct::wrapper_Type.tp_base = reinterpret_cast<PyTypeObject*>(base_cls);
// Check that base_cls is a *statically* allocated PyType.
if (pyStruct::wrapper_Type.tp_base->tp_alloc == PyType_GenericAlloc) {
Py_DECREF(base_cls);
PyErr_SetString(PyExc_TypeError, "Base class path.python.Base is a dynamic (Python defined) class.");
return false;
}
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testNestedStruct(self):
self.assertClassEqual("""
name {
native: "Outer"
cpp_name: "OutKlass"
}
cpp_has_trivial_dtor: true
members {
decltype: CLASS
class_ {
name {
native: "Inner"
cpp_name: "OutKlass::InnKlass"
}
cpp_has_trivial_dtor: true
members {
decltype: VAR
var {
name {
native: "i"
cpp_name: "i"
}
type {
lang_type: "bool"
cpp_type: "bool"
}
}
}
members {
decltype: ENUM
enum {
name {
native: "X"
cpp_name: "OutKlass::InnKlass::X"
}
members {
native: "A"
cpp_name: "OutKlass::InnKlass::X::A"
}
}
}
}
}
""", """
namespace pyOuter {
struct wrapper {
PyObject_HEAD
::clif::Instance<OutKlass> cpp;
};
static OutKlass* ThisPtr(PyObject*);
namespace pyInner {
struct wrapper {
PyObject_HEAD
::clif::Instance<OutKlass::InnKlass> cpp;
};
static OutKlass::InnKlass* ThisPtr(PyObject*);
static PyObject* get_i(PyObject* self, void* xdata) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->i, {});
}
static int set_i(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the i attribute");
return -1;
}
auto cpp = ThisPtr(self); if (!cpp) return -1;
if (Clif_PyObjAs(value, &cpp->i)) return 0;
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for i:bool", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
// Create Python Enum object (cached in _X) for OutKlass::InnKlass::X
static PyObject* wrapX() {
PyObject *py, *py_enum_class{}, *names = PyTuple_New(1);
if (names == nullptr) return nullptr;
if ((py = Py_BuildValue("(NN)", %(frchar)s("A"), PyInt_FromLong(
static_cast<typename std::underlying_type<OutKlass::InnKlass::X>::type>(OutKlass::InnKlass::X::A)))
) == nullptr) goto err;
PyTuple_SET_ITEM(names, 0, py);
py = %(frchar)s("Outer.Inner.X");
py_enum_class = PyObject_CallFunctionObjArgs(_IntEnum, py, names, nullptr);
Py_DECREF(py);
err:
Py_DECREF(names);
return py_enum_class;
}
static PyObject* _X{}; // set by above func in Init()
static PyGetSetDef Properties[] = {
{C("i"), get_i, set_i, C("C++ bool OutKlass::InnKlass.i")},
{}
};
// Inner __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Inner __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Inner __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Outer.Inner", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for OutKlass::InnKlass", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Inner takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<OutKlass::InnKlass>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static OutKlass::InnKlass* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_OutKlass_InnKlass"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("OutKlass::InnKlass"));
if (!PyErr_Occurred()) {
OutKlass::InnKlass* c = static_cast<OutKlass::InnKlass*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to OutKlass::InnKlass*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyInner
// Outer __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Outer __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Outer __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Outer", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for OutKlass", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Outer takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<OutKlass>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static OutKlass* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_OutKlass"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("OutKlass"));
if (!PyErr_Occurred()) {
OutKlass* c = static_cast<OutKlass*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to OutKlass*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyOuter
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyOuter::pyInner::wrapper_Type) < 0) return false;
Py_INCREF(&pyOuter::pyInner::wrapper_Type); // For PyModule_AddObject to steal.
if (PyType_Ready(&pyOuter::wrapper_Type) < 0) return false;
Py_INCREF(&pyOuter::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
{PyObject* em = PyImport_ImportModule("enum");
if (em == nullptr) goto err;
_Enum = PyObject_GetAttrString(em, "Enum");
_IntEnum = PyObject_GetAttrString(em, "IntEnum");
Py_DECREF(em);}
if (!_Enum || !_IntEnum) {
Py_XDECREF(_Enum);
Py_XDECREF(_IntEnum);
goto err;
}
if (PyDict_SetItemString(pyOuter::pyInner::wrapper_Type.tp_dict, "X", (pyOuter::pyInner::_X=pyOuter::pyInner::wrapX())) < 0) goto err;
if (PyDict_SetItemString(pyOuter::wrapper_Type.tp_dict, "Inner", reinterpret_cast<PyObject*>(&pyOuter::pyInner::wrapper_Type)) < 0) goto err;
if (PyModule_AddObject(module, "Outer", reinterpret_cast<PyObject*>(&pyOuter::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
{PyObject* em = PyImport_ImportModule("enum");
if (em == nullptr) goto err;
_Enum = PyObject_GetAttrString(em, "Enum");
_IntEnum = PyObject_GetAttrString(em, "IntEnum");
Py_DECREF(em);}
if (!_Enum || !_IntEnum) {
Py_XDECREF(_Enum);
Py_XDECREF(_IntEnum);
goto err;
}
if (PyDict_SetItemString(pyOuter::pyInner::wrapper_Type.tp_dict, "X", (pyOuter::pyInner::_X=pyOuter::pyInner::wrapX())) < 0) goto err;
if (PyDict_SetItemString(pyOuter::wrapper_Type.tp_dict, "Inner", reinterpret_cast<PyObject*>(&pyOuter::pyInner::wrapper_Type)) < 0) goto err;
if (PyModule_AddObject(module, "Outer", reinterpret_cast<PyObject*>(&pyOuter::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testStructProperty(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
cpp_has_trivial_dtor: true
members {
decltype: VAR
var {
name {
native: "a"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
cpp_get {
name {
cpp_name: "getA"
}
# type omitted
}
cpp_set {
name {
cpp_name: "setA"
}
params {
type {
lang_type: "int"
cpp_type: "int"
}
}
cpp_void_return: true
cpp_noexcept: false
}
}
}
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static StructTy* ThisPtr(PyObject*);
static PyObject* get_a(PyObject* self, void* xdata) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->getA(), {});
}
static int set_a(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the a attribute");
return -1;
}
int cval;
if (Clif_PyObjAs(value, &cval)) {
auto cpp = ThisPtr(self); if (!cpp) return -1;
cpp->setA(cval);
return 0;
}
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for a:int", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
static PyGetSetDef Properties[] = {
{C("a"), get_a, set_a, C("C++ int StructTy.getA()")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructTy"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructTy"));
if (!PyErr_Occurred()) {
StructTy* c = static_cast<StructTy*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructTy*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testStructUnProperty(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
cpp_has_trivial_dtor: true
members {
decltype: VAR
var {
name {
native: "x"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
cpp_get {
name {
native: "get_a"
}
}
cpp_set {
name {
native: "set_a"
}
}
}
}
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static StructTy* ThisPtr(PyObject*);
static PyObject* get_a(PyObject* self) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
return Clif_PyObjFrom(cpp->a, {});
}
static PyObject* set_a(PyObject* self, PyObject* value) {
auto cpp = ThisPtr(self); if (!cpp) return nullptr;
if (Clif_PyObjAs(value, &cpp->a)) Py_RETURN_NONE;
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for x:int", s? PyString_AS_STRING(s): "input");
Py_XDECREF(s);
return nullptr;
}
static PyMethodDef Methods[] = {
{C("get_a"), (PyCFunction)get_a, METH_NOARGS, C("get_a()->int C++ StructTy.a getter")},
{C("set_a"), set_a, METH_O, C("set_a(int) C++ StructTy.a setter")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
Methods, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructTy"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructTy"));
if (!PyErr_Occurred()) {
StructTy* c = static_cast<StructTy*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructTy*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testFinalStructProperty(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructTy"
}
cpp_has_trivial_dtor: true
members {
decltype: VAR
var {
name {
native: "a"
cpp_name: "a"
}
type {
lang_type: "int"
cpp_type: "int"
}
cpp_get {
name {
cpp_name: "getA"
}
# type omitted
}
cpp_set {
name {
cpp_name: "setA"
}
params {
type {
lang_type: "int"
cpp_type: "int"
}
}
cpp_void_return: true
cpp_noexcept: false
}
}
}
members {
decltype: VAR
var {
name {
native: "b"
cpp_name: "b"
}
type {
lang_type: "int"
cpp_type: "int"
}
cpp_get {
name {
cpp_name: "getB"
}
# type omitted
}
}
}
final: true
""", """
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructTy> cpp;
};
static PyObject* get_a(PyObject* self, void* xdata) {
return Clif_PyObjFrom(reinterpret_cast<wrapper*>(self)->cpp->getA(), {});
}
static int set_a(PyObject* self, PyObject* value, void* xdata) {
if (value == nullptr) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the a attribute");
return -1;
}
int cval;
if (Clif_PyObjAs(value, &cval)) {
reinterpret_cast<wrapper*>(self)->cpp->setA(cval);
return 0;
}
PyObject* s = PyObject_Repr(value);
PyErr_Format(PyExc_ValueError, "%%s is not valid for a:int", s? %(tochar)s(s): "input");
Py_XDECREF(s);
return -1;
}
static PyObject* get_b(PyObject* self, void* xdata) {
return Clif_PyObjFrom(reinterpret_cast<wrapper*>(self)->cpp->getB(), {});
}
static PyGetSetDef Properties[] = {
{C("a"), get_a, set_a, C("C++ int StructTy.getA()")},
{C("b"), get_b, nullptr, C("C++ int StructTy.getB()")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s, // tp_flags
"CLIF wrapper for StructTy", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
Properties, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructTy>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructTy* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testFinalStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructCpp"
}
final: true
cpp_has_trivial_dtor: true
members {
decltype: FUNC
func {
py_keep_gil: true
name {
native: "f"
cpp_name: "f"
}
}
}
""", r"""
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructCpp> cpp;
};
// f()
static PyObject* wrapf(PyObject* self) {
// Call actual C++ method.
reinterpret_cast<wrapper*>(self)->cpp->f();
Py_RETURN_NONE;
}
static PyMethodDef Methods[] = {
{C("f"), (PyCFunction)wrapf, METH_NOARGS, C("f()\n Calls C++ function\n void f()")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s, // tp_flags
"CLIF wrapper for StructCpp", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
Methods, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructCpp>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructCpp* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testVirtualStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructCpp"
}
members {
decltype: FUNC
func {
name {
native: "F"
cpp_name: "::StructCpp::f"
}
virtual: true
}
}
""", r"""
namespace pyStruct {
struct Overrider : PyObjRef, StructCpp {
using StructCpp::StructCpp;
void f() override {
SafeAttr impl(self(), "F");
if (impl.get()) {
::clif::callback::Func<void>(impl.get(), {})();
} else {
::StructCpp::f();
}
}
};
struct wrapper {
PyObject_HEAD
::clif::Instance<Overrider> cpp;
};
static StructCpp* ThisPtr(PyObject*);
// F()
static PyObject* wrapf_as_F(PyObject* self) {
// Call actual C++ method.
StructCpp* c = ThisPtr(self);
if (!c) return nullptr;
PyThreadState* _save;
Py_UNBLOCK_THREADS
c->StructCpp::f();
Py_BLOCK_THREADS
Py_RETURN_NONE;
}
// Implicit cast this as StructCpp*
static PyObject* as_StructCpp(PyObject* self) {
StructCpp* p = ::clif::python::Get(reinterpret_cast<wrapper*>(self)->cpp);
if (p == nullptr) return nullptr;
return PyCapsule_New(p, C("StructCpp"), nullptr);
}
static PyMethodDef Methods[] = {
{C("F"), (PyCFunction)wrapf_as_F, METH_NOARGS, C("F()\n Calls C++ function\n void ::StructCpp::f()")},
{C("as_StructCpp"), (PyCFunction)as_StructCpp, METH_NOARGS, C("Upcast to StructCpp*")},
{}
};
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _dtor(PyObject* self) {
Py_BEGIN_ALLOW_THREADS
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_END_ALLOW_THREADS
Py_TYPE(self)->tp_free(self);
}
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
_dtor, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructCpp", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
nullptr, // tp_iter
nullptr, // tp_iternext
Methods, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<Overrider>();
reinterpret_cast<wrapper*>(self)->cpp->::clif::PyObjRef::Init(self);
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructCpp* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructCpp"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructCpp"));
if (!PyErr_Occurred()) {
StructCpp* c = static_cast<StructCpp*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructCpp*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testIteratorStruct(self):
self.assertClassEqual("""
name {
native: "Struct"
cpp_name: "StructCpp"
}
cpp_has_trivial_dtor: true
members {
decltype: CLASS
class_ {
cpp_has_trivial_dtor: true
name {
native: "__iter__"
cpp_name: "iterator"
}
members {
decltype: FUNC
func {
name {
native: "__next__"
cpp_name: "operator*"
}
returns {
type {
lang_type: "int"
cpp_type: "int"
}
}
}
}
}
}
""", r"""
namespace pyStruct {
struct wrapper {
PyObject_HEAD
::clif::Instance<StructCpp> cpp;
};
namespace py__iter__ {
typedef ::clif::Iterator<StructCpp, iterator> iterator;
}
static StructCpp* ThisPtr(PyObject*);
namespace py__iter__ {
struct wrapper {
PyObject_HEAD
iterator iter;
};
PyObject* iternext(PyObject* self) {
PyThreadState* _save;
Py_UNBLOCK_THREADS
auto* v = reinterpret_cast<wrapper*>(self)->iter.Next();
Py_BLOCK_THREADS
return v? Clif_PyObjFrom(*v, {}): nullptr;
}
// __iter__ __del__
static void _dtor(PyObject* self) {
Py_BEGIN_ALLOW_THREADS
reinterpret_cast<wrapper*>(self)->iter.~iterator();
Py_END_ALLOW_THREADS
Py_TYPE(self)->tp_free(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct.__iter__", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
_dtor, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
"CLIF wrapper for iterator", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
PyObject_SelfIter, // tp_iter
iternext, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
Clif_PyType_Inconstructible, // tp_init
nullptr, // tp_alloc
nullptr, // tp_new
nullptr, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
} // namespace py__iter__
PyObject* new_iter(PyObject* self) {
if (!ThisPtr(self)) return nullptr;
py__iter__::wrapper* it = PyObject_New(py__iter__::wrapper, &py__iter__::wrapper_Type);
if (!it) return nullptr;
using std::equal_to; // Often a default template argument.
new(&it->iter) py__iter__::iterator(MakeStdShared(reinterpret_cast<wrapper*>(self)->cpp));
return reinterpret_cast<PyObject*>(it);
}
// Struct __init__
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);
// Struct __new__
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems);
// Struct __del__
static void _del(void* self) {
delete reinterpret_cast<wrapper*>(self);
}
PyTypeObject wrapper_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"path.to.ext.module.test.Struct", // tp_name
sizeof(wrapper), // tp_basicsize
0, // tp_itemsize
nullptr, // tp_dealloc
nullptr, // tp_print
nullptr, // tp_getattr
nullptr, // tp_setattr
nullptr, // tp_compare
nullptr, // tp_repr
nullptr, // tp_as_number
nullptr, // tp_as_sequence
nullptr, // tp_as_mapping
nullptr, // tp_hash
nullptr, // tp_call
nullptr, // tp_str
nullptr, // tp_getattro
nullptr, // tp_setattro
nullptr, // tp_as_buffer
Py_TPFLAGS_DEFAULT%(f)s | Py_TPFLAGS_BASETYPE, // tp_flags
"CLIF wrapper for StructCpp", // tp_doc
nullptr, // tp_traverse
nullptr, // tp_clear
nullptr, // tp_richcompare
0, // tp_weaklistoffset
new_iter, // tp_iter
nullptr, // tp_iternext
nullptr, // tp_methods
nullptr, // tp_members
nullptr, // tp_getset
nullptr, // tp_base
nullptr, // tp_dict
nullptr, // tp_descr_get
nullptr, // tp_descr_set
0, // tp_dictoffset
_ctor, // tp_init
_new, // tp_alloc
PyType_GenericNew, // tp_new
_del, // tp_free
nullptr, // tp_is_gc
nullptr, // tp_bases
nullptr, // tp_mro
nullptr, // tp_cache
nullptr, // tp_subclasses
nullptr, // tp_weaklist
nullptr, // tp_del
0, // tp_version_tag
};
static int _ctor(PyObject* self, PyObject* args, PyObject* kw) {
if ((args && PyTuple_GET_SIZE(args) != 0) || (kw && PyDict_Size(kw) != 0)) {
PyErr_SetString(PyExc_TypeError, "Struct takes no arguments");
return -1;
}
reinterpret_cast<wrapper*>(self)->cpp = ::clif::MakeShared<StructCpp>();
return 0;
}
static PyObject* _new(PyTypeObject* type, Py_ssize_t nitems) {
assert(nitems == 0);
PyObject* self = reinterpret_cast<PyObject*>(new wrapper);
return PyObject_Init(self, &wrapper_Type);
}
static StructCpp* ThisPtr(PyObject* py) {
if (Py_TYPE(py) == &wrapper_Type) {
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyObject* base = PyObject_CallMethod(py, C("as_StructCpp"), nullptr);
if (base) {
if (PyCapsule_CheckExact(base)) {
void* p = PyCapsule_GetPointer(base, C("StructCpp"));
if (!PyErr_Occurred()) {
StructCpp* c = static_cast<StructCpp*>(p);
Py_DECREF(base);
return c;
}
}
Py_DECREF(base);
}
if (PyObject_IsInstance(py, reinterpret_cast<PyObject*>(&wrapper_Type))) {
if (!base) {
PyErr_Clear();
return ::clif::python::Get(reinterpret_cast<wrapper*>(py)->cpp);
}
PyErr_Format(PyExc_ValueError, "can't convert %%s %%s to StructCpp*", ClassName(py), ClassType(py));
} else {
PyErr_Format(PyExc_TypeError, "expecting %%s instance, got %%s %%s", wrapper_Type.tp_name, ClassName(py), ClassType(py));
}
return nullptr;
}
} // namespace pyStruct
""" % self.code, """
bool Ready() {
if (PyType_Ready(&pyStruct::py__iter__::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::py__iter__::wrapper_Type); // For PyModule_AddObject to steal.
if (PyType_Ready(&pyStruct::wrapper_Type) < 0) return false;
Py_INCREF(&pyStruct::wrapper_Type); // For PyModule_AddObject to steal.
return true;
}
""" + ("""
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
if (PyModule_AddObject(module, "Struct", reinterpret_cast<PyObject*>(&pyStruct::wrapper_Type)) < 0) goto err;
return module;
err:
return nullptr;
}
"""))
def testEnum(self):
self.assertEnumEqual("""
name {
native: "MyEnum"
cpp_name: "myEnum"
}
members {
native: "ONE"
cpp_name: "kOne"
}
members {
cpp_name: "myEnum::TWO"
}
""", """
// Create Python Enum object (cached in _MyEnum) for myEnum
static PyObject* wrapmyEnum() {
PyObject *py, *py_enum_class{}, *names = PyTuple_New(2);
if (names == nullptr) return nullptr;
if ((py = Py_BuildValue("(NN)", %(frchar)s("ONE"), PyInt_FromLong(
static_cast<typename std::underlying_type<myEnum>::type>(myEnum::kOne)))
) == nullptr) goto err;
PyTuple_SET_ITEM(names, 0, py);
if ((py = Py_BuildValue("(NN)", %(frchar)s("TWO"), PyInt_FromLong(
static_cast<typename std::underlying_type<myEnum>::type>(myEnum::TWO)))
) == nullptr) goto err;
PyTuple_SET_ITEM(names, 1, py);
py = %(frchar)s("MyEnum");
py_enum_class = PyObject_CallFunctionObjArgs(_IntEnum, py, names, nullptr);
Py_DECREF(py);
err:
Py_DECREF(names);
return py_enum_class;
}
static PyObject* _MyEnum{}; // set by above func in Init()
""" % self.code, """
bool Ready() {
return true;
}
static struct PyModuleDef Module = {
PyModuleDef_HEAD_INIT,
"path.to.ext.module.test", // module name
"CLIF-generated module for test.h", // module doc
-1, // module keeps state in global variables
nullptr
};
PyObject* Init() {
PyObject* module = PyModule_Create(&Module);
if (!module) return nullptr;
{PyObject* em = PyImport_ImportModule("enum");
if (em == nullptr) goto err;
_Enum = PyObject_GetAttrString(em, "Enum");
_IntEnum = PyObject_GetAttrString(em, "IntEnum");
Py_DECREF(em);}
if (!_Enum || !_IntEnum) {
Py_XDECREF(_Enum);
Py_XDECREF(_IntEnum);
goto err;
}
if (PyModule_AddObject(module, "MyEnum", (_MyEnum=wrapmyEnum())) < 0) goto err;
return module;
err:
Py_DECREF(module);
return nullptr;
}
""" if self.m.py3output else """
bool Ready() {
return true;
}
PyObject* Init() {
PyObject* module = Py_InitModule3("path.to.ext.module.test", nullptr, "CLIF-generated module for test.h");
if (!module) return nullptr;
{PyObject* em = PyImport_ImportModule("enum");
if (em == nullptr) goto err;
_Enum = PyObject_GetAttrString(em, "Enum");
_IntEnum = PyObject_GetAttrString(em, "IntEnum");
Py_DECREF(em);}
if (!_Enum || !_IntEnum) {
Py_XDECREF(_Enum);
Py_XDECREF(_IntEnum);
goto err;
}
if (PyModule_AddObject(module, "MyEnum", (_MyEnum=wrapmyEnum())) < 0) goto err;
return module;
err:
return nullptr;
}
""")
if __name__ == '__main__':
unittest.main()
| 38.852623
| 149
| 0.470072
| 8,441
| 93,324
| 4.954745
| 0.046677
| 0.084786
| 0.028931
| 0.012553
| 0.909667
| 0.893886
| 0.881764
| 0.874041
| 0.864046
| 0.856108
| 0
| 0.004269
| 0.425218
| 93,324
| 2,401
| 150
| 38.868805
| 0.775414
| 0.006247
| 0
| 0.779775
| 0
| 0.036854
| 0.969285
| 0.159389
| 0
| 0
| 0
| 0
| 0.012584
| 1
| 0.006292
| false
| 0
| 0.004944
| 0
| 0.083596
| 0.005393
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
3f37a952b61b6d4a0e21b58e828ec157ef220be1
| 5,497
|
py
|
Python
|
tests/api/endpoints/test_smart_link.py
|
weimens/seahub
|
5ecf78ed7a2ddc72a23961804ee41be21c24893f
|
[
"Apache-2.0"
] | 420
|
2015-01-03T11:34:46.000Z
|
2022-03-10T07:15:41.000Z
|
tests/api/endpoints/test_smart_link.py
|
weimens/seahub
|
5ecf78ed7a2ddc72a23961804ee41be21c24893f
|
[
"Apache-2.0"
] | 735
|
2015-01-04T21:22:51.000Z
|
2022-03-31T09:26:07.000Z
|
tests/api/endpoints/test_smart_link.py
|
weimens/seahub
|
5ecf78ed7a2ddc72a23961804ee41be21c24893f
|
[
"Apache-2.0"
] | 379
|
2015-01-05T17:08:03.000Z
|
2022-03-06T00:11:50.000Z
|
# -*- coding: utf-8 -*-
import json
import uuid
from django.urls import reverse
from seahub.test_utils import BaseTestCase
try:
from seahub.settings import LOCAL_PRO_DEV_ENV
except ImportError:
LOCAL_PRO_DEV_ENV = False
class SmartLinkTest(BaseTestCase):
def setUp(self):
self.repo_id = self.repo.id
self.file_path= self.file
self.folder_path= self.folder
self.url = reverse('api-v2.1-smart-link')
def tearDown(self):
self.remove_repo()
def test_get_file_smart_link(self):
self.login_as(self.user)
para = '?repo_id=%s&path=%s&is_dir=false' % (self.repo_id, self.file_path)
resp = self.client.get(self.url + para)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['smart_link'] is not None
assert json_resp['smart_link_token'] is not None
def test_get_folder_smart_link(self):
self.login_as(self.user)
para = '?repo_id=%s&path=%s&is_dir=true' % (self.repo_id, self.folder_path)
resp = self.client.get(self.url + para)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['smart_link'] is not None
assert json_resp['smart_link_token'] is not None
def test_get_file_smart_link_with_invalid_user_permission(self):
self.login_as(self.admin)
# file smart link
para = '?repo_id=%s&path=%s&is_dir=false' % (self.repo_id, self.file_path)
resp = self.client.get(self.url + para)
self.assertEqual(403, resp.status_code)
# folder smart link
para = '?repo_id=%s&path=%s&is_dir=true' % (self.repo_id, self.folder_path)
resp = self.client.get(self.url + para)
self.assertEqual(403, resp.status_code)
class SmartLinkTokenTest(BaseTestCase):
def setUp(self):
self.repo_id = self.repo.id
self.file_path= self.file
self.folder_path= self.folder
def tearDown(self):
self.remove_repo()
def test_get_info_via_smart_link_token(self):
self.login_as(self.user)
# get file smart link token
url = reverse('api-v2.1-smart-link')
para = '?repo_id=%s&path=%s&is_dir=false' % (self.repo_id, self.file_path)
resp = self.client.get(url + para)
json_resp = json.loads(resp.content)
file_smart_link_token = json_resp['smart_link_token']
# get file info via smart link token
url = reverse('api-v2.1-smart-links-token', args=[file_smart_link_token])
resp = self.client.get(url)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['repo_id'] == self.repo_id
assert json_resp['path'] == self.file_path
assert json_resp['is_dir'] == False
# get folder smart link token
url = reverse('api-v2.1-smart-link')
para = '?repo_id=%s&path=%s&is_dir=true' % (self.repo_id, self.folder_path)
resp = self.client.get(url + para)
json_resp = json.loads(resp.content)
folder_smart_link_token = json_resp['smart_link_token']
# get folder info via smart link token
url = reverse('api-v2.1-smart-links-token', args=[folder_smart_link_token])
resp = self.client.get(url)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['repo_id'] == self.repo_id
assert json_resp['path'] == self.folder_path
assert json_resp['is_dir'] == True
def test_get_info_via_smart_link_token_with_invalid_user_permission(self):
# get file smart link token
self.login_as(self.user)
url = reverse('api-v2.1-smart-link')
para = '?repo_id=%s&path=%s&is_dir=false' % (self.repo_id, self.file_path)
resp = self.client.get(url + para)
json_resp = json.loads(resp.content)
file_smart_link_token = json_resp['smart_link_token']
self.logout()
# get file info via smart link token
self.login_as(self.admin)
url = reverse('api-v2.1-smart-links-token', args=[file_smart_link_token])
resp = self.client.get(url)
self.assertEqual(403, resp.status_code)
self.logout()
# get folder smart link token
self.login_as(self.user)
url = reverse('api-v2.1-smart-link')
para = '?repo_id=%s&path=%s&is_dir=true' % (self.repo_id, self.folder_path)
resp = self.client.get(url + para)
json_resp = json.loads(resp.content)
folder_smart_link_token = json_resp['smart_link_token']
self.logout()
# get folder info via smart link token
self.login_as(self.admin)
url = reverse('api-v2.1-smart-links-token', args=[folder_smart_link_token])
resp = self.client.get(url)
self.assertEqual(403, resp.status_code)
self.logout()
def test_get_info_via_smart_link_token_with_invalid_token(self):
file_smart_link_token = uuid.uuid4()
folder_smart_link_token = uuid.uuid4()
self.login_as(self.user)
url = reverse('api-v2.1-smart-links-token', args=[file_smart_link_token])
resp = self.client.get(url)
self.assertEqual(400, resp.status_code)
url = reverse('api-v2.1-smart-links-token', args=[folder_smart_link_token])
resp = self.client.get(url)
self.assertEqual(400, resp.status_code)
| 34.35625
| 83
| 0.649991
| 804
| 5,497
| 4.211443
| 0.093284
| 0.108978
| 0.119905
| 0.070289
| 0.92026
| 0.877437
| 0.852038
| 0.838748
| 0.832546
| 0.807738
| 0
| 0.013002
| 0.230489
| 5,497
| 159
| 84
| 34.572327
| 0.78747
| 0.055849
| 0
| 0.787037
| 0
| 0
| 0.12611
| 0.078795
| 0
| 0
| 0
| 0
| 0.185185
| 1
| 0.092593
| false
| 0
| 0.055556
| 0
| 0.166667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
4520a4d09f1e206305d1109abbfc125ff937306d
| 158
|
py
|
Python
|
src/optimizers/__init__.py
|
pomelyu/ML_HW
|
b87697f3ee86592a34d80c8dbf167a5767731630
|
[
"MIT"
] | null | null | null |
src/optimizers/__init__.py
|
pomelyu/ML_HW
|
b87697f3ee86592a34d80c8dbf167a5767731630
|
[
"MIT"
] | null | null | null |
src/optimizers/__init__.py
|
pomelyu/ML_HW
|
b87697f3ee86592a34d80c8dbf167a5767731630
|
[
"MIT"
] | null | null | null |
import mlconfig
from ..utils.mlconfig_torch import register_torch_optimizers
from .radam import RAdam
register_torch_optimizers()
mlconfig.register(RAdam)
| 17.555556
| 60
| 0.848101
| 20
| 158
| 6.45
| 0.4
| 0.20155
| 0.356589
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094937
| 158
| 8
| 61
| 19.75
| 0.902098
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
18a0ae8061d273301a02abe6f78a897345e30e96
| 2,107
|
py
|
Python
|
tests/test_story.py
|
gtors/stories
|
0614624f472151f20617afa4e6c4a0af9b409b6d
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_story.py
|
gtors/stories
|
0614624f472151f20617afa4e6c4a0af9b409b6d
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_story.py
|
gtors/stories
|
0614624f472151f20617afa4e6c4a0af9b409b6d
|
[
"BSD-2-Clause"
] | null | null | null |
import examples
def test_story_representation():
story = repr(examples.methods.Empty().x)
expected = """
Empty.x
<empty>
""".strip()
assert story == expected
story = repr(examples.methods.EmptySubstory().y)
expected = """
EmptySubstory.y
x
<empty>
""".strip()
assert story == expected
story = repr(examples.methods.SubstoryDI(examples.methods.Empty().x).y)
expected = """
SubstoryDI.y
start
before
x (Empty.x)
<empty>
after
""".strip()
assert story == expected
story = repr(examples.methods.Simple().x)
expected = """
Simple.x
one
two
three
""".strip()
assert story == expected
story = repr(examples.methods.SimpleSubstory().y)
expected = """
SimpleSubstory.y
start
before
x
one
two
three
after
""".strip()
assert story == expected
story = repr(examples.methods.SubstoryDI(examples.methods.Simple().x).y)
expected = """
SubstoryDI.y
start
before
x (Simple.x)
one
two
three
after
""".strip()
assert story == expected
story = repr(examples.methods.SubstoryDI(examples.methods.SimpleSubstory().z).y)
expected = """
SubstoryDI.y
start
before
x (SimpleSubstory.z)
first
x
one
two
three
after
""".strip()
assert story == expected
def test_story_class_attribute_representation():
story = repr(examples.methods.Empty.x)
expected = """
Empty.x
<empty>
""".strip()
assert story == expected
story = repr(examples.methods.EmptySubstory.y)
expected = """
EmptySubstory.y
x
<empty>
""".strip()
assert story == expected
story = repr(examples.methods.Simple.x)
expected = """
Simple.x
one
two
three
""".strip()
assert story == expected
story = repr(examples.methods.SimpleSubstory.y)
expected = """
SimpleSubstory.y
start
before
x
one
two
three
after
""".strip()
assert story == expected
story = repr(examples.methods.SubstoryDI.y)
expected = """
SubstoryDI.y
start
before
x ??
after
""".strip()
assert story == expected
| 16.083969
| 84
| 0.624585
| 237
| 2,107
| 5.527426
| 0.118143
| 0.171756
| 0.155725
| 0.219847
| 0.916794
| 0.890076
| 0.890076
| 0.841221
| 0.79084
| 0.755725
| 0
| 0
| 0.240626
| 2,107
| 130
| 85
| 16.207692
| 0.81875
| 0
| 0
| 0.780702
| 0
| 0
| 0.289986
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 1
| 0.017544
| false
| 0
| 0.008772
| 0
| 0.026316
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
18bb306f0fe8f039f93a18c3ee969284cf8bc171
| 131
|
py
|
Python
|
golem_start.py
|
kangchenwei/keyautotest2
|
f980d46cabfc128b2099af3d33968f236923063f
|
[
"MIT"
] | null | null | null |
golem_start.py
|
kangchenwei/keyautotest2
|
f980d46cabfc128b2099af3d33968f236923063f
|
[
"MIT"
] | null | null | null |
golem_start.py
|
kangchenwei/keyautotest2
|
f980d46cabfc128b2099af3d33968f236923063f
|
[
"MIT"
] | null | null | null |
import os
from golem.main import execute_from_command_line
if __name__ == '__main__':
execute_from_command_line(os.getcwd())
| 18.714286
| 48
| 0.78626
| 19
| 131
| 4.684211
| 0.578947
| 0.247191
| 0.404494
| 0.494382
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129771
| 131
| 6
| 49
| 21.833333
| 0.780702
| 0
| 0
| 0
| 0
| 0
| 0.061069
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
18d27e195ef72bef0ee4445dee8d49dffcaa8e64
| 4,080
|
py
|
Python
|
leasing/tests/api/test_lease_field_permissions.py
|
hkotkanen/mvj
|
a22d40869ef1b13924da428f3026d248acef81a7
|
[
"MIT"
] | null | null | null |
leasing/tests/api/test_lease_field_permissions.py
|
hkotkanen/mvj
|
a22d40869ef1b13924da428f3026d248acef81a7
|
[
"MIT"
] | null | null | null |
leasing/tests/api/test_lease_field_permissions.py
|
hkotkanen/mvj
|
a22d40869ef1b13924da428f3026d248acef81a7
|
[
"MIT"
] | null | null | null |
import pytest
from django.contrib.auth.models import Permission
from django.urls import reverse
from leasing.models import Lease
from leasing.serializers.lease import LeaseRetrieveSerializer
@pytest.mark.django_db
def test_user_cant_view_any_fields(django_db_setup, client, lease_test_data, user_factory):
user = user_factory(username='test_user')
user.set_password('test_password')
user.save()
permission = Permission.objects.get(codename='view_lease')
user.user_permissions.add(permission)
client.login(username='test_user', password='test_password')
url = reverse('lease-detail', kwargs={'pk': lease_test_data['lease'].id})
response = client.get(url)
assert response.status_code == 200, '{} {}'.format(response.status_code, response.data)
assert response.data == {}
@pytest.mark.django_db
def test_superuser_can_view_all_fields(django_db_setup, client, lease_test_data, user_factory):
user = user_factory(username='test_user')
user.set_password('test_password')
user.is_superuser = True
user.save()
client.login(username='test_user', password='test_password')
url = reverse('lease-detail', kwargs={'pk': lease_test_data['lease'].id})
response = client.get(url)
assert response.status_code == 200, '{} {}'.format(response.status_code, response.data)
assert sorted(response.data.keys()) == sorted(LeaseRetrieveSerializer().get_fields().keys())
@pytest.mark.django_db
def test_user_can_view_some_fields(django_db_setup, client, lease_test_data, user_factory):
user = user_factory(username='test_user')
user.set_password('test_password')
user.save()
user.user_permissions.add(Permission.objects.get(codename='view_lease'))
field_names = ['id', 'start_date', 'end_date', 'state']
for field_name in field_names:
codename = 'view_lease_{}'.format(field_name)
user.user_permissions.add(Permission.objects.get(codename=codename))
client.login(username='test_user', password='test_password')
url = reverse('lease-detail', kwargs={'pk': lease_test_data['lease'].id})
response = client.get(url)
assert response.status_code == 200, '{} {}'.format(response.status_code, response.data)
assert sorted(response.data.keys()) == ['end_date', 'id', 'start_date', 'state']
@pytest.mark.django_db
def test_user_cannot_modify_field(django_db_setup, client, lease_test_data, user_factory):
user = user_factory(username='test_user')
user.set_password('test_password')
user.save()
user.user_permissions.add(Permission.objects.get(codename='change_lease'))
user.user_permissions.add(Permission.objects.get(codename='view_lease_type'))
client.login(username='test_user', password='test_password')
url = reverse('lease-detail', kwargs={
'pk': lease_test_data['lease'].id
})
assert lease_test_data['lease'].type.id != 2
data = {
'type': 2,
}
response = client.patch(url, data=data, content_type='application/json')
lease = Lease.objects.get(pk=lease_test_data['lease'].id)
assert response.status_code == 200, '{} {}'.format(response.status_code, response.data)
assert lease.type_id == 1
@pytest.mark.django_db
def test_user_can_modify_field(django_db_setup, client, lease_test_data, user_factory):
user = user_factory(username='test_user')
user.set_password('test_password')
user.save()
user.user_permissions.add(Permission.objects.get(codename='change_lease'))
user.user_permissions.add(Permission.objects.get(codename='change_lease_type'))
client.login(username='test_user', password='test_password')
url = reverse('lease-detail', kwargs={'pk': lease_test_data['lease'].id})
assert lease_test_data['lease'].type.id != 2
data = {
'type': 2,
}
response = client.patch(url, data=data, content_type='application/json')
lease = Lease.objects.get(pk=lease_test_data['lease'].id)
assert response.status_code == 200, '{} {}'.format(response.status_code, response.data)
assert lease.type_id == 2
| 33.442623
| 96
| 0.721569
| 543
| 4,080
| 5.160221
| 0.138122
| 0.048537
| 0.064954
| 0.057816
| 0.850464
| 0.850464
| 0.816916
| 0.796217
| 0.755532
| 0.755532
| 0
| 0.005961
| 0.13652
| 4,080
| 121
| 97
| 33.719008
| 0.789384
| 0
| 0
| 0.620253
| 0
| 0
| 0.132108
| 0
| 0
| 0
| 0
| 0
| 0.151899
| 1
| 0.063291
| false
| 0.126582
| 0.063291
| 0
| 0.126582
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
18e19d045da8ce17eabf506d47b3e938ed98cdd0
| 97
|
py
|
Python
|
backend/voting/tests/factories/__init__.py
|
patrick91/pycon
|
9d7e15f540adcf0eaceb61fdbf67206d6aef73ec
|
[
"MIT"
] | 2
|
2017-07-18T21:51:25.000Z
|
2017-12-23T11:08:39.000Z
|
backend/voting/tests/factories/__init__.py
|
patrick91/pycon
|
9d7e15f540adcf0eaceb61fdbf67206d6aef73ec
|
[
"MIT"
] | 23
|
2017-07-18T20:22:38.000Z
|
2018-01-05T05:45:15.000Z
|
backend/voting/tests/factories/__init__.py
|
patrick91/pycon
|
9d7e15f540adcf0eaceb61fdbf67206d6aef73ec
|
[
"MIT"
] | 2
|
2017-07-18T21:27:33.000Z
|
2017-07-18T22:07:03.000Z
|
from .included_event import * # noqa
from .ranking import * # noqa
from .vote import * # noqa
| 24.25
| 37
| 0.690722
| 13
| 97
| 5.076923
| 0.538462
| 0.454545
| 0.424242
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.216495
| 97
| 3
| 38
| 32.333333
| 0.868421
| 0.14433
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
e135a7171b0b61cb3ead947717f0d689276cc5f1
| 3,646
|
py
|
Python
|
src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceSummary/cli/equal/golden_output_expected.py
|
balmasea/genieparser
|
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
|
[
"Apache-2.0"
] | 204
|
2018-06-27T00:55:27.000Z
|
2022-03-06T21:12:18.000Z
|
src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceSummary/cli/equal/golden_output_expected.py
|
balmasea/genieparser
|
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
|
[
"Apache-2.0"
] | 468
|
2018-06-19T00:33:18.000Z
|
2022-03-31T23:23:35.000Z
|
src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceSummary/cli/equal/golden_output_expected.py
|
balmasea/genieparser
|
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
|
[
"Apache-2.0"
] | 309
|
2019-01-16T20:21:07.000Z
|
2022-03-30T12:56:41.000Z
|
expected_output = {
"system_summary": {
"bdomain": {
"deleted": 0,
"total": 502,
"admin_do": 0,
"up": 502,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"other": {
"deleted": 0,
"total": 110,
"admin_do": 0,
"up": 110,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"local sw": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"xconnect": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"all": {
"deleted": 0,
"total": 612,
"admin_do": 0,
"up": 612,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
},
"GigabitEthernet0/0/7": {
"bdomain": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"other": {
"deleted": 0,
"total": 356,
"admin_do": 0,
"up": 356,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"local sw": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"xconnect": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"all": {
"deleted": 0,
"total": 356,
"admin_do": 0,
"up": 356,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
},
"Port-channel1": {
"bdomain": {
"deleted": 0,
"total": 532,
"admin_do": 0,
"up": 532,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"other": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"local sw": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"xconnect": {
"deleted": 0,
"total": 0,
"admin_do": 0,
"up": 0,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
"all": {
"deleted": 0,
"total": 532,
"admin_do": 0,
"up": 532,
"error_di": 0,
"bd_adm_do": 0,
"down": 0,
"unknown": 0,
},
},
}
| 22.930818
| 29
| 0.287164
| 327
| 3,646
| 3.012232
| 0.094801
| 0.091371
| 0.19797
| 0.152284
| 0.858883
| 0.858883
| 0.858883
| 0.858883
| 0.858883
| 0.858883
| 0
| 0.092626
| 0.549918
| 3,646
| 158
| 30
| 23.075949
| 0.507617
| 0
| 0
| 0.816456
| 0
| 0
| 0.244103
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 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
| 9
|
e153ce64f243742eedcfbedc5313b9ebf8d9fed4
| 2,899
|
py
|
Python
|
properties.py
|
dblinger/BOMD_vibspec
|
3bf10946c4a3f3eba0ca7696b4c7201a3b9e0ed1
|
[
"MIT"
] | null | null | null |
properties.py
|
dblinger/BOMD_vibspec
|
3bf10946c4a3f3eba0ca7696b4c7201a3b9e0ed1
|
[
"MIT"
] | null | null | null |
properties.py
|
dblinger/BOMD_vibspec
|
3bf10946c4a3f3eba0ca7696b4c7201a3b9e0ed1
|
[
"MIT"
] | null | null | null |
class ElectricDipole(object):
"""An ElectricDipole object contains the x, y, and z electric dipole
components
Attributes:
x: x component of the electric dipole
y: y component of the electric dipole
z: z component of the electric dipole
"""
def __init__(self):
self._x = None
self._y = None
self._z = None
@property
def x(self):
return self._x
@x.setter
def x(self,value):
self._x = value
@property
def y(self):
return self._y
@y.setter
def y(self,value):
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self,value):
self._z = value
class MagneticDipole(object):
"""A MagneticDipole object contains the x, y, and z magnetic dipole
components
Attributes:
x: x component of the magnetic dipole
y: y component of the magnetic dipole
z: z component of the magnetic dipole
"""
def __init__(self):
self._x = None
self._y = None
self._z = None
@property
def x(self):
return self._x
@x.setter
def x(self,value):
self._x = value
@property
def y(self):
return self._y
@y.setter
def y(self,value):
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self,value):
self._z = value
class ElectricField(object):
"""An ElectricField object contains the x, y, and z electric field
components
Attributes:
x: x component of the electric field
y: y component of the electric field
z: z component of the electric field
"""
def __init__(self):
self._x = None
self._y = None
self._z = None
@property
def x(self):
return self._x
@x.setter
def x(self,value):
self._x = value
@property
def y(self):
return self._y
@y.setter
def y(self,value):
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self,value):
self._z = value
class MagneticField(object):
"""A MagneticField object contains the x, y, and z magnetic field
components
Attributes:
x: x component of the magnetic field
y: y component of the magnetic field
z: z component of the magnetic field
"""
def __init__(self):
self._x = None
self._y = None
self._z = None
@property
def x(self):
return self._x
@x.setter
def x(self,value):
self._x = value
@property
def y(self):
return self._y
@y.setter
def y(self,value):
self._y = value
@property
def z(self):
return self._z
@z.setter
def z(self,value):
self._z = value
| 18.824675
| 73
| 0.560883
| 388
| 2,899
| 4.056701
| 0.07732
| 0.083863
| 0.106734
| 0.083863
| 0.909149
| 0.909149
| 0.759212
| 0.759212
| 0.554638
| 0.554638
| 0
| 0
| 0.35219
| 2,899
| 153
| 74
| 18.947712
| 0.838126
| 0.294929
| 0
| 0.956522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.304348
| false
| 0
| 0
| 0.130435
| 0.478261
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 7
|
e1be607fed41a91dc30fa21f8975eebc2a1a8f54
| 157
|
py
|
Python
|
scAnalysis/__init__.py
|
yuzhounaut/SpaceM
|
0fed7f14bb7d378ed0a8cf2e075bc562d6eed497
|
[
"Apache-2.0"
] | 8
|
2020-05-26T13:32:29.000Z
|
2021-12-05T20:32:38.000Z
|
scAnalysis/__init__.py
|
yuzhounaut/SpaceM
|
0fed7f14bb7d378ed0a8cf2e075bc562d6eed497
|
[
"Apache-2.0"
] | 2
|
2021-06-08T21:37:29.000Z
|
2022-02-01T14:26:15.000Z
|
scAnalysis/__init__.py
|
LRpz/SpaceM
|
03f7b3b871ec70ed38df63adfc4efcd30c3896a5
|
[
"Apache-2.0"
] | 3
|
2020-06-18T17:06:16.000Z
|
2021-10-08T06:55:07.000Z
|
from . import manifoldAnalysis, scAnalysis, Segmentation, scAnalysis_refactored
__all__ = [manifoldAnalysis, scAnalysis, Segmentation, scAnalysis_refactored]
| 78.5
| 79
| 0.859873
| 13
| 157
| 9.923077
| 0.538462
| 0.403101
| 0.589147
| 0.744186
| 0.899225
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.076433
| 157
| 2
| 80
| 78.5
| 0.889655
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 1
| 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
| 7
|
e1cb6fa8fbac2ae2dca7ff4a7155bc4119ed320d
| 204
|
py
|
Python
|
Unit 2/2.2/2.2.5 Caterpillar.py
|
shashwat73/cse
|
60e49307e57105cf9916c7329f53f891c5e81fdb
|
[
"MIT"
] | 1
|
2021-04-08T14:02:49.000Z
|
2021-04-08T14:02:49.000Z
|
Unit 2/2.2/2.2.5 Caterpillar.py
|
shashwat73/cse
|
60e49307e57105cf9916c7329f53f891c5e81fdb
|
[
"MIT"
] | null | null | null |
Unit 2/2.2/2.2.5 Caterpillar.py
|
shashwat73/cse
|
60e49307e57105cf9916c7329f53f891c5e81fdb
|
[
"MIT"
] | null | null | null |
circle(35)
penup()
forward(40)
circle(20)
penup()
forward(40)
circle(20)
penup()
forward(40)
circle(20)
penup()
forward(40)
circle(20)
penup()
forward(40)
circle(20)
penup()
forward(40)
| 10.736842
| 12
| 0.647059
| 30
| 204
| 4.4
| 0.2
| 0.545455
| 0.636364
| 0.757576
| 0.939394
| 0.939394
| 0.939394
| 0.939394
| 0.939394
| 0.939394
| 0
| 0.142857
| 0.176471
| 204
| 18
| 13
| 11.333333
| 0.642857
| 0
| 0
| 0.944444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
bee4843b7c2f4ea04dd62afee77fa7c6d8f3d949
| 58,142
|
bzl
|
Python
|
dotnet/private/deps/nuget2.bzl
|
marleypowell/rules_dotnet
|
b2a6c7583f7c2cf37ea62d0f1a703c7af4d333ef
|
[
"Apache-2.0"
] | null | null | null |
dotnet/private/deps/nuget2.bzl
|
marleypowell/rules_dotnet
|
b2a6c7583f7c2cf37ea62d0f1a703c7af4d333ef
|
[
"Apache-2.0"
] | null | null | null |
dotnet/private/deps/nuget2.bzl
|
marleypowell/rules_dotnet
|
b2a6c7583f7c2cf37ea62d0f1a703c7af4d333ef
|
[
"Apache-2.0"
] | null | null | null |
load("@io_bazel_rules_dotnet//dotnet/private:rules/nuget.bzl", "nuget_package")
def dotnet_repositories_nuget2():
nunitv2 = "nunitv2"
nunitrunnersv2 = "nunitrunnersv2"
### Generated by the tool
nuget_package(
name = nunitv2,
package = "nunit",
version = "2.7.1",
sha256 = "21111545dffd2d8b0eceefa3c9acb7ff8b8cc16067b43107283c50ef1ca85004",
core_lib = {
"netcoreapp2.0": "lib/nunit.framework.dll",
"netcoreapp2.1": "lib/nunit.framework.dll",
"netcoreapp3.0": "lib/nunit.framework.dll",
"netcoreapp3.1": "lib/nunit.framework.dll",
},
net_lib = {
"net45": "lib/nunit.framework.dll",
"net451": "lib/nunit.framework.dll",
"net452": "lib/nunit.framework.dll",
"net46": "lib/nunit.framework.dll",
"net461": "lib/nunit.framework.dll",
"net462": "lib/nunit.framework.dll",
"net47": "lib/nunit.framework.dll",
"net471": "lib/nunit.framework.dll",
"net472": "lib/nunit.framework.dll",
"net48": "lib/nunit.framework.dll",
"netstandard1.0": "lib/nunit.framework.dll",
"netstandard1.1": "lib/nunit.framework.dll",
"netstandard1.2": "lib/nunit.framework.dll",
"netstandard1.3": "lib/nunit.framework.dll",
"netstandard1.4": "lib/nunit.framework.dll",
"netstandard1.5": "lib/nunit.framework.dll",
"netstandard1.6": "lib/nunit.framework.dll",
"netstandard2.0": "lib/nunit.framework.dll",
"netstandard2.1": "lib/nunit.framework.dll",
},
mono_lib = "lib/nunit.framework.dll",
core_files = {
"netcoreapp2.0": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netcoreapp2.1": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netcoreapp3.0": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netcoreapp3.1": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
},
net_files = {
"net45": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net451": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net452": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net46": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net461": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net462": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net47": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net471": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net472": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"net48": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.0": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.1": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.2": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.3": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.4": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.5": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard1.6": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard2.0": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
"netstandard2.1": [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
},
mono_files = [
"lib/nunit.framework.dll",
"lib/nunit.framework.xml",
],
)
nuget_package(
name = nunitrunnersv2,
package = "nunit.runners",
version = "2.7.1",
sha256 = "02519acbc949d9267f01928086cf123a26c88f059a10757eb36283e157ec1bf2",
core_tool = {
"netcoreapp2.0": "tools/nunit-console.exe",
"netcoreapp2.1": "tools/nunit-console.exe",
"netcoreapp3.0": "tools/nunit-console.exe",
"netcoreapp3.1": "tools/nunit-console.exe",
},
net_tool = {
"net45": "tools/nunit-console.exe",
"net451": "tools/nunit-console.exe",
"net452": "tools/nunit-console.exe",
"net46": "tools/nunit-console.exe",
"net461": "tools/nunit-console.exe",
"net462": "tools/nunit-console.exe",
"net47": "tools/nunit-console.exe",
"net471": "tools/nunit-console.exe",
"net472": "tools/nunit-console.exe",
"net48": "tools/nunit-console.exe",
"netstandard1.0": "tools/nunit-console.exe",
"netstandard1.1": "tools/nunit-console.exe",
"netstandard1.2": "tools/nunit-console.exe",
"netstandard1.3": "tools/nunit-console.exe",
"netstandard1.4": "tools/nunit-console.exe",
"netstandard1.5": "tools/nunit-console.exe",
"netstandard1.6": "tools/nunit-console.exe",
"netstandard2.0": "tools/nunit-console.exe",
"netstandard2.1": "tools/nunit-console.exe",
},
mono_tool = "tools/nunit-console.exe",
core_files = {
"netcoreapp2.0": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netcoreapp2.1": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netcoreapp3.0": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netcoreapp3.1": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
},
net_files = {
"net45": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net451": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net452": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net46": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net461": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net462": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net47": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net471": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net472": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"net48": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.0": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.1": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.2": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.3": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.4": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.5": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard1.6": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard2.0": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
"netstandard2.1": [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
},
mono_files = [
"tools/lib/Images/Tree/Circles/Failure.jpg",
"tools/lib/Images/Tree/Circles/Ignored.jpg",
"tools/lib/Images/Tree/Circles/Inconclusive.jpg",
"tools/lib/Images/Tree/Circles/Skipped.jpg",
"tools/lib/Images/Tree/Circles/Success.jpg",
"tools/lib/Images/Tree/Classic/Failure.jpg",
"tools/lib/Images/Tree/Classic/Ignored.jpg",
"tools/lib/Images/Tree/Classic/Inconclusive.jpg",
"tools/lib/Images/Tree/Classic/Skipped.jpg",
"tools/lib/Images/Tree/Classic/Success.jpg",
"tools/lib/Images/Tree/Default/Failure.png",
"tools/lib/Images/Tree/Default/Ignored.png",
"tools/lib/Images/Tree/Default/Inconclusive.png",
"tools/lib/Images/Tree/Default/Skipped.png",
"tools/lib/Images/Tree/Default/Success.png",
"tools/lib/Images/Tree/Visual Studio/Failure.png",
"tools/lib/Images/Tree/Visual Studio/Ignored.png",
"tools/lib/Images/Tree/Visual Studio/Inconclusive.png",
"tools/lib/Images/Tree/Visual Studio/Skipped.png",
"tools/lib/Images/Tree/Visual Studio/Success.png",
"tools/lib/nunit-console-runner.dll",
"tools/lib/nunit-gui-runner.dll",
"tools/lib/nunit.core.dll",
"tools/lib/nunit.core.interfaces.dll",
"tools/lib/nunit.uiexception.dll",
"tools/lib/nunit.uikit.dll",
"tools/lib/nunit.util.dll",
"tools/nunit-agent-x86.exe",
"tools/nunit-agent-x86.exe.config",
"tools/nunit-agent.exe",
"tools/nunit-agent.exe.config",
"tools/nunit-console-x86.exe",
"tools/nunit-console-x86.exe.config",
"tools/nunit-console.exe",
"tools/nunit-console.exe.config",
"tools/nunit-x86.exe",
"tools/nunit-x86.exe.config",
"tools/nunit.exe",
"tools/nunit.exe.config",
],
)
### End of generated by the tool
| 49.864494
| 84
| 0.542345
| 6,343
| 58,142
| 4.968154
| 0.013085
| 0.164504
| 0.213245
| 0.274173
| 0.972614
| 0.948434
| 0.934091
| 0.934091
| 0.921398
| 0.899248
| 0
| 0.014861
| 0.309088
| 58,142
| 1,165
| 85
| 49.907296
| 0.76961
| 0.00086
| 0
| 0.937931
| 1
| 0
| 0.626472
| 0.563425
| 0
| 0
| 0
| 0
| 0
| 1
| 0.000862
| false
| 0
| 0
| 0
| 0.000862
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 12
|
bef49e1e27db32cb58dfa95cc6c80aa5d6dcd560
| 724
|
py
|
Python
|
Python/Learning/Tips/decorators.py
|
prynix/learning-programming
|
85aea40a61fb824a2b4e142331d9ac7971fef263
|
[
"MIT"
] | 2
|
2017-03-14T16:02:08.000Z
|
2017-05-02T13:48:18.000Z
|
Python/Learning/Tips/decorators.py
|
CajetanP/code-learning
|
85aea40a61fb824a2b4e142331d9ac7971fef263
|
[
"MIT"
] | 4
|
2021-05-20T21:10:13.000Z
|
2022-02-26T09:50:19.000Z
|
Python/Learning/Tips/decorators.py
|
CajetanP/code-learning
|
85aea40a61fb824a2b4e142331d9ac7971fef263
|
[
"MIT"
] | 1
|
2021-06-18T01:31:24.000Z
|
2021-06-18T01:31:24.000Z
|
from functools import wraps
# Basic
def a_decorator(func):
def wrap_fn():
print("Before function")
func()
print("After function")
return wrap_fn
@a_decorator
def a_function_to_decorate():
"""Decorator example!"""
print("Decorating that guy here!")
a_function_to_decorate()
print(a_function_to_decorate.__name__)
print()
# Lib
def a_decorator(func):
@wraps(func)
def wrap_fn():
print("Before function")
func()
print("After function")
return wrap_fn
@a_decorator
def a_function_to_decorate():
"""Decorator example!"""
print("Decorating that guy here!")
a_function_to_decorate()
print(a_function_to_decorate.__name__)
print()
| 15.083333
| 38
| 0.66989
| 92
| 724
| 4.902174
| 0.271739
| 0.119734
| 0.146341
| 0.252772
| 0.851441
| 0.851441
| 0.851441
| 0.851441
| 0.851441
| 0.851441
| 0
| 0
| 0.21547
| 724
| 47
| 39
| 15.404255
| 0.794014
| 0.066298
| 0
| 0.923077
| 0
| 0
| 0.162651
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| false
| 0
| 0.038462
| 0
| 0.346154
| 0.384615
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
83344b9b8b6b8f9e35770ca97df733a039578c3b
| 58
|
py
|
Python
|
tests/test_math_game.py
|
atmelaku/text-adventure-game
|
b814114bd85f63c3d781cdbb40531125cbf15448
|
[
"MIT"
] | null | null | null |
tests/test_math_game.py
|
atmelaku/text-adventure-game
|
b814114bd85f63c3d781cdbb40531125cbf15448
|
[
"MIT"
] | null | null | null |
tests/test_math_game.py
|
atmelaku/text-adventure-game
|
b814114bd85f63c3d781cdbb40531125cbf15448
|
[
"MIT"
] | null | null | null |
import math_game
def test_import():
assert math_game
| 11.6
| 20
| 0.758621
| 9
| 58
| 4.555556
| 0.666667
| 0.390244
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.189655
| 58
| 4
| 21
| 14.5
| 0.87234
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| true
| 0
| 0.666667
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
8344ccbf6d61ba12b854084d07daeeabdc4af263
| 54,313
|
py
|
Python
|
iengage_client/apis/augmented_intelligence_api.py
|
iEngage/python-sdk
|
76cc6ed697d7599ce9af74124c12d33ad5aff419
|
[
"Apache-2.0"
] | null | null | null |
iengage_client/apis/augmented_intelligence_api.py
|
iEngage/python-sdk
|
76cc6ed697d7599ce9af74124c12d33ad5aff419
|
[
"Apache-2.0"
] | null | null | null |
iengage_client/apis/augmented_intelligence_api.py
|
iEngage/python-sdk
|
76cc6ed697d7599ce9af74124c12d33ad5aff419
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
"""
iEngage 2.0 API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
from ..configuration import Configuration
from ..api_client import ApiClient
class AugmentedIntelligenceApi(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
config = Configuration()
if api_client:
self.api_client = api_client
else:
if not config.api_client:
config.api_client = ApiClient()
self.api_client = config.api_client
def classify(self, text, id, client_token, **kwargs):
"""
Classifies using your classifier
Returns a classification based on your training in the Classifier Admin Panel. More than one classifier may be trained. Use the correct ID from the Admin Panel to get the corresponding classification
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.classify(text, id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Text you want classified (required)
:param int id: Classifier ID from the Admin Panel (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseTextClassificationList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.classify_with_http_info(text, id, client_token, **kwargs)
else:
(data) = self.classify_with_http_info(text, id, client_token, **kwargs)
return data
def classify_with_http_info(self, text, id, client_token, **kwargs):
"""
Classifies using your classifier
Returns a classification based on your training in the Classifier Admin Panel. More than one classifier may be trained. Use the correct ID from the Admin Panel to get the corresponding classification
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.classify_with_http_info(text, id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Text you want classified (required)
:param int id: Classifier ID from the Admin Panel (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseTextClassificationList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['text', 'id', 'client_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method classify" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'text' is set
if ('text' not in params) or (params['text'] is None):
raise ValueError("Missing the required parameter `text` when calling `classify`")
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `classify`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `classify`")
resource_path = '/ml/classifier/classify'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'text' in params:
query_params['text'] = params['text']
if 'id' in params:
query_params['id'] = params['id']
header_params = {}
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseTextClassificationList',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_entities(self, id, text, client_token, **kwargs):
"""
Extracts entities from text
Classifies each word of the text as an entity based on your training in the NER Admin panel. More than one classifier may be trained. Use the correct ID from the Admin Panel to get the corresponding classification
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_entities(id, text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int id: NER ID present from the Admin Panel (required)
:param str text: Text from which to extract entities (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseEntitiesClassifiedList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_entities_with_http_info(id, text, client_token, **kwargs)
else:
(data) = self.get_entities_with_http_info(id, text, client_token, **kwargs)
return data
def get_entities_with_http_info(self, id, text, client_token, **kwargs):
"""
Extracts entities from text
Classifies each word of the text as an entity based on your training in the NER Admin panel. More than one classifier may be trained. Use the correct ID from the Admin Panel to get the corresponding classification
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_entities_with_http_info(id, text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int id: NER ID present from the Admin Panel (required)
:param str text: Text from which to extract entities (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseEntitiesClassifiedList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'text', 'client_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_entities" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_entities`")
# verify the required parameter 'text' is set
if ('text' not in params) or (params['text'] is None):
raise ValueError("Missing the required parameter `text` when calling `get_entities`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_entities`")
resource_path = '/ml/ner/classify'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'id' in params:
query_params['id'] = params['id']
if 'text' in params:
query_params['text'] = params['text']
header_params = {}
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseEntitiesClassifiedList',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_interaction_type(self, text, client_token, **kwargs):
"""
Returns the type of interaction
Classifies text to question, complaint, appreciation, suggestion or comment. This is the default classification we assign to the type field of an Interaction
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_interaction_type(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Text that is to be classified by type (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseFlowFinder
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_interaction_type_with_http_info(text, client_token, **kwargs)
else:
(data) = self.get_interaction_type_with_http_info(text, client_token, **kwargs)
return data
def get_interaction_type_with_http_info(self, text, client_token, **kwargs):
"""
Returns the type of interaction
Classifies text to question, complaint, appreciation, suggestion or comment. This is the default classification we assign to the type field of an Interaction
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_interaction_type_with_http_info(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Text that is to be classified by type (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseFlowFinder
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['text', 'client_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_interaction_type" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'text' is set
if ('text' not in params) or (params['text'] is None):
raise ValueError("Missing the required parameter `text` when calling `get_interaction_type`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_interaction_type`")
resource_path = '/ml/interactionType'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'text' in params:
query_params['text'] = params['text']
header_params = {}
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseFlowFinder',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_keywords(self, text, client_token, **kwargs):
"""
Returns the keywords of the sentence
Extracts the keywords of a sentence. This could be used for example as tags.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_keywords(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Content whose keywords are to be found out (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseKeyword
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_keywords_with_http_info(text, client_token, **kwargs)
else:
(data) = self.get_keywords_with_http_info(text, client_token, **kwargs)
return data
def get_keywords_with_http_info(self, text, client_token, **kwargs):
"""
Returns the keywords of the sentence
Extracts the keywords of a sentence. This could be used for example as tags.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_keywords_with_http_info(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Content whose keywords are to be found out (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseKeyword
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['text', 'client_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_keywords" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'text' is set
if ('text' not in params) or (params['text'] is None):
raise ValueError("Missing the required parameter `text` when calling `get_keywords`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_keywords`")
resource_path = '/ml/keywords'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'text' in params:
query_params['text'] = params['text']
header_params = {}
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseKeyword',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_popular_tag(self, start_time, end_time, start, end, requester_id, client_token, **kwargs):
"""
Get list of popular tag of interactions
Return the most popular tag of given interaction type
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_popular_tag(start_time, end_time, start, end, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param int start: start (required)
:param int end: end (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str interaction_type: /* Interaction Type 1) Question 2) Complaint 3) Idea 4) Blog 5) Discussion */
:param str sentiment_type: /* Sentiment Type 1)Positive 2)Negative 3)Neutral */
:param str additional_information: additional information
:param str association: association
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseTagList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_popular_tag_with_http_info(start_time, end_time, start, end, requester_id, client_token, **kwargs)
else:
(data) = self.get_popular_tag_with_http_info(start_time, end_time, start, end, requester_id, client_token, **kwargs)
return data
def get_popular_tag_with_http_info(self, start_time, end_time, start, end, requester_id, client_token, **kwargs):
"""
Get list of popular tag of interactions
Return the most popular tag of given interaction type
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_popular_tag_with_http_info(start_time, end_time, start, end, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param int start: start (required)
:param int end: end (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str interaction_type: /* Interaction Type 1) Question 2) Complaint 3) Idea 4) Blog 5) Discussion */
:param str sentiment_type: /* Sentiment Type 1)Positive 2)Negative 3)Neutral */
:param str additional_information: additional information
:param str association: association
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseTagList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['start_time', 'end_time', 'start', 'end', 'requester_id', 'client_token', 'interaction_type', 'sentiment_type', 'additional_information', 'association', 'category_id', 'access_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_popular_tag" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'start_time' is set
if ('start_time' not in params) or (params['start_time'] is None):
raise ValueError("Missing the required parameter `start_time` when calling `get_popular_tag`")
# verify the required parameter 'end_time' is set
if ('end_time' not in params) or (params['end_time'] is None):
raise ValueError("Missing the required parameter `end_time` when calling `get_popular_tag`")
# verify the required parameter 'start' is set
if ('start' not in params) or (params['start'] is None):
raise ValueError("Missing the required parameter `start` when calling `get_popular_tag`")
# verify the required parameter 'end' is set
if ('end' not in params) or (params['end'] is None):
raise ValueError("Missing the required parameter `end` when calling `get_popular_tag`")
# verify the required parameter 'requester_id' is set
if ('requester_id' not in params) or (params['requester_id'] is None):
raise ValueError("Missing the required parameter `requester_id` when calling `get_popular_tag`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_popular_tag`")
resource_path = '/analytics/popular/tags'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'interaction_type' in params:
query_params['interactionType'] = params['interaction_type']
if 'sentiment_type' in params:
query_params['sentimentType'] = params['sentiment_type']
if 'additional_information' in params:
query_params['additionalInformation'] = params['additional_information']
if 'association' in params:
query_params['association'] = params['association']
if 'category_id' in params:
query_params['categoryId'] = params['category_id']
if 'start_time' in params:
query_params['startTime'] = params['start_time']
if 'end_time' in params:
query_params['endTime'] = params['end_time']
if 'start' in params:
query_params['start'] = params['start']
if 'end' in params:
query_params['end'] = params['end']
header_params = {}
if 'requester_id' in params:
header_params['requesterId'] = params['requester_id']
if 'access_token' in params:
header_params['accessToken'] = params['access_token']
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseTagList',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_sentiment(self, start_time, end_time, requester_id, client_token, **kwargs):
"""
Get sentiment count of interactions
Returns the sum of the sentiment count of given interaction type
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_sentiment(start_time, end_time, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str interaction_type: /* Interaction Type 1) Question 2) Complaint 3) Idea 4) Blog 5) Discussion */
:param str additional_information: additional information
:param str association: association
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseSentimentAnalytics
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_sentiment_with_http_info(start_time, end_time, requester_id, client_token, **kwargs)
else:
(data) = self.get_sentiment_with_http_info(start_time, end_time, requester_id, client_token, **kwargs)
return data
def get_sentiment_with_http_info(self, start_time, end_time, requester_id, client_token, **kwargs):
"""
Get sentiment count of interactions
Returns the sum of the sentiment count of given interaction type
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_sentiment_with_http_info(start_time, end_time, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str interaction_type: /* Interaction Type 1) Question 2) Complaint 3) Idea 4) Blog 5) Discussion */
:param str additional_information: additional information
:param str association: association
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseSentimentAnalytics
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['start_time', 'end_time', 'requester_id', 'client_token', 'interaction_type', 'additional_information', 'association', 'category_id', 'access_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_sentiment" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'start_time' is set
if ('start_time' not in params) or (params['start_time'] is None):
raise ValueError("Missing the required parameter `start_time` when calling `get_sentiment`")
# verify the required parameter 'end_time' is set
if ('end_time' not in params) or (params['end_time'] is None):
raise ValueError("Missing the required parameter `end_time` when calling `get_sentiment`")
# verify the required parameter 'requester_id' is set
if ('requester_id' not in params) or (params['requester_id'] is None):
raise ValueError("Missing the required parameter `requester_id` when calling `get_sentiment`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_sentiment`")
resource_path = '/analytics/sentiments'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'interaction_type' in params:
query_params['interactionType'] = params['interaction_type']
if 'additional_information' in params:
query_params['additionalInformation'] = params['additional_information']
if 'association' in params:
query_params['association'] = params['association']
if 'category_id' in params:
query_params['categoryId'] = params['category_id']
if 'start_time' in params:
query_params['startTime'] = params['start_time']
if 'end_time' in params:
query_params['endTime'] = params['end_time']
header_params = {}
if 'requester_id' in params:
header_params['requesterId'] = params['requester_id']
if 'access_token' in params:
header_params['accessToken'] = params['access_token']
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseSentimentAnalytics',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def get_tag_entity_sentiments(self, tag_name, start_time, end_time, start, end, requester_id, client_token, **kwargs):
"""
Get list of tag entity sentiment
Return the list of tag entity sentiments
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_tag_entity_sentiments(tag_name, start_time, end_time, start, end, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str tag_name: tag name (required)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param int start: start (required)
:param int end: end (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str sentiment_type: /* Sentiment Type 1)Positive 2)Negative 3)Neutral */
:param str additional_information: additional information
:param str association: association
:param str interaction_type: /* Interaction Type 1)Question 2)Complaint 3)Idea 4)Blog 5)Discussion */
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseEntitySentimentList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_tag_entity_sentiments_with_http_info(tag_name, start_time, end_time, start, end, requester_id, client_token, **kwargs)
else:
(data) = self.get_tag_entity_sentiments_with_http_info(tag_name, start_time, end_time, start, end, requester_id, client_token, **kwargs)
return data
def get_tag_entity_sentiments_with_http_info(self, tag_name, start_time, end_time, start, end, requester_id, client_token, **kwargs):
"""
Get list of tag entity sentiment
Return the list of tag entity sentiments
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_tag_entity_sentiments_with_http_info(tag_name, start_time, end_time, start, end, requester_id, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str tag_name: tag name (required)
:param int start_time: start time (required)
:param int end_time: end time (required)
:param int start: start (required)
:param int end: end (required)
:param str requester_id: requesterId can be user id OR email address. (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:param str sentiment_type: /* Sentiment Type 1)Positive 2)Negative 3)Neutral */
:param str additional_information: additional information
:param str association: association
:param str interaction_type: /* Interaction Type 1)Question 2)Complaint 3)Idea 4)Blog 5)Discussion */
:param int category_id: categoryId
:param str access_token: Unique session token for user. To get access token user will have to authenticate
:return: VerveResponseEntitySentimentList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['tag_name', 'start_time', 'end_time', 'start', 'end', 'requester_id', 'client_token', 'sentiment_type', 'additional_information', 'association', 'interaction_type', 'category_id', 'access_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tag_entity_sentiments" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'tag_name' is set
if ('tag_name' not in params) or (params['tag_name'] is None):
raise ValueError("Missing the required parameter `tag_name` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'start_time' is set
if ('start_time' not in params) or (params['start_time'] is None):
raise ValueError("Missing the required parameter `start_time` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'end_time' is set
if ('end_time' not in params) or (params['end_time'] is None):
raise ValueError("Missing the required parameter `end_time` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'start' is set
if ('start' not in params) or (params['start'] is None):
raise ValueError("Missing the required parameter `start` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'end' is set
if ('end' not in params) or (params['end'] is None):
raise ValueError("Missing the required parameter `end` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'requester_id' is set
if ('requester_id' not in params) or (params['requester_id'] is None):
raise ValueError("Missing the required parameter `requester_id` when calling `get_tag_entity_sentiments`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `get_tag_entity_sentiments`")
resource_path = '/analytics/tag/entitySentiment'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'tag_name' in params:
query_params['tagName'] = params['tag_name']
if 'sentiment_type' in params:
query_params['sentimentType'] = params['sentiment_type']
if 'additional_information' in params:
query_params['additionalInformation'] = params['additional_information']
if 'association' in params:
query_params['association'] = params['association']
if 'interaction_type' in params:
query_params['interactionType'] = params['interaction_type']
if 'category_id' in params:
query_params['categoryId'] = params['category_id']
if 'start_time' in params:
query_params['startTime'] = params['start_time']
if 'end_time' in params:
query_params['endTime'] = params['end_time']
if 'start' in params:
query_params['start'] = params['start']
if 'end' in params:
query_params['end'] = params['end']
header_params = {}
if 'requester_id' in params:
header_params['requesterId'] = params['requester_id']
if 'access_token' in params:
header_params['accessToken'] = params['access_token']
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseEntitySentimentList',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
def sentiment(self, text, client_token, **kwargs):
"""
Analyzes the sentiment of the content
The response will be a Sentiment Weightage. -1 is most negative and +1 is most positive. 0 will be neutral
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.sentiment(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Sentence whose sentiment is to be found out (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseSentiment
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.sentiment_with_http_info(text, client_token, **kwargs)
else:
(data) = self.sentiment_with_http_info(text, client_token, **kwargs)
return data
def sentiment_with_http_info(self, text, client_token, **kwargs):
"""
Analyzes the sentiment of the content
The response will be a Sentiment Weightage. -1 is most negative and +1 is most positive. 0 will be neutral
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.sentiment_with_http_info(text, client_token, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str text: Sentence whose sentiment is to be found out (required)
:param str client_token: Use the Client Token. Please generate it from the Applications section under the Production & Sandbox tabs (required)
:return: VerveResponseSentiment
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['text', 'client_token']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method sentiment" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'text' is set
if ('text' not in params) or (params['text'] is None):
raise ValueError("Missing the required parameter `text` when calling `sentiment`")
# verify the required parameter 'client_token' is set
if ('client_token' not in params) or (params['client_token'] is None):
raise ValueError("Missing the required parameter `client_token` when calling `sentiment`")
resource_path = '/ml/sentiment'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'text' in params:
query_params['text'] = params['text']
header_params = {}
if 'client_token' in params:
header_params['clientToken'] = params['client_token']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['default']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='VerveResponseSentiment',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'))
| 49.375455
| 221
| 0.612561
| 6,052
| 54,313
| 5.318903
| 0.052049
| 0.046474
| 0.036036
| 0.017894
| 0.945666
| 0.937838
| 0.935663
| 0.93119
| 0.924946
| 0.91836
| 0
| 0.00157
| 0.308048
| 54,313
| 1,099
| 222
| 49.420382
| 0.854957
| 0.394896
| 0
| 0.779468
| 0
| 0
| 0.228468
| 0.044131
| 0
| 0
| 0
| 0
| 0
| 1
| 0.032319
| false
| 0
| 0.013308
| 0
| 0.093156
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
3658b8809bafd4d3ddfaa5716ec834691ec72232
| 90
|
py
|
Python
|
tests/test_wireless.py
|
N7SALab/HEV
|
d449a2ba4eeb07127b97befd0a58d37279ed8a36
|
[
"Apache-2.0"
] | null | null | null |
tests/test_wireless.py
|
N7SALab/HEV
|
d449a2ba4eeb07127b97befd0a58d37279ed8a36
|
[
"Apache-2.0"
] | 1
|
2021-06-02T01:10:50.000Z
|
2021-06-02T01:10:50.000Z
|
tests/test_wireless.py
|
N7SALab/HEV
|
d449a2ba4eeb07127b97befd0a58d37279ed8a36
|
[
"Apache-2.0"
] | null | null | null |
from core.helpers import wireless
def disabled_test_Wireless():
wireless.Wireless()
| 15
| 33
| 0.777778
| 11
| 90
| 6.181818
| 0.727273
| 0.470588
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144444
| 90
| 5
| 34
| 18
| 0.883117
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
366450067e7be59250f70b8121fe887a41929203
| 3,027
|
py
|
Python
|
src/processing/preprocess/preprocess_ts_gs.py
|
wbsg-uni-mannheim/productbert-intermediate
|
4d77b1f82dc57f1716649f94c80db77d080777d3
|
[
"BSD-3-Clause"
] | 7
|
2021-06-18T01:48:27.000Z
|
2022-03-23T01:46:08.000Z
|
src/processing/preprocess/preprocess_ts_gs.py
|
Web-based-Systems-Group/productbert-intermediate
|
4d77b1f82dc57f1716649f94c80db77d080777d3
|
[
"BSD-3-Clause"
] | 5
|
2021-06-08T22:13:04.000Z
|
2022-03-12T00:44:19.000Z
|
src/processing/preprocess/preprocess_ts_gs.py
|
Web-based-Systems-Group/productbert-intermediate
|
4d77b1f82dc57f1716649f94c80db77d080777d3
|
[
"BSD-3-Clause"
] | 2
|
2020-08-31T16:04:46.000Z
|
2020-12-14T12:41:28.000Z
|
import pandas as pd
import numpy as np
np.random.seed(42)
import random
random.seed(42)
import os
import glob
from src.data import utils
if __name__ == '__main__':
# preprocess training sets and gold standards
print('BUILDING PREPROCESSED TRAINING SETS AND GOLD STANDARDS...')
os.makedirs(os.path.dirname('../../../data/interim/wdc-lspc/training-sets/'), exist_ok=True)
os.makedirs(os.path.dirname('../../../data/interim/wdc-lspc/gold-standards/'), exist_ok=True)
for file in glob.glob('../../../data/raw/wdc-lspc/training-sets/*'):
df = pd.read_json(file, lines=True)
df['title_left'] = df['title_left'].apply(utils.clean_string_wdcv2)
df['description_left'] = df['description_left'].apply(utils.clean_string_wdcv2)
df['brand_left'] = df['brand_left'].apply(utils.clean_string_wdcv2)
df['price_left'] = df['price_left'].apply(utils.clean_string_wdcv2)
df['specTableContent_left'] = df['specTableContent_left'].apply(utils.clean_specTableContent_wdcv2)
df['title_right'] = df['title_right'].apply(utils.clean_string_wdcv2)
df['description_right'] = df['description_right'].apply(utils.clean_string_wdcv2)
df['brand_right'] = df['brand_right'].apply(utils.clean_string_wdcv2)
df['price_right'] = df['price_right'].apply(utils.clean_string_wdcv2)
df['specTableContent_right'] = df['specTableContent_right'].apply(utils.clean_specTableContent_wdcv2)
file = os.path.basename(file)
file = file.replace('.json.gz', '.pkl.gz')
file = f'preprocessed_{file}'
df.to_pickle(f'../../../data/interim/wdc-lspc/training-sets/{file}')
for file in glob.glob('../../../data/raw/wdc-lspc/gold-standards/*'):
df = pd.read_json(file, lines=True)
df['title_left'] = df['title_left'].apply(utils.clean_string_wdcv2)
df['description_left'] = df['description_left'].apply(utils.clean_string_wdcv2)
df['brand_left'] = df['brand_left'].apply(utils.clean_string_wdcv2)
df['price_left'] = df['price_left'].apply(utils.clean_string_wdcv2)
df['specTableContent_left'] = df['specTableContent_left'].apply(utils.clean_specTableContent_wdcv2)
df['title_right'] = df['title_right'].apply(utils.clean_string_wdcv2)
df['description_right'] = df['description_right'].apply(utils.clean_string_wdcv2)
df['brand_right'] = df['brand_right'].apply(utils.clean_string_wdcv2)
df['price_right'] = df['price_right'].apply(utils.clean_string_wdcv2)
df['specTableContent_right'] = df['specTableContent_right'].apply(utils.clean_specTableContent_wdcv2)
try:
df = df.drop(columns='sampling')
except KeyError:
pass
file = os.path.basename(file)
file = file.replace('.json.gz', '.pkl.gz')
file = f'preprocessed_{file}'
df.to_pickle(f'../../../data/interim/wdc-lspc/gold-standards/{file}')
print('FINISHED BUILDING PREPROCESSED TRAINING SETS AND GOLD STANDARDS...')
| 52.189655
| 109
| 0.681203
| 399
| 3,027
| 4.927318
| 0.175439
| 0.101729
| 0.152594
| 0.170905
| 0.874873
| 0.860631
| 0.835198
| 0.786368
| 0.786368
| 0.713123
| 0
| 0.009386
| 0.155269
| 3,027
| 57
| 110
| 53.105263
| 0.759484
| 0.014205
| 0
| 0.571429
| 0
| 0
| 0.349547
| 0.151292
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.020408
| 0.122449
| 0
| 0.122449
| 0.040816
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
36a569de73b7387a4d9b45d13502ceeb6c069e30
| 77
|
py
|
Python
|
np_obb/__init__.py
|
VolkerH/np_obb
|
51080e13b50e202c418c3bd9263e7f7ec468e0e4
|
[
"BSD-3-Clause"
] | 4
|
2019-03-04T04:39:25.000Z
|
2022-03-17T01:28:07.000Z
|
np_obb/__init__.py
|
VolkerH/np_obb
|
51080e13b50e202c418c3bd9263e7f7ec468e0e4
|
[
"BSD-3-Clause"
] | 10
|
2019-02-27T03:07:24.000Z
|
2020-07-13T04:13:40.000Z
|
np_obb/__init__.py
|
VolkerH/np_obb
|
51080e13b50e202c418c3bd9263e7f7ec468e0e4
|
[
"BSD-3-Clause"
] | 2
|
2019-03-04T05:13:29.000Z
|
2020-08-04T08:04:35.000Z
|
from .obb import get_obb_from_labelim, get_obb_from_mask, get_obb_from_points
| 77
| 77
| 0.896104
| 15
| 77
| 4
| 0.466667
| 0.3
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064935
| 77
| 1
| 77
| 77
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
7fdb78d43ca085321df8066a9f1061b4434059e6
| 186
|
py
|
Python
|
mayan/apps/document_states/models/__init__.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 2
|
2021-09-12T19:41:19.000Z
|
2021-09-12T19:41:20.000Z
|
mayan/apps/document_states/models/__init__.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 37
|
2021-09-13T01:00:12.000Z
|
2021-10-02T03:54:30.000Z
|
mayan/apps/document_states/models/__init__.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 1
|
2021-09-22T13:17:30.000Z
|
2021-09-22T13:17:30.000Z
|
from .workflow_instance_models import * # NOQA
from .workflow_models import * # NOQA
from .workflow_state_models import * # NOQA
from .workflow_transition_models import * # NOQA
| 37.2
| 50
| 0.763441
| 23
| 186
| 5.869565
| 0.347826
| 0.355556
| 0.474074
| 0.444444
| 0.622222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172043
| 186
| 4
| 51
| 46.5
| 0.876623
| 0.102151
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
3d4006c7e81a6bff017e1f7765a586c581aa910f
| 146
|
py
|
Python
|
stockanalysis/stocks/utils/conversion_type.py
|
ccortezaguilera/StockAnalysis
|
e1ad8481da11725a89a659f4077b1bb8251514d9
|
[
"MIT"
] | null | null | null |
stockanalysis/stocks/utils/conversion_type.py
|
ccortezaguilera/StockAnalysis
|
e1ad8481da11725a89a659f4077b1bb8251514d9
|
[
"MIT"
] | 4
|
2021-07-10T03:35:37.000Z
|
2021-07-10T03:41:55.000Z
|
stockanalysis/stocks/utils/conversion_type.py
|
ccortezaguilera/StockAnalysis
|
e1ad8481da11725a89a659f4077b1bb8251514d9
|
[
"MIT"
] | 1
|
2020-12-27T19:50:55.000Z
|
2020-12-27T19:50:55.000Z
|
from ..common.constants import CONVERSION_TYPES
def get_conversion_type(conversion_type: str):
return CONVERSION_TYPES.get(conversion_type)
| 24.333333
| 48
| 0.828767
| 19
| 146
| 6.052632
| 0.578947
| 0.365217
| 0.295652
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10274
| 146
| 5
| 49
| 29.2
| 0.877863
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 8
|
3d4c0b2bcfd83bad5f9aa7f9aff6be83560d171b
| 2,395
|
py
|
Python
|
tests/test_whcs_annotator.py
|
dasaku-ai/nlpmodel-v-h
|
326bb9467df11d517285610c70f9d22627eb5efc
|
[
"Apache-2.0"
] | null | null | null |
tests/test_whcs_annotator.py
|
dasaku-ai/nlpmodel-v-h
|
326bb9467df11d517285610c70f9d22627eb5efc
|
[
"Apache-2.0"
] | 1
|
2022-02-02T09:26:44.000Z
|
2022-02-02T09:26:44.000Z
|
tests/test_whcs_annotator.py
|
dasaku-ai/nlpmodel-v-h
|
326bb9467df11d517285610c70f9d22627eb5efc
|
[
"Apache-2.0"
] | null | null | null |
import pytest
from nlp_annotator_api.annotators.WatsonHealthAnnotator import WatsonHealthAnnotator
object_type = "text"
@pytest.fixture
def annotator():
return WatsonHealthAnnotator()
def test_empty_returns_empty(annotator):
texts = []
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == 0
def test_annotates_one(annotator):
texts = ['Hello']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_annotates_many_texts(annotator):
texts = ['Hello', 'world']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_handles_one_empty_input(annotator):
texts = ['']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_handles_many_empty_inputs(annotator):
texts = ['', '']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_handles_mixed_empty_and_non_empty_inputs(annotator):
texts = ['', 'Hello']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_skips_very_large_input(annotator):
with open('./tests/large_text.txt', 'r') as text_reader:
texts = [text_reader.read()]
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_skips_very_large_inputs_but_keeps_small_ones_after(annotator):
with open('./tests/large_text.txt', 'r') as text_reader:
texts = [text_reader.read(), 'Hello again']
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
def test_skips_very_large_inputs_but_keeps_small_ones_before(annotator):
with open('./tests/large_text.txt', 'r') as text_reader:
texts = ['Hello again', text_reader.read()]
entities = annotator.annotate_batched_entities(object_type, texts, annotator.get_entity_names())
assert len(entities) == len(texts)
| 28.176471
| 100
| 0.746973
| 299
| 2,395
| 5.64214
| 0.187291
| 0.059277
| 0.133373
| 0.170717
| 0.803201
| 0.803201
| 0.803201
| 0.803201
| 0.803201
| 0.803201
| 0
| 0.000486
| 0.14071
| 2,395
| 84
| 101
| 28.511905
| 0.819242
| 0
| 0
| 0.444444
| 0
| 0
| 0.048017
| 0.027557
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.222222
| false
| 0
| 0.044444
| 0.022222
| 0.288889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
3d541bab54127aca0ef26fb044cae0f9e3acbba4
| 2,421
|
py
|
Python
|
src/Diagnostics/SampleForTest/testdispatch.py
|
coolmay/hpcpack-acm
|
8c367148e8e9655a497b9589e9d1050faba02382
|
[
"MIT"
] | null | null | null |
src/Diagnostics/SampleForTest/testdispatch.py
|
coolmay/hpcpack-acm
|
8c367148e8e9655a497b9589e9d1050faba02382
|
[
"MIT"
] | null | null | null |
src/Diagnostics/SampleForTest/testdispatch.py
|
coolmay/hpcpack-acm
|
8c367148e8e9655a497b9589e9d1050faba02382
|
[
"MIT"
] | null | null | null |
import sys
sys.stdin.read()
print("""[{\"JobId\":5
,\"Id\":1,\"RequeueCount\":0,
\"JobType\":1,\"ParentIds\":null,
\"ChildIds\":null,\"RemainingParentIds\":null,
\"CommandLine\":\"env & sleep 10 & hostname & date\",
\"Node\":\"evancvmss000001\",
\"UserName\":\"testusername\",
\"EnvironmentVariables\": { \"TestVar1\":\"testvalue1\", \"TestVar2\": \"testvalue2\" },
\"Password\":null,\"PrivateKey\":\"-----BEGIN RSA PRIVATE KEY-----\\nMIIEowIBAAKCAQEA06bdmM5tU/InWfakBnAltIA2WEvuZ/3qFwaT4EkmgJuEITxi+3NnXn7JfW+q\\n6ezBc4lx6J0EuPggDIcslbczyz65QrB2NoH7De1PiRtWNWIonQDZHTYCbnaU3f/Nzsoj62lgfkSf\\nUj4Osxd0yHCuGsfCtKMDES3d55RMUdVwbrXPL8jUqA9zh4miV9eX0dh/+6pCqPD7/dnOCy/rYtXs\\nwgdjKG57O6eaT3XxiuozP00E5tZ7wF0fzzXBuA2Z21Sa2U42sOeeNuOvOuKQkrIzprhHhpDik31m\\nHZK47F7eF2i7j/0ImedOFdgA1ETPPKFLSGspvf1xbHgEgGz1kjFq/QIEAAEAAQKCAQABHZ2IW741\\n7RKWsq6J3eIBzKRJft4J7G3tvJxW8e3nOpVNuSXEbUssu/HUOoLdVVhuHPN/1TUgf69oXTtiRIVc\\nLIPNwcrGRGHwaP0JJKdY4gallLFMCB9i5FkhnJXbaiJvq+ndoqnnAPLf9GfVDqhV5Jqc8nxeDZ2T\\nks037GobtfMuO5WeCyTAMzc7tDIsn0HGyV0pSa7JFHAKorUuBMNnjEM+SBL37AqwcVFkstC4YD3I\\n7j4miRE3loxPmBJs5HMTV4jpAGNbNmrPzfrmP4swHNoc9LR7YKpfzVpAzb24QY82fewvOxRZH6Hz\\nBVhueJZAGV62JbBeaw9eeujDp+UBAoGBAN6IanPN/wqdqQ0i5dBwPK/0Mcq6bNtQt6n8rHD/C/xL\\nFuhuRhLPI6q7sYPeSZu84EjyArLMR1o0GW90Ls4JzIxjxGCBgdUHG8YdmB9jNIjR5notYQcRNxaw\\nwLuc5nurPt7QaxvqO3JcaDbw9c6q9c7xNE3Wlak4xxKeiXsWyHQdAoGBAPN7hpqISKIc+8dPc5kg\\nuJDDPdFcJ8py0nbysEYtY+hUaDxfw7Cm8zrNj+M9BbQR9yM6EW16P0FQ+/0XBrLMVpRkyJZ0Y3Ij\\n5Qol5IxJPyWzfj6e7cd9Rkvqs2sQcBehXCbQHjfpB12yu3excQBPT0Lr5gei7yfc+D21hGWDH1xh\\nAoGAM2lm1qxf4O790HggiiB0FN6g5kpdvemPFSm4GT8DYN1kRHy9mbjbb6V/ZIzliqJ/Wrr23qIN\\nVgy1V6eK7LUc2c5u3zDscu/6fbH2pEHCMF32FoIHaZ+Tj510WaPtJ+MvWkDijgd2hnxM42yWDZI3\\nygC16cnKt9bTPzz7XEGuPA0CgYBco2gQTcAM5igpqiIaZeezNIXFrWF6VnubRDUrTkPP9qV+KxWC\\nldK/UczoMaSE4bz9Cy/sTnHYwR5PKj6jMrnSVhI3pGrd16hiVw6BDbFX/9YNr1xa5WAkrFS9bJCp\\nfPxZzB9jOGdUEBfhr4KGEqbemHB6AVUq/pj4qaKJGP2KoQKBgFt7cqr8t+0zU5ko+B2pxmMprsUx\\nqZ3mBATMD21AshxWxsawpqoPJJ3NTScNrjISERQ6RG3lQNv+30z79k9Fy+5FUH4pvqU4sgmtYSVH\\nM4xW+aJnEhzIbE7a4an2eTc0pAxc9GexwtCFwlBouSW6kfOcMgEysoy99wQoGNgRHY/D\\n-----END RSA PRIVATE KEY-----\",
\"PublicKey\":null},
{\"JobId\":5,\"Id\":2,\"RequeueCount\":0,\"JobType\":1,\"ParentIds\":[1],\"ChildIds\":null,\"RemainingParentIds\":[],
\"CommandLine\":\"hostname & date & env\",\"Node\":\"evancvmss000002\",\"UserName\":null,\"Password\":null,\"PrivateKey\":null,\"PublicKey\":null}]""")
| 161.4
| 1,753
| 0.840149
| 137
| 2,421
| 14.846715
| 0.751825
| 0.0059
| 0.007866
| 0.020649
| 0.029499
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118837
| 0.019827
| 2,421
| 14
| 1,754
| 172.928571
| 0.738306
| 0
| 0
| 0
| 0
| 0.214286
| 0.982652
| 0.912846
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| true
| 0.142857
| 0.071429
| 0
| 0.071429
| 0.071429
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 9
|
1815a9e1aec5d927cf7cd0ccf1b4dbb97054846d
| 6,559
|
py
|
Python
|
test/client/test_read_memory_by_address.py
|
autopi-io/py-udsoncan
|
2351ee02bf4a70e5661d6fd5f48f58db740f244e
|
[
"MIT"
] | 1
|
2021-03-21T12:18:23.000Z
|
2021-03-21T12:18:23.000Z
|
test/client/test_read_memory_by_address.py
|
autopi-io/py-udsoncan
|
2351ee02bf4a70e5661d6fd5f48f58db740f244e
|
[
"MIT"
] | null | null | null |
test/client/test_read_memory_by_address.py
|
autopi-io/py-udsoncan
|
2351ee02bf4a70e5661d6fd5f48f58db740f244e
|
[
"MIT"
] | null | null | null |
from __future__ import with_statement
from __future__ import absolute_import
from test.ClientServerTest import ClientServerTest
from udsoncan import MemoryLocation
from udsoncan.exceptions import *
# Note :
# MemoryLocation object is unit tested in a separate file (test_helper_class).
# As it is the only parameter to be passed, no need to push this test too far for nothing.
class TestReadMemoryByAddress(ClientServerTest):
def test_4byte_block(self):
request = self.conn.touserqueue.get(timeout=0.2)
self.assertEqual(request, "\x23\x12\x12\x34\x04")
self.conn.fromuserqueue.put("\x63\x99\x88\x77\x66")
def _test_4byte_block(self):
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertEqual(response.service_data.memory_block, '\x99\x88\x77\x66')
def test_4byte_block_spr_no_effect(self):
request = self.conn.touserqueue.get(timeout=0.2)
self.assertEqual(request, "\x23\x12\x12\x34\x04")
self.conn.fromuserqueue.put("\x63\x99\x88\x77\x66")
def _test_4byte_block_spr_no_effect(self):
with self.udsclient.suppress_positive_response:
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertEqual(response.service_data.memory_block, '\x99\x88\x77\x66')
def test_config_format(self):
request = self.conn.touserqueue.get(timeout=0.2)
self.assertEqual(request, "\x23\x24\x00\x00\x12\x34\x00\x04")
self.conn.fromuserqueue.put("\x63\x99\x88\x77\x66")
def _test_config_format(self):
self.udsclient.config[u'server_address_format'] = 32
self.udsclient.config[u'server_memorysize_format'] = 16
self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4))
def test_4byte_block_zeropadding_ok(self):
data = "\x63\x99\x88\x77\x66"
for i in xrange(8):
self.wait_request_and_respond(data + '\x00'*(i+1))
def _test_4byte_block_zeropadding_ok(self):
self.udsclient.config[u'tolerate_zero_padding'] = True
for i in xrange(8):
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertEqual(response.service_data.memory_block, '\x99\x88\x77\x66')
def test_4byte_block_zeropadding_not_ok_exception(self):
data = "\x63\x99\x88\x77\x66"
for i in xrange(8):
self.wait_request_and_respond(data + '\x00'*(i+1))
def _test_4byte_block_zeropadding_not_ok_exception(self):
self.udsclient.config[u'tolerate_zero_padding'] = False
for i in xrange(8):
with self.assertRaises(UnexpectedResponseException):
self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
def test_4byte_block_zeropadding_not_ok_no_exception(self):
data = "\x63\x99\x88\x77\x66"
for i in xrange(8):
self.wait_request_and_respond(data + '\x00'*(i+1))
def _test_4byte_block_zeropadding_not_ok_no_exception(self):
self.udsclient.config[u'tolerate_zero_padding'] = False
self.udsclient.config[u'exception_on_unexpected_response'] = False
for i in xrange(8):
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertTrue(response.valid)
self.assertTrue(response.unexpected)
def test_request_denied_exception(self):
self.wait_request_and_respond("\x7F\x23\x45") #Request Out Of Range
def _test_request_denied_exception(self):
with self.assertRaises(NegativeResponseException) as handle:
self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
def test_request_denied_no_exception(self):
self.wait_request_and_respond("\x7F\x23\x45") #Request Out Of Range
def _test_request_denied_no_exception(self):
self.udsclient.config[u'exception_on_negative_response'] = False
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertTrue(response.valid)
self.assertFalse(response.positive)
def test_request_invalid_service_exception(self):
self.wait_request_and_respond("\x00\x45") #Inexistent Service
def _test_request_invalid_service_exception(self):
with self.assertRaises(InvalidResponseException) as handle:
self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
def test_request_invalid_service_no_exception(self):
self.wait_request_and_respond("\x00\x45") #Inexistent Service
def _test_request_invalid_service_no_exception(self):
self.udsclient.config[u'exception_on_invalid_response'] = False
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertFalse(response.valid)
def test_wrong_service_exception(self):
self.wait_request_and_respond("\x7E\x99\x88\x77\x66") # Valid but wrong service (Tester Present)
def _test_wrong_service_exception(self):
with self.assertRaises(UnexpectedResponseException) as handle:
self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
def test_wrong_service_no_exception(self):
self.wait_request_and_respond("\x7E\x99\x88\x77\x66") # Valid but wrong service (Tester Present)
def _test_wrong_service_no_exception(self):
self.udsclient.config[u'exception_on_unexpected_response'] = False
response = self.udsclient.read_memory_by_address(MemoryLocation(address=0x1234, memorysize=4, address_format=16, memorysize_format=8))
self.assertTrue(response.valid)
self.assertTrue(response.unexpected)
def test_bad_param(self):
pass
def _test_bad_param(self):
with self.assertRaises(ValueError):
self.udsclient.read_memory_by_address(1)
with self.assertRaises(ValueError):
self.udsclient.read_memory_by_address(u'aaa')
| 49.315789
| 146
| 0.737308
| 859
| 6,559
| 5.341094
| 0.151339
| 0.039669
| 0.051874
| 0.070183
| 0.86116
| 0.834133
| 0.811465
| 0.797079
| 0.781822
| 0.742807
| 0
| 0.054167
| 0.164049
| 6,559
| 132
| 147
| 49.689394
| 0.782601
| 0.050617
| 0
| 0.51
| 0
| 0
| 0.091041
| 0.042303
| 0
| 0
| 0.011581
| 0
| 0.19
| 1
| 0.26
| false
| 0.01
| 0.05
| 0
| 0.32
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
1822991a3764ec948ca4ac44c866e64d2d5ec7bf
| 3,081
|
py
|
Python
|
python/ray/tests/test_actor_pool.py
|
sunho/ray
|
0ac8138b26cc66978df150c89ef291263f23c9a1
|
[
"Apache-2.0"
] | 2
|
2019-06-17T12:38:24.000Z
|
2020-11-11T07:52:26.000Z
|
python/ray/tests/test_actor_pool.py
|
sunho/ray
|
0ac8138b26cc66978df150c89ef291263f23c9a1
|
[
"Apache-2.0"
] | 3
|
2018-08-15T19:19:25.000Z
|
2021-06-30T01:54:46.000Z
|
python/ray/tests/test_actor_pool.py
|
sunho/ray
|
0ac8138b26cc66978df150c89ef291263f23c9a1
|
[
"Apache-2.0"
] | 2
|
2017-10-31T23:20:07.000Z
|
2019-11-13T20:16:03.000Z
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import pytest
import ray
from ray.experimental import ActorPool
@pytest.fixture
def init():
ray.init(num_cpus=4)
yield
ray.shutdown()
def test_get_next(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
return x + 1
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
for i in range(5):
pool.submit(lambda a, v: a.f.remote(v), i)
assert pool.get_next() == i + 1
def test_get_next_unordered(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
return x + 1
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
total = []
for i in range(5):
pool.submit(lambda a, v: a.f.remote(v), i)
while pool.has_next():
total += [pool.get_next_unordered()]
assert all(elem in [1, 2, 3, 4, 5] for elem in total)
def test_map(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
return x + 1
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
index = 0
for v in pool.map(lambda a, v: a.double.remote(v), range(5)):
assert v == 2 * index
index += 1
def test_map_unordered(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
return x + 1
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
total = []
for v in pool.map(lambda a, v: a.double.remote(v), range(5)):
total += [v]
assert all(elem in [0, 2, 4, 6, 8] for elem in total)
def test_get_next_timeout(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
while (True):
x = x + 1
time.sleep(1)
return None
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
pool.submit(lambda a, v: a.f.remote(v), 0)
with pytest.raises(TimeoutError):
pool.get_next_unordered(5)
def test_get_next_unordered_timeout(init):
@ray.remote
class MyActor:
def __init__(self):
pass
def f(self, x):
while (True):
x + 1
time.sleep(1)
return
def double(self, x):
return 2 * x
actors = [MyActor.remote() for _ in range(4)]
pool = ActorPool(actors)
pool.submit(lambda a, v: a.f.remote(v), 0)
with pytest.raises(TimeoutError):
pool.get_next_unordered(5)
| 20.677852
| 65
| 0.545278
| 423
| 3,081
| 3.810875
| 0.153664
| 0.037221
| 0.068238
| 0.066998
| 0.771712
| 0.748759
| 0.700993
| 0.700993
| 0.700993
| 0.700993
| 0
| 0.021277
| 0.344044
| 3,081
| 148
| 66
| 20.817568
| 0.776348
| 0
| 0
| 0.71028
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037383
| 1
| 0.233645
| false
| 0.056075
| 0.065421
| 0.093458
| 0.46729
| 0.009346
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
182a11d62795573191481a44557ae5648139af70
| 9,902
|
py
|
Python
|
tests/test_rule_m3xx.py
|
zreichert/pytest_mark_checker
|
990a579635b3ba394a9780f6ab934e4983b00ef1
|
[
"Apache-2.0"
] | null | null | null |
tests/test_rule_m3xx.py
|
zreichert/pytest_mark_checker
|
990a579635b3ba394a9780f6ab934e4983b00ef1
|
[
"Apache-2.0"
] | 6
|
2018-04-24T14:00:08.000Z
|
2018-09-14T15:06:13.000Z
|
tests/test_rule_m3xx.py
|
zreichert/pytest_mark_checker
|
990a579635b3ba394a9780f6ab934e4983b00ef1
|
[
"Apache-2.0"
] | 1
|
2018-04-26T15:51:00.000Z
|
2018-04-26T15:51:00.000Z
|
# -*- coding: utf-8 -*-
# ======================================================================================================================
# imports
# ======================================================================================================================
import pytest
# ======================================================================================================================
# Globals
# ======================================================================================================================
# args to only use checks that raise an 'M' prefixed error
extra_args = ['--select', 'M']
# ======================================================================================================================
# Tests
# ======================================================================================================================
def test_duplicate_value_in_same_file(flake8dir, mocker):
"""Verify that rule3xx violations are reported when the same value is repeated for marks declared to be unqiue
within a single file.
"""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test,allow_duplicate=true,enforce_unique_value=true
""")
flake8dir.make_example_py("""
@pytest.mark.test('Unique!')
def test_unique():
pass
@pytest.mark.test('Unique!')
def test_not_unique():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = ["./example.py:5:1: M301 @pytest.mark.test value is not unique! "
"The 'Unique!' mark value already specified for the 'test_unique' test at line '1' found in the "
"'./example.py' file!"]
# Test
result = flake8dir.run_flake8(extra_args)
# noinspection PyUnresolvedReferences
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
def test_duplicate_value_in_same_mark(flake8dir, mocker):
"""Verify that rule3xx violations are reported when the same value is repeated for marks declared to be unqiue
within a multi-argument mark.
"""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test,allow_duplicate=true,allow_multiple_args=true,enforce_unique_value=true
""")
flake8dir.make_example_py("""
@pytest.mark.test('Unique!', 'Unique!')
def test_not_so_unique():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = ["./example.py:1:1: M301 @pytest.mark.test value is not unique! "
"The 'Unique!' mark value already specified for the 'test_not_so_unique' test at line '1' "
"found in the './example.py' file!"]
# Test
result = flake8dir.run_flake8(extra_args)
# noinspection PyUnresolvedReferences
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
# noinspection PyUnresolvedReferences
def test_duplicate_value_in_different_files(flake8dir, mocker):
"""Verify that rule3xx violations are reported when the same value is repeated for marks declared to be unqiue
across different files.
"""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test,enforce_unique_value=true
""")
flake8dir.make_py_files(
example1="""
@pytest.mark.test('Unique!')
def test_unique():
pass
""",
example2="""
@pytest.mark.test('Unique!')
def test_not_so_unique():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = ["./example2.py:1:1: M301 @pytest.mark.test value is not unique! "
"The 'Unique!' mark value already specified for the 'test_unique' test at line '1' "
"found in the './example1.py' file!"]
exp_out_lines_reverse = ["./example1.py:1:1: M301 @pytest.mark.test value is not unique! "
"The 'Unique!' mark value already specified for the 'test_not_so_unique' test at line '1' "
"found in the './example2.py' file!"]
# Test
result = flake8dir.run_flake8(extra_args)
# Given that certain Linux distros will have Python walk directories in non-deterministic fashion the failure
# might happen in reverse order.
try:
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
except AssertionError:
pytest.helpers.assert_lines(exp_out_lines_reverse, result.out_lines)
# noinspection PyUnresolvedReferences
def test_duplicate_values_for_multiple_rules(flake8dir, mocker):
"""Verify that rule3xx violations are reported when the same value is repeated for marks declared to be unqiue
across different files with multiple rules.
"""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test1,enforce_unique_value=true
pytest_mark2 = name=test2,enforce_unique_value=true
""")
flake8dir.make_py_files(
example1="""
@pytest.mark.test1('Unique!')
@pytest.mark.test2('Also quite unique!')
def test_unique1():
pass
@pytest.mark.test1('Very Unique!')
@pytest.mark.test2('Also unique!')
def test_unique2():
pass
""",
example2="""
@pytest.mark.test1('Unique!')
@pytest.mark.test2('Also very unique!')
def test_unique3():
pass
@pytest.mark.test1('So Unique!')
@pytest.mark.test2('Also unique!')
def test_unique4():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = ["./example2.py:1:1: M301 @pytest.mark.test1 value is not unique! "
"The 'Unique!' mark value already specified for the 'test_unique1' test at line '1' "
"found in the './example1.py' file!",
"./example2.py:5:1: M302 @pytest.mark.test2 value is not unique! "
"The 'Also unique!' mark value already specified for the 'test_unique2' test at line '5' "
"found in the './example1.py' file!"]
exp_out_lines_reverse = ["./example1.py:1:1: M301 @pytest.mark.test1 value is not unique! "
"The 'Unique!' mark value already specified for the 'test_unique3' test at line '1' "
"found in the './example2.py' file!",
"./example1.py:5:1: M302 @pytest.mark.test2 value is not unique! "
"The 'Also unique!' mark value already specified for the 'test_unique4' test at line '5' "
"found in the './example2.py' file!"]
# Test
result = flake8dir.run_flake8(extra_args)
# Given that certain Linux distros will have Python walk directories in non-deterministic fashion the failure
# might happen in reverse order.
try:
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
except AssertionError:
pytest.helpers.assert_lines(exp_out_lines_reverse, result.out_lines)
def test_all_unique_values(flake8dir, mocker):
"""Verify that rule 3xx will report no violations if enabled and all marks are unique."""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test1,enforce_unique_value=true
pytest_mark2 = name=test2,enforce_unique_value=true
""")
flake8dir.make_py_files(
example1="""
@pytest.mark.test1('Unique!')
@pytest.mark.test2('Also unique!')
def test_unique1():
pass
@pytest.mark.test1('Very Unique!')
@pytest.mark.test2('Also quite unique!')
def test_unique2():
pass
""",
example2="""
@pytest.mark.test1('Even more Unique!')
@pytest.mark.test2('Also much more unique!')
def test_unique3():
pass
@pytest.mark.test1('So Unique!')
@pytest.mark.test2('Much unique wow!')
def test_unique4():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = []
# Test
result = flake8dir.run_flake8(extra_args)
# noinspection PyUnresolvedReferences
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
def test_duplicate_values_with_rule_disabled(flake8dir, mocker):
"""Verify that repeated values do not report violations when rule3xx is disabled."""
# Setup
flake8dir.make_setup_cfg("""
[flake8]
pytest_mark1 = name=test
""")
flake8dir.make_py_files(
example1="""
@pytest.mark.test('Unique!')
def test_unique():
pass
""",
example2="""
@pytest.mark.test('Unique!')
def test_not_so_unique():
pass
""")
# Mock
mocker.patch.dict('flake8_pytest_mark.rules._unique_value_collision_map', {}) # Need to ensure cache cleared.
# Expectations
exp_out_lines = []
# Test
result = flake8dir.run_flake8(extra_args)
# noinspection PyUnresolvedReferences
pytest.helpers.assert_lines(exp_out_lines, result.out_lines)
| 37.793893
| 120
| 0.5714
| 1,090
| 9,902
| 4.995413
| 0.133945
| 0.067952
| 0.032323
| 0.023508
| 0.910927
| 0.903765
| 0.896786
| 0.887236
| 0.85932
| 0.84022
| 0
| 0.021938
| 0.258837
| 9,902
| 261
| 121
| 37.938697
| 0.719989
| 0.240154
| 0
| 0.776398
| 0
| 0.055901
| 0.588227
| 0.17308
| 0
| 0
| 0
| 0
| 0.062112
| 1
| 0.037267
| false
| 0.093168
| 0.006211
| 0
| 0.043478
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
a1156815970fafb240353db0599ec1114db7fb4c
| 19,645
|
py
|
Python
|
conftest.py
|
szedlakmate/truss-updater
|
b3fcadc70e375c62b0fd056936eb49104401369e
|
[
"MIT"
] | null | null | null |
conftest.py
|
szedlakmate/truss-updater
|
b3fcadc70e375c62b0fd056936eb49104401369e
|
[
"MIT"
] | null | null | null |
conftest.py
|
szedlakmate/truss-updater
|
b3fcadc70e375c62b0fd056936eb49104401369e
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import pytest
from truss_objects import Element, Truss
@pytest.fixture(scope="module")
def connection():
return [0, 1]
@pytest.fixture(scope="module")
def material():
return 1321432.12
@pytest.fixture(scope="module")
def section():
return 0.000034
@pytest.fixture(scope="module")
def element():
return Element(connection(), material(), section())
@pytest.fixture(scope="module")
def element_list():
return [[[0, 1], 4354354.1, 0.000235], [[0, 1], 4354354.1, 0.000235], [[0, 1], 4354354.1, 0.000235]]
@pytest.fixture(scope="module")
def node_list():
return [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 1.0, 1.0]]
@pytest.fixture(scope="module")
def bridge_stiffness_matrix():
return [[800.8480662820398, 122.94935542734655, 0.0, 0, 0, 0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [122.94935542734655, 40.98311847578218, 0.0, 0, 0, 0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1601.6961325640796, 0.0, 0.0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0.0, 81.96623695156435, 0.0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 953.6961325640794, 0.0, 0.0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, -216.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 1377.9662369515643, 0.0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, -1296.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 0, 0, 0, 1169.6961325640796, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -216.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -216.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 1377.9662369515643, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, -1296.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 0, 0, 0, 1601.6961325640796, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 81.96623695156435, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -216.0, 0.0, 0.0, 0, 0, 0, -368.8480662820397, -122.94935542734655, 0.0, 1169.6961325640796, 0.0, 0.0, -368.8480662820397, 122.94935542734655, 0.0, -216.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, -122.94935542734655, -40.98311847578218, 0.0, 0.0, 1377.9662369515643, 0.0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, -1296.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 1601.6961325640796, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 81.96623695156435, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -216.0, 0.0, 0.0, 0, 0, 0, -216.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 1169.6961325640796, 0.0, 0.0, -368.8480662820397, 122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0.0, 1377.9662369515643, 0.0, 122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0.0, -1296.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 1601.6961325640796, 0.0, 0.0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 81.96623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0, 0, 0, -216.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1169.6961325640796, 0.0, 0.0, -368.8480662820397, 122.94935542734655, 0.0, -216.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 1377.9662369515643, 0.0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, -1296.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 1601.6961325640796, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, -432.0, 0.0, 0.0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 81.96623695156435, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -216.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 1169.6961325640796, 0.0, 0.0, -368.8480662820397, 122.94935542734655, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, -216.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0.0, 1377.9662369515643, 0.0, 122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, -1296.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 1601.6961325640796, 0.0, 0.0, 0, 0, 0, -432.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, -432.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, 81.96623695156435, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0], [0, 0, 0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -432.0, 0.0, 0.0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -216.0, 0.0, 0.0, -368.8480662820397, -122.94935542734655, 0.0, 0, 0, 0, 0, 0, 0, 953.6961325640794, 0.0, 0.0, -368.8480662820397, 122.94935542734655, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -122.94935542734655, -40.98311847578218, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 1377.9662369515643, 0.0, 122.94935542734655, -40.98311847578218, 0.0, 0.0, -1296.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -368.8480662820397, 122.94935542734655, 0.0, 800.8480662820398, -122.94935542734655, 0.0, -432.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122.94935542734655, -40.98311847578218, 0.0, -122.94935542734655, 40.98311847578218, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -432.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, -432.0, 0.0, 0.0, 864.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, -1296.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1296.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
# TODO: Manually calculated basic 3D example should be calculated and added by components, like:
# stiffness matrix, solution, reactions, ideal update step, etc.
@pytest.fixture(scope="module")
def bridge():
return Truss('bridge.str', '', ['11Y'])
@pytest.fixture(scope="module")
def bridge_displacement():
return [0.0, 0.0, 0.0, 0.7777777777784746, -21.683208136474185, 0.0, 1.3854166666678396, -4.241651017060604, 0.0,
0.802083333333981, -21.52489045275065, 0.0, 0.048611111111145945, -8.337468700787781, 0.0,
1.2881944444455342, -12.141619717848036, 0.0, 0.194444444444601, -15.508270734907935, 0.0,
1.0937500000009177, -18.29158841863398, 0.0, 0.437500000000374, -20.345739435692725, 0.0,
0.024305555555572903, -4.241651017060604, 0.0, 0.12152777777787313, -12.141619717848034, 0.0,
0.3159722222224874, -18.291588418633985, 0.0, 0.6076388888894245, -21.524890452750654, 0.0,
0.4131944444447729, -20.674859153530097, 0.0, 1.215277777778798, -18.114887322825286, 0.0,
0.06319444444451273, -14.504915492119695, 0.0, 1.4777777777790002, -10.107443661413491, 0.0,
0.9965277777786364, -20.6748591535301, 0.0, 1.3465277777788993, -14.504915492119697, 0.0,
-0.11180555555562562, -5.184971830706875, 0.0, 1.5652777777790776, 0.0, 0.0, 1.5215277777790392,
-5.184971830706875, 0.0]
| 311.825397
| 17,502
| 0.45971
| 5,575
| 19,645
| 1.618834
| 0.021345
| 1.069917
| 1.545706
| 1.994903
| 0.883878
| 0.866039
| 0.842105
| 0.840222
| 0.83723
| 0.83723
| 0
| 0.562299
| 0.239298
| 19,645
| 62
| 17,503
| 316.854839
| 0.041622
| 0.009112
| 0
| 0.230769
| 0
| 0
| 0.003443
| 0
| 0
| 0
| 0
| 0.016129
| 0
| 1
| 0.230769
| true
| 0
| 0.051282
| 0.230769
| 0.512821
| 0
| 0
| 0
| 1
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 19
|
a1cd53e22bd42b8410a69abda087271a8c2a3b18
| 1,274
|
py
|
Python
|
zazi/core/service.py
|
felixcheruiyot/zazi-core-banking
|
0a2dac42235adcac3cf8c114961e407f54844223
|
[
"Apache-2.0"
] | null | null | null |
zazi/core/service.py
|
felixcheruiyot/zazi-core-banking
|
0a2dac42235adcac3cf8c114961e407f54844223
|
[
"Apache-2.0"
] | 1
|
2021-08-20T06:41:57.000Z
|
2021-08-20T06:41:57.000Z
|
zazi/core/service.py
|
felixcheruiyot/zazi-core-banking
|
0a2dac42235adcac3cf8c114961e407f54844223
|
[
"Apache-2.0"
] | null | null | null |
import requests
from django.conf import settings
#------------------
import logging
logger = logging.getLogger(__name__)
#------------------
def post(resource_url, api_url=settings.API_URL, data=None, json=None, auth_token=None, headers=None, referer=None):
if headers is None:
headers = {}
if auth_token:
headers.update(Authorization='Token %s' % auth_token)
headers.update(Referer=(referer or f'https://{settings.SITE_DOMAIN}'))
logger.debug(f'headers={headers}')
try:
response = requests.post(f"{api_url}{resource_url}", data=data, json=json, headers=headers)
return response.json()
except Exception as e:
logger.exception(e)
return
def get(resource_url, api_url=settings.API_URL, data=None, auth_token=None, headers=None, referer=None):
if headers is None:
headers = {}
if auth_token:
headers.update(Authorization='Token %s' % auth_token)
headers.update(Referer=(referer or f'https://{settings.SITE_DOMAIN}'))
logger.debug(f'headers={headers}')
try:
response = requests.get(f"{api_url}{resource_url}", data=data, headers=headers)
return response.json()
except Exception as e:
logger.exception(e)
return
| 26.541667
| 116
| 0.649137
| 161
| 1,274
| 5
| 0.254658
| 0.044721
| 0.079503
| 0.109317
| 0.859627
| 0.859627
| 0.859627
| 0.795031
| 0.795031
| 0.703106
| 0
| 0
| 0.202512
| 1,274
| 47
| 117
| 27.106383
| 0.792323
| 0.028257
| 0
| 0.733333
| 0
| 0
| 0.126316
| 0.037247
| 0
| 0
| 0
| 0
| 0
| 1
| 0.066667
| false
| 0
| 0.1
| 0
| 0.3
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
629c68960d29d5dbb7bde7b27e4a2dd94b252cbd
| 1,613
|
py
|
Python
|
tests/test_provider_ns1_terraform_ns1.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 507
|
2017-07-26T02:58:38.000Z
|
2022-01-21T12:35:13.000Z
|
tests/test_provider_ns1_terraform_ns1.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 135
|
2017-07-20T12:01:59.000Z
|
2021-10-04T22:25:40.000Z
|
tests/test_provider_ns1_terraform_ns1.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 81
|
2018-02-20T17:55:28.000Z
|
2022-01-31T07:08:40.000Z
|
# tests/test_provider_ns1-terraform_ns1.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:22:51 UTC)
def test_provider_import():
import terrascript.provider.ns1_terraform.ns1
def test_resource_import():
from terrascript.resource.ns1_terraform.ns1 import ns1_apikey
from terrascript.resource.ns1_terraform.ns1 import ns1_application
from terrascript.resource.ns1_terraform.ns1 import ns1_datafeed
from terrascript.resource.ns1_terraform.ns1 import ns1_datasource
from terrascript.resource.ns1_terraform.ns1 import ns1_monitoringjob
from terrascript.resource.ns1_terraform.ns1 import ns1_notifylist
from terrascript.resource.ns1_terraform.ns1 import ns1_pulsarjob
from terrascript.resource.ns1_terraform.ns1 import ns1_record
from terrascript.resource.ns1_terraform.ns1 import ns1_team
from terrascript.resource.ns1_terraform.ns1 import ns1_user
from terrascript.resource.ns1_terraform.ns1 import ns1_zone
def test_datasource_import():
from terrascript.data.ns1_terraform.ns1 import ns1_dnssec
from terrascript.data.ns1_terraform.ns1 import ns1_record
from terrascript.data.ns1_terraform.ns1 import ns1_zone
# TODO: Shortcut imports without namespace for official and supported providers.
# TODO: This has to be moved into a required_providers block.
# def test_version_source():
#
# import terrascript.provider.ns1_terraform.ns1
#
# t = terrascript.provider.ns1_terraform.ns1.ns1()
# s = str(t)
#
# assert 'https://github.com/ns1-terraform/terraform-provider-ns1' in s
# assert '1.12.1' in s
| 30.433962
| 80
| 0.787973
| 222
| 1,613
| 5.531532
| 0.301802
| 0.185668
| 0.21987
| 0.239414
| 0.635179
| 0.607492
| 0.535831
| 0.535831
| 0
| 0
| 0
| 0.049855
| 0.141971
| 1,613
| 52
| 81
| 31.019231
| 0.837428
| 0.309981
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019231
| 0
| 1
| 0.166667
| true
| 0
| 1
| 0
| 1.166667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
62ca040010227c5dfd65401ca736f2552505e431
| 5,928
|
py
|
Python
|
test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py
|
cfculhane/autorest.python
|
8cbca95faee88d933a58bbbd17b76834faa8d387
|
[
"MIT"
] | 35
|
2018-04-03T12:15:53.000Z
|
2022-03-11T14:03:34.000Z
|
test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py
|
cfculhane/autorest.python
|
8cbca95faee88d933a58bbbd17b76834faa8d387
|
[
"MIT"
] | 652
|
2017-08-28T22:44:41.000Z
|
2022-03-31T21:20:31.000Z
|
test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py
|
cfculhane/autorest.python
|
8cbca95faee88d933a58bbbd17b76834faa8d387
|
[
"MIT"
] | 29
|
2017-08-28T20:57:01.000Z
|
2022-03-11T14:03:38.000Z
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
try:
from ._request_builders_py3 import build_param_existing_key_request
from ._request_builders_py3 import build_response_existing_key_request
from ._request_builders_py3 import build_param_protected_key_request
from ._request_builders_py3 import build_response_protected_key_request
from ._request_builders_py3 import build_param_integer_request
from ._request_builders_py3 import build_response_integer_request
from ._request_builders_py3 import build_param_long_request
from ._request_builders_py3 import build_response_long_request
from ._request_builders_py3 import build_param_float_request
from ._request_builders_py3 import build_response_float_request
from ._request_builders_py3 import build_param_double_request
from ._request_builders_py3 import build_response_double_request
from ._request_builders_py3 import build_param_bool_request
from ._request_builders_py3 import build_response_bool_request
from ._request_builders_py3 import build_param_string_request
from ._request_builders_py3 import build_response_string_request
from ._request_builders_py3 import build_param_date_request
from ._request_builders_py3 import build_response_date_request
from ._request_builders_py3 import build_param_datetime_request
from ._request_builders_py3 import build_response_datetime_request
from ._request_builders_py3 import build_param_datetime_rfc1123_request
from ._request_builders_py3 import build_response_datetime_rfc1123_request
from ._request_builders_py3 import build_param_duration_request
from ._request_builders_py3 import build_response_duration_request
from ._request_builders_py3 import build_param_byte_request
from ._request_builders_py3 import build_response_byte_request
from ._request_builders_py3 import build_param_enum_request
from ._request_builders_py3 import build_response_enum_request
from ._request_builders_py3 import build_custom_request_id_request
except (SyntaxError, ImportError):
from ._request_builders import build_param_existing_key_request # type: ignore
from ._request_builders import build_response_existing_key_request # type: ignore
from ._request_builders import build_param_protected_key_request # type: ignore
from ._request_builders import build_response_protected_key_request # type: ignore
from ._request_builders import build_param_integer_request # type: ignore
from ._request_builders import build_response_integer_request # type: ignore
from ._request_builders import build_param_long_request # type: ignore
from ._request_builders import build_response_long_request # type: ignore
from ._request_builders import build_param_float_request # type: ignore
from ._request_builders import build_response_float_request # type: ignore
from ._request_builders import build_param_double_request # type: ignore
from ._request_builders import build_response_double_request # type: ignore
from ._request_builders import build_param_bool_request # type: ignore
from ._request_builders import build_response_bool_request # type: ignore
from ._request_builders import build_param_string_request # type: ignore
from ._request_builders import build_response_string_request # type: ignore
from ._request_builders import build_param_date_request # type: ignore
from ._request_builders import build_response_date_request # type: ignore
from ._request_builders import build_param_datetime_request # type: ignore
from ._request_builders import build_response_datetime_request # type: ignore
from ._request_builders import build_param_datetime_rfc1123_request # type: ignore
from ._request_builders import build_response_datetime_rfc1123_request # type: ignore
from ._request_builders import build_param_duration_request # type: ignore
from ._request_builders import build_response_duration_request # type: ignore
from ._request_builders import build_param_byte_request # type: ignore
from ._request_builders import build_response_byte_request # type: ignore
from ._request_builders import build_param_enum_request # type: ignore
from ._request_builders import build_response_enum_request # type: ignore
from ._request_builders import build_custom_request_id_request # type: ignore
__all__ = [
"build_param_existing_key_request",
"build_response_existing_key_request",
"build_param_protected_key_request",
"build_response_protected_key_request",
"build_param_integer_request",
"build_response_integer_request",
"build_param_long_request",
"build_response_long_request",
"build_param_float_request",
"build_response_float_request",
"build_param_double_request",
"build_response_double_request",
"build_param_bool_request",
"build_response_bool_request",
"build_param_string_request",
"build_response_string_request",
"build_param_date_request",
"build_response_date_request",
"build_param_datetime_request",
"build_response_datetime_request",
"build_param_datetime_rfc1123_request",
"build_response_datetime_rfc1123_request",
"build_param_duration_request",
"build_response_duration_request",
"build_param_byte_request",
"build_response_byte_request",
"build_param_enum_request",
"build_response_enum_request",
"build_custom_request_id_request",
]
| 58.693069
| 94
| 0.803138
| 740
| 5,928
| 5.851351
| 0.095946
| 0.147344
| 0.254503
| 0.147344
| 0.811316
| 0.761894
| 0.743649
| 0.734873
| 0.506467
| 0.130947
| 0
| 0.010506
| 0.132928
| 5,928
| 100
| 95
| 59.28
| 0.831907
| 0.139845
| 0
| 0
| 0
| 0
| 0.164955
| 0.164955
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.648352
| 0
| 0.648352
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
1a03256497d60536fc8d0d075defbd7a53a5e006
| 678
|
py
|
Python
|
cgi-bin/environ.py
|
pinckert/pinckert.com
|
7d6ce3e37c6c39c1deebbceb40f4442d34c20e23
|
[
"Apache-2.0"
] | 1
|
2020-07-29T22:45:07.000Z
|
2020-07-29T22:45:07.000Z
|
cgi-bin/environ.py
|
pinckert/pinckert.com
|
7d6ce3e37c6c39c1deebbceb40f4442d34c20e23
|
[
"Apache-2.0"
] | null | null | null |
cgi-bin/environ.py
|
pinckert/pinckert.com
|
7d6ce3e37c6c39c1deebbceb40f4442d34c20e23
|
[
"Apache-2.0"
] | null | null | null |
<<<<<<< HEAD
#!/usr/bin/python
import os
import sys
import json
import cgi
import cgitb
cgitb.enable()
#
# Return the server side environment variables
#
print "Content-type:application/json\n\n"
keylist = dict()
keys = os.environ.keys()
for key in keys:
keylist[key] = os.environ[key]
print json.dumps(keylist)
=======
#!/usr/bin/python
import os
import sys
import json
import cgi
import cgitb
cgitb.enable()
#
# Return the server side environment variables
#
print "Content-type:application/json\n\n"
keylist = dict()
keys = os.environ.keys()
for key in keys:
keylist[key] = os.environ[key]
print json.dumps(keylist)
>>>>>>> cb97fa344060fddee1b1b68722c1e6b281f454c7
| 17.842105
| 48
| 0.728614
| 96
| 678
| 5.145833
| 0.322917
| 0.072874
| 0.048583
| 0.072874
| 0.910931
| 0.910931
| 0.910931
| 0.910931
| 0.910931
| 0.910931
| 0
| 0.040886
| 0.134218
| 678
| 37
| 49
| 18.324324
| 0.800681
| 0.185841
| 0
| 0.888889
| 0
| 0
| 0.121324
| 0.121324
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.37037
| null | null | 0.148148
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 9
|
3d73b7de8dbd8f3f8d879f2ecbb1e4810c68c716
| 16,583
|
py
|
Python
|
adv_transfer_dataset.py
|
ZhenyuZhangUSTC/loss-landscape
|
debe6373714372c040b29a55dffa96cff99e2b8f
|
[
"MIT"
] | null | null | null |
adv_transfer_dataset.py
|
ZhenyuZhangUSTC/loss-landscape
|
debe6373714372c040b29a55dffa96cff99e2b8f
|
[
"MIT"
] | null | null | null |
adv_transfer_dataset.py
|
ZhenyuZhangUSTC/loss-landscape
|
debe6373714372c040b29a55dffa96cff99e2b8f
|
[
"MIT"
] | null | null | null |
import os
import torch
import shutil
import numpy as np
from PIL import Image
from torchvision import transforms
from torchvision.datasets import CIFAR10, CIFAR100, SVHN
from torch.utils.data import DataLoader, Subset, Dataset
# standard dataloader
def cifar10_dataloaders(batch_size=128, data_dir = 'datasets/cifar10', data_rate=1, add_normalize=True):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if add_normalize:
print('with normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
train_image_number = int(45000*data_rate)
train_set = Subset(CIFAR10(data_dir, train=True, transform=train_transform, download=True), list(range(train_image_number)))
val_set = Subset(CIFAR10(data_dir, train=True, transform=test_transform, download=True), list(range(45000, 50000)))
test_set = CIFAR10(data_dir, train=False, transform=test_transform, download=True)
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, drop_last=False, pin_memory=True)
val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return train_loader, val_loader, test_loader
def cifar10_dataloaders_generate_adv(batch_size=128, data_dir = 'datasets/cifar10', mark_normalize = False):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if mark_normalize:
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
train_set = Subset(CIFAR10(data_dir, train=True, transform=test_transform, download=True), list(range(10000)))
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=False, num_workers=2, drop_last=False, pin_memory=True)
return train_loader
def cifar10_dataloaders_2(batch_size=128, data_dir = 'datasets/cifar10', data_rate=1, add_normalize=True):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if add_normalize:
print('with normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize
])
test_transform = transforms.Compose([
transforms.Resize(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_transform = transforms.Compose([
transforms.Resize(224),
transforms.ToTensor(),
])
train_image_number = int(45000*data_rate)
train_set = Subset(CIFAR10(data_dir, train=True, transform=train_transform, download=True), list(range(train_image_number)))
val_set = Subset(CIFAR10(data_dir, train=True, transform=test_transform, download=True), list(range(45000, 50000)))
test_set = CIFAR10(data_dir, train=False, transform=test_transform, download=True)
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, drop_last=False, pin_memory=True)
val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return train_loader, val_loader, test_loader
def cifar10_dataloaders_3(batch_size=128, data_dir = 'datasets/cifar10', data_rate=1, add_normalize=True):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if add_normalize:
print('with normalize')
train_transform = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize
])
test_transform = transforms.Compose([
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
train_transform = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_transform = transforms.Compose([
transforms.ToTensor(),
])
train_image_number = int(45000*data_rate)
train_set = Subset(CIFAR10(data_dir, train=True, transform=train_transform, download=True), list(range(train_image_number)))
val_set = Subset(CIFAR10(data_dir, train=True, transform=test_transform, download=True), list(range(45000, 50000)))
test_set = CIFAR10(data_dir, train=False, transform=test_transform, download=True)
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, drop_last=False, pin_memory=True)
val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return train_loader, val_loader, test_loader
def cifar100_dataloaders(batch_size=128, data_dir = 'datasets/cifar100', data_rate=1, add_normalize=True):
normalize = transforms.Normalize(mean=[0.5071, 0.4867, 0.4408],
std=[0.2675, 0.2565, 0.2761])
if add_normalize:
print('with normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
train_image_number = int(45000*data_rate)
train_set = Subset(CIFAR100(data_dir, train=True, transform=train_transform, download=True), list(range(train_image_number)))
val_set = Subset(CIFAR100(data_dir, train=True, transform=test_transform, download=True), list(range(45000, 50000)))
test_set = CIFAR100(data_dir, train=False, transform=test_transform, download=True)
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, drop_last=False, pin_memory=True)
val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return train_loader, val_loader, test_loader
def svhn_dataloaders(batch_size=128, data_dir = 'datasets/svhn', data_rate=1, add_normalize=True):
normalize = transforms.Normalize(mean=[0.4377, 0.4438, 0.4728],
std=[0.1201, 0.1231, 0.1052])
if add_normalize:
print('with normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
train_transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
train_image_number = int(68257*data_rate)
train_set = Subset(SVHN(data_dir, split='train', transform=train_transform, download=True),list(range(train_image_number)))
val_set = Subset(SVHN(data_dir, split='train', transform=test_transform, download=True),list(range(68257,73257)))
test_set = SVHN(data_dir, split='test', transform=test_transform, download=True)
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, pin_memory=True)
val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return train_loader, val_loader, test_loader
# CIFAR-C Dataset
class CIFAR_C(Dataset):
def __init__(self, root, transform=None, severity=5, attack_type=''):
dataPath = os.path.join(root, '{}.npy'.format(attack_type))
labelPath = os.path.join(root, 'labels.npy')
self.data = np.load(dataPath)[(severity - 1) * 10000: severity * 10000]
self.label = np.load(labelPath).astype(np.long)[(severity - 1) * 10000: severity * 10000]
self.transform = transform
def __getitem__(self, idx):
img = self.data[idx]
img = Image.fromarray(img).convert('RGB')
if self.transform is not None:
img = self.transform(img)
label = self.label[idx]
return img, label
def __len__(self):
return self.data.shape[0]
def cifar10_c_dataloaders(batch_size, data_dir, severity, attack_type, add_normalize=True):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if add_normalize:
print('with normalize')
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
test_set = CIFAR_C(data_dir, transform=test_transform, severity=severity, attack_type=attack_type)
test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=False, num_workers=2, pin_memory=True)
return test_loader
# train data without augmentation
def pure_cifar10_dataloaders(batch_size=128, data_dir = 'datasets/cifar10', add_normalize=True):
normalize = transforms.Normalize(mean=[0.4914, 0.4822, 0.4465],
std=[0.2470, 0.2435, 0.2616])
if add_normalize:
print('with normalize')
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
else:
print('without normalize')
test_transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor()
])
train_set = Subset(CIFAR10(data_dir, train=True, transform=test_transform, download=True), list(range(45000)))
train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=2, pin_memory=True)
return train_loader
class VisDA17(Dataset):
def __init__(self, txt_file, root_dir, transform=transforms.ToTensor(), label_one_hot=False, portion=1.0):
"""
Args:
txt_file (string): Path to the txt file with annotations.
root_dir (string): Directory with all the images.
transform (callable, optional): Optional transform to be applied
on a sample.
"""
self.lines = open(txt_file, 'r').readlines()
self.root_dir = root_dir
self.transform = transform
self.label_one_hot = label_one_hot
self.portion = portion
self.number_classes = 12
assert portion != 0
if self.portion > 0:
self.lines = self.lines[:round(self.portion * len(self.lines))]
else:
self.lines = self.lines[round(self.portion * len(self.lines)):]
def __len__(self):
return len(self.lines)
def __getitem__(self, idx):
line = str.split(self.lines[idx])
path_img = os.path.join(self.root_dir, line[0])
image = Image.open(path_img)
image = image.convert('RGB')
if self.label_one_hot:
label = np.zeros(12, np.float32)
label[np.asarray(line[1], dtype=np.int)] = 1
else:
label = np.asarray(line[1], dtype=np.int)
label = torch.from_numpy(label)
if self.transform:
image = self.transform(image)
return image, label
def visda_loader(batch_size, data_dir, add_normalize=True):
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
if add_normalize:
print('with normalize')
train_trans = transforms.Compose([
transforms.RandomResizedCrop(size=224, scale=(0.75, 1.33)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize,
])
val_trans = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
normalize,
])
else:
print('without normalize')
train_trans = transforms.Compose([
transforms.RandomResizedCrop(size=224, scale=(0.75, 1.33)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor()
])
val_trans = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor()
])
train_dataset = VisDA17(txt_file=os.path.join(data_dir, "train/image_list.txt"),
root_dir=os.path.join(data_dir, "train"), transform=train_trans)
val_dataset = VisDA17(txt_file=os.path.join(data_dir, "validation/image_list.txt"),
root_dir=os.path.join(data_dir, "validation"), transform=val_trans)
train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=4, pin_memory=True)
val_loader = DataLoader(val_dataset,batch_size=batch_size, shuffle=False, num_workers=4, pin_memory=True)
return train_loader, val_loader, val_loader
class Advdataset(Dataset):
def __init__(self, root, transform=None):
alldata = torch.load(root)
self.data = alldata['data']
self.label = alldata['label']
self.transform = transform
def __getitem__(self, idx):
img = self.data[idx]
if self.transform is not None:
img = self.transform(img)
label = self.label[idx]
return img, label
def __len__(self):
return self.data.shape[0]
| 35.739224
| 129
| 0.641018
| 1,883
| 16,583
| 5.439193
| 0.097716
| 0.043058
| 0.079086
| 0.091388
| 0.840461
| 0.834407
| 0.822593
| 0.796036
| 0.766647
| 0.742824
| 0
| 0.051781
| 0.250015
| 16,583
| 463
| 130
| 35.816415
| 0.77173
| 0.016885
| 0
| 0.768328
| 0
| 0
| 0.028564
| 0.001539
| 0
| 0
| 0
| 0
| 0.002933
| 1
| 0.052786
| false
| 0
| 0.02346
| 0.008798
| 0.129032
| 0.046921
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
3d77f9f156b475e56e6d475cfacc885860e2bb08
| 74,652
|
py
|
Python
|
dash_echarts/examples/gallery/bar_race.py
|
Covarians/dash-echarts
|
0d6cfc010ea7bb91a6e0d94764dc42241dbad136
|
[
"Apache-2.0"
] | 28
|
2021-04-15T16:02:57.000Z
|
2022-03-30T07:43:50.000Z
|
dash_echarts/examples/gallery/bar_race.py
|
Covarians/dash-echarts
|
0d6cfc010ea7bb91a6e0d94764dc42241dbad136
|
[
"Apache-2.0"
] | 8
|
2021-06-23T19:49:18.000Z
|
2022-03-02T16:04:42.000Z
|
dash_echarts/examples/gallery/bar_race.py
|
Covarians/dash-echarts
|
0d6cfc010ea7bb91a6e0d94764dc42241dbad136
|
[
"Apache-2.0"
] | 8
|
2021-09-16T07:38:41.000Z
|
2022-03-09T04:59:11.000Z
|
# coding=utf-8
import json
from os import path
import dash_echarts
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
basepath = path.dirname(__file__)
filepath = path.abspath(path.join(basepath+'/../static', 'life-expectancy-table.json'))
with open(filepath) as json_file:
res = json.load(json_file)
years = []
for e in res[1:]:
if len(years) == 0 or years[-1] != e[4]:
years.append(e[4])
start_index = 0
start_year = years[start_index]
dimension = 0
def gen_next_year_data(year=None):
if not year:
year = years[0]
else:
try:
index = years.index(year)
except ValueError as e:
index = -1
if index >= len(years)-1:
year = years[-1]
elif index < 0:
year = years[0]
else:
year = years[index+1]
return year, [e for e in res[1:] if e[4] == year]
option = {
'grid': {
'top': 10,
'bottom': 30,
'left': 150,
'right': 80
},
'xAxis': {
'max': 'dataMax',
'label': {
'formatter': 'x_axis_formatter'
}
},
'dataset': {
'source': gen_next_year_data()
},
'yAxis': {
'type': 'category',
'inverse': True,
'max': 10,
'axisLabel': {
'show': True,
'textStyle': {
'fontSize': 14
},
'formatter': 'y_axis_formatter',
# function (value) {
# return value + '{flag|' + getFlag(value) + '}';
# },
'rich': {
'flag': {
'fontSize': 25,
'padding': 5
}
}
},
'animationDuration': 300,
'animationDurationUpdate': 300
},
'series': [{
'realtimeSort': True,
'seriesLayoutBy': 'column',
'type': 'bar',
'itemStyle': {
'color': 'series_color'
# color: function (param) {
# const countryColors = {"Australia":"#00008b","Canada":"#f00","China":"#ffde00","Cuba":"#002a8f","Finland":"#003580","France":"#ed2939","Germany":"#000","Iceland":"#003897","India":"#f93","Japan":"#bc002d","North Korea":"#024fa2","South Korea":"#000","New Zealand":"#00247d","Norway":"#ef2b2d","Poland":"#dc143c","Russia":"#d52b1e","Turkey":"#e30a17","United Kingdom":"#00247d","United States":"#b22234"};
# return countryColors[param.value[3]] || '#5470c6';
# }
},
'encode': {
'x': dimension,
'y': 3
},
'label': {
'show': True,
'precision': 1,
'position': 'right',
'valueAnimation': True,
'fontFamily': 'monospace'
}
}],
# Disable init animation.
'animationDuration': 0,
'animationDurationUpdate': 2000,
'animationEasing': 'linear',
'animationEasingUpdate': 'linear',
'graphic': {
'elements': [{
'type': 'text',
'right': 160,
'bottom': 60,
'style': {
'text': start_year,
'font': 'bolder 80px monospace',
'fill': 'rgba(100, 100, 100, 0.25)'
},
'z': 100
}]
}
}
# for (var i = startIndex; i < years.length - 1; ++i) {
# (function (i) {
# setTimeout(function () {
# updateYear(years[i + 1]);
# }, (i - startIndex) * updateFrequency);
# })(i);
# }
#
# function updateYear(year) {
# var source = data.slice(1).filter(function (d) {
# return d[4] === year;
# });
# option.series[0].data = source;
# option.graphic.elements[0].style.text = year;
# myChart.setOption(option);
# }
#
layout = html.Div([
dash_echarts.DashECharts(
option = option,
id='echarts-bar-race',
style={
"width": '100%',
"height": '95vh',
},
funs={
"x_axis_formatter":
'''
function (n) {
return Math.round(n);
}
''',
"y_axis_formatter":
'''
function (value) {
const flags = [{"code":"AD","emoji":"🇦🇩","unicode":"U+1F1E6 U+1F1E9","name":"Andorra","title":"flag for Andorra","dialCode":"+376"},{"code":"AE","emoji":"🇦🇪","unicode":"U+1F1E6 U+1F1EA","name":"United Arab Emirates","title":"flag for United Arab Emirates","dialCode":"+971"},{"code":"AF","emoji":"🇦🇫","unicode":"U+1F1E6 U+1F1EB","name":"Afghanistan","title":"flag for Afghanistan","dialCode":"+93"},{"code":"AG","emoji":"🇦🇬","unicode":"U+1F1E6 U+1F1EC","name":"Antigua and Barbuda","title":"flag for Antigua and Barbuda","dialCode":"+1268"},{"code":"AI","emoji":"🇦🇮","unicode":"U+1F1E6 U+1F1EE","name":"Anguilla","title":"flag for Anguilla","dialCode":"+1 264"},{"code":"AL","emoji":"🇦🇱","unicode":"U+1F1E6 U+1F1F1","name":"Albania","title":"flag for Albania","dialCode":"+355"},{"code":"AM","emoji":"🇦🇲","unicode":"U+1F1E6 U+1F1F2","name":"Armenia","title":"flag for Armenia","dialCode":"+374"},{"code":"AO","emoji":"🇦🇴","unicode":"U+1F1E6 U+1F1F4","name":"Angola","title":"flag for Angola","dialCode":"+244"},{"code":"AQ","emoji":"🇦🇶","unicode":"U+1F1E6 U+1F1F6","name":"Antarctica","title":"flag for Antarctica","dialCode":null},{"code":"AR","emoji":"🇦🇷","unicode":"U+1F1E6 U+1F1F7","name":"Argentina","title":"flag for Argentina","dialCode":"+54"},{"code":"AS","emoji":"🇦🇸","unicode":"U+1F1E6 U+1F1F8","name":"American Samoa","title":"flag for American Samoa","dialCode":"+1 684"},{"code":"AT","emoji":"🇦🇹","unicode":"U+1F1E6 U+1F1F9","name":"Austria","title":"flag for Austria","dialCode":"+43"},{"code":"AU","emoji":"🇦🇺","unicode":"U+1F1E6 U+1F1FA","name":"Australia","title":"flag for Australia","dialCode":"+61"},{"code":"AW","emoji":"🇦🇼","unicode":"U+1F1E6 U+1F1FC","name":"Aruba","title":"flag for Aruba","dialCode":"+297"},{"code":"AX","emoji":"🇦🇽","unicode":"U+1F1E6 U+1F1FD","name":"Åland Islands","title":"flag for Åland Islands","dialCode":""},{"code":"AZ","emoji":"🇦🇿","unicode":"U+1F1E6 U+1F1FF","name":"Azerbaijan","title":"flag for Azerbaijan","dialCode":"+994"},{"code":"BA","emoji":"🇧🇦","unicode":"U+1F1E7 U+1F1E6","name":"Bosnia and Herzegovina","title":"flag for Bosnia and Herzegovina","dialCode":"+387"},{"code":"BB","emoji":"🇧🇧","unicode":"U+1F1E7 U+1F1E7","name":"Barbados","title":"flag for Barbados","dialCode":"+1 246"},{"code":"BD","emoji":"🇧🇩","unicode":"U+1F1E7 U+1F1E9","name":"Bangladesh","title":"flag for Bangladesh","dialCode":"+880"},{"code":"BE","emoji":"🇧🇪","unicode":"U+1F1E7 U+1F1EA","name":"Belgium","title":"flag for Belgium","dialCode":"+32"},{"code":"BF","emoji":"🇧🇫","unicode":"U+1F1E7 U+1F1EB","name":"Burkina Faso","title":"flag for Burkina Faso","dialCode":"+226"},{"code":"BG","emoji":"🇧🇬","unicode":"U+1F1E7 U+1F1EC","name":"Bulgaria","title":"flag for Bulgaria","dialCode":"+359"},{"code":"BH","emoji":"🇧🇭","unicode":"U+1F1E7 U+1F1ED","name":"Bahrain","title":"flag for Bahrain","dialCode":"+973"},{"code":"BI","emoji":"🇧🇮","unicode":"U+1F1E7 U+1F1EE","name":"Burundi","title":"flag for Burundi","dialCode":"+257"},{"code":"BJ","emoji":"🇧🇯","unicode":"U+1F1E7 U+1F1EF","name":"Benin","title":"flag for Benin","dialCode":"+229"},{"code":"BL","emoji":"🇧🇱","unicode":"U+1F1E7 U+1F1F1","name":"Saint Barthélemy","title":"flag for Saint Barthélemy","dialCode":"+590"},{"code":"BM","emoji":"🇧🇲","unicode":"U+1F1E7 U+1F1F2","name":"Bermuda","title":"flag for Bermuda","dialCode":"+1 441"},{"code":"BN","emoji":"🇧🇳","unicode":"U+1F1E7 U+1F1F3","name":"Brunei Darussalam","title":"flag for Brunei Darussalam","dialCode":"+673"},{"code":"BO","emoji":"🇧🇴","unicode":"U+1F1E7 U+1F1F4","name":"Bolivia","title":"flag for Bolivia","dialCode":"+591"},{"code":"BQ","emoji":"🇧🇶","unicode":"U+1F1E7 U+1F1F6","name":"Bonaire, Sint Eustatius and Saba","title":"flag for Bonaire, Sint Eustatius and Saba"},{"code":"BR","emoji":"🇧🇷","unicode":"U+1F1E7 U+1F1F7","name":"Brazil","title":"flag for Brazil","dialCode":"+55"},{"code":"BS","emoji":"🇧🇸","unicode":"U+1F1E7 U+1F1F8","name":"Bahamas","title":"flag for Bahamas","dialCode":"+1 242"},{"code":"BT","emoji":"🇧🇹","unicode":"U+1F1E7 U+1F1F9","name":"Bhutan","title":"flag for Bhutan","dialCode":"+975"},{"code":"BV","emoji":"🇧🇻","unicode":"U+1F1E7 U+1F1FB","name":"Bouvet Island","title":"flag for Bouvet Island"},{"code":"BW","emoji":"🇧🇼","unicode":"U+1F1E7 U+1F1FC","name":"Botswana","title":"flag for Botswana","dialCode":"+267"},{"code":"BY","emoji":"🇧🇾","unicode":"U+1F1E7 U+1F1FE","name":"Belarus","title":"flag for Belarus","dialCode":"+375"},{"code":"BZ","emoji":"🇧🇿","unicode":"U+1F1E7 U+1F1FF","name":"Belize","title":"flag for Belize","dialCode":"+501"},{"code":"CA","emoji":"🇨🇦","unicode":"U+1F1E8 U+1F1E6","name":"Canada","title":"flag for Canada","dialCode":"+1"},{"code":"CC","emoji":"🇨🇨","unicode":"U+1F1E8 U+1F1E8","name":"Cocos (Keeling) Islands","title":"flag for Cocos (Keeling) Islands","dialCode":"+61"},{"code":"CD","emoji":"🇨🇩","unicode":"U+1F1E8 U+1F1E9","name":"Congo","title":"flag for Congo","dialCode":"+243"},{"code":"CF","emoji":"🇨🇫","unicode":"U+1F1E8 U+1F1EB","name":"Central African Republic","title":"flag for Central African Republic","dialCode":"+236"},{"code":"CG","emoji":"🇨🇬","unicode":"U+1F1E8 U+1F1EC","name":"Congo","title":"flag for Congo","dialCode":"+242"},{"code":"CH","emoji":"🇨🇭","unicode":"U+1F1E8 U+1F1ED","name":"Switzerland","title":"flag for Switzerland","dialCode":"+41"},{"code":"CI","emoji":"🇨🇮","unicode":"U+1F1E8 U+1F1EE","name":"Côte D'Ivoire","title":"flag for Côte D'Ivoire","dialCode":"+225"},{"code":"CK","emoji":"🇨🇰","unicode":"U+1F1E8 U+1F1F0","name":"Cook Islands","title":"flag for Cook Islands","dialCode":"+682"},{"code":"CL","emoji":"🇨🇱","unicode":"U+1F1E8 U+1F1F1","name":"Chile","title":"flag for Chile","dialCode":"+56"},{"code":"CM","emoji":"🇨🇲","unicode":"U+1F1E8 U+1F1F2","name":"Cameroon","title":"flag for Cameroon","dialCode":"+237"},{"code":"CN","emoji":"🇨🇳","unicode":"U+1F1E8 U+1F1F3","name":"China","title":"flag for China","dialCode":"+86"},{"code":"CO","emoji":"🇨🇴","unicode":"U+1F1E8 U+1F1F4","name":"Colombia","title":"flag for Colombia","dialCode":"+57"},{"code":"CR","emoji":"🇨🇷","unicode":"U+1F1E8 U+1F1F7","name":"Costa Rica","title":"flag for Costa Rica","dialCode":"+506"},{"code":"CU","emoji":"🇨🇺","unicode":"U+1F1E8 U+1F1FA","name":"Cuba","title":"flag for Cuba","dialCode":"+53"},{"code":"CV","emoji":"🇨🇻","unicode":"U+1F1E8 U+1F1FB","name":"Cape Verde","title":"flag for Cape Verde","dialCode":"+238"},{"code":"CW","emoji":"🇨🇼","unicode":"U+1F1E8 U+1F1FC","name":"Curaçao","title":"flag for Curaçao"},{"code":"CX","emoji":"🇨🇽","unicode":"U+1F1E8 U+1F1FD","name":"Christmas Island","title":"flag for Christmas Island","dialCode":"+61"},{"code":"CY","emoji":"🇨🇾","unicode":"U+1F1E8 U+1F1FE","name":"Cyprus","title":"flag for Cyprus","dialCode":"+537"},{"code":"CZ","emoji":"🇨🇿","unicode":"U+1F1E8 U+1F1FF","name":"Czech Republic","title":"flag for Czech Republic","dialCode":"+420"},{"code":"DE","emoji":"🇩🇪","unicode":"U+1F1E9 U+1F1EA","name":"Germany","title":"flag for Germany","dialCode":"+49"},{"code":"DJ","emoji":"🇩🇯","unicode":"U+1F1E9 U+1F1EF","name":"Djibouti","title":"flag for Djibouti","dialCode":"+253"},{"code":"DK","emoji":"🇩🇰","unicode":"U+1F1E9 U+1F1F0","name":"Denmark","title":"flag for Denmark","dialCode":"+45"},{"code":"DM","emoji":"🇩🇲","unicode":"U+1F1E9 U+1F1F2","name":"Dominica","title":"flag for Dominica","dialCode":"+1 767"},{"code":"DO","emoji":"🇩🇴","unicode":"U+1F1E9 U+1F1F4","name":"Dominican Republic","title":"flag for Dominican Republic","dialCode":"+1 849"},{"code":"DZ","emoji":"🇩🇿","unicode":"U+1F1E9 U+1F1FF","name":"Algeria","title":"flag for Algeria","dialCode":"+213"},{"code":"EC","emoji":"🇪🇨","unicode":"U+1F1EA U+1F1E8","name":"Ecuador","title":"flag for Ecuador","dialCode":"+593"},{"code":"EE","emoji":"🇪🇪","unicode":"U+1F1EA U+1F1EA","name":"Estonia","title":"flag for Estonia","dialCode":"+372"},{"code":"EG","emoji":"🇪🇬","unicode":"U+1F1EA U+1F1EC","name":"Egypt","title":"flag for Egypt","dialCode":"+20"},{"code":"EH","emoji":"🇪🇭","unicode":"U+1F1EA U+1F1ED","name":"Western Sahara","title":"flag for Western Sahara"},{"code":"ER","emoji":"🇪🇷","unicode":"U+1F1EA U+1F1F7","name":"Eritrea","title":"flag for Eritrea","dialCode":"+291"},{"code":"ES","emoji":"🇪🇸","unicode":"U+1F1EA U+1F1F8","name":"Spain","title":"flag for Spain","dialCode":"+34"},{"code":"ET","emoji":"🇪🇹","unicode":"U+1F1EA U+1F1F9","name":"Ethiopia","title":"flag for Ethiopia","dialCode":"+251"},{"code":"EU","emoji":"🇪🇺","unicode":"U+1F1EA U+1F1FA","name":"European Union","title":"flag for European Union"},{"code":"FI","emoji":"🇫🇮","unicode":"U+1F1EB U+1F1EE","name":"Finland","title":"flag for Finland","dialCode":"+358"},{"code":"FJ","emoji":"🇫🇯","unicode":"U+1F1EB U+1F1EF","name":"Fiji","title":"flag for Fiji","dialCode":"+679"},{"code":"FK","emoji":"🇫🇰","unicode":"U+1F1EB U+1F1F0","name":"Falkland Islands (Malvinas)","title":"flag for Falkland Islands (Malvinas)","dialCode":"+500"},{"code":"FM","emoji":"🇫🇲","unicode":"U+1F1EB U+1F1F2","name":"Micronesia","title":"flag for Micronesia","dialCode":"+691"},{"code":"FO","emoji":"🇫🇴","unicode":"U+1F1EB U+1F1F4","name":"Faroe Islands","title":"flag for Faroe Islands","dialCode":"+298"},{"code":"FR","emoji":"🇫🇷","unicode":"U+1F1EB U+1F1F7","name":"France","title":"flag for France","dialCode":"+33"},{"code":"GA","emoji":"🇬🇦","unicode":"U+1F1EC U+1F1E6","name":"Gabon","title":"flag for Gabon","dialCode":"+241"},{"code":"GB","emoji":"🇬🇧","unicode":"U+1F1EC U+1F1E7","name":"United Kingdom","title":"flag for United Kingdom","dialCode":"+44"},{"code":"GD","emoji":"🇬🇩","unicode":"U+1F1EC U+1F1E9","name":"Grenada","title":"flag for Grenada","dialCode":"+1 473"},{"code":"GE","emoji":"🇬🇪","unicode":"U+1F1EC U+1F1EA","name":"Georgia","title":"flag for Georgia","dialCode":"+995"},{"code":"GF","emoji":"🇬🇫","unicode":"U+1F1EC U+1F1EB","name":"French Guiana","title":"flag for French Guiana","dialCode":"+594"},{"code":"GG","emoji":"🇬🇬","unicode":"U+1F1EC U+1F1EC","name":"Guernsey","title":"flag for Guernsey","dialCode":"+44"},{"code":"GH","emoji":"🇬🇭","unicode":"U+1F1EC U+1F1ED","name":"Ghana","title":"flag for Ghana","dialCode":"+233"},{"code":"GI","emoji":"🇬🇮","unicode":"U+1F1EC U+1F1EE","name":"Gibraltar","title":"flag for Gibraltar","dialCode":"+350"},{"code":"GL","emoji":"🇬🇱","unicode":"U+1F1EC U+1F1F1","name":"Greenland","title":"flag for Greenland","dialCode":"+299"},{"code":"GM","emoji":"🇬🇲","unicode":"U+1F1EC U+1F1F2","name":"Gambia","title":"flag for Gambia","dialCode":"+220"},{"code":"GN","emoji":"🇬🇳","unicode":"U+1F1EC U+1F1F3","name":"Guinea","title":"flag for Guinea","dialCode":"+224"},{"code":"GP","emoji":"🇬🇵","unicode":"U+1F1EC U+1F1F5","name":"Guadeloupe","title":"flag for Guadeloupe","dialCode":"+590"},{"code":"GQ","emoji":"🇬🇶","unicode":"U+1F1EC U+1F1F6","name":"Equatorial Guinea","title":"flag for Equatorial Guinea","dialCode":"+240"},{"code":"GR","emoji":"🇬🇷","unicode":"U+1F1EC U+1F1F7","name":"Greece","title":"flag for Greece","dialCode":"+30"},{"code":"GS","emoji":"🇬🇸","unicode":"U+1F1EC U+1F1F8","name":"South Georgia","title":"flag for South Georgia","dialCode":"+500"},{"code":"GT","emoji":"🇬🇹","unicode":"U+1F1EC U+1F1F9","name":"Guatemala","title":"flag for Guatemala","dialCode":"+502"},{"code":"GU","emoji":"🇬🇺","unicode":"U+1F1EC U+1F1FA","name":"Guam","title":"flag for Guam","dialCode":"+1 671"},{"code":"GW","emoji":"🇬🇼","unicode":"U+1F1EC U+1F1FC","name":"Guinea-Bissau","title":"flag for Guinea-Bissau","dialCode":"+245"},{"code":"GY","emoji":"🇬🇾","unicode":"U+1F1EC U+1F1FE","name":"Guyana","title":"flag for Guyana","dialCode":"+595"},{"code":"HK","emoji":"🇭🇰","unicode":"U+1F1ED U+1F1F0","name":"Hong Kong","title":"flag for Hong Kong","dialCode":"+852"},{"code":"HM","emoji":"🇭🇲","unicode":"U+1F1ED U+1F1F2","name":"Heard Island and Mcdonald Islands","title":"flag for Heard Island and Mcdonald Islands"},{"code":"HN","emoji":"🇭🇳","unicode":"U+1F1ED U+1F1F3","name":"Honduras","title":"flag for Honduras","dialCode":"+504"},{"code":"HR","emoji":"🇭🇷","unicode":"U+1F1ED U+1F1F7","name":"Croatia","title":"flag for Croatia","dialCode":"+385"},{"code":"HT","emoji":"🇭🇹","unicode":"U+1F1ED U+1F1F9","name":"Haiti","title":"flag for Haiti","dialCode":"+509"},{"code":"HU","emoji":"🇭🇺","unicode":"U+1F1ED U+1F1FA","name":"Hungary","title":"flag for Hungary","dialCode":"+36"},{"code":"ID","emoji":"🇮🇩","unicode":"U+1F1EE U+1F1E9","name":"Indonesia","title":"flag for Indonesia","dialCode":"+62"},{"code":"IE","emoji":"🇮🇪","unicode":"U+1F1EE U+1F1EA","name":"Ireland","title":"flag for Ireland","dialCode":"+353"},{"code":"IL","emoji":"🇮🇱","unicode":"U+1F1EE U+1F1F1","name":"Israel","title":"flag for Israel","dialCode":"+972"},{"code":"IM","emoji":"🇮🇲","unicode":"U+1F1EE U+1F1F2","name":"Isle of Man","title":"flag for Isle of Man","dialCode":"+44"},{"code":"IN","emoji":"🇮🇳","unicode":"U+1F1EE U+1F1F3","name":"India","title":"flag for India","dialCode":"+91"},{"code":"IO","emoji":"🇮🇴","unicode":"U+1F1EE U+1F1F4","name":"British Indian Ocean Territory","title":"flag for British Indian Ocean Territory","dialCode":"+246"},{"code":"IQ","emoji":"🇮🇶","unicode":"U+1F1EE U+1F1F6","name":"Iraq","title":"flag for Iraq","dialCode":"+964"},{"code":"IR","emoji":"🇮🇷","unicode":"U+1F1EE U+1F1F7","name":"Iran","title":"flag for Iran","dialCode":"+98"},{"code":"IS","emoji":"🇮🇸","unicode":"U+1F1EE U+1F1F8","name":"Iceland","title":"flag for Iceland","dialCode":"+354"},{"code":"IT","emoji":"🇮🇹","unicode":"U+1F1EE U+1F1F9","name":"Italy","title":"flag for Italy","dialCode":"+39"},{"code":"JE","emoji":"🇯🇪","unicode":"U+1F1EF U+1F1EA","name":"Jersey","title":"flag for Jersey","dialCode":"+44"},{"code":"JM","emoji":"🇯🇲","unicode":"U+1F1EF U+1F1F2","name":"Jamaica","title":"flag for Jamaica","dialCode":"+1 876"},{"code":"JO","emoji":"🇯🇴","unicode":"U+1F1EF U+1F1F4","name":"Jordan","title":"flag for Jordan","dialCode":"+962"},{"code":"JP","emoji":"🇯🇵","unicode":"U+1F1EF U+1F1F5","name":"Japan","title":"flag for Japan","dialCode":"+81"},{"code":"KE","emoji":"🇰🇪","unicode":"U+1F1F0 U+1F1EA","name":"Kenya","title":"flag for Kenya","dialCode":"+254"},{"code":"KG","emoji":"🇰🇬","unicode":"U+1F1F0 U+1F1EC","name":"Kyrgyzstan","title":"flag for Kyrgyzstan","dialCode":"+996"},{"code":"KH","emoji":"🇰🇭","unicode":"U+1F1F0 U+1F1ED","name":"Cambodia","title":"flag for Cambodia","dialCode":"+855"},{"code":"KI","emoji":"🇰🇮","unicode":"U+1F1F0 U+1F1EE","name":"Kiribati","title":"flag for Kiribati","dialCode":"+686"},{"code":"KM","emoji":"🇰🇲","unicode":"U+1F1F0 U+1F1F2","name":"Comoros","title":"flag for Comoros","dialCode":"+269"},{"code":"KN","emoji":"🇰🇳","unicode":"U+1F1F0 U+1F1F3","name":"Saint Kitts and Nevis","title":"flag for Saint Kitts and Nevis","dialCode":"+1 869"},{"code":"KP","emoji":"🇰🇵","unicode":"U+1F1F0 U+1F1F5","name":"North Korea","title":"flag for North Korea","dialCode":"+850"},{"code":"KR","emoji":"🇰🇷","unicode":"U+1F1F0 U+1F1F7","name":"South Korea","title":"flag for South Korea","dialCode":"+82"},{"code":"KW","emoji":"🇰🇼","unicode":"U+1F1F0 U+1F1FC","name":"Kuwait","title":"flag for Kuwait","dialCode":"+965"},{"code":"KY","emoji":"🇰🇾","unicode":"U+1F1F0 U+1F1FE","name":"Cayman Islands","title":"flag for Cayman Islands","dialCode":"+ 345"},{"code":"KZ","emoji":"🇰🇿","unicode":"U+1F1F0 U+1F1FF","name":"Kazakhstan","title":"flag for Kazakhstan","dialCode":"+7 7"},{"code":"LA","emoji":"🇱🇦","unicode":"U+1F1F1 U+1F1E6","name":"Lao People's Democratic Republic","title":"flag for Lao People's Democratic Republic","dialCode":"+856"},{"code":"LB","emoji":"🇱🇧","unicode":"U+1F1F1 U+1F1E7","name":"Lebanon","title":"flag for Lebanon","dialCode":"+961"},{"code":"LC","emoji":"🇱🇨","unicode":"U+1F1F1 U+1F1E8","name":"Saint Lucia","title":"flag for Saint Lucia","dialCode":"+1 758"},{"code":"LI","emoji":"🇱🇮","unicode":"U+1F1F1 U+1F1EE","name":"Liechtenstein","title":"flag for Liechtenstein","dialCode":"+423"},{"code":"LK","emoji":"🇱🇰","unicode":"U+1F1F1 U+1F1F0","name":"Sri Lanka","title":"flag for Sri Lanka","dialCode":"+94"},{"code":"LR","emoji":"🇱🇷","unicode":"U+1F1F1 U+1F1F7","name":"Liberia","title":"flag for Liberia","dialCode":"+231"},{"code":"LS","emoji":"🇱🇸","unicode":"U+1F1F1 U+1F1F8","name":"Lesotho","title":"flag for Lesotho","dialCode":"+266"},{"code":"LT","emoji":"🇱🇹","unicode":"U+1F1F1 U+1F1F9","name":"Lithuania","title":"flag for Lithuania","dialCode":"+370"},{"code":"LU","emoji":"🇱🇺","unicode":"U+1F1F1 U+1F1FA","name":"Luxembourg","title":"flag for Luxembourg","dialCode":"+352"},{"code":"LV","emoji":"🇱🇻","unicode":"U+1F1F1 U+1F1FB","name":"Latvia","title":"flag for Latvia","dialCode":"+371"},{"code":"LY","emoji":"🇱🇾","unicode":"U+1F1F1 U+1F1FE","name":"Libya","title":"flag for Libya","dialCode":"+218"},{"code":"MA","emoji":"🇲🇦","unicode":"U+1F1F2 U+1F1E6","name":"Morocco","title":"flag for Morocco","dialCode":"+212"},{"code":"MC","emoji":"🇲🇨","unicode":"U+1F1F2 U+1F1E8","name":"Monaco","title":"flag for Monaco","dialCode":"+377"},{"code":"MD","emoji":"🇲🇩","unicode":"U+1F1F2 U+1F1E9","name":"Moldova","title":"flag for Moldova","dialCode":"+373"},{"code":"ME","emoji":"🇲🇪","unicode":"U+1F1F2 U+1F1EA","name":"Montenegro","title":"flag for Montenegro","dialCode":"+382"},{"code":"MF","emoji":"🇲🇫","unicode":"U+1F1F2 U+1F1EB","name":"Saint Martin (French Part)","title":"flag for Saint Martin (French Part)","dialCode":"+590"},{"code":"MG","emoji":"🇲🇬","unicode":"U+1F1F2 U+1F1EC","name":"Madagascar","title":"flag for Madagascar","dialCode":"+261"},{"code":"MH","emoji":"🇲🇭","unicode":"U+1F1F2 U+1F1ED","name":"Marshall Islands","title":"flag for Marshall Islands","dialCode":"+692"},{"code":"MK","emoji":"🇲🇰","unicode":"U+1F1F2 U+1F1F0","name":"Macedonia","title":"flag for Macedonia","dialCode":"+389"},{"code":"ML","emoji":"🇲🇱","unicode":"U+1F1F2 U+1F1F1","name":"Mali","title":"flag for Mali","dialCode":"+223"},{"code":"MM","emoji":"🇲🇲","unicode":"U+1F1F2 U+1F1F2","name":"Myanmar","title":"flag for Myanmar","dialCode":"+95"},{"code":"MN","emoji":"🇲🇳","unicode":"U+1F1F2 U+1F1F3","name":"Mongolia","title":"flag for Mongolia","dialCode":"+976"},{"code":"MO","emoji":"🇲🇴","unicode":"U+1F1F2 U+1F1F4","name":"Macao","title":"flag for Macao","dialCode":"+853"},{"code":"MP","emoji":"🇲🇵","unicode":"U+1F1F2 U+1F1F5","name":"Northern Mariana Islands","title":"flag for Northern Mariana Islands","dialCode":"+1 670"},{"code":"MQ","emoji":"🇲🇶","unicode":"U+1F1F2 U+1F1F6","name":"Martinique","title":"flag for Martinique","dialCode":"+596"},{"code":"MR","emoji":"🇲🇷","unicode":"U+1F1F2 U+1F1F7","name":"Mauritania","title":"flag for Mauritania","dialCode":"+222"},{"code":"MS","emoji":"🇲🇸","unicode":"U+1F1F2 U+1F1F8","name":"Montserrat","title":"flag for Montserrat","dialCode":"+1664"},{"code":"MT","emoji":"🇲🇹","unicode":"U+1F1F2 U+1F1F9","name":"Malta","title":"flag for Malta","dialCode":"+356"},{"code":"MU","emoji":"🇲🇺","unicode":"U+1F1F2 U+1F1FA","name":"Mauritius","title":"flag for Mauritius","dialCode":"+230"},{"code":"MV","emoji":"🇲🇻","unicode":"U+1F1F2 U+1F1FB","name":"Maldives","title":"flag for Maldives","dialCode":"+960"},{"code":"MW","emoji":"🇲🇼","unicode":"U+1F1F2 U+1F1FC","name":"Malawi","title":"flag for Malawi","dialCode":"+265"},{"code":"MX","emoji":"🇲🇽","unicode":"U+1F1F2 U+1F1FD","name":"Mexico","title":"flag for Mexico","dialCode":"+52"},{"code":"MY","emoji":"🇲🇾","unicode":"U+1F1F2 U+1F1FE","name":"Malaysia","title":"flag for Malaysia","dialCode":"+60"},{"code":"MZ","emoji":"🇲🇿","unicode":"U+1F1F2 U+1F1FF","name":"Mozambique","title":"flag for Mozambique","dialCode":"+258"},{"code":"NA","emoji":"🇳🇦","unicode":"U+1F1F3 U+1F1E6","name":"Namibia","title":"flag for Namibia","dialCode":"+264"},{"code":"NC","emoji":"🇳🇨","unicode":"U+1F1F3 U+1F1E8","name":"New Caledonia","title":"flag for New Caledonia","dialCode":"+687"},{"code":"NE","emoji":"🇳🇪","unicode":"U+1F1F3 U+1F1EA","name":"Niger","title":"flag for Niger","dialCode":"+227"},{"code":"NF","emoji":"🇳🇫","unicode":"U+1F1F3 U+1F1EB","name":"Norfolk Island","title":"flag for Norfolk Island","dialCode":"+672"},{"code":"NG","emoji":"🇳🇬","unicode":"U+1F1F3 U+1F1EC","name":"Nigeria","title":"flag for Nigeria","dialCode":"+234"},{"code":"NI","emoji":"🇳🇮","unicode":"U+1F1F3 U+1F1EE","name":"Nicaragua","title":"flag for Nicaragua","dialCode":"+505"},{"code":"NL","emoji":"🇳🇱","unicode":"U+1F1F3 U+1F1F1","name":"Netherlands","title":"flag for Netherlands","dialCode":"+31"},{"code":"NO","emoji":"🇳🇴","unicode":"U+1F1F3 U+1F1F4","name":"Norway","title":"flag for Norway","dialCode":"+47"},{"code":"NP","emoji":"🇳🇵","unicode":"U+1F1F3 U+1F1F5","name":"Nepal","title":"flag for Nepal","dialCode":"+977"},{"code":"NR","emoji":"🇳🇷","unicode":"U+1F1F3 U+1F1F7","name":"Nauru","title":"flag for Nauru","dialCode":"+674"},{"code":"NU","emoji":"🇳🇺","unicode":"U+1F1F3 U+1F1FA","name":"Niue","title":"flag for Niue","dialCode":"+683"},{"code":"NZ","emoji":"🇳🇿","unicode":"U+1F1F3 U+1F1FF","name":"New Zealand","title":"flag for New Zealand","dialCode":"+64"},{"code":"OM","emoji":"🇴🇲","unicode":"U+1F1F4 U+1F1F2","name":"Oman","title":"flag for Oman","dialCode":"+968"},{"code":"PA","emoji":"🇵🇦","unicode":"U+1F1F5 U+1F1E6","name":"Panama","title":"flag for Panama","dialCode":"+507"},{"code":"PE","emoji":"🇵🇪","unicode":"U+1F1F5 U+1F1EA","name":"Peru","title":"flag for Peru","dialCode":"+51"},{"code":"PF","emoji":"🇵🇫","unicode":"U+1F1F5 U+1F1EB","name":"French Polynesia","title":"flag for French Polynesia","dialCode":"+689"},{"code":"PG","emoji":"🇵🇬","unicode":"U+1F1F5 U+1F1EC","name":"Papua New Guinea","title":"flag for Papua New Guinea","dialCode":"+675"},{"code":"PH","emoji":"🇵🇭","unicode":"U+1F1F5 U+1F1ED","name":"Philippines","title":"flag for Philippines","dialCode":"+63"},{"code":"PK","emoji":"🇵🇰","unicode":"U+1F1F5 U+1F1F0","name":"Pakistan","title":"flag for Pakistan","dialCode":"+92"},{"code":"PL","emoji":"🇵🇱","unicode":"U+1F1F5 U+1F1F1","name":"Poland","title":"flag for Poland","dialCode":"+48"},{"code":"PM","emoji":"🇵🇲","unicode":"U+1F1F5 U+1F1F2","name":"Saint Pierre and Miquelon","title":"flag for Saint Pierre and Miquelon","dialCode":"+508"},{"code":"PN","emoji":"🇵🇳","unicode":"U+1F1F5 U+1F1F3","name":"Pitcairn","title":"flag for Pitcairn","dialCode":"+872"},{"code":"PR","emoji":"🇵🇷","unicode":"U+1F1F5 U+1F1F7","name":"Puerto Rico","title":"flag for Puerto Rico","dialCode":"+1 939"},{"code":"PS","emoji":"🇵🇸","unicode":"U+1F1F5 U+1F1F8","name":"Palestinian Territory","title":"flag for Palestinian Territory","dialCode":"+970"},{"code":"PT","emoji":"🇵🇹","unicode":"U+1F1F5 U+1F1F9","name":"Portugal","title":"flag for Portugal","dialCode":"+351"},{"code":"PW","emoji":"🇵🇼","unicode":"U+1F1F5 U+1F1FC","name":"Palau","title":"flag for Palau","dialCode":"+680"},{"code":"PY","emoji":"🇵🇾","unicode":"U+1F1F5 U+1F1FE","name":"Paraguay","title":"flag for Paraguay","dialCode":"+595"},{"code":"QA","emoji":"🇶🇦","unicode":"U+1F1F6 U+1F1E6","name":"Qatar","title":"flag for Qatar","dialCode":"+974"},{"code":"RE","emoji":"🇷🇪","unicode":"U+1F1F7 U+1F1EA","name":"Réunion","title":"flag for Réunion","dialCode":"+262"},{"code":"RO","emoji":"🇷🇴","unicode":"U+1F1F7 U+1F1F4","name":"Romania","title":"flag for Romania","dialCode":"+40"},{"code":"RS","emoji":"🇷🇸","unicode":"U+1F1F7 U+1F1F8","name":"Serbia","title":"flag for Serbia","dialCode":"+381"},{"code":"RU","emoji":"🇷🇺","unicode":"U+1F1F7 U+1F1FA","name":"Russia","title":"flag for Russia","dialCode":"+7"},{"code":"RW","emoji":"🇷🇼","unicode":"U+1F1F7 U+1F1FC","name":"Rwanda","title":"flag for Rwanda","dialCode":"+250"},{"code":"SA","emoji":"🇸🇦","unicode":"U+1F1F8 U+1F1E6","name":"Saudi Arabia","title":"flag for Saudi Arabia","dialCode":"+966"},{"code":"SB","emoji":"🇸🇧","unicode":"U+1F1F8 U+1F1E7","name":"Solomon Islands","title":"flag for Solomon Islands","dialCode":"+677"},{"code":"SC","emoji":"🇸🇨","unicode":"U+1F1F8 U+1F1E8","name":"Seychelles","title":"flag for Seychelles","dialCode":"+248"},{"code":"SD","emoji":"🇸🇩","unicode":"U+1F1F8 U+1F1E9","name":"Sudan","title":"flag for Sudan","dialCode":"+249"},{"code":"SE","emoji":"🇸🇪","unicode":"U+1F1F8 U+1F1EA","name":"Sweden","title":"flag for Sweden","dialCode":"+46"},{"code":"SG","emoji":"🇸🇬","unicode":"U+1F1F8 U+1F1EC","name":"Singapore","title":"flag for Singapore","dialCode":"+65"},{"code":"SH","emoji":"🇸🇭","unicode":"U+1F1F8 U+1F1ED","name":"Saint Helena, Ascension and Tristan Da Cunha","title":"flag for Saint Helena, Ascension and Tristan Da Cunha","dialCode":"+290"},{"code":"SI","emoji":"🇸🇮","unicode":"U+1F1F8 U+1F1EE","name":"Slovenia","title":"flag for Slovenia","dialCode":"+386"},{"code":"SJ","emoji":"🇸🇯","unicode":"U+1F1F8 U+1F1EF","name":"Svalbard and Jan Mayen","title":"flag for Svalbard and Jan Mayen","dialCode":"+47"},{"code":"SK","emoji":"🇸🇰","unicode":"U+1F1F8 U+1F1F0","name":"Slovakia","title":"flag for Slovakia","dialCode":"+421"},{"code":"SL","emoji":"🇸🇱","unicode":"U+1F1F8 U+1F1F1","name":"Sierra Leone","title":"flag for Sierra Leone","dialCode":"+232"},{"code":"SM","emoji":"🇸🇲","unicode":"U+1F1F8 U+1F1F2","name":"San Marino","title":"flag for San Marino","dialCode":"+378"},{"code":"SN","emoji":"🇸🇳","unicode":"U+1F1F8 U+1F1F3","name":"Senegal","title":"flag for Senegal","dialCode":"+221"},{"code":"SO","emoji":"🇸🇴","unicode":"U+1F1F8 U+1F1F4","name":"Somalia","title":"flag for Somalia","dialCode":"+252"},{"code":"SR","emoji":"🇸🇷","unicode":"U+1F1F8 U+1F1F7","name":"Suriname","title":"flag for Suriname","dialCode":"+597"},{"code":"SS","emoji":"🇸🇸","unicode":"U+1F1F8 U+1F1F8","name":"South Sudan","title":"flag for South Sudan"},{"code":"ST","emoji":"🇸🇹","unicode":"U+1F1F8 U+1F1F9","name":"Sao Tome and Principe","title":"flag for Sao Tome and Principe","dialCode":"+239"},{"code":"SV","emoji":"🇸🇻","unicode":"U+1F1F8 U+1F1FB","name":"El Salvador","title":"flag for El Salvador","dialCode":"+503"},{"code":"SX","emoji":"🇸🇽","unicode":"U+1F1F8 U+1F1FD","name":"Sint Maarten (Dutch Part)","title":"flag for Sint Maarten (Dutch Part)"},{"code":"SY","emoji":"🇸🇾","unicode":"U+1F1F8 U+1F1FE","name":"Syrian Arab Republic","title":"flag for Syrian Arab Republic","dialCode":"+963"},{"code":"SZ","emoji":"🇸🇿","unicode":"U+1F1F8 U+1F1FF","name":"Swaziland","title":"flag for Swaziland","dialCode":"+268"},{"code":"TC","emoji":"🇹🇨","unicode":"U+1F1F9 U+1F1E8","name":"Turks and Caicos Islands","title":"flag for Turks and Caicos Islands","dialCode":"+1 649"},{"code":"TD","emoji":"🇹🇩","unicode":"U+1F1F9 U+1F1E9","name":"Chad","title":"flag for Chad","dialCode":"+235"},{"code":"TF","emoji":"🇹🇫","unicode":"U+1F1F9 U+1F1EB","name":"French Southern Territories","title":"flag for French Southern Territories"},{"code":"TG","emoji":"🇹🇬","unicode":"U+1F1F9 U+1F1EC","name":"Togo","title":"flag for Togo","dialCode":"+228"},{"code":"TH","emoji":"🇹🇭","unicode":"U+1F1F9 U+1F1ED","name":"Thailand","title":"flag for Thailand","dialCode":"+66"},{"code":"TJ","emoji":"🇹🇯","unicode":"U+1F1F9 U+1F1EF","name":"Tajikistan","title":"flag for Tajikistan","dialCode":"+992"},{"code":"TK","emoji":"🇹🇰","unicode":"U+1F1F9 U+1F1F0","name":"Tokelau","title":"flag for Tokelau","dialCode":"+690"},{"code":"TL","emoji":"🇹🇱","unicode":"U+1F1F9 U+1F1F1","name":"Timor-Leste","title":"flag for Timor-Leste","dialCode":"+670"},{"code":"TM","emoji":"🇹🇲","unicode":"U+1F1F9 U+1F1F2","name":"Turkmenistan","title":"flag for Turkmenistan","dialCode":"+993"},{"code":"TN","emoji":"🇹🇳","unicode":"U+1F1F9 U+1F1F3","name":"Tunisia","title":"flag for Tunisia","dialCode":"+216"},{"code":"TO","emoji":"🇹🇴","unicode":"U+1F1F9 U+1F1F4","name":"Tonga","title":"flag for Tonga","dialCode":"+676"},{"code":"TR","emoji":"🇹🇷","unicode":"U+1F1F9 U+1F1F7","name":"Turkey","title":"flag for Turkey","dialCode":"+90"},{"code":"TT","emoji":"🇹🇹","unicode":"U+1F1F9 U+1F1F9","name":"Trinidad and Tobago","title":"flag for Trinidad and Tobago","dialCode":"+1 868"},{"code":"TV","emoji":"🇹🇻","unicode":"U+1F1F9 U+1F1FB","name":"Tuvalu","title":"flag for Tuvalu","dialCode":"+688"},{"code":"TW","emoji":"🇹🇼","unicode":"U+1F1F9 U+1F1FC","name":"Taiwan","title":"flag for Taiwan","dialCode":"+886"},{"code":"TZ","emoji":"🇹🇿","unicode":"U+1F1F9 U+1F1FF","name":"Tanzania","title":"flag for Tanzania","dialCode":"+255"},{"code":"UA","emoji":"🇺🇦","unicode":"U+1F1FA U+1F1E6","name":"Ukraine","title":"flag for Ukraine","dialCode":"+380"},{"code":"UG","emoji":"🇺🇬","unicode":"U+1F1FA U+1F1EC","name":"Uganda","title":"flag for Uganda","dialCode":"+256"},{"code":"UM","emoji":"🇺🇲","unicode":"U+1F1FA U+1F1F2","name":"United States Minor Outlying Islands","title":"flag for United States Minor Outlying Islands"},{"code":"US","emoji":"🇺🇸","unicode":"U+1F1FA U+1F1F8","name":"United States","title":"flag for United States","dialCode":"+1"},{"code":"UY","emoji":"🇺🇾","unicode":"U+1F1FA U+1F1FE","name":"Uruguay","title":"flag for Uruguay","dialCode":"+598"},{"code":"UZ","emoji":"🇺🇿","unicode":"U+1F1FA U+1F1FF","name":"Uzbekistan","title":"flag for Uzbekistan","dialCode":"+998"},{"code":"VA","emoji":"🇻🇦","unicode":"U+1F1FB U+1F1E6","name":"Vatican City","title":"flag for Vatican City","dialCode":"+379"},{"code":"VC","emoji":"🇻🇨","unicode":"U+1F1FB U+1F1E8","name":"Saint Vincent and The Grenadines","title":"flag for Saint Vincent and The Grenadines","dialCode":"+1 784"},{"code":"VE","emoji":"🇻🇪","unicode":"U+1F1FB U+1F1EA","name":"Venezuela","title":"flag for Venezuela","dialCode":"+58"},{"code":"VG","emoji":"🇻🇬","unicode":"U+1F1FB U+1F1EC","name":"Virgin Islands, British","title":"flag for Virgin Islands, British","dialCode":"+1 284"},{"code":"VI","emoji":"🇻🇮","unicode":"U+1F1FB U+1F1EE","name":"Virgin Islands, U.S.","title":"flag for Virgin Islands, U.S.","dialCode":"+1 340"},{"code":"VN","emoji":"🇻🇳","unicode":"U+1F1FB U+1F1F3","name":"Viet Nam","title":"flag for Viet Nam","dialCode":"+84"},{"code":"VU","emoji":"🇻🇺","unicode":"U+1F1FB U+1F1FA","name":"Vanuatu","title":"flag for Vanuatu","dialCode":"+678"},{"code":"WF","emoji":"🇼🇫","unicode":"U+1F1FC U+1F1EB","name":"Wallis and Futuna","title":"flag for Wallis and Futuna","dialCode":"+681"},{"code":"WS","emoji":"🇼🇸","unicode":"U+1F1FC U+1F1F8","name":"Samoa","title":"flag for Samoa","dialCode":"+685"},{"code":"XK","emoji":"🇽🇰","unicode":"U+1F1FD U+1F1F0","name":"Kosovo","title":"flag for Kosovo","dialCode":"+383"},{"code":"YE","emoji":"🇾🇪","unicode":"U+1F1FE U+1F1EA","name":"Yemen","title":"flag for Yemen","dialCode":"+967"},{"code":"YT","emoji":"🇾🇹","unicode":"U+1F1FE U+1F1F9","name":"Mayotte","title":"flag for Mayotte","dialCode":"+262"},{"code":"ZA","emoji":"🇿🇦","unicode":"U+1F1FF U+1F1E6","name":"South Africa","title":"flag for South Africa","dialCode":"+27"},{"code":"ZM","emoji":"🇿🇲","unicode":"U+1F1FF U+1F1F2","name":"Zambia","title":"flag for Zambia","dialCode":"+260"},{"code":"ZW","emoji":"🇿🇼","unicode":"U+1F1FF U+1F1FC","name":"Zimbabwe","title":"flag for Zimbabwe","dialCode":"+263"}]
function getFlag(countryName) {
if (!countryName) {
return '';
}
return (flags.find(function (item) {
return item.name === countryName;
}) || {}).emoji;
}
return value + '{flag|' + getFlag(value) + '}';
}
''',
"series_color":
'''
function (param) {
const countryColors = {"Australia":"#00008b","Canada":"#f00","China":"#ffde00","Cuba":"#002a8f","Finland":"#003580","France":"#ed2939","Germany":"#000","Iceland":"#003897","India":"#f93","Japan":"#bc002d","North Korea":"#024fa2","South Korea":"#000","New Zealand":"#00247d","Norway":"#ef2b2d","Poland":"#dc143c","Russia":"#d52b1e","Turkey":"#e30a17","United Kingdom":"#00247d","United States":"#b22234"};
return countryColors[param.value[3]] || '#5470c6';
}
'''
},
fun_values=['x_axis_formatter', 'y_axis_formatter', 'series_color']
),
dbc.Button('restart', color='success',
id='bar-race-button',
style={
'position': 'absolute',
'height': 50, 'width': '10%',
'top': '75%', 'left': '75%',
'opacity': 0.8
}
),
dcc.Markdown(
"""
```python
# coding=utf-8
import json
import dash
from os import path
import dash_echarts
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
basepath = path.dirname(__file__)
filepath = path.abspath(path.join(basepath, 'life-expectancy-table.json'))
with open(filepath) as json_file:
res = json.load(json_file)
years = []
for e in res[1:]:
if len(years) == 0 or years[-1] != e[4]:
years.append(e[4])
start_index = 0
start_year = years[start_index]
dimension = 0
def gen_next_year_data(year=None):
if not year:
year = years[0]
else:
try:
index = years.index(year)
except ValueError as e:
index = -1
if index >= len(years)-1:
year = years[-1]
elif index < 0:
year = years[0]
else:
year = years[index+1]
return year, [e for e in res[1:] if e[4] == year]
option = {
'grid': {
'top': 10,
'bottom': 30,
'left': 150,
'right': 80
},
'xAxis': {
'max': 'dataMax',
'label': {
'formatter': 'x_axis_formatter'
}
},
'dataset': {
'source': gen_next_year_data()
},
'yAxis': {
'type': 'category',
'inverse': True,
'max': 10,
'axisLabel': {
'show': True,
'textStyle': {
'fontSize': 14
},
'formatter': 'y_axis_formatter',
'rich': {
'flag': {
'fontSize': 25,
'padding': 5
}
}
},
'animationDuration': 300,
'animationDurationUpdate': 300
},
'series': [{
'realtimeSort': True,
'seriesLayoutBy': 'column',
'type': 'bar',
'itemStyle': {
'color': 'series_color'
},
'encode': {
'x': dimension,
'y': 3
},
'label': {
'show': True,
'precision': 1,
'position': 'right',
'valueAnimation': True,
'fontFamily': 'monospace'
}
}],
# Disable init animation.
'animationDuration': 0,
'animationDurationUpdate': 2000,
'animationEasing': 'linear',
'animationEasingUpdate': 'linear',
'graphic': {
'elements': [{
'type': 'text',
'right': 160,
'bottom': 60,
'style': {
'text': start_year,
'font': 'bolder 80px monospace',
'fill': 'rgba(100, 100, 100, 0.25)'
},
'z': 100
}]
}
}
layout = html.Div([
dash_echarts.DashECharts(
option = option,
id='echarts',
style={
"width": '100%',
"height": '95vh',
},
funs={
"x_axis_formatter":
'''
function (n) {
return Math.round(n);
}
''',
"y_axis_formatter":
'''
function (value) {
const flags = [{"code":"AD","emoji":"🇦🇩","unicode":"U+1F1E6 U+1F1E9","name":"Andorra","title":"flag for Andorra","dialCode":"+376"},{"code":"AE","emoji":"🇦🇪","unicode":"U+1F1E6 U+1F1EA","name":"United Arab Emirates","title":"flag for United Arab Emirates","dialCode":"+971"},{"code":"AF","emoji":"🇦🇫","unicode":"U+1F1E6 U+1F1EB","name":"Afghanistan","title":"flag for Afghanistan","dialCode":"+93"},{"code":"AG","emoji":"🇦🇬","unicode":"U+1F1E6 U+1F1EC","name":"Antigua and Barbuda","title":"flag for Antigua and Barbuda","dialCode":"+1268"},{"code":"AI","emoji":"🇦🇮","unicode":"U+1F1E6 U+1F1EE","name":"Anguilla","title":"flag for Anguilla","dialCode":"+1 264"},{"code":"AL","emoji":"🇦🇱","unicode":"U+1F1E6 U+1F1F1","name":"Albania","title":"flag for Albania","dialCode":"+355"},{"code":"AM","emoji":"🇦🇲","unicode":"U+1F1E6 U+1F1F2","name":"Armenia","title":"flag for Armenia","dialCode":"+374"},{"code":"AO","emoji":"🇦🇴","unicode":"U+1F1E6 U+1F1F4","name":"Angola","title":"flag for Angola","dialCode":"+244"},{"code":"AQ","emoji":"🇦🇶","unicode":"U+1F1E6 U+1F1F6","name":"Antarctica","title":"flag for Antarctica","dialCode":null},{"code":"AR","emoji":"🇦🇷","unicode":"U+1F1E6 U+1F1F7","name":"Argentina","title":"flag for Argentina","dialCode":"+54"},{"code":"AS","emoji":"🇦🇸","unicode":"U+1F1E6 U+1F1F8","name":"American Samoa","title":"flag for American Samoa","dialCode":"+1 684"},{"code":"AT","emoji":"🇦🇹","unicode":"U+1F1E6 U+1F1F9","name":"Austria","title":"flag for Austria","dialCode":"+43"},{"code":"AU","emoji":"🇦🇺","unicode":"U+1F1E6 U+1F1FA","name":"Australia","title":"flag for Australia","dialCode":"+61"},{"code":"AW","emoji":"🇦🇼","unicode":"U+1F1E6 U+1F1FC","name":"Aruba","title":"flag for Aruba","dialCode":"+297"},{"code":"AX","emoji":"🇦🇽","unicode":"U+1F1E6 U+1F1FD","name":"Åland Islands","title":"flag for Åland Islands","dialCode":""},{"code":"AZ","emoji":"🇦🇿","unicode":"U+1F1E6 U+1F1FF","name":"Azerbaijan","title":"flag for Azerbaijan","dialCode":"+994"},{"code":"BA","emoji":"🇧🇦","unicode":"U+1F1E7 U+1F1E6","name":"Bosnia and Herzegovina","title":"flag for Bosnia and Herzegovina","dialCode":"+387"},{"code":"BB","emoji":"🇧🇧","unicode":"U+1F1E7 U+1F1E7","name":"Barbados","title":"flag for Barbados","dialCode":"+1 246"},{"code":"BD","emoji":"🇧🇩","unicode":"U+1F1E7 U+1F1E9","name":"Bangladesh","title":"flag for Bangladesh","dialCode":"+880"},{"code":"BE","emoji":"🇧🇪","unicode":"U+1F1E7 U+1F1EA","name":"Belgium","title":"flag for Belgium","dialCode":"+32"},{"code":"BF","emoji":"🇧🇫","unicode":"U+1F1E7 U+1F1EB","name":"Burkina Faso","title":"flag for Burkina Faso","dialCode":"+226"},{"code":"BG","emoji":"🇧🇬","unicode":"U+1F1E7 U+1F1EC","name":"Bulgaria","title":"flag for Bulgaria","dialCode":"+359"},{"code":"BH","emoji":"🇧🇭","unicode":"U+1F1E7 U+1F1ED","name":"Bahrain","title":"flag for Bahrain","dialCode":"+973"},{"code":"BI","emoji":"🇧🇮","unicode":"U+1F1E7 U+1F1EE","name":"Burundi","title":"flag for Burundi","dialCode":"+257"},{"code":"BJ","emoji":"🇧🇯","unicode":"U+1F1E7 U+1F1EF","name":"Benin","title":"flag for Benin","dialCode":"+229"},{"code":"BL","emoji":"🇧🇱","unicode":"U+1F1E7 U+1F1F1","name":"Saint Barthélemy","title":"flag for Saint Barthélemy","dialCode":"+590"},{"code":"BM","emoji":"🇧🇲","unicode":"U+1F1E7 U+1F1F2","name":"Bermuda","title":"flag for Bermuda","dialCode":"+1 441"},{"code":"BN","emoji":"🇧🇳","unicode":"U+1F1E7 U+1F1F3","name":"Brunei Darussalam","title":"flag for Brunei Darussalam","dialCode":"+673"},{"code":"BO","emoji":"🇧🇴","unicode":"U+1F1E7 U+1F1F4","name":"Bolivia","title":"flag for Bolivia","dialCode":"+591"},{"code":"BQ","emoji":"🇧🇶","unicode":"U+1F1E7 U+1F1F6","name":"Bonaire, Sint Eustatius and Saba","title":"flag for Bonaire, Sint Eustatius and Saba"},{"code":"BR","emoji":"🇧🇷","unicode":"U+1F1E7 U+1F1F7","name":"Brazil","title":"flag for Brazil","dialCode":"+55"},{"code":"BS","emoji":"🇧🇸","unicode":"U+1F1E7 U+1F1F8","name":"Bahamas","title":"flag for Bahamas","dialCode":"+1 242"},{"code":"BT","emoji":"🇧🇹","unicode":"U+1F1E7 U+1F1F9","name":"Bhutan","title":"flag for Bhutan","dialCode":"+975"},{"code":"BV","emoji":"🇧🇻","unicode":"U+1F1E7 U+1F1FB","name":"Bouvet Island","title":"flag for Bouvet Island"},{"code":"BW","emoji":"🇧🇼","unicode":"U+1F1E7 U+1F1FC","name":"Botswana","title":"flag for Botswana","dialCode":"+267"},{"code":"BY","emoji":"🇧🇾","unicode":"U+1F1E7 U+1F1FE","name":"Belarus","title":"flag for Belarus","dialCode":"+375"},{"code":"BZ","emoji":"🇧🇿","unicode":"U+1F1E7 U+1F1FF","name":"Belize","title":"flag for Belize","dialCode":"+501"},{"code":"CA","emoji":"🇨🇦","unicode":"U+1F1E8 U+1F1E6","name":"Canada","title":"flag for Canada","dialCode":"+1"},{"code":"CC","emoji":"🇨🇨","unicode":"U+1F1E8 U+1F1E8","name":"Cocos (Keeling) Islands","title":"flag for Cocos (Keeling) Islands","dialCode":"+61"},{"code":"CD","emoji":"🇨🇩","unicode":"U+1F1E8 U+1F1E9","name":"Congo","title":"flag for Congo","dialCode":"+243"},{"code":"CF","emoji":"🇨🇫","unicode":"U+1F1E8 U+1F1EB","name":"Central African Republic","title":"flag for Central African Republic","dialCode":"+236"},{"code":"CG","emoji":"🇨🇬","unicode":"U+1F1E8 U+1F1EC","name":"Congo","title":"flag for Congo","dialCode":"+242"},{"code":"CH","emoji":"🇨🇭","unicode":"U+1F1E8 U+1F1ED","name":"Switzerland","title":"flag for Switzerland","dialCode":"+41"},{"code":"CI","emoji":"🇨🇮","unicode":"U+1F1E8 U+1F1EE","name":"Côte D'Ivoire","title":"flag for Côte D'Ivoire","dialCode":"+225"},{"code":"CK","emoji":"🇨🇰","unicode":"U+1F1E8 U+1F1F0","name":"Cook Islands","title":"flag for Cook Islands","dialCode":"+682"},{"code":"CL","emoji":"🇨🇱","unicode":"U+1F1E8 U+1F1F1","name":"Chile","title":"flag for Chile","dialCode":"+56"},{"code":"CM","emoji":"🇨🇲","unicode":"U+1F1E8 U+1F1F2","name":"Cameroon","title":"flag for Cameroon","dialCode":"+237"},{"code":"CN","emoji":"🇨🇳","unicode":"U+1F1E8 U+1F1F3","name":"China","title":"flag for China","dialCode":"+86"},{"code":"CO","emoji":"🇨🇴","unicode":"U+1F1E8 U+1F1F4","name":"Colombia","title":"flag for Colombia","dialCode":"+57"},{"code":"CR","emoji":"🇨🇷","unicode":"U+1F1E8 U+1F1F7","name":"Costa Rica","title":"flag for Costa Rica","dialCode":"+506"},{"code":"CU","emoji":"🇨🇺","unicode":"U+1F1E8 U+1F1FA","name":"Cuba","title":"flag for Cuba","dialCode":"+53"},{"code":"CV","emoji":"🇨🇻","unicode":"U+1F1E8 U+1F1FB","name":"Cape Verde","title":"flag for Cape Verde","dialCode":"+238"},{"code":"CW","emoji":"🇨🇼","unicode":"U+1F1E8 U+1F1FC","name":"Curaçao","title":"flag for Curaçao"},{"code":"CX","emoji":"🇨🇽","unicode":"U+1F1E8 U+1F1FD","name":"Christmas Island","title":"flag for Christmas Island","dialCode":"+61"},{"code":"CY","emoji":"🇨🇾","unicode":"U+1F1E8 U+1F1FE","name":"Cyprus","title":"flag for Cyprus","dialCode":"+537"},{"code":"CZ","emoji":"🇨🇿","unicode":"U+1F1E8 U+1F1FF","name":"Czech Republic","title":"flag for Czech Republic","dialCode":"+420"},{"code":"DE","emoji":"🇩🇪","unicode":"U+1F1E9 U+1F1EA","name":"Germany","title":"flag for Germany","dialCode":"+49"},{"code":"DJ","emoji":"🇩🇯","unicode":"U+1F1E9 U+1F1EF","name":"Djibouti","title":"flag for Djibouti","dialCode":"+253"},{"code":"DK","emoji":"🇩🇰","unicode":"U+1F1E9 U+1F1F0","name":"Denmark","title":"flag for Denmark","dialCode":"+45"},{"code":"DM","emoji":"🇩🇲","unicode":"U+1F1E9 U+1F1F2","name":"Dominica","title":"flag for Dominica","dialCode":"+1 767"},{"code":"DO","emoji":"🇩🇴","unicode":"U+1F1E9 U+1F1F4","name":"Dominican Republic","title":"flag for Dominican Republic","dialCode":"+1 849"},{"code":"DZ","emoji":"🇩🇿","unicode":"U+1F1E9 U+1F1FF","name":"Algeria","title":"flag for Algeria","dialCode":"+213"},{"code":"EC","emoji":"🇪🇨","unicode":"U+1F1EA U+1F1E8","name":"Ecuador","title":"flag for Ecuador","dialCode":"+593"},{"code":"EE","emoji":"🇪🇪","unicode":"U+1F1EA U+1F1EA","name":"Estonia","title":"flag for Estonia","dialCode":"+372"},{"code":"EG","emoji":"🇪🇬","unicode":"U+1F1EA U+1F1EC","name":"Egypt","title":"flag for Egypt","dialCode":"+20"},{"code":"EH","emoji":"🇪🇭","unicode":"U+1F1EA U+1F1ED","name":"Western Sahara","title":"flag for Western Sahara"},{"code":"ER","emoji":"🇪🇷","unicode":"U+1F1EA U+1F1F7","name":"Eritrea","title":"flag for Eritrea","dialCode":"+291"},{"code":"ES","emoji":"🇪🇸","unicode":"U+1F1EA U+1F1F8","name":"Spain","title":"flag for Spain","dialCode":"+34"},{"code":"ET","emoji":"🇪🇹","unicode":"U+1F1EA U+1F1F9","name":"Ethiopia","title":"flag for Ethiopia","dialCode":"+251"},{"code":"EU","emoji":"🇪🇺","unicode":"U+1F1EA U+1F1FA","name":"European Union","title":"flag for European Union"},{"code":"FI","emoji":"🇫🇮","unicode":"U+1F1EB U+1F1EE","name":"Finland","title":"flag for Finland","dialCode":"+358"},{"code":"FJ","emoji":"🇫🇯","unicode":"U+1F1EB U+1F1EF","name":"Fiji","title":"flag for Fiji","dialCode":"+679"},{"code":"FK","emoji":"🇫🇰","unicode":"U+1F1EB U+1F1F0","name":"Falkland Islands (Malvinas)","title":"flag for Falkland Islands (Malvinas)","dialCode":"+500"},{"code":"FM","emoji":"🇫🇲","unicode":"U+1F1EB U+1F1F2","name":"Micronesia","title":"flag for Micronesia","dialCode":"+691"},{"code":"FO","emoji":"🇫🇴","unicode":"U+1F1EB U+1F1F4","name":"Faroe Islands","title":"flag for Faroe Islands","dialCode":"+298"},{"code":"FR","emoji":"🇫🇷","unicode":"U+1F1EB U+1F1F7","name":"France","title":"flag for France","dialCode":"+33"},{"code":"GA","emoji":"🇬🇦","unicode":"U+1F1EC U+1F1E6","name":"Gabon","title":"flag for Gabon","dialCode":"+241"},{"code":"GB","emoji":"🇬🇧","unicode":"U+1F1EC U+1F1E7","name":"United Kingdom","title":"flag for United Kingdom","dialCode":"+44"},{"code":"GD","emoji":"🇬🇩","unicode":"U+1F1EC U+1F1E9","name":"Grenada","title":"flag for Grenada","dialCode":"+1 473"},{"code":"GE","emoji":"🇬🇪","unicode":"U+1F1EC U+1F1EA","name":"Georgia","title":"flag for Georgia","dialCode":"+995"},{"code":"GF","emoji":"🇬🇫","unicode":"U+1F1EC U+1F1EB","name":"French Guiana","title":"flag for French Guiana","dialCode":"+594"},{"code":"GG","emoji":"🇬🇬","unicode":"U+1F1EC U+1F1EC","name":"Guernsey","title":"flag for Guernsey","dialCode":"+44"},{"code":"GH","emoji":"🇬🇭","unicode":"U+1F1EC U+1F1ED","name":"Ghana","title":"flag for Ghana","dialCode":"+233"},{"code":"GI","emoji":"🇬🇮","unicode":"U+1F1EC U+1F1EE","name":"Gibraltar","title":"flag for Gibraltar","dialCode":"+350"},{"code":"GL","emoji":"🇬🇱","unicode":"U+1F1EC U+1F1F1","name":"Greenland","title":"flag for Greenland","dialCode":"+299"},{"code":"GM","emoji":"🇬🇲","unicode":"U+1F1EC U+1F1F2","name":"Gambia","title":"flag for Gambia","dialCode":"+220"},{"code":"GN","emoji":"🇬🇳","unicode":"U+1F1EC U+1F1F3","name":"Guinea","title":"flag for Guinea","dialCode":"+224"},{"code":"GP","emoji":"🇬🇵","unicode":"U+1F1EC U+1F1F5","name":"Guadeloupe","title":"flag for Guadeloupe","dialCode":"+590"},{"code":"GQ","emoji":"🇬🇶","unicode":"U+1F1EC U+1F1F6","name":"Equatorial Guinea","title":"flag for Equatorial Guinea","dialCode":"+240"},{"code":"GR","emoji":"🇬🇷","unicode":"U+1F1EC U+1F1F7","name":"Greece","title":"flag for Greece","dialCode":"+30"},{"code":"GS","emoji":"🇬🇸","unicode":"U+1F1EC U+1F1F8","name":"South Georgia","title":"flag for South Georgia","dialCode":"+500"},{"code":"GT","emoji":"🇬🇹","unicode":"U+1F1EC U+1F1F9","name":"Guatemala","title":"flag for Guatemala","dialCode":"+502"},{"code":"GU","emoji":"🇬🇺","unicode":"U+1F1EC U+1F1FA","name":"Guam","title":"flag for Guam","dialCode":"+1 671"},{"code":"GW","emoji":"🇬🇼","unicode":"U+1F1EC U+1F1FC","name":"Guinea-Bissau","title":"flag for Guinea-Bissau","dialCode":"+245"},{"code":"GY","emoji":"🇬🇾","unicode":"U+1F1EC U+1F1FE","name":"Guyana","title":"flag for Guyana","dialCode":"+595"},{"code":"HK","emoji":"🇭🇰","unicode":"U+1F1ED U+1F1F0","name":"Hong Kong","title":"flag for Hong Kong","dialCode":"+852"},{"code":"HM","emoji":"🇭🇲","unicode":"U+1F1ED U+1F1F2","name":"Heard Island and Mcdonald Islands","title":"flag for Heard Island and Mcdonald Islands"},{"code":"HN","emoji":"🇭🇳","unicode":"U+1F1ED U+1F1F3","name":"Honduras","title":"flag for Honduras","dialCode":"+504"},{"code":"HR","emoji":"🇭🇷","unicode":"U+1F1ED U+1F1F7","name":"Croatia","title":"flag for Croatia","dialCode":"+385"},{"code":"HT","emoji":"🇭🇹","unicode":"U+1F1ED U+1F1F9","name":"Haiti","title":"flag for Haiti","dialCode":"+509"},{"code":"HU","emoji":"🇭🇺","unicode":"U+1F1ED U+1F1FA","name":"Hungary","title":"flag for Hungary","dialCode":"+36"},{"code":"ID","emoji":"🇮🇩","unicode":"U+1F1EE U+1F1E9","name":"Indonesia","title":"flag for Indonesia","dialCode":"+62"},{"code":"IE","emoji":"🇮🇪","unicode":"U+1F1EE U+1F1EA","name":"Ireland","title":"flag for Ireland","dialCode":"+353"},{"code":"IL","emoji":"🇮🇱","unicode":"U+1F1EE U+1F1F1","name":"Israel","title":"flag for Israel","dialCode":"+972"},{"code":"IM","emoji":"🇮🇲","unicode":"U+1F1EE U+1F1F2","name":"Isle of Man","title":"flag for Isle of Man","dialCode":"+44"},{"code":"IN","emoji":"🇮🇳","unicode":"U+1F1EE U+1F1F3","name":"India","title":"flag for India","dialCode":"+91"},{"code":"IO","emoji":"🇮🇴","unicode":"U+1F1EE U+1F1F4","name":"British Indian Ocean Territory","title":"flag for British Indian Ocean Territory","dialCode":"+246"},{"code":"IQ","emoji":"🇮🇶","unicode":"U+1F1EE U+1F1F6","name":"Iraq","title":"flag for Iraq","dialCode":"+964"},{"code":"IR","emoji":"🇮🇷","unicode":"U+1F1EE U+1F1F7","name":"Iran","title":"flag for Iran","dialCode":"+98"},{"code":"IS","emoji":"🇮🇸","unicode":"U+1F1EE U+1F1F8","name":"Iceland","title":"flag for Iceland","dialCode":"+354"},{"code":"IT","emoji":"🇮🇹","unicode":"U+1F1EE U+1F1F9","name":"Italy","title":"flag for Italy","dialCode":"+39"},{"code":"JE","emoji":"🇯🇪","unicode":"U+1F1EF U+1F1EA","name":"Jersey","title":"flag for Jersey","dialCode":"+44"},{"code":"JM","emoji":"🇯🇲","unicode":"U+1F1EF U+1F1F2","name":"Jamaica","title":"flag for Jamaica","dialCode":"+1 876"},{"code":"JO","emoji":"🇯🇴","unicode":"U+1F1EF U+1F1F4","name":"Jordan","title":"flag for Jordan","dialCode":"+962"},{"code":"JP","emoji":"🇯🇵","unicode":"U+1F1EF U+1F1F5","name":"Japan","title":"flag for Japan","dialCode":"+81"},{"code":"KE","emoji":"🇰🇪","unicode":"U+1F1F0 U+1F1EA","name":"Kenya","title":"flag for Kenya","dialCode":"+254"},{"code":"KG","emoji":"🇰🇬","unicode":"U+1F1F0 U+1F1EC","name":"Kyrgyzstan","title":"flag for Kyrgyzstan","dialCode":"+996"},{"code":"KH","emoji":"🇰🇭","unicode":"U+1F1F0 U+1F1ED","name":"Cambodia","title":"flag for Cambodia","dialCode":"+855"},{"code":"KI","emoji":"🇰🇮","unicode":"U+1F1F0 U+1F1EE","name":"Kiribati","title":"flag for Kiribati","dialCode":"+686"},{"code":"KM","emoji":"🇰🇲","unicode":"U+1F1F0 U+1F1F2","name":"Comoros","title":"flag for Comoros","dialCode":"+269"},{"code":"KN","emoji":"🇰🇳","unicode":"U+1F1F0 U+1F1F3","name":"Saint Kitts and Nevis","title":"flag for Saint Kitts and Nevis","dialCode":"+1 869"},{"code":"KP","emoji":"🇰🇵","unicode":"U+1F1F0 U+1F1F5","name":"North Korea","title":"flag for North Korea","dialCode":"+850"},{"code":"KR","emoji":"🇰🇷","unicode":"U+1F1F0 U+1F1F7","name":"South Korea","title":"flag for South Korea","dialCode":"+82"},{"code":"KW","emoji":"🇰🇼","unicode":"U+1F1F0 U+1F1FC","name":"Kuwait","title":"flag for Kuwait","dialCode":"+965"},{"code":"KY","emoji":"🇰🇾","unicode":"U+1F1F0 U+1F1FE","name":"Cayman Islands","title":"flag for Cayman Islands","dialCode":"+ 345"},{"code":"KZ","emoji":"🇰🇿","unicode":"U+1F1F0 U+1F1FF","name":"Kazakhstan","title":"flag for Kazakhstan","dialCode":"+7 7"},{"code":"LA","emoji":"🇱🇦","unicode":"U+1F1F1 U+1F1E6","name":"Lao People's Democratic Republic","title":"flag for Lao People's Democratic Republic","dialCode":"+856"},{"code":"LB","emoji":"🇱🇧","unicode":"U+1F1F1 U+1F1E7","name":"Lebanon","title":"flag for Lebanon","dialCode":"+961"},{"code":"LC","emoji":"🇱🇨","unicode":"U+1F1F1 U+1F1E8","name":"Saint Lucia","title":"flag for Saint Lucia","dialCode":"+1 758"},{"code":"LI","emoji":"🇱🇮","unicode":"U+1F1F1 U+1F1EE","name":"Liechtenstein","title":"flag for Liechtenstein","dialCode":"+423"},{"code":"LK","emoji":"🇱🇰","unicode":"U+1F1F1 U+1F1F0","name":"Sri Lanka","title":"flag for Sri Lanka","dialCode":"+94"},{"code":"LR","emoji":"🇱🇷","unicode":"U+1F1F1 U+1F1F7","name":"Liberia","title":"flag for Liberia","dialCode":"+231"},{"code":"LS","emoji":"🇱🇸","unicode":"U+1F1F1 U+1F1F8","name":"Lesotho","title":"flag for Lesotho","dialCode":"+266"},{"code":"LT","emoji":"🇱🇹","unicode":"U+1F1F1 U+1F1F9","name":"Lithuania","title":"flag for Lithuania","dialCode":"+370"},{"code":"LU","emoji":"🇱🇺","unicode":"U+1F1F1 U+1F1FA","name":"Luxembourg","title":"flag for Luxembourg","dialCode":"+352"},{"code":"LV","emoji":"🇱🇻","unicode":"U+1F1F1 U+1F1FB","name":"Latvia","title":"flag for Latvia","dialCode":"+371"},{"code":"LY","emoji":"🇱🇾","unicode":"U+1F1F1 U+1F1FE","name":"Libya","title":"flag for Libya","dialCode":"+218"},{"code":"MA","emoji":"🇲🇦","unicode":"U+1F1F2 U+1F1E6","name":"Morocco","title":"flag for Morocco","dialCode":"+212"},{"code":"MC","emoji":"🇲🇨","unicode":"U+1F1F2 U+1F1E8","name":"Monaco","title":"flag for Monaco","dialCode":"+377"},{"code":"MD","emoji":"🇲🇩","unicode":"U+1F1F2 U+1F1E9","name":"Moldova","title":"flag for Moldova","dialCode":"+373"},{"code":"ME","emoji":"🇲🇪","unicode":"U+1F1F2 U+1F1EA","name":"Montenegro","title":"flag for Montenegro","dialCode":"+382"},{"code":"MF","emoji":"🇲🇫","unicode":"U+1F1F2 U+1F1EB","name":"Saint Martin (French Part)","title":"flag for Saint Martin (French Part)","dialCode":"+590"},{"code":"MG","emoji":"🇲🇬","unicode":"U+1F1F2 U+1F1EC","name":"Madagascar","title":"flag for Madagascar","dialCode":"+261"},{"code":"MH","emoji":"🇲🇭","unicode":"U+1F1F2 U+1F1ED","name":"Marshall Islands","title":"flag for Marshall Islands","dialCode":"+692"},{"code":"MK","emoji":"🇲🇰","unicode":"U+1F1F2 U+1F1F0","name":"Macedonia","title":"flag for Macedonia","dialCode":"+389"},{"code":"ML","emoji":"🇲🇱","unicode":"U+1F1F2 U+1F1F1","name":"Mali","title":"flag for Mali","dialCode":"+223"},{"code":"MM","emoji":"🇲🇲","unicode":"U+1F1F2 U+1F1F2","name":"Myanmar","title":"flag for Myanmar","dialCode":"+95"},{"code":"MN","emoji":"🇲🇳","unicode":"U+1F1F2 U+1F1F3","name":"Mongolia","title":"flag for Mongolia","dialCode":"+976"},{"code":"MO","emoji":"🇲🇴","unicode":"U+1F1F2 U+1F1F4","name":"Macao","title":"flag for Macao","dialCode":"+853"},{"code":"MP","emoji":"🇲🇵","unicode":"U+1F1F2 U+1F1F5","name":"Northern Mariana Islands","title":"flag for Northern Mariana Islands","dialCode":"+1 670"},{"code":"MQ","emoji":"🇲🇶","unicode":"U+1F1F2 U+1F1F6","name":"Martinique","title":"flag for Martinique","dialCode":"+596"},{"code":"MR","emoji":"🇲🇷","unicode":"U+1F1F2 U+1F1F7","name":"Mauritania","title":"flag for Mauritania","dialCode":"+222"},{"code":"MS","emoji":"🇲🇸","unicode":"U+1F1F2 U+1F1F8","name":"Montserrat","title":"flag for Montserrat","dialCode":"+1664"},{"code":"MT","emoji":"🇲🇹","unicode":"U+1F1F2 U+1F1F9","name":"Malta","title":"flag for Malta","dialCode":"+356"},{"code":"MU","emoji":"🇲🇺","unicode":"U+1F1F2 U+1F1FA","name":"Mauritius","title":"flag for Mauritius","dialCode":"+230"},{"code":"MV","emoji":"🇲🇻","unicode":"U+1F1F2 U+1F1FB","name":"Maldives","title":"flag for Maldives","dialCode":"+960"},{"code":"MW","emoji":"🇲🇼","unicode":"U+1F1F2 U+1F1FC","name":"Malawi","title":"flag for Malawi","dialCode":"+265"},{"code":"MX","emoji":"🇲🇽","unicode":"U+1F1F2 U+1F1FD","name":"Mexico","title":"flag for Mexico","dialCode":"+52"},{"code":"MY","emoji":"🇲🇾","unicode":"U+1F1F2 U+1F1FE","name":"Malaysia","title":"flag for Malaysia","dialCode":"+60"},{"code":"MZ","emoji":"🇲🇿","unicode":"U+1F1F2 U+1F1FF","name":"Mozambique","title":"flag for Mozambique","dialCode":"+258"},{"code":"NA","emoji":"🇳🇦","unicode":"U+1F1F3 U+1F1E6","name":"Namibia","title":"flag for Namibia","dialCode":"+264"},{"code":"NC","emoji":"🇳🇨","unicode":"U+1F1F3 U+1F1E8","name":"New Caledonia","title":"flag for New Caledonia","dialCode":"+687"},{"code":"NE","emoji":"🇳🇪","unicode":"U+1F1F3 U+1F1EA","name":"Niger","title":"flag for Niger","dialCode":"+227"},{"code":"NF","emoji":"🇳🇫","unicode":"U+1F1F3 U+1F1EB","name":"Norfolk Island","title":"flag for Norfolk Island","dialCode":"+672"},{"code":"NG","emoji":"🇳🇬","unicode":"U+1F1F3 U+1F1EC","name":"Nigeria","title":"flag for Nigeria","dialCode":"+234"},{"code":"NI","emoji":"🇳🇮","unicode":"U+1F1F3 U+1F1EE","name":"Nicaragua","title":"flag for Nicaragua","dialCode":"+505"},{"code":"NL","emoji":"🇳🇱","unicode":"U+1F1F3 U+1F1F1","name":"Netherlands","title":"flag for Netherlands","dialCode":"+31"},{"code":"NO","emoji":"🇳🇴","unicode":"U+1F1F3 U+1F1F4","name":"Norway","title":"flag for Norway","dialCode":"+47"},{"code":"NP","emoji":"🇳🇵","unicode":"U+1F1F3 U+1F1F5","name":"Nepal","title":"flag for Nepal","dialCode":"+977"},{"code":"NR","emoji":"🇳🇷","unicode":"U+1F1F3 U+1F1F7","name":"Nauru","title":"flag for Nauru","dialCode":"+674"},{"code":"NU","emoji":"🇳🇺","unicode":"U+1F1F3 U+1F1FA","name":"Niue","title":"flag for Niue","dialCode":"+683"},{"code":"NZ","emoji":"🇳🇿","unicode":"U+1F1F3 U+1F1FF","name":"New Zealand","title":"flag for New Zealand","dialCode":"+64"},{"code":"OM","emoji":"🇴🇲","unicode":"U+1F1F4 U+1F1F2","name":"Oman","title":"flag for Oman","dialCode":"+968"},{"code":"PA","emoji":"🇵🇦","unicode":"U+1F1F5 U+1F1E6","name":"Panama","title":"flag for Panama","dialCode":"+507"},{"code":"PE","emoji":"🇵🇪","unicode":"U+1F1F5 U+1F1EA","name":"Peru","title":"flag for Peru","dialCode":"+51"},{"code":"PF","emoji":"🇵🇫","unicode":"U+1F1F5 U+1F1EB","name":"French Polynesia","title":"flag for French Polynesia","dialCode":"+689"},{"code":"PG","emoji":"🇵🇬","unicode":"U+1F1F5 U+1F1EC","name":"Papua New Guinea","title":"flag for Papua New Guinea","dialCode":"+675"},{"code":"PH","emoji":"🇵🇭","unicode":"U+1F1F5 U+1F1ED","name":"Philippines","title":"flag for Philippines","dialCode":"+63"},{"code":"PK","emoji":"🇵🇰","unicode":"U+1F1F5 U+1F1F0","name":"Pakistan","title":"flag for Pakistan","dialCode":"+92"},{"code":"PL","emoji":"🇵🇱","unicode":"U+1F1F5 U+1F1F1","name":"Poland","title":"flag for Poland","dialCode":"+48"},{"code":"PM","emoji":"🇵🇲","unicode":"U+1F1F5 U+1F1F2","name":"Saint Pierre and Miquelon","title":"flag for Saint Pierre and Miquelon","dialCode":"+508"},{"code":"PN","emoji":"🇵🇳","unicode":"U+1F1F5 U+1F1F3","name":"Pitcairn","title":"flag for Pitcairn","dialCode":"+872"},{"code":"PR","emoji":"🇵🇷","unicode":"U+1F1F5 U+1F1F7","name":"Puerto Rico","title":"flag for Puerto Rico","dialCode":"+1 939"},{"code":"PS","emoji":"🇵🇸","unicode":"U+1F1F5 U+1F1F8","name":"Palestinian Territory","title":"flag for Palestinian Territory","dialCode":"+970"},{"code":"PT","emoji":"🇵🇹","unicode":"U+1F1F5 U+1F1F9","name":"Portugal","title":"flag for Portugal","dialCode":"+351"},{"code":"PW","emoji":"🇵🇼","unicode":"U+1F1F5 U+1F1FC","name":"Palau","title":"flag for Palau","dialCode":"+680"},{"code":"PY","emoji":"🇵🇾","unicode":"U+1F1F5 U+1F1FE","name":"Paraguay","title":"flag for Paraguay","dialCode":"+595"},{"code":"QA","emoji":"🇶🇦","unicode":"U+1F1F6 U+1F1E6","name":"Qatar","title":"flag for Qatar","dialCode":"+974"},{"code":"RE","emoji":"🇷🇪","unicode":"U+1F1F7 U+1F1EA","name":"Réunion","title":"flag for Réunion","dialCode":"+262"},{"code":"RO","emoji":"🇷🇴","unicode":"U+1F1F7 U+1F1F4","name":"Romania","title":"flag for Romania","dialCode":"+40"},{"code":"RS","emoji":"🇷🇸","unicode":"U+1F1F7 U+1F1F8","name":"Serbia","title":"flag for Serbia","dialCode":"+381"},{"code":"RU","emoji":"🇷🇺","unicode":"U+1F1F7 U+1F1FA","name":"Russia","title":"flag for Russia","dialCode":"+7"},{"code":"RW","emoji":"🇷🇼","unicode":"U+1F1F7 U+1F1FC","name":"Rwanda","title":"flag for Rwanda","dialCode":"+250"},{"code":"SA","emoji":"🇸🇦","unicode":"U+1F1F8 U+1F1E6","name":"Saudi Arabia","title":"flag for Saudi Arabia","dialCode":"+966"},{"code":"SB","emoji":"🇸🇧","unicode":"U+1F1F8 U+1F1E7","name":"Solomon Islands","title":"flag for Solomon Islands","dialCode":"+677"},{"code":"SC","emoji":"🇸🇨","unicode":"U+1F1F8 U+1F1E8","name":"Seychelles","title":"flag for Seychelles","dialCode":"+248"},{"code":"SD","emoji":"🇸🇩","unicode":"U+1F1F8 U+1F1E9","name":"Sudan","title":"flag for Sudan","dialCode":"+249"},{"code":"SE","emoji":"🇸🇪","unicode":"U+1F1F8 U+1F1EA","name":"Sweden","title":"flag for Sweden","dialCode":"+46"},{"code":"SG","emoji":"🇸🇬","unicode":"U+1F1F8 U+1F1EC","name":"Singapore","title":"flag for Singapore","dialCode":"+65"},{"code":"SH","emoji":"🇸🇭","unicode":"U+1F1F8 U+1F1ED","name":"Saint Helena, Ascension and Tristan Da Cunha","title":"flag for Saint Helena, Ascension and Tristan Da Cunha","dialCode":"+290"},{"code":"SI","emoji":"🇸🇮","unicode":"U+1F1F8 U+1F1EE","name":"Slovenia","title":"flag for Slovenia","dialCode":"+386"},{"code":"SJ","emoji":"🇸🇯","unicode":"U+1F1F8 U+1F1EF","name":"Svalbard and Jan Mayen","title":"flag for Svalbard and Jan Mayen","dialCode":"+47"},{"code":"SK","emoji":"🇸🇰","unicode":"U+1F1F8 U+1F1F0","name":"Slovakia","title":"flag for Slovakia","dialCode":"+421"},{"code":"SL","emoji":"🇸🇱","unicode":"U+1F1F8 U+1F1F1","name":"Sierra Leone","title":"flag for Sierra Leone","dialCode":"+232"},{"code":"SM","emoji":"🇸🇲","unicode":"U+1F1F8 U+1F1F2","name":"San Marino","title":"flag for San Marino","dialCode":"+378"},{"code":"SN","emoji":"🇸🇳","unicode":"U+1F1F8 U+1F1F3","name":"Senegal","title":"flag for Senegal","dialCode":"+221"},{"code":"SO","emoji":"🇸🇴","unicode":"U+1F1F8 U+1F1F4","name":"Somalia","title":"flag for Somalia","dialCode":"+252"},{"code":"SR","emoji":"🇸🇷","unicode":"U+1F1F8 U+1F1F7","name":"Suriname","title":"flag for Suriname","dialCode":"+597"},{"code":"SS","emoji":"🇸🇸","unicode":"U+1F1F8 U+1F1F8","name":"South Sudan","title":"flag for South Sudan"},{"code":"ST","emoji":"🇸🇹","unicode":"U+1F1F8 U+1F1F9","name":"Sao Tome and Principe","title":"flag for Sao Tome and Principe","dialCode":"+239"},{"code":"SV","emoji":"🇸🇻","unicode":"U+1F1F8 U+1F1FB","name":"El Salvador","title":"flag for El Salvador","dialCode":"+503"},{"code":"SX","emoji":"🇸🇽","unicode":"U+1F1F8 U+1F1FD","name":"Sint Maarten (Dutch Part)","title":"flag for Sint Maarten (Dutch Part)"},{"code":"SY","emoji":"🇸🇾","unicode":"U+1F1F8 U+1F1FE","name":"Syrian Arab Republic","title":"flag for Syrian Arab Republic","dialCode":"+963"},{"code":"SZ","emoji":"🇸🇿","unicode":"U+1F1F8 U+1F1FF","name":"Swaziland","title":"flag for Swaziland","dialCode":"+268"},{"code":"TC","emoji":"🇹🇨","unicode":"U+1F1F9 U+1F1E8","name":"Turks and Caicos Islands","title":"flag for Turks and Caicos Islands","dialCode":"+1 649"},{"code":"TD","emoji":"🇹🇩","unicode":"U+1F1F9 U+1F1E9","name":"Chad","title":"flag for Chad","dialCode":"+235"},{"code":"TF","emoji":"🇹🇫","unicode":"U+1F1F9 U+1F1EB","name":"French Southern Territories","title":"flag for French Southern Territories"},{"code":"TG","emoji":"🇹🇬","unicode":"U+1F1F9 U+1F1EC","name":"Togo","title":"flag for Togo","dialCode":"+228"},{"code":"TH","emoji":"🇹🇭","unicode":"U+1F1F9 U+1F1ED","name":"Thailand","title":"flag for Thailand","dialCode":"+66"},{"code":"TJ","emoji":"🇹🇯","unicode":"U+1F1F9 U+1F1EF","name":"Tajikistan","title":"flag for Tajikistan","dialCode":"+992"},{"code":"TK","emoji":"🇹🇰","unicode":"U+1F1F9 U+1F1F0","name":"Tokelau","title":"flag for Tokelau","dialCode":"+690"},{"code":"TL","emoji":"🇹🇱","unicode":"U+1F1F9 U+1F1F1","name":"Timor-Leste","title":"flag for Timor-Leste","dialCode":"+670"},{"code":"TM","emoji":"🇹🇲","unicode":"U+1F1F9 U+1F1F2","name":"Turkmenistan","title":"flag for Turkmenistan","dialCode":"+993"},{"code":"TN","emoji":"🇹🇳","unicode":"U+1F1F9 U+1F1F3","name":"Tunisia","title":"flag for Tunisia","dialCode":"+216"},{"code":"TO","emoji":"🇹🇴","unicode":"U+1F1F9 U+1F1F4","name":"Tonga","title":"flag for Tonga","dialCode":"+676"},{"code":"TR","emoji":"🇹🇷","unicode":"U+1F1F9 U+1F1F7","name":"Turkey","title":"flag for Turkey","dialCode":"+90"},{"code":"TT","emoji":"🇹🇹","unicode":"U+1F1F9 U+1F1F9","name":"Trinidad and Tobago","title":"flag for Trinidad and Tobago","dialCode":"+1 868"},{"code":"TV","emoji":"🇹🇻","unicode":"U+1F1F9 U+1F1FB","name":"Tuvalu","title":"flag for Tuvalu","dialCode":"+688"},{"code":"TW","emoji":"🇹🇼","unicode":"U+1F1F9 U+1F1FC","name":"Taiwan","title":"flag for Taiwan","dialCode":"+886"},{"code":"TZ","emoji":"🇹🇿","unicode":"U+1F1F9 U+1F1FF","name":"Tanzania","title":"flag for Tanzania","dialCode":"+255"},{"code":"UA","emoji":"🇺🇦","unicode":"U+1F1FA U+1F1E6","name":"Ukraine","title":"flag for Ukraine","dialCode":"+380"},{"code":"UG","emoji":"🇺🇬","unicode":"U+1F1FA U+1F1EC","name":"Uganda","title":"flag for Uganda","dialCode":"+256"},{"code":"UM","emoji":"🇺🇲","unicode":"U+1F1FA U+1F1F2","name":"United States Minor Outlying Islands","title":"flag for United States Minor Outlying Islands"},{"code":"US","emoji":"🇺🇸","unicode":"U+1F1FA U+1F1F8","name":"United States","title":"flag for United States","dialCode":"+1"},{"code":"UY","emoji":"🇺🇾","unicode":"U+1F1FA U+1F1FE","name":"Uruguay","title":"flag for Uruguay","dialCode":"+598"},{"code":"UZ","emoji":"🇺🇿","unicode":"U+1F1FA U+1F1FF","name":"Uzbekistan","title":"flag for Uzbekistan","dialCode":"+998"},{"code":"VA","emoji":"🇻🇦","unicode":"U+1F1FB U+1F1E6","name":"Vatican City","title":"flag for Vatican City","dialCode":"+379"},{"code":"VC","emoji":"🇻🇨","unicode":"U+1F1FB U+1F1E8","name":"Saint Vincent and The Grenadines","title":"flag for Saint Vincent and The Grenadines","dialCode":"+1 784"},{"code":"VE","emoji":"🇻🇪","unicode":"U+1F1FB U+1F1EA","name":"Venezuela","title":"flag for Venezuela","dialCode":"+58"},{"code":"VG","emoji":"🇻🇬","unicode":"U+1F1FB U+1F1EC","name":"Virgin Islands, British","title":"flag for Virgin Islands, British","dialCode":"+1 284"},{"code":"VI","emoji":"🇻🇮","unicode":"U+1F1FB U+1F1EE","name":"Virgin Islands, U.S.","title":"flag for Virgin Islands, U.S.","dialCode":"+1 340"},{"code":"VN","emoji":"🇻🇳","unicode":"U+1F1FB U+1F1F3","name":"Viet Nam","title":"flag for Viet Nam","dialCode":"+84"},{"code":"VU","emoji":"🇻🇺","unicode":"U+1F1FB U+1F1FA","name":"Vanuatu","title":"flag for Vanuatu","dialCode":"+678"},{"code":"WF","emoji":"🇼🇫","unicode":"U+1F1FC U+1F1EB","name":"Wallis and Futuna","title":"flag for Wallis and Futuna","dialCode":"+681"},{"code":"WS","emoji":"🇼🇸","unicode":"U+1F1FC U+1F1F8","name":"Samoa","title":"flag for Samoa","dialCode":"+685"},{"code":"XK","emoji":"🇽🇰","unicode":"U+1F1FD U+1F1F0","name":"Kosovo","title":"flag for Kosovo","dialCode":"+383"},{"code":"YE","emoji":"🇾🇪","unicode":"U+1F1FE U+1F1EA","name":"Yemen","title":"flag for Yemen","dialCode":"+967"},{"code":"YT","emoji":"🇾🇹","unicode":"U+1F1FE U+1F1F9","name":"Mayotte","title":"flag for Mayotte","dialCode":"+262"},{"code":"ZA","emoji":"🇿🇦","unicode":"U+1F1FF U+1F1E6","name":"South Africa","title":"flag for South Africa","dialCode":"+27"},{"code":"ZM","emoji":"🇿🇲","unicode":"U+1F1FF U+1F1F2","name":"Zambia","title":"flag for Zambia","dialCode":"+260"},{"code":"ZW","emoji":"🇿🇼","unicode":"U+1F1FF U+1F1FC","name":"Zimbabwe","title":"flag for Zimbabwe","dialCode":"+263"}]
function getFlag(countryName) {
if (!countryName) {
return '';
}
return (flags.find(function (item) {
return item.name === countryName;
}) || {}).emoji;
}
return value + '{flag|' + getFlag(value) + '}';
}
''',
"series_color":
'''
function (param) {
const countryColors = {"Australia":"#00008b","Canada":"#f00","China":"#ffde00","Cuba":"#002a8f","Finland":"#003580","France":"#ed2939","Germany":"#000","Iceland":"#003897","India":"#f93","Japan":"#bc002d","North Korea":"#024fa2","South Korea":"#000","New Zealand":"#00247d","Norway":"#ef2b2d","Poland":"#dc143c","Russia":"#d52b1e","Turkey":"#e30a17","United Kingdom":"#00247d","United States":"#b22234"};
return countryColors[param.value[3]] || '#5470c6';
}
'''
},
fun_values=['x_axis_formatter', 'y_axis_formatter', 'series_color']
),
dbc.Button('restart', color='success',
id='bar-race-button',
style={
'position': 'absolute',
'height': 50, 'width': '10%',
'top': '75%', 'left': '75%',
'opacity': 0.8
}
),
dcc.Interval(id="interval", interval=1 * 1000, n_intervals=0),
])
if __name__ == '__main__':
app = dash.Dash(
external_stylesheets=[dbc.themes.BOOTSTRAP],
meta_tags=[
{"name": "viewport", "content": "width=device-width, initial-scale=1"}
],
suppress_callback_exceptions=True,
)
app.layout = layout
@app.callback(
Output('echarts', 'option'),
[Input('interval', 'n_intervals'), Input("bar-race-button", "n_clicks")],
[State('echarts', 'option')]
)
def update_bar_race(n_intervals, btn, opt):
if n_intervals > 0:
triggered = dash.callback_context.triggered
prop_id, event = triggered[0]['prop_id'].split('.')
if prop_id == 'bar-race-button':
year = None
else:
year = int(opt['graphic']['elements'][0]['style']['text'])
year, data = gen_next_year_data(year=year)
opt['graphic']['elements'][0]['style']['text'] = year
opt['dataset']['source'] = data
return opt
raise PreventUpdate
app.run_server(debug=True)
```
""",
style={
"width": '80%',
"marginLeft": '10%',
"marginRight": '10%',
"height": '100vh',
}
),
])
| 183.420147
| 30,783
| 0.580976
| 10,098
| 74,652
| 4.383838
| 0.128342
| 0.09072
| 0.13608
| 0.014548
| 0.979398
| 0.977162
| 0.974519
| 0.973073
| 0.971311
| 0.969368
| 0
| 0.066254
| 0.104525
| 74,652
| 407
| 30,784
| 183.420147
| 0.580936
| 0.014494
| 0
| 0.099291
| 0
| 0
| 0.207528
| 0.023031
| 0
| 0
| 0
| 0
| 0
| 1
| 0.007092
| false
| 0
| 0.042553
| 0
| 0.056738
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
3dac513704fddc956edaf2f6d28c951bc334b2e4
| 3,073
|
py
|
Python
|
tests/test_camera.py
|
alonblade/pysg
|
8b7eb4b06d2941d3a4b6c3a9e845983b4c84f551
|
[
"MIT"
] | 1
|
2021-03-01T20:31:48.000Z
|
2021-03-01T20:31:48.000Z
|
tests/test_camera.py
|
alonblade/pysg
|
8b7eb4b06d2941d3a4b6c3a9e845983b4c84f551
|
[
"MIT"
] | 2
|
2021-01-17T13:35:09.000Z
|
2021-01-18T21:16:41.000Z
|
tests/test_camera.py
|
alonblade/pysg
|
8b7eb4b06d2941d3a4b6c3a9e845983b4c84f551
|
[
"MIT"
] | 1
|
2021-01-17T13:35:37.000Z
|
2021-01-17T13:35:37.000Z
|
from unittest import TestCase
from pysg import PerspectiveCamera, OrthographicCamera
from pysg.error import Error
class TestPerspectiveCamera(TestCase):
def test_parameter_errors_FOV(self):
with self.assertRaises(Error):
PerspectiveCamera(fov=-1, aspect=1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=0, aspect=1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=390, aspect=1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=186, aspect=1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=180, aspect=1, near=0.1, far=100)
def test_parameter_errors_aspect_ratio(self):
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=-0.1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=-1, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.0, near=0.1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0, near=0.1, far=100)
def test_parameter_errors_near_far(self):
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=-1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=0, far=0)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=-1, far=1)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=0, far=-1)
class TestOrthographicCamera(TestCase):
def test_parameter_errors_left_right(self):
with self.assertRaises(Error):
OrthographicCamera(left=100, right=-100, top=100, bottom=-100, near=0.1, far=100)
with self.assertRaises(Error):
OrthographicCamera(left=0, right=0, top=100, bottom=-100, near=0.1, far=100)
with self.assertRaises(Error):
OrthographicCamera(left=100, right=100, top=100, bottom=-100, near=0.1, far=100)
def test_parameter_errors_top_bottom(self):
with self.assertRaises(Error):
OrthographicCamera(left=-100, right=100, top=-100, bottom=100, near=0.1, far=100)
with self.assertRaises(Error):
OrthographicCamera(left=-100, right=100, top=100, bottom=100, near=0.1, far=100)
with self.assertRaises(Error):
OrthographicCamera(left=-100, right=100, top=0, bottom=0, near=0.1, far=100)
def test_parameter_errors_near_far(self):
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=-1, far=100)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=0, far=0)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=-1, far=1)
with self.assertRaises(Error):
PerspectiveCamera(fov=45, aspect=0.2, near=0, far=-1)
| 44.536232
| 93
| 0.653433
| 409
| 3,073
| 4.853301
| 0.085575
| 0.092695
| 0.231738
| 0.289673
| 0.89471
| 0.864484
| 0.86398
| 0.835768
| 0.835768
| 0.807557
| 0
| 0.092122
| 0.21933
| 3,073
| 68
| 94
| 45.191176
| 0.735306
| 0
| 0
| 0.578947
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.403509
| 1
| 0.105263
| false
| 0
| 0.052632
| 0
| 0.192982
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
3daf855cc075b03eb9fde05e13175ab4c42500a7
| 1,286
|
py
|
Python
|
duckql/functions/tests/test_array_agg.py
|
Sibyx/duckql-python
|
7780f145d643e6884178f146218551731984eea3
|
[
"MIT"
] | 4
|
2020-04-15T09:35:15.000Z
|
2021-11-11T13:03:46.000Z
|
duckql/functions/tests/test_array_agg.py
|
Sibyx/duckql-python
|
7780f145d643e6884178f146218551731984eea3
|
[
"MIT"
] | 2
|
2020-04-08T12:10:56.000Z
|
2020-04-15T09:14:44.000Z
|
duckql/functions/tests/test_array_agg.py
|
Sibyx/duckql-python
|
7780f145d643e6884178f146218551731984eea3
|
[
"MIT"
] | 1
|
2020-04-15T09:11:39.000Z
|
2020-04-15T09:11:39.000Z
|
from duckql import Property, Order, ArrayAgg
def test_simple():
stm = ArrayAgg(
property=Property(name='warehouse_logs.state'),
)
assert str(stm) == 'ARRAY_AGG(warehouse_logs.state)'
def test_order_by():
stm = ArrayAgg(
property=Property(name='warehouse_logs.state'),
order=[
Order(
property=Property(name='warehouse_logs.created_at')
)
]
)
assert str(stm) == 'ARRAY_AGG(warehouse_logs.state ORDER BY warehouse_logs.created_at ASC)'
def test_position():
stm = ArrayAgg(
property=Property(name='warehouse_logs.state'),
position=1,
order=[
Order(
property=Property(name='warehouse_logs.created_at')
)
]
)
assert str(stm) == '(ARRAY_AGG(warehouse_logs.state ORDER BY warehouse_logs.created_at ASC))[1]'
def test_alias():
stm = ArrayAgg(
property=Property(name='warehouse_logs.state'),
position=1,
order=[
Order(
property=Property(name='warehouse_logs.created_at')
)
],
alias="first_volume"
)
assert str(stm) == '(ARRAY_AGG(warehouse_logs.state ORDER BY warehouse_logs.created_at ASC))[1] AS first_volume'
| 24.730769
| 116
| 0.599533
| 143
| 1,286
| 5.174825
| 0.195804
| 0.245946
| 0.194595
| 0.274324
| 0.837838
| 0.837838
| 0.837838
| 0.837838
| 0.654054
| 0.654054
| 0
| 0.004348
| 0.284603
| 1,286
| 51
| 117
| 25.215686
| 0.8
| 0
| 0
| 0.487179
| 0
| 0
| 0.337481
| 0.212286
| 0
| 0
| 0
| 0
| 0.102564
| 1
| 0.102564
| false
| 0
| 0.025641
| 0
| 0.128205
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
b1201556936b1c798c897187c4bb3581e0e14d78
| 6,488
|
py
|
Python
|
data/dcase18_dataset.py
|
hackerekcah/ESRelation
|
6aa1e4bcb04c90fca79a125cc128481155da54a1
|
[
"MIT"
] | null | null | null |
data/dcase18_dataset.py
|
hackerekcah/ESRelation
|
6aa1e4bcb04c90fca79a125cc128481155da54a1
|
[
"MIT"
] | null | null | null |
data/dcase18_dataset.py
|
hackerekcah/ESRelation
|
6aa1e4bcb04c90fca79a125cc128481155da54a1
|
[
"MIT"
] | null | null | null |
import os
import pandas as pd
from sklearn import preprocessing
import numpy as np
import soundfile as sf
import resampy
import torch
from data import register_dataset
_ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
@register_dataset
class Dcase18TaskADevSet(torch.utils.data.Dataset):
"""
sr=48000, 10seconds, dual-channels, 10 classes.
"""
def __init__(self, fold=1, split='train', target_sr=48000, transform=None,
spl_norm=False,
random_channel=False):
"""
:param split: 'train', 'evaluate'
:param transform: callable
"""
super(Dcase18TaskADevSet, self).__init__()
self.dev_path = "/data/songhongwei/dcase2018_baseline/task1/datasets/TUT-urban-acoustic-scenes-2018-development"
if split == 'train':
csv_file = os.path.join(self.dev_path, 'evaluation_setup', 'fold1_{}.txt'.format(split))
else:
csv_file = os.path.join(self.dev_path, 'evaluation_setup', 'fold1_{}.txt'.format('evaluate'))
df = pd.read_csv(csv_file, sep='\t', names=['file_names', 'labels'])
self.file_names = df['file_names'].to_list()
self.labels = df['labels'].to_list()
if target_sr == 44100:
prefix = 'audio44100'
self.file_names = [fname.replace('audio', prefix) for fname in self.file_names]
elif target_sr == 22050:
prefix = 'audio22050'
self.file_names = [fname.replace('audio', prefix) for fname in self.file_names]
le = preprocessing.LabelBinarizer()
self.labels = le.fit_transform(np.array(self.labels))
self.transform = transform
self.spl_norm = spl_norm
self.target_sr = target_sr
self.random_channel = random_channel
def get_train_labels(self):
# self.labels is binary label, return int label
return np.argmax(self.labels, axis=1)
def __getitem__(self, index):
"""
:param index (int):
:return:
audio (torch.float32), shape=(N,)
label (torch.float32), shape=(nb_classes,)
"""
file_path = os.path.join(self.dev_path, self.file_names[index])
# (N, C), audio is not normalized ot [-1, 1] by default
audio, sr = sf.read(file_path)
if audio.ndim == 2:
if self.random_channel:
idx = np.random.randint(0, 3)
if idx == 2:
audio = np.mean(audio, 1)
else:
audio = audio[:, idx]
else:
# mean channel
audio = np.mean(audio, 1)
# Resample if necessary
if sr != self.target_sr:
# (N,)
audio = resampy.resample(audio, sr_orig=sr, sr_new=self.target_sr, filter='kaiser_best')
if self.spl_norm:
max_abs = max(abs(audio))
# avoid divide by zero
if (max_abs - 0.0) > 1e-12:
audio = audio / max_abs
binary_label = self.labels[index]
label = np.argmax(binary_label)
# must to torch.float32 for fft
sample = (torch.as_tensor(audio, dtype=torch.float32),
torch.as_tensor(label, dtype=torch.int64))
if self.transform:
sample = self.transform(sample)
return sample
def __len__(self):
return len(self.file_names)
@register_dataset
class Dcase18TaskADevSetDual(torch.utils.data.Dataset):
"""
sr=48000, 10seconds, dual-channels, 10 classes.
"""
def __init__(self, fold=1, split='train', target_sr=48000, transform=None, spl_norm=False):
"""
:param split: 'train', 'evaluate'
:param transform: callable
"""
super(Dcase18TaskADevSetDual, self).__init__()
self.dev_path = "/data/songhongwei/dcase2018_baseline/task1/datasets/TUT-urban-acoustic-scenes-2018-development"
if split == 'train':
csv_file = os.path.join(self.dev_path, 'evaluation_setup', 'fold1_{}.txt'.format(split))
else:
csv_file = os.path.join(self.dev_path, 'evaluation_setup', 'fold1_{}.txt'.format('evaluate'))
df = pd.read_csv(csv_file, sep='\t', names=['file_names', 'labels'])
self.file_names = df['file_names'].to_list()
self.labels = df['labels'].to_list()
if target_sr == 44100:
prefix = 'audio44100'
self.file_names = [fname.replace('audio', prefix) for fname in self.file_names]
elif target_sr == 22050:
prefix = 'audio22050'
self.file_names = [fname.replace('audio', prefix) for fname in self.file_names]
le = preprocessing.LabelBinarizer()
self.labels = le.fit_transform(np.array(self.labels))
self.transform = transform
self.spl_norm = spl_norm
self.target_sr = target_sr
def get_train_labels(self):
# self.labels is binary label, return int label
return np.argmax(self.labels, axis=1)
def __getitem__(self, index):
"""
:param index (int):
:return:
audio (torch.float32), shape=(N,)
label (torch.float32), shape=(nb_classes,)
"""
file_path = os.path.join(self.dev_path, self.file_names[index])
# (N, C), audio is not normalized ot [-1, 1] by default
audio, sr = sf.read(file_path)
if audio.ndim == 2:
# concatenate if multichannel
audio = np.concatenate((audio[:, 0], audio[:, 1]))
# Resample if necessary
if sr != self.target_sr:
# (N,)
audio = resampy.resample(audio, sr_orig=sr, sr_new=self.target_sr, filter='kaiser_best')
if self.spl_norm:
max_abs = max(abs(audio))
# avoid divide by zero
if (max_abs - 0.0) > 1e-12:
audio = audio / max_abs
binary_label = self.labels[index]
label = np.argmax(binary_label)
# must to torch.float32 for fft
sample = (torch.as_tensor(audio, dtype=torch.float32),
torch.as_tensor(label, dtype=torch.int64))
if self.transform:
sample = self.transform(sample)
return sample
def __len__(self):
return len(self.file_names)
if __name__ == '__main__':
ds = Dcase18TaskADevSet(split='train', target_sr=48000, spl_norm=False,
random_channel=True)
for d in ds:
pass
| 33.968586
| 120
| 0.589242
| 795
| 6,488
| 4.610063
| 0.192453
| 0.044202
| 0.049659
| 0.02292
| 0.863302
| 0.839018
| 0.839018
| 0.839018
| 0.839018
| 0.810368
| 0
| 0.033022
| 0.290536
| 6,488
| 191
| 121
| 33.968586
| 0.763198
| 0.129932
| 0
| 0.754386
| 0
| 0.017544
| 0.091627
| 0.034521
| 0
| 0
| 0
| 0
| 0
| 1
| 0.070175
| false
| 0.008772
| 0.070175
| 0.035088
| 0.210526
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b16d087c024a9305dc5cc94fe4a733355c90e732
| 156
|
py
|
Python
|
exercicios/ex035.py
|
ArthurLopesMagalhaes/Python-CursoEmVideo
|
de9006f620a7308c3001fa486b1a4bcd789f7a49
|
[
"MIT"
] | null | null | null |
exercicios/ex035.py
|
ArthurLopesMagalhaes/Python-CursoEmVideo
|
de9006f620a7308c3001fa486b1a4bcd789f7a49
|
[
"MIT"
] | null | null | null |
exercicios/ex035.py
|
ArthurLopesMagalhaes/Python-CursoEmVideo
|
de9006f620a7308c3001fa486b1a4bcd789f7a49
|
[
"MIT"
] | null | null | null |
r1 = float(input('Digite o comprimento da reta: '))
r2 = float(input('Digite o comprimento da reta: '))
r3 = float(input('Digite o comprimento da reta: '))
| 39
| 51
| 0.692308
| 24
| 156
| 4.5
| 0.416667
| 0.277778
| 0.444444
| 0.472222
| 0.944444
| 0.944444
| 0.944444
| 0
| 0
| 0
| 0
| 0.022727
| 0.153846
| 156
| 3
| 52
| 52
| 0.795455
| 0
| 0
| 0
| 0
| 0
| 0.576923
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 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
| 8
|
b1950237abdb1c68bb5796b9a48617ed0324a7ce
| 27,123
|
py
|
Python
|
tests/test_gifs.py
|
Septem151/gifsync-api
|
b5d5c1ffd8bf9957136e14ea2420567cc846fd87
|
[
"MIT"
] | 1
|
2021-06-14T18:49:35.000Z
|
2021-06-14T18:49:35.000Z
|
tests/test_gifs.py
|
Septem151/gifsync-api
|
b5d5c1ffd8bf9957136e14ea2420567cc846fd87
|
[
"MIT"
] | null | null | null |
tests/test_gifs.py
|
Septem151/gifsync-api
|
b5d5c1ffd8bf9957136e14ea2420567cc846fd87
|
[
"MIT"
] | null | null | null |
"""Test cases related to the /gifs resource."""
import typing as t
from http import HTTPStatus
from flask.testing import FlaskClient
from gifsync_api.models import Gif, GifSyncUser
from .utils.assertion import assert_error_response
from .utils.generation import (
create_auth_token,
create_random_username,
populate_database_with_users,
populate_users_with_gifs,
)
from .utils.requests import (
delete_gif,
delete_gifs,
get_gif,
get_gifs,
get_task,
post_gif,
post_gifs,
sync_gif,
)
def test_get_gifs_non_admin(client: FlaskClient) -> None:
"""Assert when GET /gifs is requested, that non-admin users
are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
response = get_gifs(client, auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_get_gifs_unauthenticated(client: FlaskClient) -> None:
"""Assert when GET /gifs is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
response = get_gifs(client)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_get_gifs_admin(client: FlaskClient, db_session) -> None:
"""Assert when GET /gifs is requested, that admin users
are allowed to make the request and returns a list of gifs
that matches all the gifs in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
populate_database_with_users(db_session)
populate_users_with_gifs(db_session)
username = create_random_username()
auth_token = create_auth_token(username, admin=True)
response = get_gifs(client, auth_token.signed)
assert response.status_code == HTTPStatus.OK
# List of gifs matches all the gifs in the database
json_data: t.Optional[dict] = response.get_json()
assert json_data is not None
assert "gifs" in json_data
assert isinstance(json_data["gifs"], list)
resp_gifs: t.List[dict] = json_data["gifs"]
db_gifs = Gif.get_all()
assert len(db_gifs) == len(resp_gifs)
for db_gif in db_gifs:
match_resp_gif_list = [
resp_gif for resp_gif in resp_gifs if resp_gif.get("id") == db_gif.id
]
assert len(match_resp_gif_list) == 1
match_resp_gif = match_resp_gif_list[0]
assert match_resp_gif.get("user_id") == db_gif.user_id
assert match_resp_gif.get("owner") == db_gif.owner.username
assert match_resp_gif.get("image") == db_gif.image
assert "image_url" in match_resp_gif
assert match_resp_gif.get("beats_per_loop") == db_gif.beats_per_loop
assert match_resp_gif.get("custom_tempo") == db_gif.custom_tempo
def test_post_gifs_existing_user(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs is requested, that users are allowed
to make the request, and that the gif added matches
the gif added in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
populate_database_with_users(db_session, username)
auth_token = create_auth_token(username)
gif_name = create_random_username()
beats_per_loop = 5
response = post_gifs(client, gif_name, beats_per_loop, auth_token.signed)
assert response.status_code == HTTPStatus.CREATED
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# Gif added matches the gif added in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_post_gifs_non_existing_user(client: FlaskClient) -> None:
"""Assert when POST /gifs is requested, that users are allowed
to make the request, that the gif added matches the gif added
in the database, and that the user is added to the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_name = create_random_username()
beats_per_loop = 5
response = post_gifs(client, gif_name, beats_per_loop, auth_token.signed)
assert response.status_code == HTTPStatus.CREATED
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# User added to the database
db_user = GifSyncUser.get_by_username(username)
assert db_user is not None
# Gif added matches the gif added in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["owner"] == db_user.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_post_gifs_unauthenticated(client: FlaskClient) -> None:
"""Assert when POST /gifs is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
gif_name = create_random_username()
beats_per_loop = 5
response = post_gifs(client, gif_name, beats_per_loop)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_post_gifs_existing_user_duplicate_name(
client: FlaskClient, db_session
) -> None:
"""Assert when POST /gifs is requested, that users are allowed to
make the request, but when a gif with the given name already exists,
the response is 400 Bad Request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
auth_token = create_auth_token(username)
response = post_gifs(client, gif_name, 5, auth_token.signed)
assert_error_response(response, HTTPStatus.BAD_REQUEST)
def test_delete_gifs_non_admin(client: FlaskClient) -> None:
"""Assert when DELETE /gifs is requested, that non-admin users
are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
response = delete_gifs(client, auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_delete_gifs_unauthenticated(client: FlaskClient) -> None:
"""Assert when DELETE /gifs is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
response = delete_gifs(client)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_delete_gifs_admin(client: FlaskClient, db_session) -> None:
"""Assert when DELETE /gifs is requested, that admin users
are allowed to make the request, and that all gifs are deleted
from the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
populate_database_with_users(db_session)
populate_users_with_gifs(db_session)
username = create_random_username()
auth_token = create_auth_token(username, admin=True)
response = delete_gifs(client, auth_token.signed)
assert response.status_code == HTTPStatus.NO_CONTENT
assert response.content_length is None
# No gifs exist in the database
all_gifs = Gif.get_all()
assert len(all_gifs) == 0
def test_get_gif_by_id_non_admin(client: FlaskClient, db_session) -> None:
"""Assert when GET /gifs/<gif_id> is requested, that users with
matching username in auth token are allowed to make the request, and
that the gif retrieved matches the gif in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
auth_token = create_auth_token(username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
response = get_gif(client, gif.id, auth_token.signed)
assert response.status_code == HTTPStatus.OK
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# Gif response matches the gif in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_get_gif_by_id_unauthenticated(client: FlaskClient) -> None:
"""Assert when GET /gifs/<gif_id> is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
response = get_gif(client, 1)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_get_gif_by_id_admin(client: FlaskClient, db_session) -> None:
"""Assert when GET /gifs/<gif_id> is requested, that admin users
are allowed to make the request, and that the gif retrieved matches
the gif in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
admin_username = create_random_username()
auth_token = create_auth_token(admin_username, admin=True)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
response = get_gif(client, gif.id, auth_token.signed)
assert response.status_code == HTTPStatus.OK
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# Gif response matches the gif in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_get_gif_by_id_mismatch(client: FlaskClient, db_session) -> None:
"""Assert when GET /gifs/<gif_id> is requested, that users with
mismatching username in auth token are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
other_username = create_random_username()
auth_token = create_auth_token(other_username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
response = get_gif(client, gif.id, auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_get_gif_by_id_non_existent(client: FlaskClient) -> None:
"""Assert when GET /gifs/<gif_id> is requested, that authenticated
requests to non-existent gifs gives 404.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_id = 1
response = get_gif(client, gif_id, auth_token.signed)
assert_error_response(response, HTTPStatus.NOT_FOUND)
def test_post_gif_by_id_non_admin(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id> is requested, that users with
matching username in auth token are allowed to make the request,
that the gif returned is updated, and that the gif is updated
in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
auth_token = create_auth_token(username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
new_gif_data = {
"name": create_random_username(),
"beats_per_loop": 20,
"custom_tempo": 140,
}
response = post_gif(client, gif.id, new_gif_data, auth_token.signed)
assert response.status_code == HTTPStatus.OK
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# Gif response matches the updated gif values
assert gif_data["name"] == new_gif_data["name"]
assert gif_data["beats_per_loop"] == new_gif_data["beats_per_loop"]
assert gif_data["custom_tempo"] == new_gif_data["custom_tempo"]
# Gif response matches the gif in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_post_gif_by_id_unauthenticated(client: FlaskClient) -> None:
"""Assert when POST /gifs/<gif_id> is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
gif_id = 1
response = post_gif(client, gif_id)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_post_gif_by_id_admin(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id> is requested, that admin users
are allowed to make the request, that the gif returned is updated,
and that the gif is updated in the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
admin_username = create_random_username()
auth_token = create_auth_token(admin_username, admin=True)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
new_gif_data = {
"name": create_random_username(),
"beats_per_loop": 20,
"custom_tempo": 140,
}
response = post_gif(client, gif.id, new_gif_data, auth_token.signed)
assert response.status_code == HTTPStatus.OK
gif_data: t.Optional[dict] = response.get_json()
assert gif_data is not None
assert "id" in gif_data
assert "name" in gif_data
assert "owner" in gif_data
assert "beats_per_loop" in gif_data
assert "custom_tempo" in gif_data
assert "image" in gif_data
assert "image_url" in gif_data
# Gif response matches the updated gif values
assert gif_data["name"] == new_gif_data["name"]
assert gif_data["beats_per_loop"] == new_gif_data["beats_per_loop"]
assert gif_data["custom_tempo"] == new_gif_data["custom_tempo"]
# Gif response matches the gif in database
db_gif = Gif.get_by_id(gif_data["id"])
assert db_gif is not None
assert gif_data["name"] == db_gif.name
assert gif_data["owner"] == db_gif.owner.username
assert gif_data["beats_per_loop"] == db_gif.beats_per_loop
assert gif_data["custom_tempo"] == db_gif.custom_tempo
assert gif_data["image"] == db_gif.image
def test_post_gif_by_id_mismatch(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id> is requested, that users with
mismatching username in auth token are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
other_username = create_random_username()
auth_token = create_auth_token(other_username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
response = post_gif(client, gif.id, auth_token=auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_post_gif_by_id_non_existent(client: FlaskClient) -> None:
"""Assert when POST /gifs/<gif_id> is requested, that authenticated
requests to non-existent gifs gives 404.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_id = 1
response = post_gif(client, gif_id, auth_token=auth_token.signed)
assert_error_response(response, HTTPStatus.NOT_FOUND)
def test_delete_gif_by_id_non_admin(client: FlaskClient, db_session) -> None:
"""Assert when DELETE /gifs/<gif_id> is requested, that users with
matching username in auth token are allowed to make the request,
that the gif is deleted from the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
auth_token = create_auth_token(username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
gif_id = gif.id
response = delete_gif(client, gif_id, auth_token.signed)
assert response.status_code == HTTPStatus.NO_CONTENT
assert response.content_length is None
assert Gif.get_by_id(gif_id) is None
def test_delete_gif_by_id_unauthenticated(client: FlaskClient) -> None:
"""Assert when DELETE /gifs/<gif_id> is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
gif_id = 1
response = delete_gif(client, gif_id)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_delete_gif_by_id_admin(client: FlaskClient, db_session) -> None:
"""Assert when DELETE /gifs/<gif_id> is requested, that admin users
are allowed to make the request, and that the gif is deleted from
the database.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
admin_username = create_random_username()
auth_token = create_auth_token(admin_username, admin=True)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
gif_id = gif.id
response = delete_gif(client, gif_id, auth_token.signed)
assert response.status_code == HTTPStatus.NO_CONTENT
assert response.content_length is None
assert Gif.get_by_id(gif_id) is None
def test_delete_gif_by_id_mismatch(client: FlaskClient, db_session) -> None:
"""Assert when DELETE /gifs/<gif_id> is requested, that users with
mismatching username in auth token are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
other_username = create_random_username()
auth_token = create_auth_token(other_username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
response = delete_gif(client, gif.id, auth_token=auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_delete_gif_by_id_non_existent(client: FlaskClient) -> None:
"""Assert when DELETE /gifs/<gif_id> is requested, that authenticated
requests to non-existent gifs gives 404.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_id = 1
response = delete_gif(client, gif_id, auth_token=auth_token.signed)
assert_error_response(response, HTTPStatus.NOT_FOUND)
def test_sync_gif_by_id_non_admin(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id>/sync is requested, that users with
matching username in auth token are allowed to make the request,
and that the sync task completes successfully.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
gif_id = gif.id
tempo = 140
response = sync_gif(client, gif_id, tempo, auth_token.signed)
assert response.status_code == HTTPStatus.OK
resp_json: t.Optional[dict] = response.get_json()
assert resp_json is not None
assert "task_id" in resp_json
# In testing mode, rq completes the task synchronously,
# so when we make this call, it should be finished already.
response = get_task(client, resp_json["task_id"])
resp_json = response.get_json()
assert resp_json is not None
assert "id" in resp_json
assert "complete" in resp_json
def test_sync_gif_by_id_unauthenticated(client: FlaskClient) -> None:
"""Assert when POST /gifs/<gif_id>/sync is requested, that unauthenticated
users are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
gif_id = 1
tempo = 140
response = sync_gif(client, gif_id, tempo)
assert_error_response(response, HTTPStatus.UNAUTHORIZED)
def test_sync_gif_by_id_admin(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id>/sync is requested, that admin users
are allowed to make the request, and that the sync task completes
successfully.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
admin_username = create_random_username()
auth_token = create_auth_token(admin_username, admin=True)
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
gif_id = gif.id
tempo = 140
response = sync_gif(client, gif_id, tempo, auth_token.signed)
assert response.status_code == HTTPStatus.OK
resp_json: t.Optional[dict] = response.get_json()
assert resp_json is not None
assert "task_id" in resp_json
# In testing mode, rq completes the task synchronously,
# so when we make this call, it should be finished already.
response = get_task(client, resp_json["task_id"])
resp_json = response.get_json()
assert resp_json is not None
assert "id" in resp_json
assert "complete" in resp_json
def test_sync_gif_by_id_mismatch(client: FlaskClient, db_session) -> None:
"""Assert when POST /gifs/<gif_id>/sync is requested, that users with
mismatching username in auth token are not allowed to make the request.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
db_session: The Database session fixture.
"""
username = create_random_username()
gif_name = create_random_username()
populate_users_with_gifs(db_session, extra_user_gif=(username, gif_name))
other_username = create_random_username()
auth_token = create_auth_token(other_username)
gif = Gif.get_by_username_and_name(username, gif_name)
assert gif is not None
tempo = 140
response = sync_gif(client, gif.id, tempo, auth_token=auth_token.signed)
assert_error_response(response, HTTPStatus.FORBIDDEN)
def test_sync_gif_by_id_non_existent(client: FlaskClient) -> None:
"""Assert when POST /gifs/<gif_id>/sync is requested, that authenticated
requests to non-existent gifs gives 404.
Args:
client (:obj:`~flask.testing.FlaskClient`): The Client fixture.
"""
username = create_random_username()
auth_token = create_auth_token(username)
gif_id = 1
tempo = 140
response = sync_gif(client, gif_id, tempo, auth_token.signed)
assert_error_response(response, HTTPStatus.NOT_FOUND)
| 39.308696
| 81
| 0.722966
| 3,894
| 27,123
| 4.754751
| 0.038264
| 0.040454
| 0.05401
| 0.029166
| 0.948582
| 0.942155
| 0.932595
| 0.923684
| 0.911099
| 0.899055
| 0
| 0.002501
| 0.189286
| 27,123
| 689
| 82
| 39.365747
| 0.839511
| 0.286178
| 0
| 0.763092
| 0
| 0
| 0.046172
| 0
| 0
| 0
| 0
| 0
| 0.40399
| 1
| 0.074813
| false
| 0
| 0.017456
| 0
| 0.092269
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
b19eae2d0271b3acc8cf206583a96a2611656b10
| 11,181
|
py
|
Python
|
code/FileDownload.py
|
AnthonySigogne/HackatonIWCS2017
|
d0683a1c8246b75d110984207ec1f1cee67accef
|
[
"MIT"
] | 1
|
2017-11-20T17:30:31.000Z
|
2017-11-20T17:30:31.000Z
|
code/FileDownload.py
|
AnthonySigogne/HackatonIWCS2017
|
d0683a1c8246b75d110984207ec1f1cee67accef
|
[
"MIT"
] | null | null | null |
code/FileDownload.py
|
AnthonySigogne/HackatonIWCS2017
|
d0683a1c8246b75d110984207ec1f1cee67accef
|
[
"MIT"
] | null | null | null |
#!/usr/sfw/bin/python
# -*- coding: utf-8 -*-
import glob, os, re, sys, urllib.request
letters = {}
letters["a"] = 1
letters["b"] = 1
letters["c"] = 1
letters["d"] = 1
letters["e"] = 1
letters["f"] = 1
letters["g"] = 1
letters["h"] = 1
letters["i"] = 1
letters["j"] = 1
letters["k"] = 1
letters["l"] = 1
letters["m"] = 1
letters["n"] = 1
letters["o"] = 1
letters["p"] = 1
letters["q"] = 1
letters["r"] = 1
letters["s"] = 1
letters["t"] = 1
letters["u"] = 1
letters["v"] = 1
letters["w"] = 1
letters["x"] = 1
letters["y"] = 1
letters["z"] = 1
replacements = {}
replacements["æ"] = "ae"
replacements["à"] = "a"
replacements["á"] = "a"
replacements["á"] = "a"
replacements["ã"] = "a"
replacements["ä"] = "a"
replacements["â"] = "a"
replacements["ç"] = "c"
replacements["é"] = "e"
replacements["è"] = "e"
replacements["ë"] = "e"
replacements["ê"] = "e"
replacements["ï"] = "i"
replacements["î"] = "i"
replacements["ì"] = "i"
replacements["ñ"] = "n"
replacements["ô"] = "o"
replacements["ö"] = "o"
replacements["ó"] = "o"
replacements["œ"] = "oe"
replacements["ü"] = "u"
replacements["ù"] = "u"
replacements["ú"] = "u"
def removeAccent(word, replacements):
for letter in replacements:
word = word.replace(letter, replacements[letter])
print("!!!!!"+word)
return word
"""
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_1%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_10%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_11%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_12%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_13%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_14%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_2%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_3%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_4%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_5%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_6%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_7%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_8%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Au%20bonheur%20des%20dames_9%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20III_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20III_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20III_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20III_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20III_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20II_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20II_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20II_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20II_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20II_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%206%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20IV_Chapitre%207%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20I_Chapitre%206%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VII_Chapitre%206%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VI_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VI_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VI_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VI_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20VI_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Germinal_Partie%20V_Chapitre%206%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_I%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_II%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_III%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_IV%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_IX%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_V%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_VI%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_VII%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_VIII%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_X%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_XI%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20B%EAte%20humaine_XII%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_I%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_II%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_III%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_IV%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_V%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_VI%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Cur%E9e_VII%20-%20Wikisource.htm",
"""
allUrl = [
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_I%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_II%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_III%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_IV%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_V%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_VI%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/La%20Fortune%20des%20Rougon_VII%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_I%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_II%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_III%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_IV%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_V%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Le%20Ventre%20de%20Paris_VI%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%201%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%2010%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%2011%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%2012%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%2013%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%2014%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%202%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%203%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%204%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%205%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%206%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%207%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%208%20-%20Wikisource.htm",
"http://www.jeuxdemots.org/HACK/hack_texts/Nana_Chapitre%209%20-%20Wikisource.htm"
]
for url in allUrl:
res = re.search(".*[/]([^/]*)$",url)
if res:
print(res.group(1))
# Récupère la page de résultats Gallica en l'enregistrant dans le même dossier
site = urllib.request.urlopen(url)
data = site.read()
print(removeAccent(res.group(1).replace("%20","_"),replacements))
file = open(removeAccent(res.group(1).replace("%20","_"),replacements), "wb")
file.write(data)
file.close()
| 61.773481
| 100
| 0.771219
| 1,705
| 11,181
| 4.915543
| 0.10088
| 0.083522
| 0.20284
| 0.238635
| 0.881876
| 0.876984
| 0.876984
| 0.866961
| 0.866961
| 0.866961
| 0
| 0.086388
| 0.036133
| 11,181
| 180
| 101
| 62.116667
| 0.691287
| 0.010643
| 0
| 0.020833
| 0
| 0.28125
| 0.59679
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.010417
| false
| 0
| 0.010417
| 0
| 0.03125
| 0.03125
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
b1abfafd39054fbbe007e626d34d9af2cb99ff19
| 86
|
py
|
Python
|
SmartBuild/SmartBuild/settings/__init__.py
|
ampamo/smart-build
|
a0c9a3871eb7ca06a6cd6d4a15aba70e2291f4fb
|
[
"CC0-1.0"
] | null | null | null |
SmartBuild/SmartBuild/settings/__init__.py
|
ampamo/smart-build
|
a0c9a3871eb7ca06a6cd6d4a15aba70e2291f4fb
|
[
"CC0-1.0"
] | null | null | null |
SmartBuild/SmartBuild/settings/__init__.py
|
ampamo/smart-build
|
a0c9a3871eb7ca06a6cd6d4a15aba70e2291f4fb
|
[
"CC0-1.0"
] | null | null | null |
from _enviroments import get_server_type
exec("from %s import *" % get_server_type())
| 28.666667
| 44
| 0.77907
| 13
| 86
| 4.769231
| 0.615385
| 0.290323
| 0.483871
| 0.612903
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 86
| 2
| 45
| 43
| 0.815789
| 0
| 0
| 0
| 0
| 0
| 0.186047
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
4915ae312a4f0744f6b9c7e5b85de74b2c7eadd1
| 4,000
|
py
|
Python
|
quasielasticbayes/test/Four_test.py
|
mantidproject/quasielasticbayes
|
016bdf9c6f9b9dc9cb71f5658b4244d7945e3238
|
[
"BSD-3-Clause"
] | null | null | null |
quasielasticbayes/test/Four_test.py
|
mantidproject/quasielasticbayes
|
016bdf9c6f9b9dc9cb71f5658b4244d7945e3238
|
[
"BSD-3-Clause"
] | 6
|
2022-02-08T08:57:54.000Z
|
2022-03-14T09:07:30.000Z
|
quasielasticbayes/test/Four_test.py
|
mantidproject/quasielasticbayes
|
016bdf9c6f9b9dc9cb71f5658b4244d7945e3238
|
[
"BSD-3-Clause"
] | null | null | null |
"""Characterization tests for Four module"""
import unittest
import numpy as np
#from quasielasticbayes.testing import load_json will add this later
from quasielasticbayes.Four import four
class FourTest(unittest.TestCase):
"""
Characterization tests for the four Fortran module
"""
# P = +1, N = -1, Z = 0
def test_Four_PPN_Re(self):
# reference inputs
x = np.zeros(4098, dtype=complex)
nonzero_entries = 8
x[:nonzero_entries] = [complex(np.cos(float(i)+0.1), 0.) for i in range(nonzero_entries)]
y = x
out = four(y,8,1,1,-1)
dp= 3
self.assertAlmostEqual(-1.6806+3.6243j, out[0], dp)
self.assertAlmostEqual(1.4300-0.4846j, out[1], dp)
self.assertAlmostEqual(0.5016-0.4846j, out[2], dp)
self.assertAlmostEqual(1.4299+3.6243j, out[3], dp)
self.assertAlmostEqual(-0.5748, out[4], dp)
self.assertAlmostEqual(0.3780, out[5], dp)
self.assertAlmostEqual(0.9833, out[6], dp)
self.assertAlmostEqual(0.6845, out[7], dp)
# In the code it only seems to use 1,-1,-1 and 1,1,0
# So these are the two we will test
def test_Four_PNN_Re(self):
x = np.zeros(4098, dtype=complex)
nonzero_entries = 8
x[:nonzero_entries] = [complex(np.cos(float(i)+0.1), 0.) for i in range(nonzero_entries)]
y = x
out = four(y,8,1,-1,-1)
dp= 3
self.assertAlmostEqual(-1.681+3.6243j, out[0], dp)
self.assertAlmostEqual(1.4299-0.4846j, out[1], dp)
self.assertAlmostEqual(0.5016-0.4846j, out[2], dp)
self.assertAlmostEqual(1.4299+3.6243j, out[3], dp)
self.assertAlmostEqual(-0.5748, out[4], dp)
self.assertAlmostEqual(0.37800, out[5], dp)
self.assertAlmostEqual(0.9833, out[6], dp)
self.assertAlmostEqual(0.6845, out[7], dp)
def test_Four_PNN_Im(self):
x = np.zeros(4098, dtype=complex)
nonzero_entries = 8
x[:nonzero_entries] = [complex(np.cos(float(i)+0.1), i) for i in range(nonzero_entries)]
y = x
out = four(y,8,1,-1,-1)
dp= 3
self.assertAlmostEqual(-1.681+13.2812j, out[0], dp)
self.assertAlmostEqual(-2.5701+1.1722j, out[1], dp)
self.assertAlmostEqual(0.5016-2.1415j, out[2], dp)
self.assertAlmostEqual(5.4299-6.0326j, out[3], dp)
self.assertAlmostEqual(-0.5748+4j, out[4], dp)
self.assertAlmostEqual(0.3780+5j, out[5], dp)
self.assertAlmostEqual(0.9833+6j, out[6], dp)
self.assertAlmostEqual(0.6845+7j, out[7], dp)
def test_Four_PPZ_Re(self):
x = np.zeros(4098, dtype=complex)
nonzero_entries = 8
x[:nonzero_entries] = [complex(np.cos(float(i)+0.1),0.) for i in range(nonzero_entries)]
y = x
out = four(y,8,1,1,0)
dp= 3
self.assertAlmostEqual(-0.0553, out[0], dp)
self.assertAlmostEqual(1.5000+1.4527j, out[1], dp)
self.assertAlmostEqual(1.0357, out[2], dp)
self.assertAlmostEqual(1.5000-1.4527j, out[3], dp)
self.assertAlmostEqual(-0.0554, out[4], dp)
self.assertAlmostEqual(0.3780, out[5], dp)
self.assertAlmostEqual(0.9833, out[6], dp)
self.assertAlmostEqual(0.6845, out[7], dp)
def test_Four_PPZ_Im(self):
x = np.zeros(4098, dtype=complex)
nonzero_entries = 8
x[:nonzero_entries] = [complex(np.cos(float(i)+0.1),i) for i in range(nonzero_entries)]
y = x
out = four(y,8,1,1,0)
dp= 3
self.assertAlmostEqual(5.9446, out[0], dp)
self.assertAlmostEqual(1.4999-1.3757j, out[1], dp)
self.assertAlmostEqual(1.0357-2j, out[2], dp)
self.assertAlmostEqual(1.4999-4.2812j, out[3], dp)
self.assertAlmostEqual(-6.0554, out[4], dp)
self.assertAlmostEqual(0.3780+5j, out[5], dp)
self.assertAlmostEqual(0.9833+6j, out[6], dp)
self.assertAlmostEqual(0.6845+7j, out[7], dp)
if __name__ == '__main__':
unittest.main()
| 41.237113
| 97
| 0.612
| 608
| 4,000
| 3.962171
| 0.177632
| 0.348692
| 0.334164
| 0.219178
| 0.815691
| 0.777086
| 0.740141
| 0.681196
| 0.618929
| 0.618929
| 0
| 0.130933
| 0.23625
| 4,000
| 97
| 98
| 41.237113
| 0.65761
| 0.07025
| 0
| 0.604938
| 0
| 0
| 0.002165
| 0
| 0
| 0
| 0
| 0
| 0.493827
| 1
| 0.061728
| false
| 0
| 0.037037
| 0
| 0.111111
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
491fa2c12b10dcc0e2b69b9198727369407d495c
| 1,097
|
py
|
Python
|
tests/data/class_blank_parentheses.py
|
rbenton/black
|
2bae41f92ed125f687e0ddef3a5913cda755a64f
|
[
"MIT"
] | null | null | null |
tests/data/class_blank_parentheses.py
|
rbenton/black
|
2bae41f92ed125f687e0ddef3a5913cda755a64f
|
[
"MIT"
] | null | null | null |
tests/data/class_blank_parentheses.py
|
rbenton/black
|
2bae41f92ed125f687e0ddef3a5913cda755a64f
|
[
"MIT"
] | null | null | null |
class SimpleClassWithBlankParentheses():
pass
class ClassWithSpaceParentheses ( ):
first_test_data = 90
second_test_data = 100
def test_func(self):
return None
class ClassWithEmptyFunc(object):
def func_with_blank_parentheses():
return 5
def public_func_with_blank_parentheses():
return None
def class_under_the_func_with_blank_parentheses():
class InsideFunc():
pass
class NormalClass (
):
def func_for_testing(self, first, second):
sum = first + second
return sum
# output
class SimpleClassWithBlankParentheses:
pass
class ClassWithSpaceParentheses:
first_test_data = 90
second_test_data = 100
def test_func( self ):
return None
class ClassWithEmptyFunc( object ):
def func_with_blank_parentheses():
return 5
def public_func_with_blank_parentheses():
return None
def class_under_the_func_with_blank_parentheses():
class InsideFunc:
pass
class NormalClass:
def func_for_testing( self, first, second ):
sum = first + second
return sum
| 18.59322
| 50
| 0.703737
| 125
| 1,097
| 5.856
| 0.24
| 0.065574
| 0.106557
| 0.196721
| 0.991803
| 0.991803
| 0.991803
| 0.991803
| 0.991803
| 0.991803
| 0
| 0.014337
| 0.23701
| 1,097
| 58
| 51
| 18.913793
| 0.860215
| 0.005469
| 0
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25641
| false
| 0.102564
| 0
| 0.153846
| 0.820513
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
|
0
| 11
|
4927e3dc4fc831e217320dd34ce3ba6a227893a2
| 62
|
py
|
Python
|
build/lib/timm_vis/__init__.py
|
novice03/timm-vis
|
73a15bc31c6afb9a9d457a79cc90d77811f01d1b
|
[
"MIT"
] | 14
|
2021-05-19T19:33:23.000Z
|
2022-03-25T06:50:39.000Z
|
timm_vis/__init__.py
|
novice03/timm-vis
|
73a15bc31c6afb9a9d457a79cc90d77811f01d1b
|
[
"MIT"
] | null | null | null |
timm_vis/__init__.py
|
novice03/timm-vis
|
73a15bc31c6afb9a9d457a79cc90d77811f01d1b
|
[
"MIT"
] | 3
|
2022-01-22T15:50:37.000Z
|
2022-03-23T23:51:56.000Z
|
from timm_vis.helpers import *
from timm_vis.methods import *
| 31
| 31
| 0.806452
| 10
| 62
| 4.8
| 0.6
| 0.333333
| 0.458333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 62
| 2
| 32
| 31
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
b8e986b2462d172681fd7b7cb7c142c0571dddc2
| 50,134
|
py
|
Python
|
controllers/candidate.py
|
poldelgado/PoliceSignUp
|
32eb49e4ee2a493c4545fbb3ff3503cc98a9fbf1
|
[
"MIT"
] | null | null | null |
controllers/candidate.py
|
poldelgado/PoliceSignUp
|
32eb49e4ee2a493c4545fbb3ff3503cc98a9fbf1
|
[
"MIT"
] | null | null | null |
controllers/candidate.py
|
poldelgado/PoliceSignUp
|
32eb49e4ee2a493c4545fbb3ff3503cc98a9fbf1
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from datetime import datetime
table = db.auth_user
inscription = db.inscription
height = db.height
response.view_title = '%s %s' % (
request.function.replace('_', ' ').title(),
table._singular
)
def index():
redirect(URL(request.controller, 'list'))
@auth.requires_membership('Admin')
def list():
announcement = None # XML(response.render('announcement.html'))
query = (table)
items = db(query).select(orderby=~table.created_on).render()
actions = [
{'is_item_action': lambda item: True, 'url': lambda item: URL('view.html', args=[item.id]), 'icon': 'search'},
{'is_item_action': lambda item: True, 'url': lambda item: URL('edit.html', args=[item.id]), 'icon': 'pencil'},
]
fields = [f for f in table]
# fields = [
# table.id,
# table.created_on, table.created_by,
# ]
response.view = 'template/list.%s' % request.extension
return dict(
item_name=table._singular,
row_list=items,
actions=actions,
field_list=fields,
announcement=announcement
)
@auth.requires_membership('Admin')
def create():
fields = [
'id',
'created_on', 'created_by',
]
form = SQLFORM(table) # , fields=fields)
if form.process().accepted:
session.flash = '%s created!' % table._singular
redirect(URL(request.controller, 'list'))
elif form.errors:
response.flash = 'Please correct the errors'
response.view = 'template/create.html'
return dict(item_name=table._singular, form=form)
def view():
item = table(table.id == request.args(0)) or redirect(URL('index'))
form = SQLFORM(table, item, readonly=True, comments=False)
response.view = 'template/view.%s' % request.extension
return dict(item_name=table._singular, form=form, item=item)
@auth.requires_membership('Admin')
def edit():
# db.support_case.case_subcategory.requires = IS_IN_DB(
# # db, db.case_subcategory._id, db.case_category._format,
# db, db.case_subcategory._id, '%(case_category)s*%(title)s',
# # sort=True, # orderby=db.case_subcategory.title,
# # cache=(cache.ram, 60)
# )
item = table(request.args(0)) or redirect(URL('index'))
form = SQLFORM(table, item)
if form.process().accepted:
session.flash = '%s updated!' % table._singular
redirect(URL(request.controller, 'list'))
elif form.errors:
response.flash = 'Please correct the errors'
response.view = 'template/edit.html'
return dict(item_name=table._singular, form=form)
@auth.requires_membership('Admin')
def populate():
query = table
set = db(query)
# rows = set.select()
set.delete()
from gluon.contrib.populate import populate
populate(table, 15)
redirect(URL('list'))
@auth.requires_membership('Admin')
def update():
query = table
set = db(query)
rows = set.select()
for row in rows:
# row.xxxx = 'yyyy'
row.update_record()
redirect(URL('list'))
def gestion():
form = SQLFORM.smartgrid(db.person, csv=False)
return dict(form = form)
@auth.requires_login()
def profile():
user_profile = db(db.auth_user.id == auth.user_id).select().first()
shift = db(db.shift_candidate.auth_user == auth.user_id).select().first()
inscription = db(user_profile.id == db.inscription.auth_user).select().last()
height_exam = db(db.height.inscription == inscription.id).select().first()
intellectual_exam = db(db.intellectual_exam.inscription == inscription.id).select().first()
medical_exam = db(db.medical_exam.inscription == inscription.id).select().first()
physical_exam = db(db.physical_exam.inscription == inscription.id).select().first()
groupal_psychological_examination = db(db.groupal_psychological_examination.inscription == inscription.id).select().first()
psychological_interview = db(db.psychological_interview.inscription == inscription.id).select().first()
if not(height_exam == None):
if ((height_exam.height >= 1.7) and (user_profile.gender == T('Male'))) or ((height_exam.height >= 1.65) and (user_profile.gender == T('Female'))):
height_exam.update_record(aproved=True)
else:
height_exam.update_record(aproved=False)
if not(intellectual_exam == None):
if (intellectual_exam.spanish_language >=6) and (intellectual_exam.history >= 6) and (intellectual_exam.geography >=6):
intellectual_exam.update_record(aproved=True)
else:
intellectual_exam.update_record(aproved=False)
if not(physical_exam == None):
if physical_exam.abs_test >= 6 and physical_exam.arms >=6 and physical_exam.aerobics >= 6:
physical_exam.update_record(aproved=True)
else:
physical_exam.update_record(aproved=False)
return dict(user = user_profile, shift = shift, inscription = inscription, height_exam = height_exam, intellectual_exam = intellectual_exam, medical_exam = medical_exam, physical_exam = physical_exam,
groupal_psychological_examination = groupal_psychological_examination, psychological_interview = psychological_interview)
def register():
if auth.is_logged_in():
auth.logout()
redirect(URL('candidate','register'))
control_time = False
limitI = datetime(2018,11,1,3,0,0)
limitF = datetime(2018,11,12,2,55,0)
actual_time = datetime.now()
if actual_time<limitF and actual_time>limitI:
control_time = True
auth.settings.register_onaccept = add_user_shift
auth.settings.register_next = URL(c='candidate',f='profile')
return dict(form = auth.register(), control_time = control_time)
@auth.requires_login()
def forms():
return dict()
# @auth.requires_login()
# def inscription_form():
# candidate = db(db.auth_user.id == auth.user_id).select().first()
# inscription = db(db.shift_candidate.auth_user == auth.user_id).select().last()
# return dict(inscription = inscription)
@auth.requires_login()
def inscription_form():
import os
from gluon.contrib.pyfpdf import FPDF
candidate = db(db.auth_user.id == auth.user_id).select().first()
inscription = db(db.shift_candidate.auth_user == auth.user_id).select().last()
age = calculate_age(candidate.birth_date)
logoIES = os.path.join(request.folder, "static", "images", "logo_ies.png")
logoMinSeg = os.path.join(request.folder, "static", "images", "logoMinisterio.png")
titulo_form = unicode('FORMULARIO ÚNICO DE INSCRIPCIÓN PARA ASPIRANTES A CADETES DE PRIMER AÑO DEL INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSE FRANCISCO DE SAN MARTÍN" - CICLO LECTIVO 2019',"utf-8")
declaracion_jurada = unicode('Declaro bajo juramento de ley: 1°) Que los datos consignados son verdaderos; 2°) Que he tomado conocimiento y acepto los términos de la presente convocatoria y proceso de selección, conforme el Decreto respectivo, como así tambien las pautas establecidas por el I.E.S. de Policía "GJFSM"; 3°) Que no registro antecedentes judiciales ni penales de carácter doloso ni contravencionales policiales, ni me encuentro procesado por la justicia provincial o nacional. En consecuencia, quedo sujeto a las normas que rigen administrativa y jurídicamente en la materia (Art. 172, 292 y c.c. Código Penal Argentino), y además obligado a comunicar toda variante dentro de los 15 (quince) días corridos a partir de la fecha en que éstas se hayan producido.','utf-8')
pdf = FPDF('P', 'mm', 'A4')
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
pdf.set_font('Times', 'B', 12)
pdf.line(30,37,200,37)
pdf.line(30,37,30,290)
pdf.line(200,37,200,290)
pdf.line(30,290,200,290)
pdf.line(30,75,200,75)
pdf.line(120,37,120,75)
pdf.line(30,239,200,239)
pdf.dashed_line(35,65,115,65) #FIRMA CONTROLADOR FORMULARIO
pdf.dashed_line(138,278,198,278) #FIRMA CONTROLADOR FISICO
pdf.text(40,43,unicode('DOCUMENTACIÓN CONTROLADA','utf-8'))
pdf.text(138,43,'FORMULARIO NRO:')
pdf.text(33,50,'FECHA: / /')
pdf.text(37,70,'FIRMA Y SELLO DEL CONTROLADOR')
pdf.text(150,63,'TURNO:')
pdf.text(125,69,unicode('DÍA: ','utf-8') + inscription.shift.shift_date.strftime("%d/%m/%Y"))
pdf.text(125,74,'HORA: ' + inscription.shift.shift_time.strftime("%H:%M"))
pdf.set_xy(38,77)
pdf.multi_cell(157,5, titulo_form,0,'C',False)
#DATOS DEL POSTULANTE
pdf.set_font('Times','',12)
pdf.text(34,100,'APELLIDO/S: ' + unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(34,105,'NOMBRE/S: ' + unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(34,110, 'D.N.I.:' + unicode(inscription.auth_user.username, 'utf-8'))
pdf.text(34,115,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(34,120,'EDAD: ' + str(age))
pdf.text(34,125,'GENERO: ' + unicode(inscription.auth_user.gender,'utf-8').upper())
pdf.text(34,130,'ESTADO CIVIL: ' + unicode(inscription.auth_user.marital_status, 'utf-8').upper())
pdf.text(34,135,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality, 'utf-8').upper())
pdf.text(34,140, 'DOMICILIO: ' + unicode(inscription.auth_user.address, 'utf-8').upper())
pdf.text(34,145, 'CIUDAD / LOCALIDAD: ' + unicode(inscription.auth_user.city,'utf-8').upper())
pdf.text(34,150,'PROVINCIA: ' + unicode(inscription.auth_user.province,'utf-8').upper())
pdf.text(34,155, unicode('COMISARIA JURISDICCIONAL: ' + inscription.auth_user.police_station, 'utf-8').upper())
pdf.text(34,160,'TEL. FIJO: ' + inscription.auth_user.phone)
pdf.text(34,165,'TEL. CEL.: ' + inscription.auth_user.mobile_phone)
pdf.text(34,170,unicode('CORREO ELECTRÓNICO: ','utf-8') + unicode(inscription.auth_user.email,'utf-8').lower())
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR: ' + inscription.auth_user.high_school,'utf-8').upper())
else:
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR:','utf-8'))
pdf.set_xy(110,171)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.high_school,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ' + inscription.auth_user.tertiary_title,'utf-8').upper())
else:
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ','utf-8'))
pdf.set_xy(108,176)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.tertiary_title,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
pdf.set_font('Times','B',12)
pdf.text(37,245, unicode('ESTOS DATOS SERÁN COMPLETADOS POR PERSONAL DEL I.E.S.P "G.J.F.S.M"','utf-8'))
pdf.set_font('Times','',12)
pdf.text(34,257, 'ESTATURA:..................')
pdf.text(34,267, 'PESO:.............................')
pdf.text(34,277, 'I.M.C.:............................')
pdf.set_xy(34,185.7)
pdf.set_font('Times','',12)
pdf.multi_cell(160,4, declaracion_jurada,0,'J',False)
pdf.set_font('Times','',9)
pdf.text(34,230,unicode('FIRMA DEL ASPIRANTE AL MOMENTO DE PRESENTAR LA DOCUMENTACIÓN: ..........................................................','utf-8'))
pdf.text(34,237,unicode('ACLARACIÓN: .................................................................................................................................................................................','utf-8'))
#pdf.set_xy(34,320)
#pdf.multi_cell(160,5, aclaracion,0,'J',False)
pdf.text(140,282, 'FIRMA Y SELLO DEL CONTROLADOR')
#NRO DE FORMULARIO
pdf.set_font('Arial','B',40)
pdf.set_xy(120,47)
pdf.cell(75,10,str(inscription.id),0,0,'C')
#SEGUNDA PAGINA
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
pdf.set_font('Times', 'B', 12)
pdf.line(30,37,200,37)
pdf.line(30,37,30,290)
pdf.line(200,37,200,290)
pdf.line(30,290,200,290)
pdf.line(30,75,200,75)
pdf.line(120,37,120,75)
pdf.line(30,239,200,239)
pdf.dashed_line(35,65,115,65) #FIRMA CONTROLADOR FORMULARIO
pdf.dashed_line(138,278,198,278) #FIRMA CONTROLADOR FISICO
pdf.text(40,43,unicode('DOCUMENTACIÓN CONTROLADA','utf-8'))
pdf.text(138,43,'FORMULARIO NRO:')
pdf.text(33,50,'FECHA: / /')
pdf.text(37,70,'FIRMA Y SELLO DEL CONTROLADOR')
pdf.text(150,63,'TURNO:')
pdf.text(125,69,unicode('DÍA: ','utf-8') + inscription.shift.shift_date.strftime("%d/%m/%Y"))
pdf.text(125,74,'HORA: ' + inscription.shift.shift_time.strftime("%H:%M"))
pdf.set_xy(38,77)
pdf.multi_cell(157,5, titulo_form,0,'C',False)
#DATOS DEL POSTULANTE
pdf.set_font('Times','',12)
pdf.text(34,100,'APELLIDO/S: ' + unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(34,105,'NOMBRE/S: ' + unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(34,110, 'D.N.I.:' + unicode(inscription.auth_user.username, 'utf-8'))
pdf.text(34,115,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(34,120,'EDAD: ' + str(age))
pdf.text(34,125,'GENERO: ' + unicode(inscription.auth_user.gender,'utf-8').upper())
pdf.text(34,130,'ESTADO CIVIL: ' + unicode(inscription.auth_user.marital_status, 'utf-8').upper())
pdf.text(34,135,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality, 'utf-8').upper())
pdf.text(34,140, 'DOMICILIO: ' + unicode(inscription.auth_user.address, 'utf-8').upper())
pdf.text(34,145, 'CIUDAD / LOCALIDAD: ' + unicode(inscription.auth_user.city,'utf-8').upper())
pdf.text(34,150,'PROVINCIA: ' + unicode(inscription.auth_user.province,'utf-8').upper())
pdf.text(34,155, unicode('COMISARIA JURISDICCIONAL: ' + inscription.auth_user.police_station, 'utf-8').upper())
pdf.text(34,160,'TEL. FIJO: ' + inscription.auth_user.phone)
pdf.text(34,165,'TEL. CEL.: ' + inscription.auth_user.mobile_phone)
pdf.text(34,170,unicode('CORREO ELECTRÓNICO: ','utf-8') + unicode(inscription.auth_user.email,'utf-8').lower())
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR: ' + inscription.auth_user.high_school,'utf-8').upper())
else:
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR:','utf-8'))
pdf.set_xy(110,171)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.high_school,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ' + inscription.auth_user.tertiary_title,'utf-8').upper())
else:
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ','utf-8'))
pdf.set_xy(108,176)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.tertiary_title,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
pdf.set_font('Times','B',12)
pdf.text(37,245, unicode('ESTOS DATOS SERÁN COMPLETADOS POR PERSONAL DEL I.E.S.P "G.J.F.S.M"','utf-8'))
pdf.set_font('Times','',12)
pdf.text(34,257, 'ESTATURA:..................')
pdf.text(34,267, 'PESO:.............................')
pdf.text(34,277, 'I.M.C.:............................')
pdf.set_xy(34,185.7)
pdf.set_font('Times','',12)
pdf.multi_cell(160,4, declaracion_jurada,0,'J',False)
pdf.set_font('Times','',9)
pdf.text(34,230,unicode('FIRMA DEL ASPIRANTE AL MOMENTO DE PRESENTAR LA DOCUMENTACIÓN: ..........................................................','utf-8'))
pdf.text(34,237,unicode('ACLARACIÓN: .................................................................................................................................................................................','utf-8'))
#pdf.set_xy(34,320)
#pdf.multi_cell(160,5, aclaracion,0,'J',False)
pdf.text(140,282, 'FIRMA Y SELLO DEL CONTROLADOR')
#NRO DE FORMULARIO
pdf.set_font('Arial','B',40)
pdf.set_xy(120,47)
pdf.cell(75,10,str(inscription.id),0,0,'C')
#FORMULARIO NOTAS EXAMEN INTELECTUAL
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
#VARIABLES
enc_intelectual = unicode('FORMULARIO DE EXÁMENES DE CONOCIMIENTOS INTELECTUALES PARA ASPIRANTES A CADETES DE PRIMER AÑO DEL INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSÉ FRANCISCO DE SAN MARTÍN"','utf-8')
presentado = unicode('(El presente formulario deberá ser presentado por el Aspirante al momento de rendir los Exámenes de Conocimientos Intelectuales)','utf-8')
aprobacion = unicode('La aprobación del EXAMEN DE CONOCIMIENTOS INTELECTUALES requerirá la obtención de un puntaje mínimo de sesenta (60) sobre cien (100) puntos por materia o de doscientos cuarenta (240) puntos en la sumatoria de las tres asignaturas, siempre y cuando no se obtenga menos de cuarenta (40) puntos en ninguna materia.','utf-8')
sin_recuperatorio = unicode('LOS EXAMENES INTELECTUALES NO TIENEN RECUPERATORIO.','utf-8')
pdf.rect(30,37,170,250)
pdf.set_xy(33,40)
pdf.set_font('Arial','BU',12)
pdf.multi_cell(165,5,enc_intelectual,0,'C',False)
pdf.set_xy(31,56)
pdf.set_font('Times','',9)
pdf.multi_cell(172,3,presentado,0,'',False)
pdf.set_font('Times','',12)
pdf.text(33,70,'APELIDO/S: '+unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(33,75,'NOMBRE/S: '+unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(33,80,'D.N.I.: '+unicode(inscription.auth_user.username,'utf-8').upper())
pdf.text(33,85,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(33,90,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality,'utf-8').upper())
pdf.rect(140,60,60,30)
pdf.text(153,68,unicode('FORMULARIO N°','utf-8'))
pdf.set_xy(140,75)
pdf.set_font('Arial','B',40)
pdf.multi_cell(60,5,str(inscription.id),0,'C',False)
pdf.set_xy(33,98)
pdf.set_font('Times','',10)
pdf.multi_cell(165,5,aprobacion,0,'J',False)
pdf.text(125,125,unicode('SAN MIGUEL DE TUCUMÁN,......./......./..............','utf-8'))
pdf.text(125,242,unicode('SAN MIGUEL DE TUCUMÁN,......./......./..............','utf-8'))
pdf.text(33,135,unicode('FIRMA DEL ASPIRANTE.........................................................................................................................................','utf-8'))
pdf.text(33,142,unicode('ACLARACIÓN...........................................................................................................................................................','utf-8'))
pdf.text(33,256,unicode('FIRMA DEL ASPIRANTE.........................................................................................................................................','utf-8'))
pdf.text(33,264,unicode('ACLARACIÓN...........................................................................................................................................................','utf-8'))
pdf.set_xy(33,112)
pdf.set_font('Times','B',10)
pdf.multi_cell(165,5,sin_recuperatorio,0,'',False)
#CUADRO NOTAS EXAMENES
pdf.rect(33,152,164,40)
pdf.line(33,162,197,162)
pdf.line(74,162,74,192)
pdf.line(115,162,115,192)
pdf.line(156,162,156,192)
pdf.dashed_line(36,188,71,188)
pdf.dashed_line(77,188,112,188)
pdf.dashed_line(118,188,153,188)
pdf.dashed_line(159,188,194,188)
pdf.rect(84,200,62,30)
pdf.line(84,210,146,210)
pdf.dashed_line(87,227,143,227)
pdf.text(87,158,unicode('RESULTADO DE LOS EXÁMENES','utf-8'))
pdf.text(46,168,'LENGUA')
pdf.text(86,168,'HISTORIA')
pdf.text(125,168,unicode('GEOGRAFÍA','utf-8'))
pdf.text(104,206,'PROMEDIO')
pdf.set_xy(156,165)
pdf.multi_cell(41,4,unicode('EDUCACIÓN ÉTICA Y CIUDADANA','utf-8'),0,'C',False)
#FORMULARIO DE AUTORIZACION MENOR DE EDAD
if age < 18:
instituto = unicode('INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSÉ FRANCISCO DE SAN MARTÍN"','utf-8')
direccion = unicode('Calle Muñecas N°1.025 - San Miguel de Tucumán','utf-8')
telefono = unicode('Telefono N°(0381) 4305141 - Republica Argentina','utf-8')
porintermedio = unicode('Por intermedio de la presente, manifiesto/amos expreso consentimiento AUTORIZANDO a mí/nuestro....................................................................................., DNI nro.......................................nacido el ......./......./.............. a inscribirse y participar en todas las etapas del proceso de selección (Exámenes Intelectuales, Psicológicos, Médicos y de Aptitud Física), para ingresar como Aspirante a Cadete de Primer Año del Instituto de Enseñanza Superior de Policía "Gral. José Francisco de San Martín" Ciclo Lectivo 2019, bajo los términos y condiciones del Decreto respectivo y las pautas establecidas por el I.E.S.P. "G.J.F.S.M."','utf-8')
consentimiento = unicode('(El consentimiento expreso para la presente autorización debe ser otorgada por ambos progenitores de conformidad a lo dispuesto por el Art. 645 y ccs del Código Civil y Comercial de la nación).','utf-8')
enesteacto = unicode('En este acto presta conformidad expresa el menor de edad para realizar los actos enunciados precedentemente.','utf-8')
certificacion = unicode('CERTIFICACIÓN DE FIRMAS POR ESCRIBANO PÚBLICO O JUEZ DE PAZ (DE PROGENITORES)','utf-8')
certificacion2 = unicode('CERTIFICACIÓN DE FIRMAS POR ESCRIBANO PÚBLICO O JUEZ DE PAZ\n(DE PADRES O REPRESENTANTE LEGAL)','utf-8')
suscribe = unicode('El que suscribe CERTIFICA que la/s firma/s que antecede/n pertenece/n\na ........................................................................... DNI N°....................................................\n y a........................................................................ DNI N°....................................................\npor haber sido puesta/s en mi presencia.','utf-8')
pdf.add_page()
pdf.rect(30,10,175,28)
pdf.image(logoIES,32,11,23,26)
pdf.set_xy(52,11)
pdf.set_font('Times','B',14)
pdf.multi_cell(135,5, instituto,0,'C',False)
pdf.set_font('Times','',12)
pdf.text(77,30,direccion)
pdf.text(76,35,telefono)
pdf.set_font('Arial','BU',14)
pdf.set_xy(30,40)
pdf.multi_cell(150,6,unicode('INGRESO 2019\nAUTORIZACIÓN PARA ASPIRANTES MENORES DE 18 AÑOS','utf-8'),0,'C',False)
pdf.set_xy(30,55)
pdf.set_font('Times','',10)
pdf.multi_cell(150,4,consentimiento,0,'J',False)
pdf.set_font('Times','',12)
pdf.set_xy(30,70)
pdf.multi_cell(150,5,porintermedio,0,'J',False)
pdf.rect(30,115,155,60)
pdf.line(30,125,185,125)
pdf.line(30,145,185,145)
pdf.line(30,155,185,155)
pdf.line(80,115,80,175)
pdf.line(135,125,135,145)
pdf.line(135,155,135,175)
pdf.line(135,130,185,130)
pdf.line(135,160,185,160)
pdf.set_xy(30,116)
pdf.set_font('Arial','B',10)
pdf.multi_cell(48,4,'APELLIDO Y NOMBRE DEL PROGENITOR',0,'C',False)
pdf.set_xy(30,146)
pdf.multi_cell(48,4,'APELLIDO Y NOMBRE DEL PROGENITOR',0,'C',False)
pdf.text(45,135,'FIRMA')
pdf.text(45,165,'FIRMA')
pdf.text(150,129, unicode('D.N.I N°','utf-8'))
pdf.text(150,159, unicode('D.N.I N°','utf-8'))
pdf.set_font('Arial','', 9)
pdf.text(90,209,'(Lugar y Fecha)')
pdf.text(31,226,unicode('*Espacio reservado para certificación de firmas','utf-8'))
pdf.set_xy(30,176)
pdf.multi_cell(150,3,enesteacto,0,'C',False)
pdf.rect(30,182,155,15)
pdf.line(30,187,185,187)
pdf.line(120,182,120,197)
pdf.line(132,182,132,197)
pdf.line(30,205,185,205)
pdf.set_font('Arial','B',10)
pdf.text(45,186,'APELLIDO Y NOMBRE DEL MENOR')
pdf.text(121,186,'EDAD')
pdf.text(151,186,unicode('DNI N°','utf-8'))
pdf.set_xy(30,213)
pdf.set_font('Arial','B',12)
pdf.multi_cell(155,5,certificacion,0,'C',False)
pdf.rect(30,223,155,68)
return pdf.output(dest='S')
@auth.requires_login()
def medical_exam_form():
candidate = db(db.auth_user.id == auth.user_id).select().first()
inscription = db(candidate.id == db.inscription.auth_user).select().last()
return dict(inscription = inscription)
@auth.requires_login()
def physical_exam_form():
candidate = db(db.auth_user.id == auth.user_id).select().first()
inscription = db(candidate.id == db.inscription.auth_user).select().last()
return dict(inscription = inscription)
@auth.requires_login()
def intellectual_exam_form():
candidate = db(db.auth_user.id == auth.user_id).select().first()
inscription = db(candidate.id == db.inscription.auth_user).select().last()
return dict(inscription = inscription)
def add_user_shift(form):
user_id=form.vars.id
shift = search_shift()
db.shift_candidate.insert(auth_user = user_id, shift = shift)
inscription.insert(auth_user = user_id)
#function that search the shift with less cadets
def search_shift():
shifts = db(db.shift).select(orderby = db.shift.shift_date|db.shift.shift_time)
flag = True
shift_candidate1 = db(db.shift_candidate.shift == shifts[0].id).select()
first_id = shifts.first().id
if shift_candidate1 is None:
flag = False
return first_id
else:
for i in range(1, len(shifts)):
shift_candidate2 = db(db.shift_candidate.shift == shifts[i].id).select()
if shift_candidate2 is None:
flag = False
return shifts[i].id
else:
if len(shift_candidate1) > len(shift_candidate2):
flag = False
return shifts[i].id
if flag:
return first_id
def show_shift_assigned():
form = FORM(DIV(DIV(INPUT(_name='dni',_placeholder='Ingrese DNI',_class='form-control', requires=IS_NOT_EMPTY()),_class='input-group'),_class='form-group'),
INPUT(_type='submit',_value='Buscar',_class='btn btn-primary'),_class='form-inline')
if form.accepts(request, session):
response.flash = 'busqueda terminada'
redirect(URL('candidate','print_inscription_form', args = (request.vars.dni)))
elif form.errors:
response.flash = 'el formulario tiene errores'
else:
response.flash = 'por favor complete el formulario'
return dict(form = form)
# def print_inscription_form():
# candidate = db(db.auth_user.username == request.vars['dni']).select().first()
# # inscription = db(db.inscription.auth_user == candidate.id).select().last()
# inscription = db(db.shift_candidate.auth_user == candidate.id).select().last()
# return dict(inscription = inscription)
def print_inscription_form():
import os
from gluon.contrib.pyfpdf import FPDF
candidate = db(db.auth_user.username == request.vars['dni']).select().first()
inscription = db(db.shift_candidate.auth_user == candidate.id).select().last()
age = calculate_age(candidate.birth_date)
logoIES = os.path.join(request.folder, "static", "images", "logo_ies.png")
logoMinSeg = os.path.join(request.folder, "static", "images", "logoMinisterio.png")
titulo_form = unicode('FORMULARIO ÚNICO DE INSCRIPCIÓN PARA ASPIRANTES A CADETES DE PRIMER AÑO DEL INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSE FRANCISCO DE SAN MARTÍN" - CICLO LECTIVO 2019',"utf-8")
declaracion_jurada = unicode('Declaro bajo juramento de ley: 1°) Que los datos consignados son verdaderos; 2°) Que he tomado conocimiento y acepto los términos de la presente convocatoria y proceso de selección, conforme el Decreto respectivo, como así tambien las pautas establecidas por el I.E.S. de Policía "GJFSM"; 3°) Que no registro antecedentes judiciales ni penales de carácter doloso ni contravencionales policiales, ni me encuentro procesado por la justicia provincial o nacional. En consecuencia, quedo sujeto a las normas que rigen administrativa y jurídicamente en la materia (Art. 172, 292 y c.c. Código Penal Argentino), y además obligado a comunicar toda variante dentro de los 15 (quince) días corridos a partir de la fecha en que éstas se hayan producido.','utf-8')
pdf = FPDF('P', 'mm', 'A4')
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
pdf.set_font('Times', 'B', 12)
pdf.line(30,37,200,37)
pdf.line(30,37,30,290)
pdf.line(200,37,200,290)
pdf.line(30,290,200,290)
pdf.line(30,75,200,75)
pdf.line(120,37,120,75)
pdf.line(30,239,200,239)
pdf.dashed_line(35,65,115,65) #FIRMA CONTROLADOR FORMULARIO
pdf.dashed_line(138,278,198,278) #FIRMA CONTROLADOR FISICO
pdf.text(40,43,unicode('DOCUMENTACIÓN CONTROLADA','utf-8'))
pdf.text(138,43,'FORMULARIO NRO:')
pdf.text(33,50,'FECHA: / /')
pdf.text(37,70,'FIRMA Y SELLO DEL CONTROLADOR')
pdf.text(150,63,'TURNO:')
pdf.text(125,69,unicode('DÍA: ','utf-8') + inscription.shift.shift_date.strftime("%d/%m/%Y"))
pdf.text(125,74,'HORA: ' + inscription.shift.shift_time.strftime("%H:%M"))
pdf.set_xy(38,77)
pdf.multi_cell(157,5, titulo_form,0,'C',False)
#DATOS DEL POSTULANTE
pdf.set_font('Times','',12)
pdf.text(34,100,'APELLIDO/S: ' + unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(34,105,'NOMBRE/S: ' + unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(34,110, 'D.N.I.:' + unicode(inscription.auth_user.username, 'utf-8'))
pdf.text(34,115,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(34,120,'EDAD: ' + str(age))
pdf.text(34,125,'GENERO: ' + unicode(inscription.auth_user.gender,'utf-8').upper())
pdf.text(34,130,'ESTADO CIVIL: ' + unicode(inscription.auth_user.marital_status, 'utf-8').upper())
pdf.text(34,135,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality, 'utf-8').upper())
pdf.text(34,140, 'DOMICILIO: ' + unicode(inscription.auth_user.address, 'utf-8').upper())
pdf.text(34,145, 'CIUDAD / LOCALIDAD: ' + unicode(inscription.auth_user.city,'utf-8').upper())
pdf.text(34,150,'PROVINCIA: ' + unicode(inscription.auth_user.province,'utf-8').upper())
pdf.text(34,155, unicode('COMISARIA JURISDICCIONAL: ' + inscription.auth_user.police_station, 'utf-8').upper())
pdf.text(34,160,'TEL. FIJO: ' + inscription.auth_user.phone)
pdf.text(34,165,'TEL. CEL.: ' + inscription.auth_user.mobile_phone)
pdf.text(34,170,unicode('CORREO ELECTRÓNICO: ','utf-8') + unicode(inscription.auth_user.email,'utf-8').lower())
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR: ' + inscription.auth_user.high_school,'utf-8').upper())
else:
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR:','utf-8'))
pdf.set_xy(110,171)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.high_school,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ' + inscription.auth_user.tertiary_title,'utf-8').upper())
else:
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ','utf-8'))
pdf.set_xy(108,176)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.tertiary_title,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
pdf.set_font('Times','B',12)
pdf.text(37,245, unicode('ESTOS DATOS SERÁN COMPLETADOS POR PERSONAL DEL I.E.S.P "G.J.F.S.M"','utf-8'))
pdf.set_font('Times','',12)
pdf.text(34,257, 'ESTATURA:..................')
pdf.text(34,267, 'PESO:.............................')
pdf.text(34,277, 'I.M.C.:............................')
pdf.set_xy(34,185.7)
pdf.set_font('Times','',12)
pdf.multi_cell(160,4, declaracion_jurada,0,'J',False)
pdf.set_font('Times','',9)
pdf.text(34,230,unicode('FIRMA DEL ASPIRANTE AL MOMENTO DE PRESENTAR LA DOCUMENTACIÓN: ..........................................................','utf-8'))
pdf.text(34,237,unicode('ACLARACIÓN: .................................................................................................................................................................................','utf-8'))
#pdf.set_xy(34,320)
#pdf.multi_cell(160,5, aclaracion,0,'J',False)
pdf.text(140,282, 'FIRMA Y SELLO DEL CONTROLADOR')
#NRO DE FORMULARIO
pdf.set_font('Arial','B',40)
pdf.set_xy(120,47)
pdf.cell(75,10,str(inscription.id),0,0,'C')
#SEGUNDA PAGINA
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
pdf.set_font('Times', 'B', 12)
pdf.line(30,37,200,37)
pdf.line(30,37,30,290)
pdf.line(200,37,200,290)
pdf.line(30,290,200,290)
pdf.line(30,75,200,75)
pdf.line(120,37,120,75)
pdf.line(30,239,200,239)
pdf.dashed_line(35,65,115,65) #FIRMA CONTROLADOR FORMULARIO
pdf.dashed_line(138,278,198,278) #FIRMA CONTROLADOR FISICO
pdf.text(40,43,unicode('DOCUMENTACIÓN CONTROLADA','utf-8'))
pdf.text(138,43,'FORMULARIO NRO:')
pdf.text(33,50,'FECHA: / /')
pdf.text(37,70,'FIRMA Y SELLO DEL CONTROLADOR')
pdf.text(150,63,'TURNO:')
pdf.text(125,69,unicode('DÍA: ','utf-8') + inscription.shift.shift_date.strftime("%d/%m/%Y"))
pdf.text(125,74,'HORA: ' + inscription.shift.shift_time.strftime("%H:%M"))
pdf.set_xy(38,77)
pdf.multi_cell(157,5, titulo_form,0,'C',False)
#DATOS DEL POSTULANTE
pdf.set_font('Times','',12)
pdf.text(34,100,'APELLIDO/S: ' + unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(34,105,'NOMBRE/S: ' + unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(34,110, 'D.N.I.:' + unicode(inscription.auth_user.username, 'utf-8'))
pdf.text(34,115,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(34,120,'EDAD: ' + str(age))
pdf.text(34,125,'GENERO: ' + unicode(inscription.auth_user.gender,'utf-8').upper())
pdf.text(34,130,'ESTADO CIVIL: ' + unicode(inscription.auth_user.marital_status, 'utf-8').upper())
pdf.text(34,135,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality, 'utf-8').upper())
pdf.text(34,140, 'DOMICILIO: ' + unicode(inscription.auth_user.address, 'utf-8').upper())
pdf.text(34,145, 'CIUDAD / LOCALIDAD: ' + unicode(inscription.auth_user.city,'utf-8').upper())
pdf.text(34,150,'PROVINCIA: ' + unicode(inscription.auth_user.province,'utf-8').upper())
pdf.text(34,155, unicode('COMISARIA JURISDICCIONAL: ' + inscription.auth_user.police_station, 'utf-8').upper())
pdf.text(34,160,'TEL. FIJO: ' + inscription.auth_user.phone)
pdf.text(34,165,'TEL. CEL.: ' + inscription.auth_user.mobile_phone)
pdf.text(34,170,unicode('CORREO ELECTRÓNICO: ','utf-8') + unicode(inscription.auth_user.email,'utf-8').lower())
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR: ' + inscription.auth_user.high_school,'utf-8').upper())
else:
pdf.text(34,175, unicode('TÍTULO SECUNDARIO EXPEDIDO POR:','utf-8'))
pdf.set_xy(110,171)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.high_school,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
if(len(inscription.auth_user.high_school)<=40):
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ' + inscription.auth_user.tertiary_title,'utf-8').upper())
else:
pdf.text(34,180, unicode('TÍTULO TERCIARIO/UNIVERSITARIO: ','utf-8'))
pdf.set_xy(108,176)
pdf.set_font('Times','',9)
pdf.multi_cell(85,2.8,unicode(inscription.auth_user.tertiary_title,'utf-8').upper(),0,'J',False)
pdf.set_font('Times','',12)
pdf.set_font('Times','B',12)
pdf.text(37,245, unicode('ESTOS DATOS SERÁN COMPLETADOS POR PERSONAL DEL I.E.S.P "G.J.F.S.M"','utf-8'))
pdf.set_font('Times','',12)
pdf.text(34,257, 'ESTATURA:..................')
pdf.text(34,267, 'PESO:.............................')
pdf.text(34,277, 'I.M.C.:............................')
pdf.set_xy(34,185.7)
pdf.set_font('Times','',12)
pdf.multi_cell(160,4, declaracion_jurada,0,'J',False)
pdf.set_font('Times','',9)
pdf.text(34,230,unicode('FIRMA DEL ASPIRANTE AL MOMENTO DE PRESENTAR LA DOCUMENTACIÓN: ..........................................................','utf-8'))
pdf.text(34,237,unicode('ACLARACIÓN: .................................................................................................................................................................................','utf-8'))
#pdf.set_xy(34,320)
#pdf.multi_cell(160,5, aclaracion,0,'J',False)
pdf.text(140,282, 'FIRMA Y SELLO DEL CONTROLADOR')
#NRO DE FORMULARIO
pdf.set_font('Arial','B',40)
pdf.set_xy(120,47)
pdf.cell(75,10,str(inscription.id),0,0,'C')
#FORMULARIO NOTAS EXAMEN INTELECTUAL
pdf.add_page()
#LOGOS
pdf.image(logoIES,165,10,23,26)
pdf.image(logoMinSeg,45,13,80,20)
#VARIABLES
enc_intelectual = unicode('FORMULARIO DE EXÁMENES DE CONOCIMIENTOS INTELECTUALES PARA ASPIRANTES A CADETES DE PRIMER AÑO DEL INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSÉ FRANCISCO DE SAN MARTÍN"','utf-8')
presentado = unicode('(El presente formulario deberá ser presentado por el Aspirante al momento de rendir los Exámenes de Conocimientos Intelectuales)','utf-8')
aprobacion = unicode('La aprobación del EXAMEN DE CONOCIMIENTOS INTELECTUALES requerirá la obtención de un puntaje mínimo de sesenta (60) sobre cien (100) puntos por materia o de doscientos cuarenta (240) puntos en la sumatoria de las tres asignaturas, siempre y cuando no se obtenga menos de cuarenta (40) puntos en ninguna materia.','utf-8')
sin_recuperatorio = unicode('LOS EXAMENES INTELECTUALES NO TIENEN RECUPERATORIO.','utf-8')
pdf.rect(30,37,170,250)
pdf.set_xy(33,40)
pdf.set_font('Arial','BU',12)
pdf.multi_cell(165,5,enc_intelectual,0,'C',False)
pdf.set_xy(31,56)
pdf.set_font('Times','',9)
pdf.multi_cell(172,3,presentado,0,'',False)
pdf.set_font('Times','',12)
pdf.text(33,70,'APELIDO/S: '+unicode(inscription.auth_user.last_name,'utf-8').upper())
pdf.text(33,75,'NOMBRE/S: '+unicode(inscription.auth_user.first_name,'utf-8').upper())
pdf.text(33,80,'D.N.I.: '+unicode(inscription.auth_user.username,'utf-8').upper())
pdf.text(33,85,'FECHA DE NACIMIENTO: ' + inscription.auth_user.birth_date.strftime("%d/%m/%Y"))
pdf.text(33,90,'NACIONALIDAD: ' + unicode(inscription.auth_user.nationality,'utf-8').upper())
pdf.rect(140,60,60,30)
pdf.text(153,68,unicode('FORMULARIO N°','utf-8'))
pdf.set_xy(140,75)
pdf.set_font('Arial','B',40)
pdf.multi_cell(60,5,str(inscription.id),0,'C',False)
pdf.set_xy(33,98)
pdf.set_font('Times','',10)
pdf.multi_cell(165,5,aprobacion,0,'J',False)
pdf.text(125,125,unicode('SAN MIGUEL DE TUCUMÁN,......./......./..............','utf-8'))
pdf.text(125,242,unicode('SAN MIGUEL DE TUCUMÁN,......./......./..............','utf-8'))
pdf.text(33,135,unicode('FIRMA DEL ASPIRANTE.........................................................................................................................................','utf-8'))
pdf.text(33,142,unicode('ACLARACIÓN...........................................................................................................................................................','utf-8'))
pdf.text(33,256,unicode('FIRMA DEL ASPIRANTE.........................................................................................................................................','utf-8'))
pdf.text(33,264,unicode('ACLARACIÓN...........................................................................................................................................................','utf-8'))
pdf.set_xy(33,112)
pdf.set_font('Times','B',10)
pdf.multi_cell(165,5,sin_recuperatorio,0,'',False)
#CUADRO NOTAS EXAMENES
pdf.rect(33,152,164,40)
pdf.line(33,162,197,162)
pdf.line(74,162,74,192)
pdf.line(115,162,115,192)
pdf.line(156,162,156,192)
pdf.dashed_line(36,188,71,188)
pdf.dashed_line(77,188,112,188)
pdf.dashed_line(118,188,153,188)
pdf.dashed_line(159,188,194,188)
pdf.rect(84,200,62,30)
pdf.line(84,210,146,210)
pdf.dashed_line(87,227,143,227)
pdf.text(87,158,unicode('RESULTADO DE LOS EXÁMENES','utf-8'))
pdf.text(46,168,'LENGUA')
pdf.text(86,168,'HISTORIA')
pdf.text(125,168,unicode('GEOGRAFÍA','utf-8'))
pdf.text(104,206,'PROMEDIO')
pdf.set_xy(156,165)
pdf.multi_cell(41,4,unicode('EDUCACIÓN ÉTICA Y CIUDADANA','utf-8'),0,'C',False)
#FORMULARIO DE AUTORIZACION MENOR DE EDAD
if age < 18:
instituto = unicode('INSTITUTO DE ENSEÑANZA SUPERIOR DE POLICÍA "GRAL. JOSÉ FRANCISCO DE SAN MARTÍN"','utf-8')
direccion = unicode('Calle Muñecas N°1.025 - San Miguel de Tucumán','utf-8')
telefono = unicode('Telefono N°(0381) 4305141 - Republica Argentina','utf-8')
porintermedio = unicode('Por intermedio de la presente, manifiesto/amos expreso consentimiento AUTORIZANDO a mí/nuestro....................................................................................., DNI nro.......................................nacido el ......./......./.............. a inscribirse y participar en todas las etapas del proceso de selección (Exámenes Intelectuales, Psicológicos, Médicos y de Aptitud Física), para ingresar como Aspirante a Cadete de Primer Año del Instituto de Enseñanza Superior de Policía "Gral. José Francisco de San Martín" Ciclo Lectivo 2019, bajo los términos y condiciones del Decreto respectivo y las pautas establecidas por el I.E.S.P. "G.J.F.S.M."','utf-8')
consentimiento = unicode('(El consentimiento expreso para la presente autorización debe ser otorgada por ambos progenitores de conformidad a lo dispuesto por el Art. 645 y ccs del Código Civil y Comercial de la nación).','utf-8')
enesteacto = unicode('En este acto presta conformidad expresa el menor de edad para realizar los actos enunciados precedentemente.','utf-8')
certificacion = unicode('CERTIFICACIÓN DE FIRMAS POR ESCRIBANO PÚBLICO O JUEZ DE PAZ (DE PROGENITORES)','utf-8')
certificacion2 = unicode('CERTIFICACIÓN DE FIRMAS POR ESCRIBANO PÚBLICO O JUEZ DE PAZ\n(DE PADRES O REPRESENTANTE LEGAL)','utf-8')
suscribe = unicode('El que suscribe CERTIFICA que la/s firma/s que antecede/n pertenece/n\na ........................................................................... DNI N°....................................................\n y a........................................................................ DNI N°....................................................\npor haber sido puesta/s en mi presencia.','utf-8')
pdf.add_page()
pdf.rect(30,10,175,28)
pdf.image(logoIES,32,11,23,26)
pdf.set_xy(52,11)
pdf.set_font('Times','B',14)
pdf.multi_cell(135,5, instituto,0,'C',False)
pdf.set_font('Times','',12)
pdf.text(77,30,direccion)
pdf.text(76,35,telefono)
pdf.set_font('Arial','BU',14)
pdf.set_xy(30,40)
pdf.multi_cell(150,6,unicode('INGRESO 2019\nAUTORIZACIÓN PARA ASPIRANTES MENORES DE 18 AÑOS','utf-8'),0,'C',False)
pdf.set_xy(30,55)
pdf.set_font('Times','',10)
pdf.multi_cell(150,4,consentimiento,0,'J',False)
pdf.set_font('Times','',12)
pdf.set_xy(30,70)
pdf.multi_cell(150,5,porintermedio,0,'J',False)
pdf.rect(30,115,155,60)
pdf.line(30,125,185,125)
pdf.line(30,145,185,145)
pdf.line(30,155,185,155)
pdf.line(80,115,80,175)
pdf.line(135,125,135,145)
pdf.line(135,155,135,175)
pdf.line(135,130,185,130)
pdf.line(135,160,185,160)
pdf.set_xy(30,116)
pdf.set_font('Arial','B',10)
pdf.multi_cell(48,4,'APELLIDO Y NOMBRE DEL PROGENITOR',0,'C',False)
pdf.set_xy(30,146)
pdf.multi_cell(48,4,'APELLIDO Y NOMBRE DEL PROGENITOR',0,'C',False)
pdf.text(45,135,'FIRMA')
pdf.text(45,165,'FIRMA')
pdf.text(150,129, unicode('D.N.I N°','utf-8'))
pdf.text(150,159, unicode('D.N.I N°','utf-8'))
pdf.set_font('Arial','', 9)
pdf.text(90,209,'(Lugar y Fecha)')
pdf.text(31,226,unicode('*Espacio reservado para certificación de firmas','utf-8'))
pdf.set_xy(30,176)
pdf.multi_cell(150,3,enesteacto,0,'C',False)
pdf.rect(30,182,155,15)
pdf.line(30,187,185,187)
pdf.line(120,182,120,197)
pdf.line(132,182,132,197)
pdf.line(30,205,185,205)
pdf.set_font('Arial','B',10)
pdf.text(45,186,'APELLIDO Y NOMBRE DEL MENOR')
pdf.text(121,186,'EDAD')
pdf.text(151,186,unicode('DNI N°','utf-8'))
pdf.set_xy(30,213)
pdf.set_font('Arial','B',12)
pdf.multi_cell(155,5,certificacion,0,'C',False)
pdf.rect(30,223,155,68)
return pdf.output(dest='S')
def hidden_candidate_register():
auth.settings.register_onaccept = add_user_shift
auth.settings.register_next = URL(c='candidate',f='profile')
return dict(form = auth.register())
def calculate_age(dob):
from datetime import date
today = date.today()
if today > dob:
age = today.year - dob.year
if dob.month > today.month:
age -= 1
if today.month == dob.month:
if dob.day > dob.month:
age -= 1
return age
else:
return 0
def list_aproved():
aspirantes = db(db.inscription.id == db.psychological_interview.inscription).select(join=db.auth_user.on(db.auth_user.id==db.inscription.auth_user))
return dict(aprobados = aspirantes)
def listado_aprobados():
import os
import xlwt
from datetime import datetime
inscriptions = db(db.inscription.id == db.psychological_interview.inscription).select(join=db.auth_user.on(db.auth_user.id==db.inscription.auth_user))
tmpfilename=os.path.join(request.folder,'private',str("tem.xls"))
font0 = xlwt.Font()
font0.name = 'Arial'
font0.bold = True
style0 = xlwt.XFStyle()
style0.font = font0
#Formato para fechas
style1 = xlwt.XFStyle()
style1.num_format_str = 'DD-MMMM-YYYY'
#formato para datos en texto
style2 = xlwt.XFStyle()
style2.font.name = 'Arial'
style2.font.bold = False
#formato para datos de hora
style3 = xlwt.XFStyle()
style3.num_format_str = 'HH:MM'
wb = xlwt.Workbook()
ws = wb.add_sheet('Sample report')
#encabezado
ws.write(0, 0, 'Formulario', style0)
ws.write(0, 3, 'DNI', style0)
ws.write(0, 4, 'Apellido y Nombre/s', style0)
ws.write(0, 5, 'F.Nac', style0)
ws.write(0, 6, 'EDAD', style0)
ws.write(0, 7, 'Genero', style0)
ws.write(0, 8, 'Estado Civil', style0)
ws.write(0, 9, 'Carrera', style0)
ws.write(0, 10, 'Tel. Fijo', style0)
ws.write(0, 11, 'Tel. Celular', style0)
ws.write(0, 12, 'Direccion', style0)
ws.write(0, 13, 'Provincia', style0)
ws.write(0, 14, 'Comisaria Jur.', style0)
ws.write(0, 15, 'Col. Secundario', style0)
ws.write(0, 16, 'Titulo Terciario', style0)
#completa filas con datos de inscriptos
for i in xrange(0,len(inscriptions)):
ws.write(i+1, 0, inscriptions[i].inscription.id, style2)
ws.write(i+1, 3, inscriptions[i].auth_user.username, style2)
ws.write(i+1, 4, unicode(inscriptions[i].auth_user.last_name + ', ' + inscriptions[i].auth_user.first_name,'utf-8'), style2)
ws.write(i+1, 5, inscriptions[i].auth_user.birth_date, style1)
ws.write(i+1, 6, calculate_age(inscriptions[i].auth_user.birth_date), style2)
ws.write(i+1, 7, inscriptions[i].auth_user.gender, style2)
ws.write(i+1, 8, inscriptions[i].auth_user.marital_status, style2)
ws.write(i+1, 9, unicode(inscriptions[i].auth_user.career,'utf-8'), style2)
ws.write(i+1, 10, unicode(inscriptions[i].auth_user.phone,'utf-8'), style2)
ws.write(i+1, 11, unicode(inscriptions[i].auth_user.mobile_phone,'utf-8'), style2)
ws.write(i+1, 12, unicode(inscriptions[i].auth_user.address,'utf-8'), style2)
ws.write(i+1, 13, unicode(inscriptions[i].auth_user.province,'utf-8'), style2)
ws.write(i+1, 14, unicode(inscriptions[i].auth_user.police_station,'utf-8'), style2)
ws.write(i+1, 15, unicode(inscriptions[i].auth_user.high_school,'utf-8'), style2)
ws.write(i+1, 16, unicode(inscriptions[i].auth_user.tertiary_title,'utf-8'), style2)
wb.save(tmpfilename)
data = open(tmpfilename,"rb").read()
os.unlink(tmpfilename)
response.headers['Content-Type']='application/vnd.ms-excel'
return data
def calculate_age(dob):
from datetime import date
today = date.today()
if today > dob:
age = today.year - dob.year
if dob.month > today.month:
age -= 1
if today.month == dob.month:
if dob.day > dob.month:
age -= 1
return age
else:
return 0
| 51.366803
| 787
| 0.621435
| 7,144
| 50,134
| 4.276176
| 0.103163
| 0.043078
| 0.060329
| 0.027497
| 0.86484
| 0.836754
| 0.817965
| 0.806082
| 0.802088
| 0.796131
| 0
| 0.075453
| 0.158555
| 50,134
| 976
| 788
| 51.366803
| 0.648192
| 0.040851
| 0
| 0.775434
| 0
| 0.022333
| 0.311893
| 0.079817
| 0
| 0
| 0
| 0
| 0
| 1
| 0.029777
| false
| 0
| 0.013648
| 0.001241
| 0.074442
| 0.002481
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
7714acc1e69e89548f6bc50f8da968bc7273c657
| 5,170
|
py
|
Python
|
mev/api/tests/test_startup.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | 2
|
2021-11-15T08:11:59.000Z
|
2022-03-12T05:24:23.000Z
|
mev/api/tests/test_startup.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | 37
|
2020-08-03T14:57:02.000Z
|
2022-02-25T19:56:40.000Z
|
mev/api/tests/test_startup.py
|
hsph-qbrc/mev-backend
|
c381800aa7d53d7256e89a4db5a0f9444264e9a6
|
[
"MIT"
] | 2
|
2021-07-12T03:22:52.000Z
|
2021-11-15T08:12:01.000Z
|
import unittest
import unittest.mock as mock
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
from api.cloud_backends.google_cloud import startup_check
'''
This set of tests checks that the startup checks execute as planned.
Namely, ensures that the proper errors are emitted if there is a failure
in getting things properly configured.
'''
class GoogleCloudStartupTest(unittest.TestCase):
@mock.patch('api.cloud_backends.google_cloud.get_runner')
@mock.patch('api.cloud_backends.google_cloud.get_instance_region')
@mock.patch('api.cloud_backends.google_cloud.settings')
@mock.patch('api.storage_backends.google_cloud.GoogleBucketStorage.get_bucket')
@mock.patch('api.storage_backends.google_cloud.storage')
@mock.patch('api.storage_backends.google_cloud.service_account')
@mock.patch('api.storage_backends.google_cloud.settings')
def test_google_cloud_case1(self, \
mock_storage_settings, \
mock_storage_service_account, \
mock_storage, \
mock_get_bucket, \
mock_settings, \
mock_get_instance_region, \
mock_get_runner):
'''
Here we simulate the case where everything is good to go
and consistent when using bucket storage and remote job runners
'''
mock_get_instance_region.return_value = 'foo-region'
mock_settings.ENABLE_REMOTE_JOBS = True
mock_settings.REQUESTED_REMOTE_JOB_RUNNERS = ['abc',]
mock_settings.STORAGE_LOCATION = settings.REMOTE
mock_runner_class = mock.MagicMock()
mock_runner = mock.MagicMock()
mock_runner.check_if_ready.return_value = None
mock_runner_class.return_value = mock_runner
mock_get_runner.return_value = mock_runner_class
mock_bucket = mock.MagicMock()
mock_bucket.location = 'foo-region'
mock_get_bucket.return_value = mock_bucket
startup_check()
mock_runner.check_if_ready.assert_called()
@mock.patch('api.cloud_backends.google_cloud.get_runner')
@mock.patch('api.cloud_backends.google_cloud.get_instance_region')
@mock.patch('api.cloud_backends.google_cloud.settings')
@mock.patch('api.storage_backends.google_cloud.GoogleBucketStorage.get_bucket')
@mock.patch('api.storage_backends.google_cloud.storage')
@mock.patch('api.storage_backends.google_cloud.service_account')
@mock.patch('api.storage_backends.google_cloud.settings')
def test_google_cloud_case2(self,
mock_storage_settings,
mock_storage_service_account,
mock_storage,
mock_get_bucket,
mock_settings,
mock_get_instance_region,
mock_get_runner):
'''
Here we simulate the case where bucket-storage is used, but the bucket
is in a different region than the VM running the instance. We want to
fail that.
'''
mock_get_instance_region.return_value = 'foo-region'
mock_settings.ENABLE_REMOTE_JOBS = True
mock_settings.REQUESTED_REMOTE_JOB_RUNNERS = ['abc',]
mock_settings.STORAGE_LOCATION = settings.REMOTE
mock_runner_class = mock.MagicMock()
mock_runner = mock.MagicMock()
mock_runner.check_if_ready.return_value = None
mock_runner_class.return_value = mock_runner
mock_get_runner.return_value = mock_runner_class
mock_bucket = mock.MagicMock()
mock_bucket.location = 'other-region'
mock_get_bucket.return_value = mock_bucket
with self.assertRaises(ImproperlyConfigured):
startup_check()
mock_runner.check_if_ready.assert_called()
@mock.patch('api.cloud_backends.google_cloud.get_runner')
@mock.patch('api.cloud_backends.google_cloud.get_with_retry')
@mock.patch('api.cloud_backends.google_cloud.get_instance_region')
@mock.patch('api.cloud_backends.google_cloud.settings')
@mock.patch('api.storage_backends.google_cloud.GoogleBucketStorage.get_bucket')
@mock.patch('api.storage_backends.google_cloud.storage')
@mock.patch('api.storage_backends.google_cloud.service_account')
@mock.patch('api.storage_backends.google_cloud.settings')
def test_google_cloud_case3(self,
mock_storage_settings,
mock_storage_service_account,
mock_storage,
mock_get_bucket,
mock_settings,
mock_get_instance_region,
mock_get_with_retry,
mock_get_runner):
'''
Simulate the case where bucket-storage is used but we do NOT enable
remote job runners
'''
mock_get_instance_region.return_value = 'foo-region'
mock_settings.ENABLE_REMOTE_JOBS = False
mock_settings.STORAGE_LOCATION = settings.REMOTE
mock_runner_class = mock.MagicMock()
mock_runner = mock.MagicMock()
mock_runner.check_if_ready.return_value = None
mock_runner_class.return_value = mock_runner
mock_get_runner.return_value = mock_runner_class
mock_bucket = mock.MagicMock()
mock_bucket.location = 'foo-region'
mock_get_bucket.return_value = mock_bucket
startup_check()
| 42.727273
| 83
| 0.72089
| 650
| 5,170
| 5.38
| 0.163077
| 0.081784
| 0.124964
| 0.065199
| 0.837575
| 0.829854
| 0.829854
| 0.829854
| 0.818416
| 0.800114
| 0
| 0.000723
| 0.197679
| 5,170
| 121
| 84
| 42.727273
| 0.842334
| 0.069633
| 0
| 0.787234
| 0
| 0
| 0.24353
| 0.228489
| 0
| 0
| 0
| 0
| 0.031915
| 1
| 0.031915
| false
| 0
| 0.053191
| 0
| 0.095745
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
62643d39aaf9deb5c2533b50f4e8791da16b6c4a
| 94
|
py
|
Python
|
baz/baz/__init__.py
|
zeebonk/gitflow
|
f7e237f1bcc14a66a4c0b000bd7e9fc8986dd753
|
[
"MIT"
] | null | null | null |
baz/baz/__init__.py
|
zeebonk/gitflow
|
f7e237f1bcc14a66a4c0b000bd7e9fc8986dd753
|
[
"MIT"
] | null | null | null |
baz/baz/__init__.py
|
zeebonk/gitflow
|
f7e237f1bcc14a66a4c0b000bd7e9fc8986dd753
|
[
"MIT"
] | null | null | null |
print("Hello baz")
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
#bla
| 5.529412
| 18
| 0.617021
| 18
| 94
| 3.222222
| 0.222222
| 1.448276
| 2.017241
| 2.482759
| 0.775862
| 0.775862
| 0.775862
| 0.775862
| 0.775862
| 0.775862
| 0
| 0
| 0.180851
| 94
| 16
| 19
| 5.875
| 0.753247
| 0.478723
| 0
| 0
| 0
| 0
| 0.264706
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 11
|
626692bc7f03cc0d5bb50b76d4860c4c8cfee58b
| 48
|
py
|
Python
|
src/txCascil/exceptions.py
|
DanSeraf/spyd
|
af893b7f9c67785613b25754eb2cf150523a9fe4
|
[
"Zlib"
] | null | null | null |
src/txCascil/exceptions.py
|
DanSeraf/spyd
|
af893b7f9c67785613b25754eb2cf150523a9fe4
|
[
"Zlib"
] | null | null | null |
src/txCascil/exceptions.py
|
DanSeraf/spyd
|
af893b7f9c67785613b25754eb2cf150523a9fe4
|
[
"Zlib"
] | null | null | null |
class AuthenticationHardFailure(Exception): pass
| 48
| 48
| 0.895833
| 4
| 48
| 10.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041667
| 48
| 1
| 48
| 48
| 0.934783
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 1
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
|
0
| 7
|
02a7e08db3cf2b1e43112d00175c5b69e4a84bed
| 138
|
py
|
Python
|
value_iteration/cost_functions/__init__.py
|
BolunDai0216/value_iteration
|
ca762eacffc9e719ccc1a2fcd3994a343d03b017
|
[
"MIT"
] | null | null | null |
value_iteration/cost_functions/__init__.py
|
BolunDai0216/value_iteration
|
ca762eacffc9e719ccc1a2fcd3994a343d03b017
|
[
"MIT"
] | null | null | null |
value_iteration/cost_functions/__init__.py
|
BolunDai0216/value_iteration
|
ca762eacffc9e719ccc1a2fcd3994a343d03b017
|
[
"MIT"
] | null | null | null |
from value_iteration.cost_functions.convex_conjugate_function import *
from value_iteration.cost_functions.state_cost_functions import *
| 34.5
| 70
| 0.891304
| 18
| 138
| 6.388889
| 0.555556
| 0.33913
| 0.313043
| 0.382609
| 0.53913
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.065217
| 138
| 3
| 71
| 46
| 0.891473
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
02bea6bcd3f73a8370edf2d2d966a5923d9a16dd
| 230
|
py
|
Python
|
tests/test_eval.py
|
mattijn/calculator_NL
|
c658332893538897b3584afdeb5e43c85c5d1fcb
|
[
"MIT"
] | null | null | null |
tests/test_eval.py
|
mattijn/calculator_NL
|
c658332893538897b3584afdeb5e43c85c5d1fcb
|
[
"MIT"
] | null | null | null |
tests/test_eval.py
|
mattijn/calculator_NL
|
c658332893538897b3584afdeb5e43c85c5d1fcb
|
[
"MIT"
] | null | null | null |
from evaluate import eval
def test_unary_divide():
assert eval('//2') == 2
def test_pwr_up():
assert eval('2↑3') == 8
def test_pwr_down():
assert eval('8↓3') == 2
def test_pwr_db_down():
assert eval('8⇓2') == 3
| 17.692308
| 27
| 0.617391
| 43
| 230
| 3.162791
| 0.44186
| 0.205882
| 0.220588
| 0.161765
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.060109
| 0.204348
| 230
| 13
| 28
| 17.692308
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.051948
| 0
| 0
| 0
| 0
| 0
| 0.444444
| 1
| 0.444444
| true
| 0
| 0.111111
| 0
| 0.555556
| 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
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
02fbde3afad697ddee77429dc68e528524322b60
| 31,225
|
py
|
Python
|
sdk/python/pulumi_f5bigip/traffic_selector.py
|
pulumi/pulumi-f5bigip
|
4bce074f8bd7cb42f359ef4814ca5b437230fd1c
|
[
"ECL-2.0",
"Apache-2.0"
] | 4
|
2018-12-21T23:30:33.000Z
|
2021-10-12T16:38:27.000Z
|
sdk/python/pulumi_f5bigip/traffic_selector.py
|
pulumi/pulumi-f5bigip
|
4bce074f8bd7cb42f359ef4814ca5b437230fd1c
|
[
"ECL-2.0",
"Apache-2.0"
] | 61
|
2019-01-09T01:50:19.000Z
|
2022-03-31T15:27:17.000Z
|
sdk/python/pulumi_f5bigip/traffic_selector.py
|
pulumi/pulumi-f5bigip
|
4bce074f8bd7cb42f359ef4814ca5b437230fd1c
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2019-10-05T10:36:30.000Z
|
2019-10-05T10:36:30.000Z
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['TrafficSelectorArgs', 'TrafficSelector']
@pulumi.input_type
class TrafficSelectorArgs:
def __init__(__self__, *,
destination_address: pulumi.Input[str],
name: pulumi.Input[str],
source_address: pulumi.Input[str],
description: Optional[pulumi.Input[str]] = None,
destination_port: Optional[pulumi.Input[int]] = None,
direction: Optional[pulumi.Input[str]] = None,
ip_protocol: Optional[pulumi.Input[int]] = None,
ipsec_policy: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[int]] = None,
source_port: Optional[pulumi.Input[int]] = None):
"""
The set of arguments for constructing a TrafficSelector resource.
:param pulumi.Input[str] destination_address: Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[str] name: Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
:param pulumi.Input[str] source_address: Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[str] description: Description of the traffic selector.
:param pulumi.Input[int] destination_port: Specifies the IP port used by the application. The default value is `All Ports (0)`
:param pulumi.Input[str] direction: Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
:param pulumi.Input[int] ip_protocol: Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
:param pulumi.Input[str] ipsec_policy: Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
:param pulumi.Input[int] order: Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
:param pulumi.Input[int] source_port: Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
pulumi.set(__self__, "destination_address", destination_address)
pulumi.set(__self__, "name", name)
pulumi.set(__self__, "source_address", source_address)
if description is not None:
pulumi.set(__self__, "description", description)
if destination_port is not None:
pulumi.set(__self__, "destination_port", destination_port)
if direction is not None:
pulumi.set(__self__, "direction", direction)
if ip_protocol is not None:
pulumi.set(__self__, "ip_protocol", ip_protocol)
if ipsec_policy is not None:
pulumi.set(__self__, "ipsec_policy", ipsec_policy)
if order is not None:
pulumi.set(__self__, "order", order)
if source_port is not None:
pulumi.set(__self__, "source_port", source_port)
@property
@pulumi.getter(name="destinationAddress")
def destination_address(self) -> pulumi.Input[str]:
"""
Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "destination_address")
@destination_address.setter
def destination_address(self, value: pulumi.Input[str]):
pulumi.set(self, "destination_address", value)
@property
@pulumi.getter
def name(self) -> pulumi.Input[str]:
"""
Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: pulumi.Input[str]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="sourceAddress")
def source_address(self) -> pulumi.Input[str]:
"""
Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "source_address")
@source_address.setter
def source_address(self, value: pulumi.Input[str]):
pulumi.set(self, "source_address", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Description of the traffic selector.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="destinationPort")
def destination_port(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`
"""
return pulumi.get(self, "destination_port")
@destination_port.setter
def destination_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "destination_port", value)
@property
@pulumi.getter
def direction(self) -> Optional[pulumi.Input[str]]:
"""
Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
"""
return pulumi.get(self, "direction")
@direction.setter
def direction(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "direction", value)
@property
@pulumi.getter(name="ipProtocol")
def ip_protocol(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
"""
return pulumi.get(self, "ip_protocol")
@ip_protocol.setter
def ip_protocol(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "ip_protocol", value)
@property
@pulumi.getter(name="ipsecPolicy")
def ipsec_policy(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
"""
return pulumi.get(self, "ipsec_policy")
@ipsec_policy.setter
def ipsec_policy(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "ipsec_policy", value)
@property
@pulumi.getter
def order(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
"""
return pulumi.get(self, "order")
@order.setter
def order(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "order", value)
@property
@pulumi.getter(name="sourcePort")
def source_port(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
return pulumi.get(self, "source_port")
@source_port.setter
def source_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "source_port", value)
@pulumi.input_type
class _TrafficSelectorState:
def __init__(__self__, *,
description: Optional[pulumi.Input[str]] = None,
destination_address: Optional[pulumi.Input[str]] = None,
destination_port: Optional[pulumi.Input[int]] = None,
direction: Optional[pulumi.Input[str]] = None,
ip_protocol: Optional[pulumi.Input[int]] = None,
ipsec_policy: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[int]] = None,
source_address: Optional[pulumi.Input[str]] = None,
source_port: Optional[pulumi.Input[int]] = None):
"""
Input properties used for looking up and filtering TrafficSelector resources.
:param pulumi.Input[str] description: Description of the traffic selector.
:param pulumi.Input[str] destination_address: Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] destination_port: Specifies the IP port used by the application. The default value is `All Ports (0)`
:param pulumi.Input[str] direction: Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
:param pulumi.Input[int] ip_protocol: Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
:param pulumi.Input[str] ipsec_policy: Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
:param pulumi.Input[str] name: Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
:param pulumi.Input[int] order: Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
:param pulumi.Input[str] source_address: Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] source_port: Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
if description is not None:
pulumi.set(__self__, "description", description)
if destination_address is not None:
pulumi.set(__self__, "destination_address", destination_address)
if destination_port is not None:
pulumi.set(__self__, "destination_port", destination_port)
if direction is not None:
pulumi.set(__self__, "direction", direction)
if ip_protocol is not None:
pulumi.set(__self__, "ip_protocol", ip_protocol)
if ipsec_policy is not None:
pulumi.set(__self__, "ipsec_policy", ipsec_policy)
if name is not None:
pulumi.set(__self__, "name", name)
if order is not None:
pulumi.set(__self__, "order", order)
if source_address is not None:
pulumi.set(__self__, "source_address", source_address)
if source_port is not None:
pulumi.set(__self__, "source_port", source_port)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Description of the traffic selector.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="destinationAddress")
def destination_address(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "destination_address")
@destination_address.setter
def destination_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "destination_address", value)
@property
@pulumi.getter(name="destinationPort")
def destination_port(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`
"""
return pulumi.get(self, "destination_port")
@destination_port.setter
def destination_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "destination_port", value)
@property
@pulumi.getter
def direction(self) -> Optional[pulumi.Input[str]]:
"""
Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
"""
return pulumi.get(self, "direction")
@direction.setter
def direction(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "direction", value)
@property
@pulumi.getter(name="ipProtocol")
def ip_protocol(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
"""
return pulumi.get(self, "ip_protocol")
@ip_protocol.setter
def ip_protocol(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "ip_protocol", value)
@property
@pulumi.getter(name="ipsecPolicy")
def ipsec_policy(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
"""
return pulumi.get(self, "ipsec_policy")
@ipsec_policy.setter
def ipsec_policy(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "ipsec_policy", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def order(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
"""
return pulumi.get(self, "order")
@order.setter
def order(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "order", value)
@property
@pulumi.getter(name="sourceAddress")
def source_address(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "source_address")
@source_address.setter
def source_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "source_address", value)
@property
@pulumi.getter(name="sourcePort")
def source_port(self) -> Optional[pulumi.Input[int]]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
return pulumi.get(self, "source_port")
@source_port.setter
def source_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "source_port", value)
class TrafficSelector(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
destination_address: Optional[pulumi.Input[str]] = None,
destination_port: Optional[pulumi.Input[int]] = None,
direction: Optional[pulumi.Input[str]] = None,
ip_protocol: Optional[pulumi.Input[int]] = None,
ipsec_policy: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[int]] = None,
source_address: Optional[pulumi.Input[str]] = None,
source_port: Optional[pulumi.Input[int]] = None,
__props__=None):
"""
`TrafficSelector` Manage IPSec Traffic Selectors on BIG-IP
Resources should be named with their "full path". The full path is the combination of the partition + name (example: /Common/test-selector)
## Example Usage
```python
import pulumi
import pulumi_f5bigip as f5bigip
test_selector = f5bigip.TrafficSelector("test-selector",
destination_address="3.10.11.2/32",
name="/Common/test-selector",
source_address="2.10.11.12/32")
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Description of the traffic selector.
:param pulumi.Input[str] destination_address: Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] destination_port: Specifies the IP port used by the application. The default value is `All Ports (0)`
:param pulumi.Input[str] direction: Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
:param pulumi.Input[int] ip_protocol: Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
:param pulumi.Input[str] ipsec_policy: Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
:param pulumi.Input[str] name: Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
:param pulumi.Input[int] order: Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
:param pulumi.Input[str] source_address: Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] source_port: Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: TrafficSelectorArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
`TrafficSelector` Manage IPSec Traffic Selectors on BIG-IP
Resources should be named with their "full path". The full path is the combination of the partition + name (example: /Common/test-selector)
## Example Usage
```python
import pulumi
import pulumi_f5bigip as f5bigip
test_selector = f5bigip.TrafficSelector("test-selector",
destination_address="3.10.11.2/32",
name="/Common/test-selector",
source_address="2.10.11.12/32")
```
:param str resource_name: The name of the resource.
:param TrafficSelectorArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(TrafficSelectorArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
destination_address: Optional[pulumi.Input[str]] = None,
destination_port: Optional[pulumi.Input[int]] = None,
direction: Optional[pulumi.Input[str]] = None,
ip_protocol: Optional[pulumi.Input[int]] = None,
ipsec_policy: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[int]] = None,
source_address: Optional[pulumi.Input[str]] = None,
source_port: Optional[pulumi.Input[int]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = TrafficSelectorArgs.__new__(TrafficSelectorArgs)
__props__.__dict__["description"] = description
if destination_address is None and not opts.urn:
raise TypeError("Missing required property 'destination_address'")
__props__.__dict__["destination_address"] = destination_address
__props__.__dict__["destination_port"] = destination_port
__props__.__dict__["direction"] = direction
__props__.__dict__["ip_protocol"] = ip_protocol
__props__.__dict__["ipsec_policy"] = ipsec_policy
if name is None and not opts.urn:
raise TypeError("Missing required property 'name'")
__props__.__dict__["name"] = name
__props__.__dict__["order"] = order
if source_address is None and not opts.urn:
raise TypeError("Missing required property 'source_address'")
__props__.__dict__["source_address"] = source_address
__props__.__dict__["source_port"] = source_port
super(TrafficSelector, __self__).__init__(
'f5bigip:index/trafficSelector:TrafficSelector',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
destination_address: Optional[pulumi.Input[str]] = None,
destination_port: Optional[pulumi.Input[int]] = None,
direction: Optional[pulumi.Input[str]] = None,
ip_protocol: Optional[pulumi.Input[int]] = None,
ipsec_policy: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
order: Optional[pulumi.Input[int]] = None,
source_address: Optional[pulumi.Input[str]] = None,
source_port: Optional[pulumi.Input[int]] = None) -> 'TrafficSelector':
"""
Get an existing TrafficSelector resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Description of the traffic selector.
:param pulumi.Input[str] destination_address: Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] destination_port: Specifies the IP port used by the application. The default value is `All Ports (0)`
:param pulumi.Input[str] direction: Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
:param pulumi.Input[int] ip_protocol: Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
:param pulumi.Input[str] ipsec_policy: Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
:param pulumi.Input[str] name: Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
:param pulumi.Input[int] order: Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
:param pulumi.Input[str] source_address: Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
:param pulumi.Input[int] source_port: Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _TrafficSelectorState.__new__(_TrafficSelectorState)
__props__.__dict__["description"] = description
__props__.__dict__["destination_address"] = destination_address
__props__.__dict__["destination_port"] = destination_port
__props__.__dict__["direction"] = direction
__props__.__dict__["ip_protocol"] = ip_protocol
__props__.__dict__["ipsec_policy"] = ipsec_policy
__props__.__dict__["name"] = name
__props__.__dict__["order"] = order
__props__.__dict__["source_address"] = source_address
__props__.__dict__["source_port"] = source_port
return TrafficSelector(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def description(self) -> pulumi.Output[str]:
"""
Description of the traffic selector.
"""
return pulumi.get(self, "description")
@property
@pulumi.getter(name="destinationAddress")
def destination_address(self) -> pulumi.Output[str]:
"""
Specifies the host or network IP address to which the application traffic is destined.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "destination_address")
@property
@pulumi.getter(name="destinationPort")
def destination_port(self) -> pulumi.Output[int]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`
"""
return pulumi.get(self, "destination_port")
@property
@pulumi.getter
def direction(self) -> pulumi.Output[str]:
"""
Specifies whether the traffic selector applies to inbound or outbound traffic, or both. The default value is `Both`.
"""
return pulumi.get(self, "direction")
@property
@pulumi.getter(name="ipProtocol")
def ip_protocol(self) -> pulumi.Output[int]:
"""
Specifies the network protocol to use for this traffic. The default value is `All Protocols (255)`
"""
return pulumi.get(self, "ip_protocol")
@property
@pulumi.getter(name="ipsecPolicy")
def ipsec_policy(self) -> pulumi.Output[str]:
"""
Specifies the IPsec policy that tells the BIG-IP system how to handle the packets.When creating a new traffic selector, if this parameter is not specified, the default is `default-ipsec-policy`.
"""
return pulumi.get(self, "ipsec_policy")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Name of the IPSec traffic-selector,it should be "full path".The full path is the combination of the partition + name of the IPSec traffic-selector.(For example `/Common/test-selector`)
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def order(self) -> pulumi.Output[int]:
"""
Specifies the order in which traffic is matched, if traffic can be matched to multiple traffic selectors.Traffic is matched to the traffic selector with the highest priority (lowest order number).
When creating a new traffic selector, if this parameter is not specified, the default is `last`
"""
return pulumi.get(self, "order")
@property
@pulumi.getter(name="sourceAddress")
def source_address(self) -> pulumi.Output[str]:
"""
Specifies the host or network IP address from which the application traffic originates.When creating a new traffic selector, this parameter is required.
"""
return pulumi.get(self, "source_address")
@property
@pulumi.getter(name="sourcePort")
def source_port(self) -> pulumi.Output[int]:
"""
Specifies the IP port used by the application. The default value is `All Ports (0)`.
"""
return pulumi.get(self, "source_port")
| 51.272578
| 241
| 0.670584
| 3,870
| 31,225
| 5.260465
| 0.052196
| 0.072404
| 0.075597
| 0.04863
| 0.913842
| 0.901366
| 0.891296
| 0.877149
| 0.865802
| 0.854013
| 0
| 0.003229
| 0.236285
| 31,225
| 608
| 242
| 51.356908
| 0.850463
| 0.424051
| 0
| 0.788571
| 1
| 0
| 0.097242
| 0.003984
| 0
| 0
| 0
| 0
| 0
| 1
| 0.162857
| false
| 0.002857
| 0.014286
| 0
| 0.274286
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
b82965f61c63894b0c5235030cc9dae976188dca
| 9,642
|
py
|
Python
|
qr_base_drive_teleop/src/qr_base_drive_teleop/qr_base_drive_teleop.py
|
QuantumRoboticsURC/qrteam
|
bb28f4ad82eab6fb0706be13f8571e0b3261641e
|
[
"MIT"
] | null | null | null |
qr_base_drive_teleop/src/qr_base_drive_teleop/qr_base_drive_teleop.py
|
QuantumRoboticsURC/qrteam
|
bb28f4ad82eab6fb0706be13f8571e0b3261641e
|
[
"MIT"
] | null | null | null |
qr_base_drive_teleop/src/qr_base_drive_teleop/qr_base_drive_teleop.py
|
QuantumRoboticsURC/qrteam
|
bb28f4ad82eab6fb0706be13f8571e0b3261641e
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
import rospy
import time
from sensor_msgs.msg import Joy
from std_msgs.msg import Float32
from std_msgs.msg import Int32
from geometry_msgs.msg import Twist
from actionlib_msgs.msg import GoalID
class DriveTeleop:
def __init__(self):
# Initialize speed setting
self.vel_limit_setting = 1 # default to medium speed
# Initialize publishers
self.cmd_vel_teleop = rospy.Publisher("teleop/cmd_vel", Twist, queue_size=1)
self.cmd_vel_mux = rospy.Publisher("cmd_vel_mux", Int32, queue_size=1)
self.joy_sub = rospy.Subscriber("joy_drive", Joy, self.on_joy)
self.vel_limit_lost_comms = rospy.Subscriber("vel_limit_lost_comms", Float32, self.on_vel_limit_lost_comms)
self.left_speed = 0
self.right_speed = 0
self.last_axis_left = 0
self.last_axis_right = 0
self.acel = 10
self.desacel = 0.5
def on_vel_limit_lost_comms(self, msg):
self.vel_limit_setting = msg.data
def on_joy(self, data):
self.joy_sub.unregister()
if (self.joy_drive_model == "ps5"):
# Set speed ratio using d-pad
if data.axes[7] == 1: # full speed (d-pad up)
self.vel_limit_setting = 1
if data.axes[6] != 0: # medium speed (d-pad left or right)
self.vel_limit_setting = 0.6
if data.axes[7] == -1: # low speed (d-pad down)
self.vel_limit_setting = 0.3
# Move base mode
if data.buttons[9]: # Select button
self.cmd_vel_mux.publish(2)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Autonomous mode
if data.buttons[10]: # Start button
self.cmd_vel_mux.publish(1)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Drive sticks
##### left speed axis 1
axis_left = data.axes[1]
if abs(axis_left) == 0 and self.left_speed != 0:
if abs(self.left_speed) < self.desacel: self.left_speed = 0
elif self.left_speed >= self.desacel: self.left_speed -= self.desacel
elif self.left_speed <= -self.desacel: self.left_speed += self.desacel
else:
left_difference = axis_left-self.left_speed
if (left_difference > 0 and self.left_speed < self.vel_limit_setting):
self.left_speed += abs(axis_left) / self.acel
if self.left_speed > 1: self.left_speed = 1
elif (left_difference < 0 and self.left_speed > -self.vel_limit_setting):
self.left_speed -= abs(axis_left) / self.acel
if self.left_speed < -1: self.left_speed = -1
##### right speed axis 5
axis_right = data.axes[5]
if abs(axis_right) == 0 and self.right_speed != 0:
if abs(self.right_speed) < self.desacel: self.right_speed = 0
elif self.right_speed >= self.desacel: self.right_speed -= self.desacel
elif self.right_speed <= -self.desacel: self.right_speed += self.desacel
else:
right_difference = axis_right-self.right_speed
if (right_difference > 0 and self.right_speed < self.vel_limit_setting):
self.right_speed += abs(axis_right) / self.acel
if self.right_speed > 1: self.right_speed = 1
elif (right_difference < 0 and self.right_speed > -self.vel_limit_setting):
self.right_speed -= abs(axis_right) / self.acel
if self.right_speed < -1: self.right_speed = -1
elif (self.joy_drive_model == "ec"):
# Set speed ratio using d-pad
if data.axes[7] == 1: # full speed (d-pad up)
self.speed_setting = 1
if data.axes[6] != 0: # medium speed (d-pad left or right)
self.speed_setting = 2
if data.axes[7] == -1: # low speed (d-pad down)
self.speed_setting = 3
# Move base mode
if data.buttons[10]: # Select button
self.cmd_vel_mux.publish(2)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Autonomous mode
if data.buttons[11]: # Start button
self.cmd_vel_mux.publish(1)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Drive sticks
##### left speed axis 1
axis_left = data.axes[1]
if abs(axis_left) == 0 and self.left_speed != 0:
if abs(self.left_speed) < self.desacel: self.left_speed = 0
elif self.left_speed >= self.desacel: self.left_speed -= self.desacel
elif self.left_speed <= -self.desacel: self.left_speed += self.desacel
else:
left_difference = axis_left-self.left_speed
if (left_difference > 0 and self.left_speed < self.vel_limit_setting):
self.left_speed += abs(axis_left) / self.acel
if self.left_speed > 1: self.left_speed = 1
elif (left_difference < 0 and self.left_speed > -self.vel_limit_setting):
self.left_speed -= abs(axis_left) / self.acel
if self.left_speed < -1: self.left_speed = -1
##### right speed axis 3
axis_right = data.axes[3]
if abs(axis_right) == 0 and self.right_speed != 0:
if abs(self.right_speed) < self.desacel: self.right_speed = 0
elif self.right_speed >= self.desacel: self.right_speed -= self.desacel
elif self.right_speed <= -self.desacel: self.right_speed += self.desacel
else:
right_difference = axis_right-self.right_speed
if (right_difference > 0 and self.right_speed < self.vel_limit_setting):
self.right_speed += abs(axis_right) / self.acel
if self.right_speed > 1: self.right_speed = 1
elif (right_difference < 0 and self.right_speed > -self.vel_limit_setting):
self.right_speed -= abs(axis_right) / self.acel
if self.right_speed < -1: self.right_speed = -1
elif (self.joy_drive_model == "xbox"):
# Set speed ratio using d-pad
if data.axes[7] == 1: # full speed (d-pad up)
self.speed_setting = 1
if data.axes[6] != 0: # medium speed (d-pad left or right)
self.speed_setting = 2
if data.axes[7] == -1: # low speed (d-pad down)
self.speed_setting = 3
# Move base mode
if data.buttons[6]: # Select button
self.cmd_vel_mux.publish(2)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Autonomous mode
if data.buttons[7]: # Start button
self.cmd_vel_mux.publish(1)
time.sleep(3)
self.cmd_vel_mux.publish(0)
# Drive sticks
##### left speed axis 1
axis_left = data.axes[1]
if abs(axis_left) == 0 and self.left_speed != 0:
if abs(self.left_speed) < self.desacel: self.left_speed = 0
elif self.left_speed >= self.desacel: self.left_speed -= self.desacel
elif self.left_speed <= -self.desacel: self.left_speed += self.desacel
else:
left_difference = axis_left-self.left_speed
if (left_difference > 0 and self.left_speed < self.vel_limit_setting):
self.left_speed += abs(axis_left) / self.acel
if self.left_speed > 1: self.left_speed = 1
elif (left_difference < 0 and self.left_speed > -self.vel_limit_setting):
self.left_speed -= abs(axis_left) / self.acel
if self.left_speed < -1: self.left_speed = -1
##### right speed axis 4
axis_right = data.axes[4]
if abs(axis_right) == 0 and self.right_speed != 0:
if abs(self.right_speed) < self.desacel: self.right_speed = 0
elif self.right_speed >= self.desacel: self.right_speed -= self.desacel
elif self.right_speed <= -self.desacel: self.right_speed += self.desacel
else:
right_difference = axis_right-self.right_speed
if (right_difference > 0 and self.right_speed < self.vel_limit_setting):
self.right_speed += abs(axis_right) / self.acel
if self.right_speed > 1: self.right_speed = 1
elif (right_difference < 0 and self.right_speed > -self.vel_limit_setting):
self.right_speed -= abs(axis_right) / self.acel
if self.right_speed < -1: self.right_speed = -1
# Convert skid steering speeds to twist speeds
self.linear_vel = (self.left_speed + self.right_speed) / 2.0 # (m/s)
self.angular_vel = (self.left_speed - self.right_speed) / 2.0 # (rad/s)
# Publish Twist
twist = Twist()
twist.linear.x = self.linear_vel
twist.angular.z = self.angular_vel
self.cmd_vel_teleop.publish(twist)
self.joy_sub = rospy.Subscriber("joy_drive", Joy, self.on_joy)
def main():
rospy.init_node("qr_base_drive_teleop")
qr_base_drive_teleop = DriveTeleop()
qr_base_drive_teleop.joy_drive_model = rospy.get_param('~joy_drive_model')
rospy.spin()
| 50.21875
| 115
| 0.569177
| 1,282
| 9,642
| 4.058502
| 0.087363
| 0.093408
| 0.127426
| 0.075149
| 0.82068
| 0.800692
| 0.791851
| 0.786854
| 0.786854
| 0.774553
| 0
| 0.022695
| 0.332815
| 9,642
| 192
| 116
| 50.21875
| 0.786103
| 0.0838
| 0
| 0.716981
| 0
| 0
| 0.012315
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.025157
| false
| 0
| 0.044025
| 0
| 0.075472
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b88998695f7cfc15fd464d69c5fff87ca92cb1ed
| 66,246
|
py
|
Python
|
tests/test_tasks_irods.py
|
bihealth/sodar-taskflow
|
0ec4e5a9ea9ee834ebaa3505ade6948cc7667cbc
|
[
"MIT"
] | null | null | null |
tests/test_tasks_irods.py
|
bihealth/sodar-taskflow
|
0ec4e5a9ea9ee834ebaa3505ade6948cc7667cbc
|
[
"MIT"
] | null | null | null |
tests/test_tasks_irods.py
|
bihealth/sodar-taskflow
|
0ec4e5a9ea9ee834ebaa3505ade6948cc7667cbc
|
[
"MIT"
] | null | null | null |
"""Tests for iRODS tasks"""
# TODO: Add tests for batch tasks
import uuid
# from irods.access import iRODSAccess
from irods.data_object import iRODSDataObject
from irods.collection import iRODSCollection
from irods.exception import (
CollectionDoesNotExist,
UserDoesNotExist,
UserGroupDoesNotExist,
# NoResultFound,
DataObjectDoesNotExist,
)
from irods.meta import iRODSMeta
# from irods.models import Collection
from irods.user import iRODSUser, iRODSUserGroup
from unittest import TestCase
from apis.irods_utils import init_irods, cleanup_irods_data
from config import settings
from flows.base_flow import BaseLinearFlow
from tasks.irods_tasks import * # noqa
USER_PREFIX = 'omics_'
PROJECT_UUID = 'c668fca5-bc35-4721-b9e1-faefb660daba'
IRODS_ZONE = settings.TASKFLOW_IRODS_ZONE
DEFAULT_USER_GROUP = USER_PREFIX + 'group1'
GROUP_USER = USER_PREFIX + 'user1'
GROUPLESS_USER = USER_PREFIX + 'user2'
ROOT_COLL = settings.TASKFLOW_IRODS_PROJECT_ROOT
TEST_COLL = '{}/test'.format(ROOT_COLL)
TEST_COLL_NEW = '{}/test_new'.format(ROOT_COLL)
TEST_COLL_NEW2 = '{}/test_new2'.format(ROOT_COLL)
TEST_COLL_SUB = '{}/sub'.format(TEST_COLL)
TEST_USER = USER_PREFIX + 'user3'
TEST_USER_TYPE = 'rodsuser'
TEST_KEY = 'test_key'
TEST_VAL = 'test_val'
TEST_UNITS = 'test_units'
TEST_USER_GROUP = USER_PREFIX + 'group2'
# NOTE: Yes, we really need this for the python irods client
TEST_ACCESS_READ_IN = 'read'
TEST_ACCESS_READ_OUT = 'read object'
TEST_ACCESS_WRITE_IN = 'write'
TEST_ACCESS_WRITE_OUT = 'modify object'
TEST_ACCESS_NULL = 'null'
TEST_OBJ = TEST_COLL + '/move_obj'
TEST_OBJ2 = TEST_COLL + '/move_obj2'
TEST_MOVE_COLL = TEST_COLL + '/move_coll'
TEST_BATCH_MOVE_COLL = ROOT_COLL + '/move_coll'
BATCH_SRC_PATH = TEST_COLL + '/batch_src'
BATCH_DEST_PATH = TEST_COLL + '/batch_dest'
BATCH_OBJ_PATH = BATCH_SRC_PATH + '/batch_obj'
BATCH_OBJ2_PATH = BATCH_SRC_PATH + '/batch_obj2'
class IRODSTestBase(TestCase):
"""Base test class for iRODS tasks"""
def setUp(self):
# Fail if we can't cleanup iRODS
# TODO: Remove, not needed anymore
if not settings.TASKFLOW_ALLOW_IRODS_CLEANUP:
raise Exception('iRODS cleanup not allowed')
# Init iRODS connection to TEST server
self.irods = init_irods(test_mode=True)
# HACK: Avoiding exceptions which may result to tearDown not getting
# called and unwanted objects being left in iRODS
try:
# Init default collections
self.irods.collections.create(ROOT_COLL)
self.irods.collections.create(TEST_COLL)
# Init default user group
group = self.irods.user_groups.create(DEFAULT_USER_GROUP)
# Init default users
self.irods.users.create(
user_name=GROUP_USER, user_type='rodsuser', user_zone=IRODS_ZONE
)
group.addmember(GROUP_USER)
self.irods.users.create(
user_name=GROUPLESS_USER,
user_type='rodsuser',
user_zone=IRODS_ZONE,
)
except Exception as ex:
print('setUp failed: {}'.format(ex))
# Init flow
self.flow = self._init_flow()
def tearDown(self):
# Remove leftover data from iRODS
cleanup_irods_data(self.irods, verbose=False)
self.irods.cleanup() # Clean shutdown
def _run_flow(self):
return self.flow.run(verbose=False)
def _init_flow(self):
return BaseLinearFlow(
irods=self.irods,
sodar_api=None,
project_uuid=PROJECT_UUID,
flow_name=str(uuid.uuid4()),
flow_data={},
targets=['irods'],
)
def _add_task(self, cls, name, inject, force_fail=False):
self.flow.add_task(
cls(
name=name,
irods=self.irods,
verbose=False,
inject=inject,
force_fail=force_fail,
)
)
def _get_root_coll(self):
return self.irods.collections.get(ROOT_COLL)
def _get_test_coll(self):
return self.irods.collections.get(TEST_COLL)
def _get_test_obj(self):
return self.irods.data_objects.get(TEST_OBJ)
def _get_user_access(self, target, user_name):
target_access = self.irods.permissions.get(target=target)
return next(
(x for x in target_access if x.user_name == user_name), None
)
class TestCreateCollectionTask(IRODSTestBase):
def test_execute(self):
"""Test collection creation"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
)
# Assert precondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
coll = self.irods.collections.get(TEST_COLL_NEW)
self.assertIsInstance(coll, iRODSCollection)
def test_execute_twice(self):
"""Test collection creation twice"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
coll = self.irods.collections.get(TEST_COLL_NEW)
self.assertIsInstance(coll, iRODSCollection)
def test_revert_created(self):
"""Test collection creation reverting after creating"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
def test_revert_not_modified(self):
"""Test collection creation reverting without modification"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
coll = self.irods.collections.get(TEST_COLL_NEW)
self.assertIsInstance(coll, iRODSCollection)
def test_execute_nested(self):
"""Test collection creation with nested collections"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW + '/subcoll1/subcoll2'},
)
# Assert preconditions
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1',
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1/subcoll2',
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
coll = self.irods.collections.get(TEST_COLL_NEW)
self.assertIsInstance(coll, iRODSCollection)
coll = self.irods.collections.get(TEST_COLL_NEW + '/subcoll1')
self.assertIsInstance(coll, iRODSCollection)
coll = self.irods.collections.get(TEST_COLL_NEW + '/subcoll1/subcoll2')
self.assertIsInstance(coll, iRODSCollection)
def test_execute_nested_twice(self):
"""Test collection creation twice with nested collections"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW + '/subcoll1/subcoll2'},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW + '/subcoll1/subcoll2'},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
coll = self.irods.collections.get(TEST_COLL_NEW)
self.assertIsInstance(coll, iRODSCollection)
coll = self.irods.collections.get(TEST_COLL_NEW + '/subcoll1')
self.assertIsInstance(coll, iRODSCollection)
coll = self.irods.collections.get(TEST_COLL_NEW + '/subcoll1/subcoll2')
self.assertIsInstance(coll, iRODSCollection)
def test_revert_created_nested(self):
"""Test creation reverting with nested collections"""
self._add_task(
cls=CreateCollectionTask,
name='Create collection',
inject={'path': TEST_COLL_NEW + '/subcoll1/subcoll2'},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postconditions
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1',
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1/subcoll2',
)
class TestRemoveCollectionTask(IRODSTestBase):
def test_execute(self):
"""Test collection removal"""
self._add_task(
cls=RemoveCollectionTask,
name='Remove collection',
inject={'path': TEST_COLL},
)
# Assert precondition
coll = self.irods.collections.get(TEST_COLL)
self.assertIsInstance(coll, iRODSCollection)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL
)
def test_execute_twice(self):
"""Test collection removal twice"""
self._add_task(
cls=RemoveCollectionTask,
name='Remove collection',
inject={'path': TEST_COLL},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveCollectionTask,
name='Remove collection',
inject={'path': TEST_COLL},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL
)
def test_revert_removed(self):
"""Test collection removal reverting after removing"""
self._add_task(
cls=RemoveCollectionTask,
name='Remove collection',
inject={'path': TEST_COLL},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
coll = self.irods.collections.get(TEST_COLL)
self.assertIsInstance(coll, iRODSCollection)
def test_revert_not_modified(self):
"""Test collection removal reverting without modification"""
# Assert precondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
# Init and run flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveCollectionTask,
name='Remove collection',
inject={'path': TEST_COLL_NEW},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
class TestRemoveDataObjectTask(IRODSTestBase):
def setUp(self):
super().setUp()
# Init object to be removed
self.access_obj = self.irods.data_objects.create(TEST_OBJ)
def test_execute(self):
"""Test data object removal"""
self._add_task(
cls=RemoveDataObjectTask,
name='Remove data object',
inject={'path': TEST_OBJ},
)
# Assert precondition
obj = self.irods.data_objects.get(TEST_OBJ)
self.assertIsInstance(obj, iRODSDataObject)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(TEST_OBJ)
def test_execute_twice(self):
"""Test data object removal twice"""
self._add_task(
cls=RemoveDataObjectTask,
name='Remove data object',
inject={'path': TEST_OBJ},
)
self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveDataObjectTask,
name='Remove data_object',
inject={'path': TEST_OBJ},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(TEST_OBJ)
def test_revert_removed(self):
"""Test data object removal reverting after removing"""
self._add_task(
cls=RemoveDataObjectTask,
name='Remove data_object',
inject={'path': TEST_OBJ},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
obj = self.irods.data_objects.get(TEST_OBJ)
self.assertIsInstance(obj, iRODSDataObject)
def test_revert_not_modified(self):
"""Test data object removal reverting without modification"""
# Assert precondition
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(TEST_OBJ2)
# Init and run flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveDataObjectTask,
name='Remove data object',
inject={'path': TEST_OBJ2},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(TEST_OBJ2)
class TestSetCollectionMetadataTask(IRODSTestBase):
def test_execute(self):
"""Test setting metadata"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
)
test_coll = self._get_test_coll()
# Assert precondition
self.assertRaises(Exception, test_coll.metadata.get_one, TEST_KEY)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
# NOTE: We must retrieve collection again to refresh its metadata
test_coll = self._get_test_coll()
meta_item = test_coll.metadata.get_one(TEST_KEY)
self.assertIsInstance(meta_item, iRODSMeta)
self.assertEqual(meta_item.name, TEST_KEY)
self.assertEqual(meta_item.value, TEST_VAL)
self.assertEqual(meta_item.units, TEST_UNITS)
def test_execute_twice(self):
"""Test setting metadata twice"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
test_coll = self._get_test_coll()
meta_item = test_coll.metadata.get_one(TEST_KEY)
self.assertIsInstance(meta_item, iRODSMeta)
def test_revert_created(self):
"""Test metadata setting reverting after creating a new item"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
test_coll = self._get_test_coll()
self.assertRaises(KeyError, test_coll.metadata.get_one, TEST_KEY)
def test_revert_modified(self):
"""Test metadata setting reverting after modification"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
new_val = 'new value'
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': new_val,
'units': TEST_UNITS,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
test_coll = self._get_test_coll()
meta_item = test_coll.metadata.get_one(TEST_KEY)
self.assertIsInstance(meta_item, iRODSMeta)
self.assertEqual(meta_item.value, TEST_VAL) # Original value
def test_revert_not_modified(self):
"""Test metadata setting reverting without modification"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': TEST_VAL,
'units': TEST_UNITS,
},
force_fail=True,
)
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
test_coll = self._get_test_coll()
self.assertIsInstance(test_coll, iRODSCollection)
def test_execute_empty(self):
"""Test setting an empty value for metadata"""
self._add_task(
cls=SetCollectionMetadataTask,
name='Set metadata',
inject={
'path': TEST_COLL,
'name': TEST_KEY,
'value': '',
'units': TEST_UNITS,
},
)
test_coll = self._get_test_coll()
# Assert precondition
self.assertRaises(Exception, test_coll.metadata.get_one, TEST_KEY)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
# NOTE: We must retrieve collection again to refresh its metadata
test_coll = self._get_test_coll()
meta_item = test_coll.metadata.get_one(TEST_KEY)
self.assertIsInstance(meta_item, iRODSMeta)
self.assertEqual(meta_item.name, TEST_KEY)
self.assertEqual(meta_item.value, META_EMPTY_VALUE)
self.assertEqual(meta_item.units, TEST_UNITS)
class TestCreateUserGroupTask(IRODSTestBase):
def test_execute(self):
"""Test user group creation"""
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
)
# Assert precondition
self.assertRaises(
UserGroupDoesNotExist, self.irods.user_groups.get, TEST_USER_GROUP
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(TEST_USER_GROUP)
self.assertIsInstance(group, iRODSUserGroup)
def test_execute_twice(self):
"""Test user group creation twice"""
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(TEST_USER_GROUP)
self.assertIsInstance(group, iRODSUserGroup)
def test_revert_created(self):
"""Test collection creation reverting after creation"""
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
self.assertRaises(
UserGroupDoesNotExist, self.irods.user_groups.get, TEST_USER_GROUP
)
def test_revert_not_modified(self):
"""Test collection creation reverting without modification"""
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateUserGroupTask,
name='Create user group',
inject={'name': TEST_USER_GROUP},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(TEST_USER_GROUP)
self.assertIsInstance(group, iRODSUserGroup)
class TestSetCollAccessTask(IRODSTestBase):
def test_execute_read(self):
"""Test access setting for read"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
# Assert precondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertEqual(user_access, None)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_execute_write(self):
"""Test access setting for write/modify"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_WRITE_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
# Assert precondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertEqual(user_access, None)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_WRITE_OUT)
def test_execute_twice(self):
"""Test access setting twice"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_revert_created(self):
"""Test access setting"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow success
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsNone(user_access)
# self.assertEqual(user_access.access_name, TEST_ACCESS_NULL)
def test_revert_modified(self):
"""Test access setting reverting after modification"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_WRITE_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_revert_not_modified(self):
"""Test access setting reverting without modification"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': DEFAULT_USER_GROUP,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_execute_no_recursion(self):
"""Test access setting for a collection with recursive=False"""
# Set up subcollection and test user
sub_coll = self.irods.collections.create(TEST_COLL_SUB)
self.irods.users.create(
user_name=TEST_USER,
user_type=TEST_USER_TYPE,
user_zone=self.irods.zone,
)
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': TEST_USER,
'recursive': False,
},
)
# Assert preconditions
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=TEST_USER
)
self.assertEqual(user_access, None)
user_access = self._get_user_access(
target=sub_coll, user_name=TEST_USER
)
self.assertEqual(user_access, None)
# Run flow
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=TEST_USER
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
user_access = self._get_user_access(
target=sub_coll, user_name=TEST_USER
)
self.assertEqual(user_access, None)
def test_revert_no_recursion(self):
"""Test access setting reverting for a collection with recursive=False"""
# Set up subcollection and test user
sub_coll = self.irods.collections.create(TEST_COLL_SUB)
self.irods.users.create(
user_name=TEST_USER,
user_type=TEST_USER_TYPE,
user_zone=self.irods.zone,
)
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_COLL,
'user_name': TEST_USER,
'recursive': False,
},
force_fail=True,
) # FAIL
# Assert preconditions
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=TEST_USER
)
self.assertEqual(user_access, None)
user_access = self._get_user_access(
target=sub_coll, user_name=TEST_USER
)
self.assertEqual(user_access, None)
# Run flow
result = self._run_flow()
# Assert flow success
self.assertEqual(result, False)
# Assert postconditions
user_access = self._get_user_access(
target=self._get_test_coll(), user_name=TEST_USER
)
self.assertEqual(user_access, None)
user_access = self._get_user_access(
target=sub_coll, user_name=TEST_USER
)
self.assertEqual(user_access, None)
class TestSetDataObjAccessTask(IRODSTestBase):
def setUp(self):
super().setUp()
# Init object to be copied
self.access_obj = self.irods.data_objects.create(TEST_OBJ)
def test_execute_read(self):
"""Test access setting for read"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
# Assert precondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertEqual(user_access, None)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_execute_write(self):
"""Test access setting for write/modify"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_WRITE_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
# Assert precondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertEqual(user_access, None)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_WRITE_OUT)
def test_execute_twice(self):
"""Test access setting twice"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_revert_created(self):
"""Test access setting"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow success
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsNone(user_access)
def test_revert_modified(self):
"""Test access setting reverting after modification"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_WRITE_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
def test_revert_not_modified(self):
"""Test access setting reverting without modification"""
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=SetAccessTask,
name='Set access',
inject={
'access_name': TEST_ACCESS_READ_IN,
'path': TEST_OBJ,
'user_name': DEFAULT_USER_GROUP,
'obj_target': True,
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
user_access = self._get_user_access(
target=self._get_test_obj(), user_name=DEFAULT_USER_GROUP
)
self.assertIsInstance(user_access, iRODSAccess)
self.assertEqual(user_access.access_name, TEST_ACCESS_READ_OUT)
class TestCreateUserTask(IRODSTestBase):
def test_execute(self):
"""Test user creation"""
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
)
# Assert precondition
self.assertRaises(UserDoesNotExist, self.irods.users.get, TEST_USER)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
user = self.irods.users.get(TEST_USER)
self.assertIsInstance(user, iRODSUser)
def test_execute_twice(self):
"""Test user creation twice"""
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
)
result = self._run_flow()
# Assert postcondition
user = self.irods.users.get(TEST_USER)
self.assertIsInstance(user, iRODSUser)
def test_revert_created(self):
"""Test user creation reverting after creating"""
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
self.assertRaises(UserDoesNotExist, self.irods.users.get, TEST_USER)
def test_revert_not_modified(self):
"""Test user creation reverting without modification"""
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=CreateUserTask,
name='Create user',
inject={'user_name': TEST_USER, 'user_type': TEST_USER_TYPE},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
user = self.irods.users.get(TEST_USER)
self.assertIsInstance(user, iRODSUser)
class TestAddUserToGroupTask(IRODSTestBase):
def test_execute(self):
"""Test user addition"""
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
)
# Assert precondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUPLESS_USER), False)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUPLESS_USER), True)
def test_execute_twice(self):
"""Test user addition twice"""
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUPLESS_USER), True)
def test_revert_modified(self):
"""Test user addition reverting after modification"""
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUPLESS_USER), False)
def test_revert_not_modified(self):
"""Test user addition reverting without modification"""
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=AddUserToGroupTask,
name='Add user to group',
inject={
'group_name': DEFAULT_USER_GROUP,
'user_name': GROUPLESS_USER,
},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUPLESS_USER), True)
class TestRemoveUserFromGroupTask(IRODSTestBase):
def test_execute(self):
"""Test user removal"""
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
)
# Assert precondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUP_USER), True)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUP_USER), False)
def test_execute_twice(self):
"""Test user removal twice"""
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUP_USER), False)
def test_revert_modified(self):
"""Test user ramoval reverting after modification"""
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUP_USER), True)
def test_revert_not_modified(self):
"""Test user removal reverting without modification"""
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=RemoveUserFromGroupTask,
name='Remove user from group',
inject={'group_name': DEFAULT_USER_GROUP, 'user_name': GROUP_USER},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postcondition
group = self.irods.user_groups.get(DEFAULT_USER_GROUP)
self.assertEqual(group.hasmember(GROUP_USER), False)
class TestMoveDataObjectTask(IRODSTestBase):
def setUp(self):
super().setUp()
# Init object to be copied
self.move_obj = self.irods.data_objects.create(TEST_OBJ)
# Init collection for copying
self.move_coll = self.irods.collections.create(TEST_MOVE_COLL)
def test_execute(self):
"""Test moving a data object"""
self._add_task(
cls=MoveDataObjectTask,
name='Move data object',
inject={'src_path': TEST_OBJ, 'dest_path': TEST_MOVE_COLL},
)
# Assert precondition
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/move_obj'.format(TEST_MOVE_COLL))
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert object state after move
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(TEST_OBJ)
move_obj = self.irods.data_objects.get(
'{}/move_obj'.format(TEST_MOVE_COLL)
)
self.assertIsInstance(move_obj, iRODSDataObject)
def test_revert(self):
"""Test reverting the moving of a data object"""
self._add_task(
cls=MoveDataObjectTask,
name='Move data object',
inject={'src_path': TEST_OBJ, 'dest_path': TEST_MOVE_COLL},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert object state after move
move_obj = self.irods.data_objects.get(TEST_OBJ)
self.assertIsInstance(move_obj, iRODSDataObject)
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/move_obj'.format(TEST_MOVE_COLL))
def test_overwrite_failure(self):
"""Test moving a data object when a similarly named file exists"""
new_obj_path = TEST_MOVE_COLL + '/move_obj'
# Create object already in target
new_obj = self.irods.data_objects.create(new_obj_path)
self._add_task(
cls=MoveDataObjectTask,
name='Move data object',
inject={'src_path': TEST_OBJ, 'dest_path': TEST_MOVE_COLL},
)
with self.assertRaises(Exception):
self._run_flow()
# Assert state of both objects after attempted move
# TODO: Better way to compare file objects than checksum?
# TODO: obj1 != obj2 even if they point to the same thing in iRODS..
move_obj2 = self.irods.data_objects.get(TEST_OBJ)
self.assertEqual(self.move_obj.checksum, move_obj2.checksum)
new_obj2 = self.irods.data_objects.get(new_obj_path)
self.assertEqual(new_obj.checksum, new_obj2.checksum)
# TODO: Test Checksum verifying
class TestBatchCreateCollectionsTask(IRODSTestBase):
def test_execute(self):
"""Test batch collection creation"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
)
# Assert preconditions
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW2
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW), iRODSCollection
)
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW2), iRODSCollection
)
def test_execute_twice(self):
"""Test batch collection creation twice"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
)
result = self._run_flow()
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW), iRODSCollection
)
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW2), iRODSCollection
)
def test_revert_created(self):
"""Test batch collection creation reverting after creating"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postconditions
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW
)
self.assertRaises(
CollectionDoesNotExist, self.irods.collections.get, TEST_COLL_NEW2
)
def test_revert_not_modified(self):
"""Test batch collection creation reverting without modification"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Init and run new flow
self.flow = self._init_flow()
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={'paths': [TEST_COLL_NEW, TEST_COLL_NEW2]},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postconditions
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW), iRODSCollection
)
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW2), iRODSCollection
)
def test_execute_nested(self):
"""Test batch collection creation with nested collections"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={
'paths': [
TEST_COLL_NEW + '/subcoll1/subcoll1a',
TEST_COLL_NEW + '/subcoll2/subcoll2a',
]
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW + '/subcoll1/subcoll1a'),
iRODSCollection,
)
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW + '/subcoll2/subcoll2a'),
iRODSCollection,
)
def test_execute_nested_existing(self):
"""Test batch collection creation with existing collection"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={
'paths': [
TEST_COLL_NEW + '/subcoll1/subcoll1a',
TEST_COLL_NEW + '/subcoll1',
]
},
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert postconditions
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW + '/subcoll1/subcoll1a'),
iRODSCollection,
)
self.assertIsInstance(
self.irods.collections.get(TEST_COLL_NEW + '/subcoll1'),
iRODSCollection,
)
def test_revert_created_nested(self):
"""Test batch creation reverting with nested collections"""
self._add_task(
cls=BatchCreateCollectionsTask,
name='Create collections',
inject={
'paths': [
TEST_COLL_NEW + '/subcoll1/subcoll1a',
TEST_COLL_NEW + '/subcoll2/subcoll2a',
]
},
force_fail=True,
) # FAIL
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert postconditions
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1',
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll1/subcoll1a',
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll2',
)
self.assertRaises(
CollectionDoesNotExist,
self.irods.collections.get,
TEST_COLL_NEW + '/subcoll2/subcoll2a',
)
class TestBatchMoveDataObjectsTask(IRODSTestBase):
def setUp(self):
super().setUp()
# Init batch collections
self.src_coll = self.irods.collections.create(BATCH_SRC_PATH)
self.dest_coll = self.irods.collections.create(BATCH_DEST_PATH)
# Init objects to be copied
self.batch_obj = self.irods.data_objects.create(BATCH_OBJ_PATH)
self.batch_obj2 = self.irods.data_objects.create(BATCH_OBJ2_PATH)
def test_execute(self):
"""Test moving data objects and setting access"""
self._add_task(
cls=BatchMoveDataObjectsTask,
name='Move data objects',
inject={
'src_root': BATCH_SRC_PATH,
'dest_root': BATCH_DEST_PATH,
'src_paths': [BATCH_OBJ_PATH, BATCH_OBJ2_PATH],
'access_name': TEST_ACCESS_READ_IN,
'user_name': DEFAULT_USER_GROUP,
},
)
# Assert preconditions
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/batch_obj'.format(BATCH_DEST_PATH))
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/batch_obj2'.format(BATCH_DEST_PATH))
self.assertEqual(
self._get_user_access(
target=self.irods.data_objects.get(BATCH_OBJ_PATH),
user_name=DEFAULT_USER_GROUP,
),
None,
)
self.assertEqual(
self._get_user_access(
target=self.irods.data_objects.get(BATCH_OBJ2_PATH),
user_name=DEFAULT_USER_GROUP,
),
None,
)
result = self._run_flow()
# Assert flow success
self.assertEqual(result, True)
# Assert object state after move
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(BATCH_OBJ_PATH)
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get(BATCH_OBJ2_PATH)
self.assertIsInstance(
self.irods.data_objects.get('{}/batch_obj'.format(BATCH_DEST_PATH)),
iRODSDataObject,
)
self.assertIsInstance(
self.irods.data_objects.get(
'{}/batch_obj2'.format(BATCH_DEST_PATH)
),
iRODSDataObject,
)
obj_access = self._get_user_access(
target=self.irods.data_objects.get(
'{}/batch_obj'.format(BATCH_DEST_PATH)
),
user_name=DEFAULT_USER_GROUP,
)
self.assertIsInstance(obj_access, iRODSAccess)
self.assertEqual(obj_access.access_name, TEST_ACCESS_READ_OUT)
obj_access = self._get_user_access(
target=self.irods.data_objects.get(
'{}/batch_obj2'.format(BATCH_DEST_PATH)
),
user_name=DEFAULT_USER_GROUP,
)
self.assertIsInstance(obj_access, iRODSAccess)
self.assertEqual(obj_access.access_name, TEST_ACCESS_READ_OUT)
def test_revert(self):
"""Test reverting the moving of data objects"""
self._add_task(
cls=BatchMoveDataObjectsTask,
name='Move data objects',
inject={
'src_root': BATCH_SRC_PATH,
'dest_root': BATCH_DEST_PATH,
'src_paths': [BATCH_OBJ_PATH, BATCH_OBJ2_PATH],
'access_name': TEST_ACCESS_READ_IN,
'user_name': DEFAULT_USER_GROUP,
},
force_fail=True,
) # FAILS
result = self._run_flow()
# Assert flow failure
self.assertNotEqual(result, True)
# Assert object state after move
self.assertIsInstance(
self.irods.data_objects.get('{}/batch_obj'.format(BATCH_SRC_PATH)),
iRODSDataObject,
)
self.assertIsInstance(
self.irods.data_objects.get('{}/batch_obj2'.format(BATCH_SRC_PATH)),
iRODSDataObject,
)
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/batch_obj'.format(BATCH_DEST_PATH))
with self.assertRaises(DataObjectDoesNotExist):
self.irods.data_objects.get('{}/batch_obj2'.format(BATCH_DEST_PATH))
obj_access = self._get_user_access(
target=self.irods.data_objects.get(
'{}/batch_obj'.format(BATCH_SRC_PATH)
),
user_name=DEFAULT_USER_GROUP,
)
self.assertIsNone(obj_access)
obj_access = self._get_user_access(
target=self.irods.data_objects.get(
'{}/batch_obj2'.format(BATCH_SRC_PATH)
),
user_name=DEFAULT_USER_GROUP,
)
self.assertIsNone(obj_access)
def test_overwrite_failure(self):
"""Test moving data objects when a similarly named file exists"""
new_obj_path = BATCH_DEST_PATH + '/batch_obj2'
# Create object already in target
new_obj = self.irods.data_objects.create(new_obj_path)
self._add_task(
cls=BatchMoveDataObjectsTask,
name='Move data objects',
inject={
'src_root': BATCH_SRC_PATH,
'dest_root': BATCH_DEST_PATH,
'src_paths': [BATCH_OBJ_PATH, BATCH_OBJ2_PATH],
'access_name': TEST_ACCESS_READ_IN,
'user_name': DEFAULT_USER_GROUP,
},
)
with self.assertRaises(Exception):
self._run_flow()
# Assert state of objects after attempted move
self.assertIsInstance(
self.irods.data_objects.get('{}/batch_obj'.format(BATCH_SRC_PATH)),
iRODSDataObject,
)
self.assertIsInstance(
self.irods.data_objects.get('{}/batch_obj2'.format(BATCH_SRC_PATH)),
iRODSDataObject,
)
self.assertIsInstance(
self.irods.data_objects.get(new_obj_path), iRODSDataObject
)
move_obj = self.irods.data_objects.get(
'{}/batch_obj2'.format(BATCH_SRC_PATH)
)
self.assertEqual(self.batch_obj.checksum, move_obj.checksum)
existing_obj = self.irods.data_objects.get(new_obj_path)
self.assertEqual(new_obj.checksum, existing_obj.checksum)
| 30.346312
| 81
| 0.590088
| 6,830
| 66,246
| 5.440556
| 0.040117
| 0.031217
| 0.023951
| 0.033155
| 0.901155
| 0.889744
| 0.863828
| 0.833607
| 0.815926
| 0.802901
| 0
| 0.002377
| 0.320367
| 66,246
| 2,182
| 82
| 30.36022
| 0.822957
| 0.120143
| 0
| 0.760782
| 0
| 0
| 0.064377
| 0.000624
| 0
| 0
| 0
| 0.000458
| 0.15027
| 1
| 0.051887
| false
| 0
| 0.007412
| 0.003369
| 0.072776
| 0.000674
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b219730db31f5d570996fc61f947e377a8be7568
| 151
|
py
|
Python
|
pp_api/__init__.py
|
alexisdimi/pp_api
|
0f1a64e2b45e0aac33ccebba77b5e6812967cb96
|
[
"MIT"
] | 3
|
2017-12-01T16:22:44.000Z
|
2018-03-01T10:00:32.000Z
|
pp_api/__init__.py
|
alexisdimi/pp_api
|
0f1a64e2b45e0aac33ccebba77b5e6812967cb96
|
[
"MIT"
] | 3
|
2017-07-27T08:36:22.000Z
|
2018-09-25T12:20:12.000Z
|
pp_api/__init__.py
|
alexisdimi/pp_api
|
0f1a64e2b45e0aac33ccebba77b5e6812967cb96
|
[
"MIT"
] | 5
|
2017-05-04T13:50:00.000Z
|
2018-08-28T15:14:31.000Z
|
from pp_api.pp_calls import *
from pp_api.sparql_calls import *
from pp_api.gs_calls import *
from pp_api.extractor_utils import *
import pp_api.utils
| 25.166667
| 36
| 0.821192
| 28
| 151
| 4.107143
| 0.321429
| 0.217391
| 0.313043
| 0.443478
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119205
| 151
| 5
| 37
| 30.2
| 0.864662
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
b2320aa85de635bc0131ee14469bccad3ab4c53e
| 2,356
|
py
|
Python
|
advent1.py
|
michaelcippolito/adventofcode2017
|
b45e528f91ad00dc0792a0ac0eb1799c49fbbbb9
|
[
"Unlicense"
] | null | null | null |
advent1.py
|
michaelcippolito/adventofcode2017
|
b45e528f91ad00dc0792a0ac0eb1799c49fbbbb9
|
[
"Unlicense"
] | null | null | null |
advent1.py
|
michaelcippolito/adventofcode2017
|
b45e528f91ad00dc0792a0ac0eb1799c49fbbbb9
|
[
"Unlicense"
] | null | null | null |
#!/usr/bin/python
number = "6592822488931338589815525425236818285229555616392928433262436847386544514648645288129834834862363847542262953164877694234514375164927616649264122487182321437459646851966649732474925353281699895326824852555747127547527163197544539468632369858413232684269835288817735678173986264554586412678364433327621627496939956645283712453265255261565511586373551439198276373843771249563722914847255524452675842558622845416218195374459386785618255129831539984559644185369543662821311686162137672168266152494656448824719791398797359326412235723234585539515385352426579831251943911197862994974133738196775618715739412713224837531544346114877971977411275354168752719858889347588136787894798476123335894514342411742111135337286449968879251481449757294167363867119927811513529711239534914119292833111624483472466781475951494348516125474142532923858941279569675445694654355314925386833175795464912974865287564866767924677333599828829875283753669783176288899797691713766199641716546284841387455733132519649365113182432238477673375234793394595435816924453585513973119548841577126141962776649294322189695375451743747581241922657947182232454611837512564776273929815169367899818698892234618847815155578736875295629917247977658723868641411493551796998791839776335793682643551875947346347344695869874564432566956882395424267187552799458352121248147371938943799995158617871393289534789214852747976587432857675156884837634687257363975437535621197887877326295229195663235129213398178282549432599455965759999159247295857366485345759516622427833518837458236123723353817444545271644684925297477149298484753858863551357266259935298184325926848958828192317538375317946457985874965434486829387647425222952585293626473351211161684297351932771462665621764392833122236577353669215833721772482863775629244619639234636853267934895783891823877845198326665728659328729472456175285229681244974389248235457688922179237895954959228638193933854787917647154837695422429184757725387589969781672596568421191236374563718951738499591454571728641951699981615249635314789251239677393251756396"
length = len(number)
i=0
sum=0
for c in number:
if i != length-1:
print(c,number[i+1])
if c == number[i+1]:
sum = sum + int(c)
print sum
i += 1
else:
print(c,number[0])
if c == number[0]:
sum = sum + int(c)
print sum
| 102.434783
| 2,049
| 0.929117
| 53
| 2,356
| 41.301887
| 0.339623
| 0.012791
| 0.010964
| 0.008223
| 0.016446
| 0.016446
| 0
| 0
| 0
| 0
| 0
| 0.913393
| 0.049236
| 2,356
| 22
| 2,050
| 107.090909
| 0.063839
| 0.006791
| 0
| 0.25
| 0
| 0
| 0.871313
| 0.871313
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.25
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
b25d45115cd17a0df33073db2372ed51c5163f4f
| 41
|
py
|
Python
|
test_web_directory/test_package/a/mod.py
|
ParikhKadam/httpimport
|
47786966477c03b12298fd6f23fd8ce9d23b9140
|
[
"Apache-2.0"
] | 196
|
2017-08-23T15:44:14.000Z
|
2022-03-29T14:27:02.000Z
|
test_web_directory/test_package/a/mod.py
|
ParikhKadam/httpimport
|
47786966477c03b12298fd6f23fd8ce9d23b9140
|
[
"Apache-2.0"
] | 34
|
2017-12-17T16:57:49.000Z
|
2022-01-29T20:07:19.000Z
|
test_web_directory/test_package/a/mod.py
|
ParikhKadam/httpimport
|
47786966477c03b12298fd6f23fd8ce9d23b9140
|
[
"Apache-2.0"
] | 42
|
2017-10-16T22:08:45.000Z
|
2022-03-02T16:05:17.000Z
|
def module_name():
return 'Module A'
| 13.666667
| 21
| 0.658537
| 6
| 41
| 4.333333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.219512
| 41
| 2
| 22
| 20.5
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0.195122
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
b271210011c1c0cb29622c1a662682beac5b6c8e
| 41
|
py
|
Python
|
__init__.py
|
HaydenHu/kicad-plugins
|
f03a4c9ef7ba460995a05cb2b2f8250f3d7661f4
|
[
"MIT"
] | null | null | null |
__init__.py
|
HaydenHu/kicad-plugins
|
f03a4c9ef7ba460995a05cb2b2f8250f3d7661f4
|
[
"MIT"
] | null | null | null |
__init__.py
|
HaydenHu/kicad-plugins
|
f03a4c9ef7ba460995a05cb2b2f8250f3d7661f4
|
[
"MIT"
] | null | null | null |
from . import SchematicPositionsToLayout
| 20.5
| 40
| 0.878049
| 3
| 41
| 12
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 41
| 1
| 41
| 41
| 0.972973
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
a233a3909a4633805a2f46e93fc96b9f18122700
| 179
|
py
|
Python
|
src/image_caption_machine/world/__init__.py
|
brandontrabucco/ros-image-captioner
|
5fd18317f2ec600cdc61628028292a22eef45fc2
|
[
"MIT"
] | 3
|
2018-09-08T10:28:59.000Z
|
2019-09-08T00:11:33.000Z
|
src/image_caption_machine/world/__init__.py
|
brandontrabucco/ros-image-captioner
|
5fd18317f2ec600cdc61628028292a22eef45fc2
|
[
"MIT"
] | null | null | null |
src/image_caption_machine/world/__init__.py
|
brandontrabucco/ros-image-captioner
|
5fd18317f2ec600cdc61628028292a22eef45fc2
|
[
"MIT"
] | 2
|
2019-04-17T17:24:28.000Z
|
2019-06-10T18:16:44.000Z
|
"""Author: Brandon Trabucco.
Expose a public API for the World.
"""
from image_caption_machine.world.server import Server
from image_caption_machine.world.client import Client
| 19.888889
| 53
| 0.804469
| 26
| 179
| 5.384615
| 0.653846
| 0.128571
| 0.228571
| 0.328571
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122905
| 179
| 8
| 54
| 22.375
| 0.89172
| 0.335196
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
a29e6b6ea256646a5c44aeffa79ebc2bfcdc5600
| 14,086
|
py
|
Python
|
devilry/devilry_group/tests/test_feedbackfeed/student/test_comment_edit_history.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | null | null | null |
devilry/devilry_group/tests/test_feedbackfeed/student/test_comment_edit_history.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | null | null | null |
devilry/devilry_group/tests/test_feedbackfeed/student/test_comment_edit_history.py
|
aless80/devilry-django
|
416c262e75170d5662542f15e2d7fecf5ab84730
|
[
"BSD-3-Clause"
] | null | null | null |
import mock
from django.contrib import messages
from django.http import Http404
from django.template import defaultfilters
from django.test import TestCase, override_settings
from django.utils import timezone
from django_cradmin import cradmin_testhelpers
from model_mommy import mommy
from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql
from devilry.devilry_group import models as group_models
from devilry.devilry_group.views.student import group_comment_history
from devilry.devilry_group import devilry_group_mommy_factories as group_mommy
class TestStudentCommentEditHistoryView(TestCase, cradmin_testhelpers.TestCaseMixin):
"""
General testing of what gets rendered to student view.
"""
viewclass = group_comment_history.StudentGroupCommentHistoryView
def setUp(self):
AssignmentGroupDbCacheCustomSql().initialize()
def test_comment_not_visible_to_everyone_raises_404(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EXAMINER_AND_ADMINS)
with self.assertRaises(Http404):
self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
def test_missing_comment_id_in_kwargs(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
with self.assertRaises(Http404):
self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user)
def test_comment_does_not_exists_raises_404(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
with self.assertRaises(Http404):
self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': 1})
def test_comment_no_history_no_history_items_rendered(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertFalse(mockresponse.selector.exists('.devilry-comment-edit-history-item'))
self.assertTrue(mockresponse.selector.exists('.devilry-comment-history-no-items'))
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=False)
def test_students_can_not_see_other_users_comment_edit_history(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertFalse(mockresponse.selector.exists('.devilry-comment-edit-history-item'))
self.assertTrue(mockresponse.selector.exists('.devilry-comment-history-no-items'))
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_comment_no_history_no_history_items_rendered(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertFalse(mockresponse.selector.exists('.devilry-comment-edit-history-item'))
self.assertTrue(mockresponse.selector.exists('.devilry-comment-history-no-items'))
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_comment_no_history_no_history_items_rendered(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertEqual(mockresponse.selector.one('.devilry-comment-history-no-items').alltext_normalized,
'No comment-history available. This may be because you do not have access to see the '
'edit-history for this comment. If you think this is an error, please contact an '
'administrator.')
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_students_can_see_other_users_comment_edit_history(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertTrue(mockresponse.selector.exists('.devilry-comment-edit-history-item'))
self.assertFalse(mockresponse.selector.exists('.devilry-comment-history-no-items'))
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_multiple_comment_edit_history_entries_rendered(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE, _quantity=3)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertEqual(mockresponse.selector.count('.devilry-comment-edit-history-item'), 3)
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_only_history_entries_visible_to_everyone_rendered(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE, _quantity=3)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EXAMINER_AND_ADMINS, _quantity=3)
mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_PRIVATE, _quantity=3)
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertEqual(mockresponse.selector.count('.devilry-comment-edit-history-item'), 3)
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_history_entry_content(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
history_entry = mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE,
pre_edit_text='Pre edit text')
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertEqual(mockresponse.selector.one('.devilry-comment-history-item__title').alltext_normalized,
'{}'.format(defaultfilters.date(timezone.localtime(history_entry.edited_datetime),
'DATETIME_FORMAT')))
self.assertEqual(mockresponse.selector.one('.devilry-comment-history-item__description').alltext_normalized,
'Pre edit text')
@override_settings(DEVILRY_COMMENT_STUDENTS_CAN_SEE_OTHER_USERS_COMMENT_HISTORY=True)
def test_history_entries_render_order(self):
candidate = mommy.make('core.Candidate',
relatedstudent=mommy.make('core.RelatedStudent'))
groupcomment = mommy.make('devilry_group.GroupComment',
feedback_set__group=candidate.assignment_group,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE)
history_entry1 = mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE,
edited_datetime=timezone.now() - timezone.timedelta(hours=10))
history_entry2 = mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE,
edited_datetime=timezone.now() - timezone.timedelta(hours=14))
history_entry3 = mommy.make('devilry_group.GroupCommentEditHistory', group_comment=groupcomment,
visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE,
edited_datetime=timezone.now() - timezone.timedelta(hours=4))
mockresponse = self.mock_http200_getrequest_htmls(
cradmin_role=candidate.assignment_group,
requestuser=candidate.relatedstudent.user,
viewkwargs={'group_comment_id': groupcomment.id})
self.assertEqual(mockresponse.selector.list('.devilry-comment-history-item__title')[0].alltext_normalized,
'{}'.format(defaultfilters.date(timezone.localtime(history_entry3.edited_datetime),
'DATETIME_FORMAT')))
self.assertEqual(mockresponse.selector.list('.devilry-comment-history-item__title')[1].alltext_normalized,
'{}'.format(defaultfilters.date(timezone.localtime(history_entry1.edited_datetime),
'DATETIME_FORMAT')))
self.assertEqual(mockresponse.selector.list('.devilry-comment-history-item__title')[2].alltext_normalized,
'{}'.format(defaultfilters.date(timezone.localtime(history_entry2.edited_datetime),
'DATETIME_FORMAT')))
| 66.758294
| 116
| 0.683516
| 1,343
| 14,086
| 6.843634
| 0.113924
| 0.043086
| 0.033946
| 0.045697
| 0.868676
| 0.86106
| 0.859863
| 0.857578
| 0.826243
| 0.812534
| 0
| 0.006976
| 0.23676
| 14,086
| 210
| 117
| 67.07619
| 0.847921
| 0.003834
| 0
| 0.712042
| 0
| 0
| 0.144763
| 0.084546
| 0
| 0
| 0
| 0
| 0.099476
| 1
| 0.068063
| false
| 0
| 0.062827
| 0
| 0.141361
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0c5a4c57ac3ba937a07cd9db5ec76141003a383d
| 40,987
|
py
|
Python
|
tests/test_component_replacement.py
|
TinkerBoard-Android/external-google-fruit
|
57123c8a2477a4d99cb68c53d195e9fb428dd535
|
[
"Apache-2.0"
] | 1,666
|
2015-01-04T08:52:43.000Z
|
2022-03-28T11:06:19.000Z
|
tests/test_component_replacement.py
|
TinkerBoard-Android/external-google-fruit
|
57123c8a2477a4d99cb68c53d195e9fb428dd535
|
[
"Apache-2.0"
] | 135
|
2015-02-19T11:35:07.000Z
|
2022-03-29T05:00:42.000Z
|
tests/test_component_replacement.py
|
TinkerBoard-Android/external-google-fruit
|
57123c8a2477a4d99cb68c53d195e9fb428dd535
|
[
"Apache-2.0"
] | 253
|
2015-01-14T08:15:10.000Z
|
2022-03-24T07:49:53.000Z
|
#!/usr/bin/env python3
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from absl.testing import parameterized
from fruit_test_common import *
COMMON_DEFINITIONS = '''
#include "test_common.h"
'''
class TestComponentReplacement(parameterized.TestCase):
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_success(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_success_across_normalized_component(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<> getRootComponent1() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
fruit::Component<int> getRootComponent2() {
return fruit::createComponent()
.install(ReplacedComponentInstallation);
}
int main() {
fruit::NormalizedComponent<> normalizedComponent(getRootComponent1);
fruit::Injector<int> injector(normalizedComponent, getRootComponent2);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_installed_using_component_function_success(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.installComponentFunctions(fruit::componentFunction(ReplacedComponentInstallation));
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
def test_replace_component_success_with_conversion(self):
source = '''
fruit::Component<int> getReplacedComponent(std::string) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(double, std::string, int) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(getReplacedComponent, "Hi").with(getReplacementComponent, 2.0, "Hello", 12)
.install(getReplacedComponent, "Hi");
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
def test_replace_component_installed_using_component_function_success_with_conversion(self):
source = '''
fruit::Component<int> getReplacedComponent(std::string) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(double, std::string, int) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(getReplacedComponent, "Hi").with(getReplacementComponent, 2.0, "Hello", 12)
.installComponentFunctions(fruit::componentFunction(getReplacedComponent, "Hi"));
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent', 'getReplacementComponent', 'getReplacementReplacementComponent'),
('double', 'getReplacedComponent, 1.0', 'getReplacementComponent, 1.0', 'getReplacementReplacementComponent, 1.0'),
])
def test_replace_component_chain_success(self,
ComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentInstallation, ReplacementReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementReplacementComponent(ComponentParamTypes) {
static int n = 30;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.replace(ReplacementComponentInstallation).with(ReplacementReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 30);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent', 'getReplacementComponent', 'getReplacementReplacementComponent'),
('double', 'getReplacedComponent, 1.0', 'getReplacementComponent, 1.0', 'getReplacementReplacementComponent, 1.0'),
])
def test_replace_component_chain_other_order_success(self,
ComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentInstallation, ReplacementReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementReplacementComponent(ComponentParamTypes) {
static int n = 30;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(ReplacementComponentInstallation).with(ReplacementReplacementComponentInstallation)
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 30);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
def test_replace_component_different_type_error(self):
source = '''
fruit::Component<int> getReplacedComponent();
fruit::Component<double> getReplacementComponent();
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(getReplacedComponent).with(getReplacementComponent);
}
'''
expect_generic_compile_error(
# Clang
r'candidate template ignored: could not match .Component<int>. against .Component<double>.'
# GCC
r'|mismatched types .int. and .double.'
# MSVC
r'|could not deduce template argument for .fruit::Component<int> \(__cdecl \*\)\(FormalArgs...\). from .fruit::Component<double> \(void\).',
COMMON_DEFINITIONS,
source)
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_already_replaced_consistent_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<int> injector(getRootComponent);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_already_replaced_across_normalized_component_consistent_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<> getRootComponent1() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
fruit::Component<int> getRootComponent2() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::NormalizedComponent<> normalizedComponent(getRootComponent1);
fruit::Injector<int> injector(normalizedComponent, getRootComponent2);
int n = injector.get<int>();
Assert(n == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent', 'getOtherReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")', 'getOtherReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_already_replaced_inconsistent_error(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation, OtherReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getOtherReplacementComponent(ReplacementComponentParamTypes) {
static int n = 30;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.replace(ReplacedComponentInstallation).with(OtherReplacementComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
(void) injector;
}
'''
expect_runtime_error(
r'Fatal injection error: the component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\((void)?ReplacedComponentParamTypes\) was replaced '
r'\(using .replace\(...\).with\(...\)\) with both the component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) and the component function at '
r'(0x)?[0-9a-fA-F]* with signature (class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) .',
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent', 'getOtherReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")', 'getOtherReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_already_replaced_across_normalized_component_inconsistent_error(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation, OtherReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getOtherReplacementComponent(ReplacementComponentParamTypes) {
static int n = 30;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<> getRootComponent1() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
fruit::Component<> getRootComponent2() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(OtherReplacementComponentInstallation);
}
int main() {
fruit::NormalizedComponent<> normalizedComponent(getRootComponent1);
fruit::Injector<> injector(normalizedComponent, getRootComponent2);
(void) injector;
}
'''
expect_runtime_error(
r'Fatal injection error: the component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\((void)?ReplacedComponentParamTypes\) was replaced '
r'\(using .replace\(...\).with\(...\)\) with both the component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) and the component function at '
r'(0x)?[0-9a-fA-F]* with signature (class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) .',
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_after_install_error(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent() {
return fruit::createComponent()
.install(ReplacedComponentInstallation)
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
int main() {
fruit::Injector<int> injector(getRootComponent);
(void) injector;
}
'''
expect_runtime_error(
r'Fatal injection error: unable to replace \(using .replace\(...\).with\(...\)\) the component function at '
r'(0x)?[0-9a-fA-F]* with signature (class )?fruit::Component<int> \((__cdecl)?\*\)\((void)?ReplacedComponentParamTypes\) with the '
r'component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) because the former component function '
r'was installed before the .replace\(...\).with\(...\).',
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_after_install_across_normalized_component_error(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<int> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.bindInstance(n);
}
fruit::Component<int> getRootComponent1() {
return fruit::createComponent()
.install(ReplacedComponentInstallation);
}
fruit::Component<> getRootComponent2() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
int main() {
fruit::NormalizedComponent<int> normalizedComponent(getRootComponent1);
fruit::Injector<int> injector(normalizedComponent, getRootComponent2);
(void) injector;
}
'''
expect_runtime_error(
r'Fatal injection error: unable to replace \(using .replace\(...\).with\(...\)\) the component function at '
r'(0x)?[0-9a-fA-F]* with signature (class )?fruit::Component<int> \((__cdecl)?\*\)\((void)?ReplacedComponentParamTypes\) with the '
r'component function at (0x)?[0-9a-fA-F]* with signature '
r'(class )?fruit::Component<int> \((__cdecl)?\*\)\(.*\) because the former component function '
r'was installed before the .replace\(...\).with\(...\).',
COMMON_DEFINITIONS,
source,
locals())
@parameterized.parameters([
('', 'getReplacedComponent', '', 'getReplacementComponent'),
('double', 'getReplacedComponent, 1.0', 'std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_unused_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 0);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_used_multiple_times_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_also_installed_directly_before_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.install(ReplacementComponentInstallation)
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_also_installed_directly_after_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation)
.install(ReplacementComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_also_installed_directly_before_across_normalized_component_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent1() {
return fruit::createComponent()
.install(ReplacementComponentInstallation);
}
fruit::Component<> getRootComponent2() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
int main() {
fruit::NormalizedComponent<> normalizedComponent(getRootComponent1);
fruit::Injector<> injector(normalizedComponent, getRootComponent2);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent'),
('double', 'getReplacedComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_component_also_installed_directly_after_across_normalized_component_ok(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent1() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation);
}
fruit::Component<> getRootComponent2() {
return fruit::createComponent()
.install(ReplacementComponentInstallation);
}
int main() {
fruit::NormalizedComponent<> normalizedComponent(getRootComponent1);
fruit::Injector<> injector(normalizedComponent, getRootComponent2);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 20);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
@multiple_parameters([
('', 'getReplacedComponent', 'getOtherReplacementComponent'),
('double', 'getReplacedComponent, 1.0', 'getOtherReplacementComponent, 1.0'),
], [
('', 'getReplacementComponent'),
('std::string', 'getReplacementComponent, std::string("Hello, world")'),
])
def test_replace_multiple_components_with_same(self,
ReplacedComponentParamTypes, ReplacedComponentInstallation, OtherReplacedComponentInstallation, ReplacementComponentParamTypes, ReplacementComponentInstallation):
source = '''
fruit::Component<> getReplacedComponent(ReplacedComponentParamTypes) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getOtherReplacementComponent(ReplacedComponentParamTypes) {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent(ReplacementComponentParamTypes) {
static int n = 30;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(ReplacedComponentInstallation).with(ReplacementComponentInstallation)
.replace(OtherReplacedComponentInstallation).with(ReplacementComponentInstallation)
.install(ReplacedComponentInstallation)
.install(OtherReplacedComponentInstallation);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 1);
Assert(*(multibindings[0]) == 30);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
def test_replace_component_one_set_of_args_only(self):
source = '''
fruit::Component<> getReplacedComponent(double) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent() {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(getReplacedComponent, 1.0).with(getReplacementComponent)
.install(getReplacedComponent, 1.0)
.install(getReplacedComponent, 5.0);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 2);
Assert(*(multibindings[0]) == 20);
Assert(*(multibindings[1]) == 10);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
def test_replace_component_already_replaced_with_different_args(self):
source = '''
fruit::Component<> getReplacedComponent(double) {
static int n = 10;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getReplacementComponent() {
static int n = 20;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getOtherReplacementComponent() {
static int n = 30;
return fruit::createComponent()
.addInstanceMultibinding(n);
}
fruit::Component<> getRootComponent() {
return fruit::createComponent()
.replace(getReplacedComponent, 1.0).with(getReplacementComponent)
.replace(getReplacedComponent, 5.0).with(getOtherReplacementComponent)
.install(getReplacedComponent, 1.0)
.install(getReplacedComponent, 5.0);
}
int main() {
fruit::Injector<> injector(getRootComponent);
std::vector<int*> multibindings = injector.getMultibindings<int>();
Assert(multibindings.size() == 2);
Assert(*(multibindings[0]) == 20);
Assert(*(multibindings[1]) == 30);
}
'''
expect_success(
COMMON_DEFINITIONS,
source,
locals())
if __name__ == '__main__':
absltest.main()
| 41.908998
| 177
| 0.568766
| 2,638
| 40,987
| 8.740713
| 0.07771
| 0.056466
| 0.08908
| 0.049441
| 0.921329
| 0.911354
| 0.908318
| 0.90255
| 0.886243
| 0.881993
| 0
| 0.010435
| 0.326616
| 40,987
| 977
| 178
| 41.951894
| 0.825
| 0.014834
| 0
| 0.810651
| 0
| 0.013018
| 0.758387
| 0.333655
| 0
| 0
| 0
| 0
| 0.033136
| 1
| 0.027219
| false
| 0
| 0.002367
| 0
| 0.12426
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
a7621ec9ebae107922583126a6f1023d0af14a75
| 206
|
py
|
Python
|
tests/test_2ocupadas_seguidas.py
|
fromant65/AAT
|
48c74c8ec305c0921400a39e2fc93b0cb487e916
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_2ocupadas_seguidas.py
|
fromant65/AAT
|
48c74c8ec305c0921400a39e2fc93b0cb487e916
|
[
"BSD-3-Clause"
] | 4
|
2020-04-29T21:42:33.000Z
|
2020-04-30T13:01:03.000Z
|
tests/test_2ocupadas_seguidas.py
|
fromant65/AAT
|
48c74c8ec305c0921400a39e2fc93b0cb487e916
|
[
"BSD-3-Clause"
] | null | null | null |
from src.bingo import t_2ocupadas_seguidas
from src.bingo import carton1
#Testea que haya hasta 2 celdas ocupadas seguidas
def test_2ocupadas_seguidas():
assert t_2ocupadas_seguidas(carton1()) == True
| 29.428571
| 50
| 0.81068
| 30
| 206
| 5.366667
| 0.633333
| 0.31677
| 0.149068
| 0.223602
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.03352
| 0.131068
| 206
| 6
| 51
| 34.333333
| 0.865922
| 0.23301
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
a7bc6a2ea03114096cc7b933d6744a677e2c2617
| 82,158
|
py
|
Python
|
realperson/python/antchain_sdk_realperson/models.py
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | 6
|
2020-06-28T06:40:50.000Z
|
2022-02-25T11:02:18.000Z
|
realperson/python/antchain_sdk_realperson/models.py
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | null | null | null |
realperson/python/antchain_sdk_realperson/models.py
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | 6
|
2020-06-30T09:29:03.000Z
|
2022-01-07T10:42:22.000Z
|
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import BinaryIO, List
class Config(TeaModel):
"""
Model for initing client
"""
def __init__(
self,
access_key_id: str = None,
access_key_secret: str = None,
security_token: str = None,
protocol: str = None,
read_timeout: int = None,
connect_timeout: int = None,
http_proxy: str = None,
https_proxy: str = None,
endpoint: str = None,
no_proxy: str = None,
max_idle_conns: int = None,
user_agent: str = None,
socks_5proxy: str = None,
socks_5net_work: str = None,
max_idle_time_millis: int = None,
keep_alive_duration_millis: int = None,
max_requests: int = None,
max_requests_per_host: int = None,
):
# accesskey id
self.access_key_id = access_key_id
# accesskey secret
self.access_key_secret = access_key_secret
# security token
self.security_token = security_token
# http protocol
self.protocol = protocol
# read timeout
self.read_timeout = read_timeout
# connect timeout
self.connect_timeout = connect_timeout
# http proxy
self.http_proxy = http_proxy
# https proxy
self.https_proxy = https_proxy
# endpoint
self.endpoint = endpoint
# proxy white list
self.no_proxy = no_proxy
# max idle conns
self.max_idle_conns = max_idle_conns
# user agent
self.user_agent = user_agent
# socks5 proxy
self.socks_5proxy = socks_5proxy
# socks5 network
self.socks_5net_work = socks_5net_work
# 长链接最大空闲时长
self.max_idle_time_millis = max_idle_time_millis
# 长链接最大连接时长
self.keep_alive_duration_millis = keep_alive_duration_millis
# 最大连接数(长链接最大总数)
self.max_requests = max_requests
# 每个目标主机的最大连接数(分主机域名的长链接最大总数
self.max_requests_per_host = max_requests_per_host
def validate(self):
pass
def to_map(self):
result = dict()
if self.access_key_id is not None:
result['accessKeyId'] = self.access_key_id
if self.access_key_secret is not None:
result['accessKeySecret'] = self.access_key_secret
if self.security_token is not None:
result['securityToken'] = self.security_token
if self.protocol is not None:
result['protocol'] = self.protocol
if self.read_timeout is not None:
result['readTimeout'] = self.read_timeout
if self.connect_timeout is not None:
result['connectTimeout'] = self.connect_timeout
if self.http_proxy is not None:
result['httpProxy'] = self.http_proxy
if self.https_proxy is not None:
result['httpsProxy'] = self.https_proxy
if self.endpoint is not None:
result['endpoint'] = self.endpoint
if self.no_proxy is not None:
result['noProxy'] = self.no_proxy
if self.max_idle_conns is not None:
result['maxIdleConns'] = self.max_idle_conns
if self.user_agent is not None:
result['userAgent'] = self.user_agent
if self.socks_5proxy is not None:
result['socks5Proxy'] = self.socks_5proxy
if self.socks_5net_work is not None:
result['socks5NetWork'] = self.socks_5net_work
if self.max_idle_time_millis is not None:
result['maxIdleTimeMillis'] = self.max_idle_time_millis
if self.keep_alive_duration_millis is not None:
result['keepAliveDurationMillis'] = self.keep_alive_duration_millis
if self.max_requests is not None:
result['maxRequests'] = self.max_requests
if self.max_requests_per_host is not None:
result['maxRequestsPerHost'] = self.max_requests_per_host
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('accessKeyId') is not None:
self.access_key_id = m.get('accessKeyId')
if m.get('accessKeySecret') is not None:
self.access_key_secret = m.get('accessKeySecret')
if m.get('securityToken') is not None:
self.security_token = m.get('securityToken')
if m.get('protocol') is not None:
self.protocol = m.get('protocol')
if m.get('readTimeout') is not None:
self.read_timeout = m.get('readTimeout')
if m.get('connectTimeout') is not None:
self.connect_timeout = m.get('connectTimeout')
if m.get('httpProxy') is not None:
self.http_proxy = m.get('httpProxy')
if m.get('httpsProxy') is not None:
self.https_proxy = m.get('httpsProxy')
if m.get('endpoint') is not None:
self.endpoint = m.get('endpoint')
if m.get('noProxy') is not None:
self.no_proxy = m.get('noProxy')
if m.get('maxIdleConns') is not None:
self.max_idle_conns = m.get('maxIdleConns')
if m.get('userAgent') is not None:
self.user_agent = m.get('userAgent')
if m.get('socks5Proxy') is not None:
self.socks_5proxy = m.get('socks5Proxy')
if m.get('socks5NetWork') is not None:
self.socks_5net_work = m.get('socks5NetWork')
if m.get('maxIdleTimeMillis') is not None:
self.max_idle_time_millis = m.get('maxIdleTimeMillis')
if m.get('keepAliveDurationMillis') is not None:
self.keep_alive_duration_millis = m.get('keepAliveDurationMillis')
if m.get('maxRequests') is not None:
self.max_requests = m.get('maxRequests')
if m.get('maxRequestsPerHost') is not None:
self.max_requests_per_host = m.get('maxRequestsPerHost')
return self
class AudioMeta(TeaModel):
def __init__(
self,
sample_freq: int = None,
channels_num: int = None,
bits: int = None,
channel: int = None,
):
# 采样率
self.sample_freq = sample_freq
# 音频道数
self.channels_num = channels_num
# 音频数据采样点所占位数
self.bits = bits
# 语音信道分离标识
self.channel = channel
def validate(self):
pass
def to_map(self):
result = dict()
if self.sample_freq is not None:
result['sample_freq'] = self.sample_freq
if self.channels_num is not None:
result['channels_num'] = self.channels_num
if self.bits is not None:
result['bits'] = self.bits
if self.channel is not None:
result['channel'] = self.channel
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('sample_freq') is not None:
self.sample_freq = m.get('sample_freq')
if m.get('channels_num') is not None:
self.channels_num = m.get('channels_num')
if m.get('bits') is not None:
self.bits = m.get('bits')
if m.get('channel') is not None:
self.channel = m.get('channel')
return self
class Audio(TeaModel):
def __init__(
self,
token: str = None,
raw_data: str = None,
audio_url: str = None,
):
# 音频文件名称(单次请求保持唯一)
self.token = token
# 待认证的音频文件,base64编码格式
self.raw_data = raw_data
# 音频文件OSS地址
self.audio_url = audio_url
def validate(self):
pass
def to_map(self):
result = dict()
if self.token is not None:
result['token'] = self.token
if self.raw_data is not None:
result['raw_data'] = self.raw_data
if self.audio_url is not None:
result['audio_url'] = self.audio_url
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('token') is not None:
self.token = m.get('token')
if m.get('raw_data') is not None:
self.raw_data = m.get('raw_data')
if m.get('audio_url') is not None:
self.audio_url = m.get('audio_url')
return self
class XNameValuePair(TeaModel):
def __init__(
self,
name: str = None,
value: str = None,
):
# 键名
self.name = name
# 键值
self.value = value
def validate(self):
self.validate_required(self.name, 'name')
self.validate_required(self.value, 'value')
def to_map(self):
result = dict()
if self.name is not None:
result['name'] = self.name
if self.value is not None:
result['value'] = self.value
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('name') is not None:
self.name = m.get('name')
if m.get('value') is not None:
self.value = m.get('value')
return self
class QueryFacevrfServerRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
certify_id: str = None,
extern_param: str = None,
material_hash: str = None,
outer_order_no: str = None,
scene_id: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 实人认证唯一标识
self.certify_id = certify_id
# 预留扩展业务参数
self.extern_param = extern_param
# 认证材料(如人脸图像)的哈希
self.material_hash = material_hash
# 外部唯一标识。用于定位。
# 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 场景ID
self.scene_id = scene_id
def validate(self):
self.validate_required(self.certify_id, 'certify_id')
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.scene_id, 'scene_id')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.extern_param is not None:
result['extern_param'] = self.extern_param
if self.material_hash is not None:
result['material_hash'] = self.material_hash
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.scene_id is not None:
result['scene_id'] = self.scene_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
if m.get('material_hash') is not None:
self.material_hash = m.get('material_hash')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('scene_id') is not None:
self.scene_id = m.get('scene_id')
return self
class QueryFacevrfServerResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
identity_info: str = None,
material_info: str = None,
material_matched: str = None,
passed: str = None,
reason: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 认证的主体信息,一般的认证场景返回为空
self.identity_info = identity_info
# 认证主体附件信息,一般的认证场景都是返回空
self.material_info = material_info
# 认证材料哈希是否匹配
self.material_matched = material_matched
# 是否通过,通过为T,不通过为F
self.passed = passed
# 业务失败原因
self.reason = reason
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.identity_info is not None:
result['identity_info'] = self.identity_info
if self.material_info is not None:
result['material_info'] = self.material_info
if self.material_matched is not None:
result['material_matched'] = self.material_matched
if self.passed is not None:
result['passed'] = self.passed
if self.reason is not None:
result['reason'] = self.reason
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('identity_info') is not None:
self.identity_info = m.get('identity_info')
if m.get('material_info') is not None:
self.material_info = m.get('material_info')
if m.get('material_matched') is not None:
self.material_matched = m.get('material_matched')
if m.get('passed') is not None:
self.passed = m.get('passed')
if m.get('reason') is not None:
self.reason = m.get('reason')
return self
class CreateFacevrfServerRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
biz_code: str = None,
callback_url: str = None,
cert_name: str = None,
cert_no: str = None,
cert_type: str = None,
extern_param: str = None,
facial_picture_ref: str = None,
identity_type: str = None,
meta_info: str = None,
outer_order_no: str = None,
return_url: str = None,
scene_id: str = None,
user_id: str = None,
user_ip: str = None,
user_mobile: str = None,
callback_need_retry: bool = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 认证模式码
self.biz_code = biz_code
# h5认证完成后,服务端回调此地址通知商户认证结果
self.callback_url = callback_url
# 真实姓名
self.cert_name = cert_name
# 证件号码
self.cert_no = cert_no
# 证件类型,如身份证
self.cert_type = cert_type
# 预留扩展参数
self.extern_param = extern_param
# 自定义比对源人脸图像,base64编码格式
self.facial_picture_ref = facial_picture_ref
# 身份信息来源类型,如证件
self.identity_type = identity_type
# metainfo 环境参数,需要通过客户端 SDK 获取
self.meta_info = meta_info
# 外部唯一标识。用于定位。
# 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 回跳地址
self.return_url = return_url
# 场景ID
self.scene_id = scene_id
# 商户自定义的用户ID
self.user_id = user_id
# 用户的IP
self.user_ip = user_ip
# 用户的手机号
self.user_mobile = user_mobile
# callbackUrl回调时是否需要重试,默认false(不需要重试)
self.callback_need_retry = callback_need_retry
def validate(self):
self.validate_required(self.biz_code, 'biz_code')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.cert_type, 'cert_type')
self.validate_required(self.identity_type, 'identity_type')
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.scene_id, 'scene_id')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.biz_code is not None:
result['biz_code'] = self.biz_code
if self.callback_url is not None:
result['callback_url'] = self.callback_url
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.cert_type is not None:
result['cert_type'] = self.cert_type
if self.extern_param is not None:
result['extern_param'] = self.extern_param
if self.facial_picture_ref is not None:
result['facial_picture_ref'] = self.facial_picture_ref
if self.identity_type is not None:
result['identity_type'] = self.identity_type
if self.meta_info is not None:
result['meta_info'] = self.meta_info
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.return_url is not None:
result['return_url'] = self.return_url
if self.scene_id is not None:
result['scene_id'] = self.scene_id
if self.user_id is not None:
result['user_id'] = self.user_id
if self.user_ip is not None:
result['user_ip'] = self.user_ip
if self.user_mobile is not None:
result['user_mobile'] = self.user_mobile
if self.callback_need_retry is not None:
result['callback_need_retry'] = self.callback_need_retry
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('biz_code') is not None:
self.biz_code = m.get('biz_code')
if m.get('callback_url') is not None:
self.callback_url = m.get('callback_url')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('cert_type') is not None:
self.cert_type = m.get('cert_type')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
if m.get('facial_picture_ref') is not None:
self.facial_picture_ref = m.get('facial_picture_ref')
if m.get('identity_type') is not None:
self.identity_type = m.get('identity_type')
if m.get('meta_info') is not None:
self.meta_info = m.get('meta_info')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('return_url') is not None:
self.return_url = m.get('return_url')
if m.get('scene_id') is not None:
self.scene_id = m.get('scene_id')
if m.get('user_id') is not None:
self.user_id = m.get('user_id')
if m.get('user_ip') is not None:
self.user_ip = m.get('user_ip')
if m.get('user_mobile') is not None:
self.user_mobile = m.get('user_mobile')
if m.get('callback_need_retry') is not None:
self.callback_need_retry = m.get('callback_need_retry')
return self
class CreateFacevrfServerResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
certify_id: str = None,
certify_url: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 实人认证唯一标识
self.certify_id = certify_id
# 认证地址。只在特定场景返回。
self.certify_url = certify_url
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.certify_url is not None:
result['certify_url'] = self.certify_url
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('certify_url') is not None:
self.certify_url = m.get('certify_url')
return self
class ExecFacevrfServerRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
cert_name: str = None,
cert_no: str = None,
cert_type: str = None,
extern_param: str = None,
facial_picture_ref: str = None,
identity_type: str = None,
outer_order_no: str = None,
scene_id: str = None,
user_id: str = None,
user_ip: str = None,
user_mobile: str = None,
facial_picture_auth: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 真实姓名
self.cert_name = cert_name
# 证件号码
self.cert_no = cert_no
# 证件类型,如身份证
self.cert_type = cert_type
# 预留扩展参数
self.extern_param = extern_param
# 自定义比对源人脸图像,base64编码格式
self.facial_picture_ref = facial_picture_ref
# 身份信息来源类型,如证件
self.identity_type = identity_type
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 场景ID
self.scene_id = scene_id
# 商户自定义的用户ID
self.user_id = user_id
# 用户的IP
self.user_ip = user_ip
# 用户的手机号(或其哈希值)
self.user_mobile = user_mobile
# 待认证的人脸图像,base64编码格式
self.facial_picture_auth = facial_picture_auth
def validate(self):
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.cert_type, 'cert_type')
self.validate_required(self.identity_type, 'identity_type')
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.scene_id, 'scene_id')
self.validate_required(self.facial_picture_auth, 'facial_picture_auth')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.cert_type is not None:
result['cert_type'] = self.cert_type
if self.extern_param is not None:
result['extern_param'] = self.extern_param
if self.facial_picture_ref is not None:
result['facial_picture_ref'] = self.facial_picture_ref
if self.identity_type is not None:
result['identity_type'] = self.identity_type
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.scene_id is not None:
result['scene_id'] = self.scene_id
if self.user_id is not None:
result['user_id'] = self.user_id
if self.user_ip is not None:
result['user_ip'] = self.user_ip
if self.user_mobile is not None:
result['user_mobile'] = self.user_mobile
if self.facial_picture_auth is not None:
result['facial_picture_auth'] = self.facial_picture_auth
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('cert_type') is not None:
self.cert_type = m.get('cert_type')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
if m.get('facial_picture_ref') is not None:
self.facial_picture_ref = m.get('facial_picture_ref')
if m.get('identity_type') is not None:
self.identity_type = m.get('identity_type')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('scene_id') is not None:
self.scene_id = m.get('scene_id')
if m.get('user_id') is not None:
self.user_id = m.get('user_id')
if m.get('user_ip') is not None:
self.user_ip = m.get('user_ip')
if m.get('user_mobile') is not None:
self.user_mobile = m.get('user_mobile')
if m.get('facial_picture_auth') is not None:
self.facial_picture_auth = m.get('facial_picture_auth')
return self
class ExecFacevrfServerResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
certify_id: str = None,
passed: str = None,
reason: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 认证ID
self.certify_id = certify_id
# 是否通过,通过为T,不通过为F
self.passed = passed
# 业务失败原因
self.reason = reason
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.passed is not None:
result['passed'] = self.passed
if self.reason is not None:
result['reason'] = self.reason
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('passed') is not None:
self.passed = m.get('passed')
if m.get('reason') is not None:
self.reason = m.get('reason')
return self
class GetFacevrfEvidenceRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
certify_id: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 某次刷脸的certifyId
self.certify_id = certify_id
def validate(self):
self.validate_required(self.certify_id, 'certify_id')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.certify_id is not None:
result['certify_id'] = self.certify_id
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
return self
class GetFacevrfEvidenceResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
certify_id: str = None,
onchain_id: str = None,
onchain_status: str = None,
pdf_expired: bool = None,
pdf_content: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 刷脸的certifyId,原样返回
self.certify_id = certify_id
# 统一证据ID,非SUCCESS状态为null,可在控制台中持统一证据ID验证pdf文件的正确性,法院方也可用此统一证据ID在司法链控制台进行核验pdf文件的正确性。
self.onchain_id = onchain_id
# 上链状态,`SUCCESS`表示成功、`INIT`表示正在上链
self.onchain_status = onchain_status
# pdf存证是否已经过期,不支持超过6个月的存证获取
self.pdf_expired = pdf_expired
# 存证pdf文件内容的base64
self.pdf_content = pdf_content
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.onchain_id is not None:
result['onchain_id'] = self.onchain_id
if self.onchain_status is not None:
result['onchain_status'] = self.onchain_status
if self.pdf_expired is not None:
result['pdf_expired'] = self.pdf_expired
if self.pdf_content is not None:
result['pdf_content'] = self.pdf_content
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('onchain_id') is not None:
self.onchain_id = m.get('onchain_id')
if m.get('onchain_status') is not None:
self.onchain_status = m.get('onchain_status')
if m.get('pdf_expired') is not None:
self.pdf_expired = m.get('pdf_expired')
if m.get('pdf_content') is not None:
self.pdf_content = m.get('pdf_content')
return self
class CheckIndividualidTwometaRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
extern_param: str = None,
scene: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 姓名
self.cert_name = cert_name
# 身份证号码
self.cert_no = cert_no
# map结果的json数据格式,预留字段
self.extern_param = extern_param
# 认证子类型
self.scene = scene
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.extern_param is not None:
result['extern_param'] = self.extern_param
if self.scene is not None:
result['scene'] = self.scene
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
if m.get('scene') is not None:
self.scene = m.get('scene')
return self
class CheckIndividualidTwometaResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
match: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# true:匹配成功 false:匹配失败
self.match = match
# 扩展信息,预留字段
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.match is not None:
result['match'] = self.match
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('match') is not None:
self.match = m.get('match')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CheckIndividualidThreemetaRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
mobile: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 姓名
self.cert_name = cert_name
# 身份证号码
self.cert_no = cert_no
# 手机号码
self.mobile = mobile
# map结果的json数据格式,预留字段
#
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.mobile, 'mobile')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.mobile is not None:
result['mobile'] = self.mobile
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('mobile') is not None:
self.mobile = m.get('mobile')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CheckIndividualidThreemetaResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
match: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# true:匹配成功 false:匹配失败
self.match = match
# 扩展信息,预留字段
#
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.match is not None:
result['match'] = self.match
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('match') is not None:
self.match = m.get('match')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CheckIndividualidFourmetaRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
mobile: str = None,
bank_card: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 姓名
#
self.cert_name = cert_name
# 身份证号码
self.cert_no = cert_no
# 手机号码
self.mobile = mobile
# 银行卡号
self.bank_card = bank_card
# map结果的json数据格式,预留字段
#
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.mobile, 'mobile')
self.validate_required(self.bank_card, 'bank_card')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.mobile is not None:
result['mobile'] = self.mobile
if self.bank_card is not None:
result['bank_card'] = self.bank_card
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('mobile') is not None:
self.mobile = m.get('mobile')
if m.get('bank_card') is not None:
self.bank_card = m.get('bank_card')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CheckIndividualidFourmetaResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
match: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# true:匹配成功 false:匹配失败
#
self.match = match
# 扩展信息,预留字段
#
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.match is not None:
result['match'] = self.match
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('match') is not None:
self.match = m.get('match')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CheckRouteThreemetaRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
mobile: str = None,
scene: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 姓名
self.cert_name = cert_name
# 身份证号
self.cert_no = cert_no
# 手机号
self.mobile = mobile
# 使用场景
self.scene = scene
# map结果的json数据格式,预留字段
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.mobile, 'mobile')
self.validate_required(self.scene, 'scene')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.mobile is not None:
result['mobile'] = self.mobile
if self.scene is not None:
result['scene'] = self.scene
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('mobile') is not None:
self.mobile = m.get('mobile')
if m.get('scene') is not None:
self.scene = m.get('scene')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CheckRouteThreemetaResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
match: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# true:匹配成功 false:匹配失败
self.match = match
# 扩展信息,预留字段
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.match is not None:
result['match'] = self.match
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('match') is not None:
self.match = m.get('match')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CreateVoiceprintServermodeRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
user_id: str = None,
file_object: BinaryIO = None,
file_object_name: str = None,
file_id: str = None,
audio_meta: AudioMeta = None,
audios: List[Audio] = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 商户自定义的用户ID
self.user_id = user_id
# 音频文件流
# 待上传文件
self.file_object = file_object
# 待上传文件名
self.file_object_name = file_object_name
self.file_id = file_id
# 音频元数据
self.audio_meta = audio_meta
# 音频文件集合
self.audios = audios
# 预留扩展参数
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.user_id, 'user_id')
self.validate_required(self.audio_meta, 'audio_meta')
if self.audio_meta:
self.audio_meta.validate()
self.validate_required(self.audios, 'audios')
if self.audios:
for k in self.audios:
if k:
k.validate()
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.user_id is not None:
result['user_id'] = self.user_id
if self.file_object is not None:
result['fileObject'] = self.file_object
if self.file_object_name is not None:
result['fileObjectName'] = self.file_object_name
if self.file_id is not None:
result['file_id'] = self.file_id
if self.audio_meta is not None:
result['audio_meta'] = self.audio_meta.to_map()
result['audios'] = []
if self.audios is not None:
for k in self.audios:
result['audios'].append(k.to_map() if k else None)
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('user_id') is not None:
self.user_id = m.get('user_id')
if m.get('fileObject') is not None:
self.file_object = m.get('fileObject')
if m.get('fileObjectName') is not None:
self.file_object_name = m.get('fileObjectName')
if m.get('file_id') is not None:
self.file_id = m.get('file_id')
if m.get('audio_meta') is not None:
temp_model = AudioMeta()
self.audio_meta = temp_model.from_map(m['audio_meta'])
self.audios = []
if m.get('audios') is not None:
for k in m.get('audios'):
temp_model = Audio()
self.audios.append(temp_model.from_map(k))
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CreateVoiceprintServermodeResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
extern_info: str = None,
result_code_sub: str = None,
result_msg_sub: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 扩展信息,预留字段
self.extern_info = extern_info
# 产品结果明细,不影响决策
self.result_code_sub = result_code_sub
# result_code_sub对应的文案
self.result_msg_sub = result_msg_sub
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.extern_info is not None:
result['extern_info'] = self.extern_info
if self.result_code_sub is not None:
result['result_code_sub'] = self.result_code_sub
if self.result_msg_sub is not None:
result['result_msg_sub'] = self.result_msg_sub
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
if m.get('result_code_sub') is not None:
self.result_code_sub = m.get('result_code_sub')
if m.get('result_msg_sub') is not None:
self.result_msg_sub = m.get('result_msg_sub')
return self
class VerifyVoiceprintServermodeRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
user_id: str = None,
audio_auth: str = None,
audio_url: str = None,
audio_meta: AudioMeta = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 商户自定义的用户ID
self.user_id = user_id
# 音频文件,base64编码格式
#
self.audio_auth = audio_auth
# 音频文件OSS地址
self.audio_url = audio_url
# 音频元数据
self.audio_meta = audio_meta
# 预留扩展参数
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.user_id, 'user_id')
self.validate_required(self.audio_meta, 'audio_meta')
if self.audio_meta:
self.audio_meta.validate()
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.user_id is not None:
result['user_id'] = self.user_id
if self.audio_auth is not None:
result['audio_auth'] = self.audio_auth
if self.audio_url is not None:
result['audio_url'] = self.audio_url
if self.audio_meta is not None:
result['audio_meta'] = self.audio_meta.to_map()
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('user_id') is not None:
self.user_id = m.get('user_id')
if m.get('audio_auth') is not None:
self.audio_auth = m.get('audio_auth')
if m.get('audio_url') is not None:
self.audio_url = m.get('audio_url')
if m.get('audio_meta') is not None:
temp_model = AudioMeta()
self.audio_meta = temp_model.from_map(m['audio_meta'])
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class VerifyVoiceprintServermodeResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
certify_id: str = None,
extern_info: str = None,
result_code_sub: str = None,
result_msg_sub: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 声纹认证唯一ID
self.certify_id = certify_id
# 扩展信息,预留字段
self.extern_info = extern_info
# 产品结果明细,不影响决策
self.result_code_sub = result_code_sub
# result_code_sub对应的文案
self.result_msg_sub = result_msg_sub
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.extern_info is not None:
result['extern_info'] = self.extern_info
if self.result_code_sub is not None:
result['result_code_sub'] = self.result_code_sub
if self.result_msg_sub is not None:
result['result_msg_sub'] = self.result_msg_sub
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
if m.get('result_code_sub') is not None:
self.result_code_sub = m.get('result_code_sub')
if m.get('result_msg_sub') is not None:
self.result_msg_sub = m.get('result_msg_sub')
return self
class CheckRouteTwometaRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
scene: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 姓名
self.cert_name = cert_name
# 身份证号
self.cert_no = cert_no
# 使用场景
self.scene = scene
# map结果的json数据格式,预留字段
#
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_name, 'cert_name')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.scene, 'scene')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.scene is not None:
result['scene'] = self.scene
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('scene') is not None:
self.scene = m.get('scene')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CheckRouteTwometaResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
match: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# true:匹配成功 false:匹配失败
#
self.match = match
# 扩展信息,预留字段
#
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.match is not None:
result['match'] = self.match
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('match') is not None:
self.match = m.get('match')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class QueryMobileRiskRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
apdid_token: str = None,
scene: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部唯一标识。用于定位。 值为32位长度的字母数字组合前面几位字符是商户自定义的简称,中间可以使用一段时间,后段可以使用一个随机或递增序列
self.outer_order_no = outer_order_no
# 设备身份临时标识
self.apdid_token = apdid_token
# 接口使用场景,不同场景下接口返回字段集合会有差异,可缺省
self.scene = scene
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.apdid_token, 'apdid_token')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.apdid_token is not None:
result['apdid_token'] = self.apdid_token
if self.scene is not None:
result['scene'] = self.scene
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('apdid_token') is not None:
self.apdid_token = m.get('apdid_token')
if m.get('scene') is not None:
self.scene = m.get('scene')
return self
class QueryMobileRiskResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
device_info: str = None,
risk_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 设备相关数据,默认只返回apdid,由Map<String,String>序列化
self.device_info = device_info
# 设备风险标签,由Map<String,String>序列化
self.risk_info = risk_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.device_info is not None:
result['device_info'] = self.device_info
if self.risk_info is not None:
result['risk_info'] = self.risk_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('device_info') is not None:
self.device_info = m.get('device_info')
if m.get('risk_info') is not None:
self.risk_info = m.get('risk_info')
return self
class DetailFacevrfServerRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
certify_id: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 实人认证唯一标识
self.certify_id = certify_id
# 预留扩展业务参数
self.extern_param = extern_param
def validate(self):
self.validate_required(self.certify_id, 'certify_id')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.certify_id is not None:
result['certify_id'] = self.certify_id
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('certify_id') is not None:
self.certify_id = m.get('certify_id')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class DetailFacevrfServerResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
state: str = None,
identity_info: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# PASS:认证通过
# FAIL:认证不通过
# NO_RECODE:无认证记录
# PROCESSING:认证中
self.state = state
# 认证人信息,包括姓名和身份证号,不加密
# state为PASS/FAIL/PROCESSING时为JSON字符串,为NO_RECORD时为空
self.identity_info = identity_info
# 预留扩展结果
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.state is not None:
result['state'] = self.state
if self.identity_info is not None:
result['identity_info'] = self.identity_info
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('state') is not None:
self.state = m.get('state')
if m.get('identity_info') is not None:
self.identity_info = m.get('identity_info')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CheckAnticheatPersonalRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
product_instance_id: str = None,
outer_order_no: str = None,
cert_name: str = None,
cert_no: str = None,
company_name: str = None,
company_no: str = None,
extern_param: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 外部请求id
self.outer_order_no = outer_order_no
# 主体姓名
self.cert_name = cert_name
# 主体身份证号
self.cert_no = cert_no
# 受雇企业
self.company_name = company_name
# 组织机构代码
self.company_no = company_no
# 扩展字段,json格式
self.extern_param = extern_param
def validate(self):
self.validate_required(self.outer_order_no, 'outer_order_no')
self.validate_required(self.cert_no, 'cert_no')
self.validate_required(self.company_name, 'company_name')
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.product_instance_id is not None:
result['product_instance_id'] = self.product_instance_id
if self.outer_order_no is not None:
result['outer_order_no'] = self.outer_order_no
if self.cert_name is not None:
result['cert_name'] = self.cert_name
if self.cert_no is not None:
result['cert_no'] = self.cert_no
if self.company_name is not None:
result['company_name'] = self.company_name
if self.company_no is not None:
result['company_no'] = self.company_no
if self.extern_param is not None:
result['extern_param'] = self.extern_param
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('product_instance_id') is not None:
self.product_instance_id = m.get('product_instance_id')
if m.get('outer_order_no') is not None:
self.outer_order_no = m.get('outer_order_no')
if m.get('cert_name') is not None:
self.cert_name = m.get('cert_name')
if m.get('cert_no') is not None:
self.cert_no = m.get('cert_no')
if m.get('company_name') is not None:
self.company_name = m.get('company_name')
if m.get('company_no') is not None:
self.company_no = m.get('company_no')
if m.get('extern_param') is not None:
self.extern_param = m.get('extern_param')
return self
class CheckAnticheatPersonalResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
risk_level: str = None,
extern_info: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 风险等级
self.risk_level = risk_level
# 扩展信息
self.extern_info = extern_info
def validate(self):
pass
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.risk_level is not None:
result['risk_level'] = self.risk_level
if self.extern_info is not None:
result['extern_info'] = self.extern_info
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('risk_level') is not None:
self.risk_level = m.get('risk_level')
if m.get('extern_info') is not None:
self.extern_info = m.get('extern_info')
return self
class CreateAntcloudGatewayxFileUploadRequest(TeaModel):
def __init__(
self,
auth_token: str = None,
api_code: str = None,
file_label: str = None,
file_metadata: str = None,
file_name: str = None,
mime_type: str = None,
api_cluster: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
# 上传文件作用的openapi method
self.api_code = api_code
# 文件标签,多个标签;分割
self.file_label = file_label
# 自定义的文件元数据
self.file_metadata = file_metadata
# 文件名,不传则随机生成文件名
self.file_name = file_name
# 文件的多媒体类型
self.mime_type = mime_type
# 产品方的api归属集群,即productInstanceId
self.api_cluster = api_cluster
def validate(self):
self.validate_required(self.api_code, 'api_code')
if self.file_label is not None:
self.validate_max_length(self.file_label, 'file_label', 100)
if self.file_metadata is not None:
self.validate_max_length(self.file_metadata, 'file_metadata', 1000)
if self.file_name is not None:
self.validate_max_length(self.file_name, 'file_name', 100)
def to_map(self):
result = dict()
if self.auth_token is not None:
result['auth_token'] = self.auth_token
if self.api_code is not None:
result['api_code'] = self.api_code
if self.file_label is not None:
result['file_label'] = self.file_label
if self.file_metadata is not None:
result['file_metadata'] = self.file_metadata
if self.file_name is not None:
result['file_name'] = self.file_name
if self.mime_type is not None:
result['mime_type'] = self.mime_type
if self.api_cluster is not None:
result['api_cluster'] = self.api_cluster
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('auth_token') is not None:
self.auth_token = m.get('auth_token')
if m.get('api_code') is not None:
self.api_code = m.get('api_code')
if m.get('file_label') is not None:
self.file_label = m.get('file_label')
if m.get('file_metadata') is not None:
self.file_metadata = m.get('file_metadata')
if m.get('file_name') is not None:
self.file_name = m.get('file_name')
if m.get('mime_type') is not None:
self.mime_type = m.get('mime_type')
if m.get('api_cluster') is not None:
self.api_cluster = m.get('api_cluster')
return self
class CreateAntcloudGatewayxFileUploadResponse(TeaModel):
def __init__(
self,
req_msg_id: str = None,
result_code: str = None,
result_msg: str = None,
expired_time: str = None,
file_id: str = None,
upload_headers: List[XNameValuePair] = None,
upload_url: str = None,
):
# 请求唯一ID,用于链路跟踪和问题排查
self.req_msg_id = req_msg_id
# 结果码,一般OK表示调用成功
self.result_code = result_code
# 异常信息的文本描述
self.result_msg = result_msg
# 上传有效期
self.expired_time = expired_time
# 32位文件唯一id
self.file_id = file_id
# 放入http请求头里
self.upload_headers = upload_headers
# 文件上传地址
self.upload_url = upload_url
def validate(self):
if self.expired_time is not None:
self.validate_pattern(self.expired_time, 'expired_time', '\\d{4}[-]\\d{1,2}[-]\\d{1,2}[T]\\d{2}:\\d{2}:\\d{2}([Z]|([\\.]\\d{1,9})?[\\+]\\d{2}[\\:]?\\d{2})')
if self.upload_headers:
for k in self.upload_headers:
if k:
k.validate()
def to_map(self):
result = dict()
if self.req_msg_id is not None:
result['req_msg_id'] = self.req_msg_id
if self.result_code is not None:
result['result_code'] = self.result_code
if self.result_msg is not None:
result['result_msg'] = self.result_msg
if self.expired_time is not None:
result['expired_time'] = self.expired_time
if self.file_id is not None:
result['file_id'] = self.file_id
result['upload_headers'] = []
if self.upload_headers is not None:
for k in self.upload_headers:
result['upload_headers'].append(k.to_map() if k else None)
if self.upload_url is not None:
result['upload_url'] = self.upload_url
return result
def from_map(self, m: dict = None):
m = m or dict()
if m.get('req_msg_id') is not None:
self.req_msg_id = m.get('req_msg_id')
if m.get('result_code') is not None:
self.result_code = m.get('result_code')
if m.get('result_msg') is not None:
self.result_msg = m.get('result_msg')
if m.get('expired_time') is not None:
self.expired_time = m.get('expired_time')
if m.get('file_id') is not None:
self.file_id = m.get('file_id')
self.upload_headers = []
if m.get('upload_headers') is not None:
for k in m.get('upload_headers'):
temp_model = XNameValuePair()
self.upload_headers.append(temp_model.from_map(k))
if m.get('upload_url') is not None:
self.upload_url = m.get('upload_url')
return self
| 35.535467
| 168
| 0.592748
| 11,093
| 82,158
| 4.139457
| 0.033535
| 0.05183
| 0.093295
| 0.066813
| 0.817069
| 0.755265
| 0.738474
| 0.729698
| 0.723905
| 0.719136
| 0
| 0.001428
| 0.30972
| 82,158
| 2,311
| 169
| 35.550844
| 0.808259
| 0.045899
| 0
| 0.777954
| 1
| 0.000527
| 0.106579
| 0.002112
| 0
| 0
| 0
| 0
| 0
| 1
| 0.07173
| false
| 0.015295
| 0.001055
| 0
| 0.126582
| 0.00211
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
ac1a5a8976fa7508b1f0399265e91849f3708ca1
| 7,484
|
py
|
Python
|
NERTranserLearning/ExperimentTransferCrfTraining.py
|
Eddie-Shulman/NLP-NER-with-transfer-learning
|
e8aa7fde35c5a7e65b25a60b7d6ea12a93a52f40
|
[
"MIT"
] | 1
|
2020-01-31T18:55:14.000Z
|
2020-01-31T18:55:14.000Z
|
NERTranserLearning/ExperimentTransferCrfTraining.py
|
Eddie-Shulman/NLP-NER-with-transfer-learning
|
e8aa7fde35c5a7e65b25a60b7d6ea12a93a52f40
|
[
"MIT"
] | 5
|
2020-01-28T22:17:27.000Z
|
2022-02-09T23:31:53.000Z
|
NERTranserLearning/ExperimentTransferCrfTraining.py
|
Eddie-Shulman/NLP-NER-with-transfer-learning
|
e8aa7fde35c5a7e65b25a60b7d6ea12a93a52f40
|
[
"MIT"
] | null | null | null |
from NERTranserLearning.Experiment import Experiment
class ExperimentTransferCrfTraining(Experiment):
"""
Contains the configurations of the transfer learning training on various data-sets for both Elmo and naive
embeddings with CRF output layer.
It's crucial the training will run in a sequential order as they depend one on another.
Comment all configurations but the one you wish to run and run this code
as a module.
"""
@property
def EXPERIMENT_PLAN(self):
return [
{
'train': {
'dataset': 'gmb_dataset',
'input_checkpoint': None,
'output_checkpoint': 'trained/transfer_crf/gmb-crf-simple.ckpt',
'model': 'crf_simple_embedding_model',
'train': 'train_crf_output',
'freeze_bi_lstm': False,
'freeze_output_layer': False
},
'test': ['btc_dataset','ritter_dataset'],
},
# {
# 'train': {
# 'dataset': 'btc_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb-crf-simple.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc_train-crf-simple.ckpt',
# 'model': 'crf_simple_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['btc_dataset_test','ritter_dataset'],
# },
# {
# 'train': {
# 'dataset': 'btc_dataset',
# 'input_checkpoint': 'trained/transfer_crf/gmb-crf-simple.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc-crf-simple.ckpt',
# 'model': 'crf_simple_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['ritter_dataset'],
# },
# {
# 'train': {
# 'dataset': 'ritter_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-simple.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter_train-crf-simple.ckpt',
# 'model': 'crf_simple_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['ritter_dataset_test'],
# },
# {
# 'train': {
# 'dataset': 'ritter_dataset',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-simple.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter-crf-simple.ckpt',
# 'model': 'crf_simple_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['wsj_dataset'],
# },
# {
# 'train': {
# 'dataset': 'ritter_wsj_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-simple.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter_wsj_train-crf-simple.ckpt',
# 'model': 'tdd_simple_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['wsj_dataset_test'],
# },
# {
# 'train': {
# 'dataset': 'gmb_dataset',
# 'input_checkpoint': None,
# 'output_checkpoint': 'trained/transfer_crf/gmb-crf-elmo.ckpt',
# 'model': 'crf_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['btc_dataset','ritter_dataset'],
# },
# {
# 'train': {
# 'dataset': 'btc_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb-crf-elmo.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc_train-crf-elmo.ckpt',
# 'model': 'crf_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['btc_dataset_test','ritter_dataset'],
# },
# {
# 'train': {
# 'dataset': 'btc_dataset',
# 'input_checkpoint': 'trained/transfer_crf/gmb-crf-elmo.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc-crf-elmo.ckpt',
# 'model': 'crf_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['ritter_dataset'],
# },
# {
# 'train': {
# 'dataset': 'ritter_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-elmo.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter_train-crf-elmo.ckpt',
# 'model': 'crf_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['ritter_dataset_test'],
# },
# {
# 'train': {
# 'dataset': 'ritter_dataset',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-elmo.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter-crf-elmo.ckpt',
# 'model': 'crf_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['wsj_dataset'],
# },
# {
# 'train': {
# 'dataset': 'ritter_wsj_dataset_train',
# 'input_checkpoint': 'trained/transfer_crf/gmb+btc-crf-elmo.ckpt',
# 'output_checkpoint': 'trained/transfer_crf/gmb+btc+ritter_wsj_train-crf-elmo.ckpt',
# 'model': 'tdd_elmo_embedding_model',
# 'train': 'train_crf_output',
# 'freeze_bi_lstm': False,
# 'freeze_output_layer': False
# },
# 'test': ['wsj_dataset_test'],
# },
]
if __name__ == '__main__':
ExperimentTransferCrfTraining().run_experiment()
| 45.084337
| 110
| 0.463522
| 620
| 7,484
| 5.25
| 0.125806
| 0.1149
| 0.168971
| 0.189247
| 0.864516
| 0.855914
| 0.855914
| 0.855914
| 0.855914
| 0.855914
| 0
| 0
| 0.409407
| 7,484
| 165
| 111
| 45.357576
| 0.736425
| 0.64511
| 0
| 0
| 0
| 0
| 0.087445
| 0.026474
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05
| false
| 0
| 0.05
| 0.05
| 0.2
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ac685ae11df25a0c4470c0076dd1f18588b9eb64
| 589
|
py
|
Python
|
ClassFiles/Python101/PythonicComparisionStatements/MultipleComparisonOperators.py
|
minefarmer/CompletePython
|
6de46e7ee29d9e4eaada60352c193f552afd6f15
|
[
"Unlicense"
] | null | null | null |
ClassFiles/Python101/PythonicComparisionStatements/MultipleComparisonOperators.py
|
minefarmer/CompletePython
|
6de46e7ee29d9e4eaada60352c193f552afd6f15
|
[
"Unlicense"
] | null | null | null |
ClassFiles/Python101/PythonicComparisionStatements/MultipleComparisonOperators.py
|
minefarmer/CompletePython
|
6de46e7ee29d9e4eaada60352c193f552afd6f15
|
[
"Unlicense"
] | null | null | null |
# age = 82
# name = "Rich"
# if age >= 18 and name == "Rich":
# print("I can drink alcohol") # I can drink alcohol
# age = 17
# name = "Rich"
# if age >= 18 and name == "Rich":
# print("I can drink alcohol")
# else:
# print("I can drink Coke") # I can drink Coke
# age = 17
# name = "Rich"
# if age >= 18 or name == "Carl":
# print("I can drink alcohol")
# else:
# print("I can drink Coke") # I can drink Coke
age = 82
name = "Rich"
if age >= 18 or name == "Carl":
print("I can drink alcohol")
else:
print("I can drink Coke") # I can drink alcohol
| 18.40625
| 57
| 0.560272
| 94
| 589
| 3.510638
| 0.180851
| 0.133333
| 0.3
| 0.29697
| 0.930303
| 0.930303
| 0.930303
| 0.887879
| 0.887879
| 0.887879
| 0
| 0.037647
| 0.278438
| 589
| 31
| 58
| 19
| 0.738824
| 0.70798
| 0
| 0
| 0
| 0
| 0.284768
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
3bb35c5183a7e93a30be13279f27c43b58f7f03e
| 79,578
|
py
|
Python
|
dlkit/abstract_osid/configuration/managers.py
|
UOC/dlkit
|
a9d265db67e81b9e0f405457464e762e2c03f769
|
[
"MIT"
] | 2
|
2018-02-23T12:16:11.000Z
|
2020-10-08T17:54:24.000Z
|
dlkit/abstract_osid/configuration/managers.py
|
UOC/dlkit
|
a9d265db67e81b9e0f405457464e762e2c03f769
|
[
"MIT"
] | 87
|
2017-04-21T18:57:15.000Z
|
2021-12-13T19:43:57.000Z
|
dlkit/abstract_osid/configuration/managers.py
|
UOC/dlkit
|
a9d265db67e81b9e0f405457464e762e2c03f769
|
[
"MIT"
] | 1
|
2018-03-01T16:44:25.000Z
|
2018-03-01T16:44:25.000Z
|
"""Implementations of configuration abstract base class managers."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and include no methods.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specification
# pylint: disable=too-many-arguments
# Argument signature defined in specification.
# pylint: disable=duplicate-code
# All apparent duplicates have been inspected. They aren't.
import abc
class ConfigurationProfile:
"""The ``ConfigurationProfile`` describes the profile of the configuration service."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def supports_visible_federation(self):
"""Tests if federation is visible for this service.
:return: ``true`` if visible federation is supported, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_retrieval(self):
"""Tests for the availability of a configuration value retrieval service.
:return: ``true`` if value retrieval is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_lookup(self):
"""Tests for the availability of a configuration value lookup service.
:return: ``true`` if value lookup is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_query(self):
"""Tests for the availability of a configuration value query service.
:return: ``true`` if value query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_search(self):
"""Tests for the availability of a configuration value search service.
:return: ``true`` if value search is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_admin(self):
"""Tests for the availability of a configuration value administration service.
:return: ``true`` if value administration is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_value_notification(self):
"""Tests for the availability of a configuration value notification service.
:return: ``true`` if value notification is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_lookup(self):
"""Tests for the availability of a parameter lookup service.
:return: ``true`` if parameter lookup is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_query(self):
"""Tests for the availability of a parameter query service.
:return: ``true`` if parameter query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_search(self):
"""Tests for the availability of a parameter search service.
:return: ``true`` if parameter search is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_admin(self):
"""Tests for the availability of a parameter update service.
:return: ``true`` if parameter update is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented in all
providers.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_notification(self):
"""Tests for the availability of a parameter notification service.
:return: ``true`` if parameter notification is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_configuration(self):
"""Tests for the availability of a service to lookup mappings of parameters to configurations.
:return: ``true`` if parameter configuration is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented in all
providers.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_configuration_assignment(self):
"""Tests for the availability of a service to map parameters to configurations.
:return: ``true`` if parameter configuration assignment is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented in all
providers.*
"""
return # boolean
@abc.abstractmethod
def supports_parameter_smart_configuration(self):
"""Tests for the availability of a parameter smart configuration service.
:return: ``true`` if parameter smart configuration service is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented in all
providers.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_lookup(self):
"""Tests for the availability of a configuration lookup service.
:return: ``true`` if configuration lookup is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_query(self):
"""Tests for the availability of a configuration query service.
:return: ``true`` if configuration query is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_search(self):
"""Tests for the availability of a configuration search service.
:return: ``true`` if configuration search is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_admin(self):
"""Tests for the availability of a configuration admin service.
:return: ``true`` if configuration admin is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_notification(self):
"""Tests for the availability of a notification service for subscribing to changes to configurations.
:return: ``true`` if a configuration notification service is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_hierarchy(self):
"""Tests for the availability of a configuration hierarchy traversal service.
:return: ``true`` if a configuration hierarchy traversal is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_hierarchy_design(self):
"""Tests for the availability of a configuration hierarchy design service.
:return: ``true`` if a configuration hierarchy design is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_batch(self):
"""Tests for the availability of a configuration batch service.
:return: ``true`` if a configuration batch service is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def supports_configuration_rules(self):
"""Tests for the availability of a configuration rules service.
:return: ``true`` if a configuration rules service is available, ``false`` otherwise
:rtype: ``boolean``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_value_condition_record_types(self):
"""Gets the supported value condition record types.
:return: a list containing the supported ``ValueCondition`` record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
value_condition_record_types = property(fget=get_value_condition_record_types)
@abc.abstractmethod
def supports_value_condition_record_type(self, value_condition_record_type):
"""Tests if the given ``ValueCondition`` record type is supported.
:param value_condition_record_type: a ``Type`` indicating a ``ValueCondition`` record type
:type value_condition_record_type: ``osid.type.Type``
:return: ``true`` if the given value condition record ``Type`` is supported, ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``value_condition_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_value_record_types(self):
"""Gets all the value record types supported.
:return: the list of supported value record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
value_record_types = property(fget=get_value_record_types)
@abc.abstractmethod
def supports_value_record_type(self, value_record_type):
"""Tests if a given value record type is supported.
:param value_record_type: the value record type
:type value_record_type: ``osid.type.Type``
:return: ``true`` if the value record type is supported ``,`` ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``value_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_value_search_record_types(self):
"""Gets all the value search record types supported.
:return: the list of supported value search record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
value_search_record_types = property(fget=get_value_search_record_types)
@abc.abstractmethod
def supports_value_search_record_type(self, value_search_record_type):
"""Tests if a given value search type is supported.
:param value_search_record_type: the value search record type
:type value_search_record_type: ``osid.type.Type``
:return: ``true`` if the value search record type is supported ``,`` ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``value_search_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_parameter_record_types(self):
"""Gets all the parameter record types supported.
:return: the list of supported parameter record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
parameter_record_types = property(fget=get_parameter_record_types)
@abc.abstractmethod
def supports_parameter_record_type(self, parameter_record_type):
"""Tests if a given parameter record type is supported.
:param parameter_record_type: a parameter record type
:type parameter_record_type: ``osid.type.Type``
:return: ``true`` if the parameter record type is supported, ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``parameter_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_parameter_search_record_types(self):
"""Gets all the parameter search record types supported.
:return: the list of supported parameter search record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
parameter_search_record_types = property(fget=get_parameter_search_record_types)
@abc.abstractmethod
def supports_parameter_search_record_type(self, parameter_search_record_type):
"""Tests if a given parameter search record type is supported.
:param parameter_search_record_type: the value search type
:type parameter_search_record_type: ``osid.type.Type``
:return: ``true`` if the parameter search record type is supported, ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``parameter_search_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_configuration_record_types(self):
"""Gets all the configuration record types supported.
:return: the list of supported configuration record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
configuration_record_types = property(fget=get_configuration_record_types)
@abc.abstractmethod
def supports_configuration_record_type(self, configuration_record_type):
"""Tests if a given configuration record type is supported.
:param configuration_record_type: a configuration record type
:type configuration_record_type: ``osid.type.Type``
:return: ``true`` if the configuration record type is supported, ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``configuration_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
@abc.abstractmethod
def get_configuration_search_record_types(self):
"""Gets all the configuration search record types supported.
:return: the list of supported configuration search record types
:rtype: ``osid.type.TypeList``
*compliance: mandatory -- This method must be implemented.*
"""
return # osid.type.TypeList
configuration_search_record_types = property(fget=get_configuration_search_record_types)
@abc.abstractmethod
def supports_configuration_search_record_type(self, configuration_search_record_type):
"""Tests if a given configuration search record type is supported.
:param configuration_search_record_type: the configuration search record type
:type configuration_search_record_type: ``osid.type.Type``
:return: ``true`` if the configuration search record type is support ``e`` d, ``false`` otherwise
:rtype: ``boolean``
:raise: ``NullArgument`` -- ``configuration_search_record_type`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
return # boolean
class ConfigurationManager:
"""The configuration manager provides access sessions to retrieve and manage configurations.
A manager may support federation in that values can be accessed in a
specified configuration and parameters may be defined in a specified
registry. The sessions included in this manager are:
* ``ValueRetrievalSession:`` a basic session for retrieving
configuration values
* ``ValueLookupSession:`` a basic session for looking up
configuration values
* ``ValueQuerySession:`` a basic session for querying
configuration values
* ``ValueSearchSession:`` a basic session for searching
configuration values
* ``ValueAdminSession:`` a session for setting and changing
configuration values
* ``ValueNotificationSession:`` a session for subscribing to
changes of configuration values
* ``ParameterLookupSession:`` a session for retrieving defined
parameters
* ``ParameterQuerySession:`` a session for querying defined
parameters
* ``ParameterSearchSession:`` a session for searching defined
parameters
* ``ParameterAdminSession:`` a session for creating, updating and
deleting parameter definitions
* ``ParameterNoitificationSession:`` a session for subscribing to
adds and changes of parameters
* ``ParamaterRegistrySession:`` a session for examining mappings
of parameters to registries
* ``ParamaterRegistryAssignmentSession:`` a session for making
mappings of parameters to registries
* ``ParameterConfigurationSession:`` a session for examining
mappings of parameters to configurations
* ``ParameterConfigurationAssignmentSession:`` a session for
mapping parameters to configurations
* ``ParameterSmartConfigurationSession:`` a session for managing
smart configurations of parameters
* ``ConfigurationLookupSession:`` a session for retrieving
configurations
* ``ConfigurationQuerySession:`` a session for querying
configurations
* ``ConfigurationSearchSession:`` a session for searching
configurations
* ``ConfigurationAdminSession:`` a session for creating and
updating configurations
* ``ConfigurationNotificationSession:`` a session for subscribing
to adds and changes to configurations
* ``ConfigurationHierarchySession:`` a session for traversing a
hierarchy of configurations
* ``ConfigurationHierarchyDesignSession:`` a session for managing
a hierarchy of configurations
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def get_value_retrieval_session(self):
"""Gets a configuration value retrieval session.
:return: a ``ValueRetrievalSession``
:rtype: ``osid.configuration.ValueRetrievalSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_retrieval()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_retrieval()`` is ``true``.*
"""
return # osid.configuration.ValueRetrievalSession
value_retrieval_session = property(fget=get_value_retrieval_session)
@abc.abstractmethod
def get_value_retrieval_session_for_configuration(self, configuration_id):
"""Gets a configuration value retrieval session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueRetrievalSession``
:rtype: ``osid.configuration.ValueRetrievalSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_retrieval()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_retrieval()`` are ``true``.*
"""
return # osid.configuration.ValueRetrievalSession
@abc.abstractmethod
def get_value_lookup_session(self):
"""Gets a configuration value lookup session.
:return: a ``ValueLookupSession``
:rtype: ``osid.configuration.ValueLookupSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_lookup()`` is ``true``.*
"""
return # osid.configuration.ValueLookupSession
value_lookup_session = property(fget=get_value_lookup_session)
@abc.abstractmethod
def get_value_lookup_session_for_configuration(self, configuration_id):
"""Gets a configuration value lookup session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueLookupSession``
:rtype: ``osid.configuration.ValueLookupSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_lookup()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_lookup()`` are ``true``.*
"""
return # osid.configuration.ValueLookupSession
@abc.abstractmethod
def get_value_query_session(self):
"""Gets a configuration value query session.
:return: a ``ValueQuerySession``
:rtype: ``osid.configuration.ValueQuerySession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_query()`` is ``true``.*
"""
return # osid.configuration.ValueQuerySession
value_query_session = property(fget=get_value_query_session)
@abc.abstractmethod
def get_value_query_session_for_configuration(self, configuration_id):
"""Gets a configuration value query session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueQuerySession``
:rtype: ``osid.configuration.ValueQuerySession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_query()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and ``supports_value_query()``
are ``true``.*
"""
return # osid.configuration.ValueQuerySession
@abc.abstractmethod
def get_value_search_session(self):
"""Gets a configuration value search session.
:return: a ``ValueSearchSession``
:rtype: ``osid.configuration.ValueSearchSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_search()`` is ``true``.*
"""
return # osid.configuration.ValueSearchSession
value_search_session = property(fget=get_value_search_session)
@abc.abstractmethod
def get_value_search_session_for_configuration(self, configuration_id):
"""Gets a configuration value search session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueSearchSession``
:rtype: ``osid.configuration.ValueSearchSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_search()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_search()`` are ``true``.*
"""
return # osid.configuration.ValueSearchSession
@abc.abstractmethod
def get_value_admin_session(self):
"""Gets a configuration value administration session.
:return: a ``ValueAdminSession``
:rtype: ``osid.configuration.ValueAdminSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_admin()`` is ``true``.*
"""
return # osid.configuration.ValueAdminSession
value_admin_session = property(fget=get_value_admin_session)
@abc.abstractmethod
def get_value_admin_session_for_configuration(self, configuration_id):
"""Gets a value administration session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueAdminSession``
:rtype: ``osid.configuration.ValueAdminSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- ``supports_value_admin()`` or ``supports_visible_federation()`` is ``false``
:raise: ``Unimplemented`` -- ``supports_value_admin()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and ``supports_value_admin()``
are ``true``.*
"""
return # osid.configuration.ValueAdminSession
@abc.abstractmethod
def get_value_notification_session(self, value_receiver):
"""Gets a value notification session.
:param value_receiver: the notification callback
:type value_receiver: ``osid.configuration.ValueReceiver``
:return: a ``ValueNotificationSession``
:rtype: ``osid.configuration.ValueNotificationSession``
:raise: ``NullArgument`` -- ``value_receiver`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_notification()`` is ``true``.*
"""
return # osid.configuration.ValueNotificationSession
@abc.abstractmethod
def get_value_notification_session_for_configuration(self, value_receiver, configuration_id):
"""Gets a value notification session using the specified configuration.
:param value_receiver: the notification callback
:type value_receiver: ``osid.configuration.ValueReceiver``
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ValueNotificationSession``
:rtype: ``osid.configuration.ValueNotificationSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``value_receiver`` or ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_notification()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_notification()`` are ``true``.*
"""
return # osid.configuration.ValueNotificationSession
@abc.abstractmethod
def get_parameter_lookup_session(self):
"""Gets a parameter lookup session.
:return: a ``ParameterLookupSession``
:rtype: ``osid.configuration.ParameterLookupSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_lookup()`` is ``true``.*
"""
return # osid.configuration.ParameterLookupSession
parameter_lookup_session = property(fget=get_parameter_lookup_session)
@abc.abstractmethod
def get_parameter_lookup_session_for_configuration(self, configuration_id):
"""Gets a parameter lookup session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParamaterLookupSession``
:rtype: ``osid.configuration.ParameterLookupSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_lookup()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_lookup()`` are ``true``.*
"""
return # osid.configuration.ParameterLookupSession
@abc.abstractmethod
def get_parameter_query_session(self):
"""Gets a parameter query session.
:return: a ``ParameterQuerySession``
:rtype: ``osid.configuration.ParameterQuerySession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_query()`` is ``true``.*
"""
return # osid.configuration.ParameterQuerySession
parameter_query_session = property(fget=get_parameter_query_session)
@abc.abstractmethod
def get_parameter_query_session_for_configuration(self, configuration_id):
"""Gets a parameter search session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParamaterQuerySession``
:rtype: ``osid.configuration.ParameterQuerySession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_query()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_query()`` are ``true``.*
"""
return # osid.configuration.ParameterQuerySession
@abc.abstractmethod
def get_parameter_search_session(self):
"""Gets a parameter search session.
:return: a ``ParameterSearchSession``
:rtype: ``osid.configuration.ParameterSearchSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_search()`` is ``true``.*
"""
return # osid.configuration.ParameterSearchSession
parameter_search_session = property(fget=get_parameter_search_session)
@abc.abstractmethod
def get_parameter_search_session_for_configuration(self, configuration_id):
"""Gets a parameter search session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParamaterSearchSession``
:rtype: ``osid.configuration.ParameterSearchSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_search()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_search()`` are ``true``.*
"""
return # osid.configuration.ParameterSearchSession
@abc.abstractmethod
def get_parameter_admin_session(self):
"""Gets a parameter administration session.
:return: a ``ParameterAdminSession``
:rtype: ``osid.configuration.ParameterAdminSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_admin()`` is ``true``.*
"""
return # osid.configuration.ParameterAdminSession
parameter_admin_session = property(fget=get_parameter_admin_session)
@abc.abstractmethod
def get_parameter_admin_session_for_configuration(self, configuration_id):
"""Gets a parameter administration session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParameterAdminSession``
:rtype: ``osid.configuration.ParameterAdminSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_search()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_admin()`` are ``true``.*
"""
return # osid.configuration.ParameterAdminSession
@abc.abstractmethod
def get_parameter_notification_session(self, parameter_receiver):
"""Gets a parameter notification session.
:param parameter_receiver: the notification callback
:type parameter_receiver: ``osid.configuration.ParameterReceiver``
:return: a ``ParameterNotificationSession``
:rtype: ``osid.configuration.ParameterNotificationSession``
:raise: ``NullArgument`` -- ``parameter_receiver`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_notification()`` is ``true``.*
"""
return # osid.configuration.ParameterNotificationSession
@abc.abstractmethod
def get_parameter_notification_session_for_configuration(self, parameter_receiver, configuration_id):
"""Gets a parameter notification session using the specified configuration.
:param parameter_receiver: the notification callback
:type parameter_receiver: ``osid.configuration.ParameterReceiver``
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParameterNotificationSession``
:rtype: ``osid.configuration.ParameterNotificationSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``parameter_receiver`` or ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_notification()`` or ``supports_visible_federation()`` is
``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_notification()`` are ``true``.*
"""
return # osid.configuration.ParameterNotificationSession
@abc.abstractmethod
def get_parameter_configuration_session(self):
"""Gets a session for looking up mappings of parameters to configurations.
:return: a ``ParameterConfigurationSession``
:rtype: ``osid.configuration.ParameterConfigurationSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_configuration()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_configuration()`` is ``true``.*
"""
return # osid.configuration.ParameterConfigurationSession
parameter_configuration_session = property(fget=get_parameter_configuration_session)
@abc.abstractmethod
def get_parameter_configuration_assignment_session(self):
"""Gets a session for managing mappings of parameters to configurations.
:return: a ``ParameterConfigurationAssignmentSession``
:rtype: ``osid.configuration.ParameterConfigurationAssignmentSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_configuration_assignment()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_configuration_assignment()`` is ``true``.*
"""
return # osid.configuration.ParameterConfigurationAssignmentSession
parameter_configuration_assignment_session = property(fget=get_parameter_configuration_assignment_session)
@abc.abstractmethod
def get_parameter_smart_configuration_session(self, configuration_id):
"""Gets a session for managing smart configurations.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:return: a ``ParameterSmartConfigurationSession``
:rtype: ``osid.configuration.ParameterSmartConfigurationSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_smart_configuration()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_smart_configuration()`` is ``true``.*
"""
return # osid.configuration.ParameterSmartConfigurationSession
@abc.abstractmethod
def get_configuration_lookup_session(self):
"""Gets a configuration lookup session.
:return: a ``ConfigurationLookupSession``
:rtype: ``osid.configuration.ConfigurationLookupSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_lookup()`` is ``true``.*
"""
return # osid.configuration.ConfigurationLookupSession
configuration_lookup_session = property(fget=get_configuration_lookup_session)
@abc.abstractmethod
def get_configuration_query_session(self):
"""Gets a configuration query session.
:return: a ``ConfigurationQuerySession``
:rtype: ``osid.configuration.ConfigurationQuerySession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_query()`` is ``true``.*
"""
return # osid.configuration.ConfigurationQuerySession
configuration_query_session = property(fget=get_configuration_query_session)
@abc.abstractmethod
def get_configuration_search_session(self):
"""Gets a configuration search session.
:return: a ``ConfigurationSearchSession``
:rtype: ``osid.configuration.ConfigurationSearchSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_search()`` is ``true``.*
"""
return # osid.configuration.ConfigurationSearchSession
configuration_search_session = property(fget=get_configuration_search_session)
@abc.abstractmethod
def get_configuration_admin_session(self):
"""Gets a configuration administration session.
:return: a ``ConfigurationAdminSession``
:rtype: ``osid.configuration.ConfigurationAdminSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_admin()`` is ``true``.*
"""
return # osid.configuration.ConfigurationAdminSession
configuration_admin_session = property(fget=get_configuration_admin_session)
@abc.abstractmethod
def get_configuration_notification_session(self, configuration_receiver):
"""Gets the notification session for subscribing to changes to configurations.
:param configuration_receiver: the notification callback
:type configuration_receiver: ``osid.configuration.ConfigurationReceiver``
:return: a ``ConfigurationNotificationSession``
:rtype: ``osid.configuration.ConfigurationNotificationSession``
:raise: ``NullArgument`` -- ``configuration_receiver`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_notification()`` is ``true``.*
"""
return # osid.configuration.ConfigurationNotificationSession
@abc.abstractmethod
def get_configuration_hierarchy_session(self):
"""Gets a hierarchy traversal service for configurations.
:return: a ``ConfigurationHierarchySession``
:rtype: ``osid.configuration.ConfigurationHierarchySession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_hierarchy()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_hierarchy()`` is ``true``.*
"""
return # osid.configuration.ConfigurationHierarchySession
configuration_hierarchy_session = property(fget=get_configuration_hierarchy_session)
@abc.abstractmethod
def get_configuration_hierarchy_design_session(self):
"""Gets a hierarchy design service for configurations.
:return: a ``ConfigurationHierarchyDesignSession``
:rtype: ``osid.configuration.ConfigurationHierarchyDesignSession``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_hierarchy_design()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_hierarchy_design()`` is ``true``.*
"""
return # osid.configuration.ConfigurationHierarchyDesignSession
configuration_hierarchy_design_session = property(fget=get_configuration_hierarchy_design_session)
@abc.abstractmethod
def get_configuration_batch_manager(self):
"""Gets a ``ConfigurationBatchManager``.
:return: a ``ConfigurationBatchManager``
:rtype: ``osid.configuration.batch.ConfigurationBatchManager``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_batch()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_batch()`` is ``true``.*
"""
return # osid.configuration.batch.ConfigurationBatchManager
configuration_batch_manager = property(fget=get_configuration_batch_manager)
@abc.abstractmethod
def get_configuration_rules_manager(self):
"""Gets a ``ConfigurationRulesManager``.
:return: a ``ConfigurationRulesManager``
:rtype: ``osid.configuration.rules.ConfigurationRulesManager``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_rules()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_rules()`` is ``true``.*
"""
return # osid.configuration.rules.ConfigurationRulesManager
configuration_rules_manager = property(fget=get_configuration_rules_manager)
class ConfigurationProxyManager:
"""The configuration manager provides access to sessions to retrieve and manage configurations.
Methods in this manager support the passing a ``Proxy``. A manager
may support federation in that values can be accessed in a specified
configuration and paramaters may be defined in a specified registry.
The sessions included in this manager are:
* ``ValueRetrievalSession:`` a basic session for retrieving
configuration values
* ``ValueLookupSession:`` a basic session for looking up
configuration values
* ``ValueQuerySession:`` a basic session for querying
configuration values
* ``ValueSearchSession:`` a basic session for searching
configuration values
* ``ValueAdminSession:`` a session for setting and changing
configuration values
* ``ValueNotificationSession:`` a session for subscribing to
changes of configuration values
* ``ParameterLookupSession:`` a session for retrieving defined
parameters
* ``ParameterQuerySession:`` a session for querying defined
parameters
* ``ParameterSearchSession:`` a session for searching defined
parameters
* ``ParameterAdminSession:`` a session for creating, updating and
deleting parameter definitions
* ``ParameterNoitificationSession:`` a session for subscribing to
adds and changes of parameters
* ``ParamaterRegistrySession:`` a session for examining mappings
of parameters to registries
* ``ParamaterRegistryAssignmentSession:`` a session for making
mappings of parameters to registries
* ``ParameterConfigurationSession:`` a session for examining
mappings of parameters to configurations
* ``ParameterConfigurationAssignmentSession:`` a session for
mapping parameters to configurations
* ``ParameterSmartConfigurationSession:`` a session for managing
smart configurations of parameters
* ``ConfigurationLookupSession:`` a session for retrieving
configurations
* ``ConfigurationQuerySession:`` a session for querying
configurations
* ``ConfigurationSearchSession:`` a session for searching
configurations
* ``ConfigurationAdminSession:`` a session for creating and
updating configurations
* ``ConfigurationNotificationSession:`` a session for subscribing
to adds and changes to configurations
* ``ConfigurationHierarchySession:`` a session for traversing a
hierarchy of configurations
* ``ConfigurationHierarchyDesignSession:`` a session for managing
a hierarchy of configurations
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def get_value_retrieval_session(self, proxy):
"""Gets a configuration value retrieval session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueRetrievalSession``
:rtype: ``osid.configuration.ValueRetrievalSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_retrieval()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_retrieval()`` is ``true``.*
"""
return # osid.configuration.ValueRetrievalSession
@abc.abstractmethod
def get_value_retrieval_session_for_configuration(self, configuration_id, proxy):
"""Gets a configuration value retrieval session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueRetrievalSession``
:rtype: ``osid.configuration.ValueRetrievalSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_retrieval()`` or ``supports_visible_federation()`` is ``False``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_retrieval()`` are ``true``*
"""
return # osid.configuration.ValueRetrievalSession
@abc.abstractmethod
def get_value_lookup_session(self, proxy):
"""Gets a configuration value lookup session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueLookupSession``
:rtype: ``osid.configuration.ValueLookupSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_lookup()`` is ``true``.*
"""
return # osid.configuration.ValueLookupSession
@abc.abstractmethod
def get_value_lookup_session_for_configuration(self, configuration_id, proxy):
"""Gets a configuration value lookup session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueLookupSession``
:rtype: ``osid.configuration.ValueLookupSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_lookup()`` or ``supports_visible_federation()`` is ``False``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_lookup()`` are ``true``*
"""
return # osid.configuration.ValueLookupSession
@abc.abstractmethod
def get_value_query_session(self, proxy):
"""Gets a configuration value query session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueQuerySession``
:rtype: ``osid.configuration.ValueQuerySession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_query()`` is ``true``.*
"""
return # osid.configuration.ValueQuerySession
@abc.abstractmethod
def get_value_query_session_for_configuration(self, configuration_id, proxy):
"""Gets a configuration value query session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueQuerySession``
:rtype: ``osid.configuration.ValueQuerySession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_query()`` or ``supports_visible_federation()`` is ``False``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and ``supports_value_query()``
are ``true``*
"""
return # osid.configuration.ValueQuerySession
@abc.abstractmethod
def get_value_search_session(self, proxy):
"""Gets a configuration value search session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueSearchSession``
:rtype: ``osid.configuration.ValueSearchSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_lookup()`` is ``true``.*
"""
return # osid.configuration.ValueSearchSession
@abc.abstractmethod
def get_value_search_session_for_configuration(self, configuration_id, proxy):
"""Gets a configuration value search session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueSearchSession``
:rtype: ``osid.configuration.ValueSearchSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_search()`` or ``supports_visible_federation()`` is ``False``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_search()`` are ``true``*
"""
return # osid.configuration.ValueSearchSession
@abc.abstractmethod
def get_value_notification_session(self, value_receiver, proxy):
"""Gets a value notification session.
:param value_receiver: notification callback
:type value_receiver: ``osid.configuration.ValueReceiver``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueNotificationSession``
:rtype: ``osid.configuration.ValueNotificationSession``
:raise: ``NullArgument`` -- ``value_receiver`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_notification()`` is ``true``.*
"""
return # osid.configuration.ValueNotificationSession
@abc.abstractmethod
def get_value_notification_session_for_configuration(self, value_receiver, configuration_id, proxy):
"""Gets a value notification session using the specified configuration.
:param value_receiver: notification callback
:type value_receiver: ``osid.configuration.ValueReceiver``
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueNotificationSession``
:rtype: ``osid.configuration.ValueNotificationSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``value_receiver, configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_notification()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_value_notification()`` are ``true``.*
"""
return # osid.configuration.ValueNotificationSession
@abc.abstractmethod
def get_value_admin_session(self, proxy):
"""Gets a configuration value administration session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueAdminSession``
:rtype: ``osid.configuration.ValueAdminSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_value_admin()`` is ``true``.*
"""
return # osid.configuration.ValueAdminSession
@abc.abstractmethod
def get_value_admin_session_for_configuration(self, configuration_id, proxy):
"""Gets a value administration session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ValueAdminSession``
:rtype: ``osid.configuration.ValueAdminSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_value_search()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and ``supports_value_admin()``
are ``true``.*
"""
return # osid.configuration.ValueAdminSession
@abc.abstractmethod
def get_parameter_lookup_session(self, proxy):
"""Gets a parameter lookup session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterLookupSession``
:rtype: ``osid.configuration.ParameterLookupSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_lookup()`` is ``true``.*
"""
return # osid.configuration.ParameterLookupSession
@abc.abstractmethod
def get_parameter_lookup_session_for_configuration(self, configuration_id, proxy):
"""Gets a parameter lookup session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParamaterLookupSession``
:rtype: ``osid.configuration.ParameterLookupSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_lookup()`` are ``true``.*
"""
return # osid.configuration.ParameterLookupSession
@abc.abstractmethod
def get_parameter_query_session(self, proxy):
"""Gets a parameter query session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterQuerySession``
:rtype: ``osid.configuration.ParameterQuerySession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_query()`` is ``true``.*
"""
return # osid.configuration.ParameterQuerySession
@abc.abstractmethod
def get_parameter_query_session_for_configuration(self, configuration_id, proxy):
"""Gets a parameter query session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParamaterQuerySession``
:rtype: ``osid.configuration.ParameterQuerySession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_query()`` are ``true``.*
"""
return # osid.configuration.ParameterQuerySession
@abc.abstractmethod
def get_parameter_search_session(self, proxy):
"""Gets a parameter search session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterSearchSession``
:rtype: ``osid.configuration.ParameterSearchSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_search()`` is ``true``.*
"""
return # osid.configuration.ParameterSearchSession
@abc.abstractmethod
def get_parameter_search_session_for_configuration(self, configuration_id, proxy):
"""Gets a parameter search session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParamaterSearchSession``
:rtype: ``osid.configuration.ParameterSearchSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_search()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_search()`` are ``true``.*
"""
return # osid.configuration.ParameterSearchSession
@abc.abstractmethod
def get_parameter_admin_session(self, proxy):
"""Gets a parameter administration session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterAdminSession``
:rtype: ``osid.configuration.ParameterAdminSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_admin()`` is ``true``.*
"""
return # osid.configuration.ParameterAdminSession
@abc.abstractmethod
def get_parameter_admin_session_for_configuration(self, configuration_id, proxy):
"""Gets a parameter administration session using the supplied configuration.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterAdminSession``
:rtype: ``osid.configuration.ParameterAdminSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuration_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_admin()`` or ``supports_visible_federation()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_admin()`` are ``true``.*
"""
return # osid.configuration.ParameterAdminSession
@abc.abstractmethod
def get_parameter_notification_session(self, parameter_receiver, proxy):
"""Gets a parameter notification session.
:param parameter_receiver: notification callback
:type parameter_receiver: ``osid.configuration.ParameterReceiver``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterNotificationSession``
:rtype: ``osid.configuration.ParameterNotificationSession``
:raise: ``NullArgument`` -- ``parameter_receiver`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_notification()`` is ``true``.*
"""
return # osid.configuration.ParameterNotificationSession
@abc.abstractmethod
def get_parameter_notification_session_for_configuration(self, parameter_receiver, configuration_id, proxy):
"""Gets a parameter notification session using the specified configuration.
:param parameter_receiver: notification callback
:type parameter_receiver: ``osid.configuration.ParameterReceiver``
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterNotificationSession``
:rtype: ``osid.configuration.ParameterNotificationSession``
:raise: ``NotFound`` -- ``registry_id`` is not found
:raise: ``NullArgument`` -- ``parameter_receiver, configuration_id,`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_notification()`` or ``supports_visible_federation()`` is
``false``
*compliance: optional -- This method must be implemented if
``supports_visible_federation()`` and
``supports_parameter_notification()`` are ``true``.*
"""
return # osid.configuration.ParameterNotificationSession
@abc.abstractmethod
def get_parameter_configuration_session(self, proxy):
"""Gets a session for examining mappings of parameters to configurations.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterConfigurationSession``
:rtype: ``osid.configuration.ParameterConfigurationSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_configuration()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_configuration()`` is ``true``.*
"""
return # osid.configuration.ParameterConfigurationSession
@abc.abstractmethod
def get_parameter_configuration_assignment_session(self, proxy):
"""Gets a session for managing mappings of parameters to configurations.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterConfigurationAssignmentSession``
:rtype: ``osid.configuration.ParameterConfigurationAssignmentSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_configuration_assignment()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_configuration_assignment()`` is ``true``.*
"""
return # osid.configuration.ParameterConfigurationAssignmentSession
@abc.abstractmethod
def get_parameter_smart_configuration_session(self, configuration_id, proxy):
"""Gets a session for managing smart configurations of parameters.
:param configuration_id: the ``Id`` of the ``Configuration`` to use
:type configuration_id: ``osid.id.Id``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ParameterSmartConfigurationSession``
:rtype: ``osid.configuration.ParameterSmartConfigurationSession``
:raise: ``NotFound`` -- ``configuration_id`` is not found
:raise: ``NullArgument`` -- ``configuratin_id`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_parameter_smart_configuration()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_parameter_smart_configuration()`` is ``true``.*
"""
return # osid.configuration.ParameterSmartConfigurationSession
@abc.abstractmethod
def get_configuration_lookup_session(self, proxy):
"""Gets a configuration lookup session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationLookupSession``
:rtype: ``osid.configuration.ConfigurationLookupSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_lookup()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_lookup()`` is ``true``.*
"""
return # osid.configuration.ConfigurationLookupSession
@abc.abstractmethod
def get_configuration_query_session(self, proxy):
"""Gets a configuration query session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationQuerySession``
:rtype: ``osid.configuration.ConfigurationQuerySession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_query()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_query()`` is ``true``.*
"""
return # osid.configuration.ConfigurationQuerySession
@abc.abstractmethod
def get_configuration_search_session(self, proxy):
"""Gets a configuration search session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationSearchSession``
:rtype: ``osid.configuration.ConfigurationSearchSession``
:raise: ``OperationFailed`` -- ``proxy`` is ``null``
:raise: ``NullArgument`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_search()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_search()`` is ``true``.*
"""
return # osid.configuration.ConfigurationSearchSession
@abc.abstractmethod
def get_configuration_notification_session(self, configuration_receiver, proxy):
"""Gets the notification session for subscribing to changes to configurations.
:param configuration_receiver: notification callback
:type configuration_receiver: ``osid.configuration.ConfigurationReceiver``
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationNotificationSession``
:rtype: ``osid.configuration.ConfigurationNotificationSession``
:raise: ``NullArgument`` -- ``configuration_receiver`` or ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_notification()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_notification()`` is ``true``.*
"""
return # osid.configuration.ConfigurationNotificationSession
@abc.abstractmethod
def get_configuration_admin_session(self, proxy):
"""Gets a configuration administration session.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationAdminSession``
:rtype: ``osid.configuration.ConfigurationAdminSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_admin()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_admin()`` is ``true``.*
"""
return # osid.configuration.ConfigurationAdminSession
@abc.abstractmethod
def get_configuration_hierarchy_session(self, proxy):
"""Gets a hierarchy traversal service for configurations.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfiguraqtionHierarchySession``
:rtype: ``osid.configuration.ConfigurationHierarchySession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_hierarchy()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_hierarchy()`` is ``true``.*
"""
return # osid.configuration.ConfigurationHierarchySession
@abc.abstractmethod
def get_configuration_hierarchy_design_session(self, proxy):
"""Gets a hierarchy design service for configurations.
:param proxy: a proxy
:type proxy: ``osid.proxy.Proxy``
:return: a ``ConfigurationHierarchyDesignSession``
:rtype: ``osid.configuration.ConfigurationHierarchyDesignSession``
:raise: ``NullArgument`` -- ``proxy`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_hierarchy_design()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_hierarchy_design()`` is ``true``.*
"""
return # osid.configuration.ConfigurationHierarchyDesignSession
@abc.abstractmethod
def get_configuration_batch_proxy_manager(self):
"""Gets a ``ConfigurationProxyManager``.
:return: a ``ConfigurationBatchProxyManager``
:rtype: ``osid.configuration.batch.ConfigurationBatchProxyManager``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_batch()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_batch()`` is ``true``.*
"""
return # osid.configuration.batch.ConfigurationBatchProxyManager
configuration_batch_proxy_manager = property(fget=get_configuration_batch_proxy_manager)
@abc.abstractmethod
def get_configuration_rules_proxy_manager(self):
"""Gets a ``ConfigurationProxyManager``.
:return: a ``ConfigurationRulesProxyManager``
:rtype: ``osid.configuration.rules.ConfigurationRulesProxyManager``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Unimplemented`` -- ``supports_configuration_rules()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_configuration_rules()`` is ``true``.*
"""
return # osid.configuration.rules.ConfigurationRulesProxyManager
configuration_rules_proxy_manager = property(fget=get_configuration_rules_proxy_manager)
| 40.684049
| 120
| 0.665586
| 7,674
| 79,578
| 6.754887
| 0.02932
| 0.047881
| 0.040897
| 0.032718
| 0.950942
| 0.920289
| 0.884407
| 0.85356
| 0.789301
| 0.756197
| 0
| 0
| 0.219395
| 79,578
| 1,955
| 121
| 40.704859
| 0.834479
| 0.716932
| 0
| 0.609065
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.300283
| false
| 0
| 0.002833
| 0
| 0.699717
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 8
|
3bca6bb79d06e778ea0edb61646c8d7c408d9889
| 5,935
|
py
|
Python
|
tests/context/test_context_basics.py
|
EddLabs/eddington-static
|
cdd1d9514c4eea1bd06c24894b3922e6cc3fb1f5
|
[
"Apache-2.0"
] | null | null | null |
tests/context/test_context_basics.py
|
EddLabs/eddington-static
|
cdd1d9514c4eea1bd06c24894b3922e6cc3fb1f5
|
[
"Apache-2.0"
] | null | null | null |
tests/context/test_context_basics.py
|
EddLabs/eddington-static
|
cdd1d9514c4eea1bd06c24894b3922e6cc3fb1f5
|
[
"Apache-2.0"
] | null | null | null |
import pytest
from statue.context import Context
from statue.exceptions import ContextCircularParentingError
from tests.constants import (
CONTEXT1,
CONTEXT2,
CONTEXT3,
CONTEXT_HELP_STRING1,
CONTEXT_HELP_STRING2,
CONTEXT_HELP_STRING3,
)
def test_context_default_constructor():
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1)
assert context.name == CONTEXT1
assert not context.aliases
assert context.all_names == [CONTEXT1]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent is None
assert context.parents == []
assert not context.allowed_by_default
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
"aliases=[], "
"parent=None, "
"allowed_by_default=False"
")"
)
def test_context_constructor_with_aliases():
context = Context(
name=CONTEXT1, help=CONTEXT_HELP_STRING1, aliases=[CONTEXT2, CONTEXT3]
)
assert context.name == CONTEXT1
assert context.aliases == [CONTEXT2, CONTEXT3]
assert context.all_names == [CONTEXT1, CONTEXT2, CONTEXT3]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent is None
assert context.parents == []
assert not context.allowed_by_default
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
f"aliases=['{CONTEXT2}', '{CONTEXT3}'], "
"parent=None, "
"allowed_by_default=False"
")"
)
def test_context_constructor_with_parent():
parent = Context(name=CONTEXT2, help=CONTEXT_HELP_STRING2)
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1, parent=parent)
assert context.name == CONTEXT1
assert not context.aliases
assert context.all_names == [CONTEXT1]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent == parent
assert context.parents == [parent]
assert not context.allowed_by_default
parent_str = str(parent)
assert parent_str == (
"Context("
f"name='{CONTEXT2}', "
f"help='{CONTEXT_HELP_STRING2}', "
"aliases=[], "
f"parent=None, "
"allowed_by_default=False"
")"
)
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
"aliases=[], "
f"parent={parent_str}, "
"allowed_by_default=False"
")"
)
def test_context_constructor_with_grandparent():
grandparent = Context(name=CONTEXT3, help=CONTEXT_HELP_STRING3)
parent = Context(name=CONTEXT2, help=CONTEXT_HELP_STRING2, parent=grandparent)
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1, parent=parent)
assert context.name == CONTEXT1
assert not context.aliases
assert context.all_names == [CONTEXT1]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent == parent
assert context.parents == [parent, grandparent]
assert not context.allowed_by_default
grandparent_str, parent_str = str(grandparent), str(parent)
assert grandparent_str == (
"Context("
f"name='{CONTEXT3}', "
f"help='{CONTEXT_HELP_STRING3}', "
"aliases=[], "
f"parent=None, "
"allowed_by_default=False"
")"
)
assert parent_str == (
"Context("
f"name='{CONTEXT2}', "
f"help='{CONTEXT_HELP_STRING2}', "
"aliases=[], "
f"parent={grandparent_str}, "
"allowed_by_default=False"
")"
)
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
"aliases=[], "
f"parent={parent_str}, "
"allowed_by_default=False"
")"
)
def test_context_constructor_allowed_by_default():
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1, allowed_by_default=True)
assert context.name == CONTEXT1
assert not context.aliases
assert context.all_names == [CONTEXT1]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent is None
assert context.allowed_by_default
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
"aliases=[], "
f"parent=None, "
"allowed_by_default=True"
")"
)
def test_context_clear_aliases():
context = Context(
name=CONTEXT1, help=CONTEXT_HELP_STRING1, aliases=[CONTEXT2, CONTEXT3]
)
context.clear_aliases()
assert context.name == CONTEXT1
assert not context.aliases
assert context.all_names == [CONTEXT1]
assert context.help == CONTEXT_HELP_STRING1
assert context.parent is None
assert not context.allowed_by_default
assert str(context) == (
"Context("
f"name='{CONTEXT1}', "
f"help='{CONTEXT_HELP_STRING1}', "
"aliases=[], "
f"parent=None, "
"allowed_by_default=False"
")"
)
def test_context_cannot_set_circular_parenting():
parent = Context(name=CONTEXT2, help=CONTEXT_HELP_STRING2)
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1, parent=parent)
with pytest.raises(
ContextCircularParentingError,
match=f'^Cannot set circular parenting between "{CONTEXT2}" and "{CONTEXT1}"$',
):
parent.parent = context
def test_context_cannot_set_circular_grandparenting():
grandparent = Context(name=CONTEXT3, help=CONTEXT_HELP_STRING3)
parent = Context(name=CONTEXT2, help=CONTEXT_HELP_STRING2, parent=grandparent)
context = Context(name=CONTEXT1, help=CONTEXT_HELP_STRING1, parent=parent)
with pytest.raises(
ContextCircularParentingError,
match=f'^Cannot set circular parenting between "{CONTEXT3}" and "{CONTEXT1}"$',
):
grandparent.parent = context
| 29.824121
| 88
| 0.649705
| 639
| 5,935
| 5.807512
| 0.075117
| 0.112638
| 0.117219
| 0.118566
| 0.831312
| 0.808138
| 0.777957
| 0.777957
| 0.752088
| 0.734303
| 0
| 0.01847
| 0.233698
| 5,935
| 198
| 89
| 29.974747
| 0.797493
| 0
| 0
| 0.707602
| 0
| 0
| 0.196125
| 0.089638
| 0
| 0
| 0
| 0
| 0.28655
| 1
| 0.046784
| false
| 0
| 0.023392
| 0
| 0.070175
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ce0721df09e60549334ae6a2e7ff5756eb53f1f6
| 4,195
|
py
|
Python
|
tests/util/test_ascii_art.py
|
toastisme/dials
|
6bc8ababc33bfe334513677f8adb65c0e90003f3
|
[
"BSD-3-Clause"
] | 58
|
2015-10-15T09:28:20.000Z
|
2022-03-28T20:09:38.000Z
|
tests/util/test_ascii_art.py
|
toastisme/dials
|
6bc8ababc33bfe334513677f8adb65c0e90003f3
|
[
"BSD-3-Clause"
] | 1,741
|
2015-11-24T08:17:02.000Z
|
2022-03-31T15:46:42.000Z
|
tests/util/test_ascii_art.py
|
toastisme/dials
|
6bc8ababc33bfe334513677f8adb65c0e90003f3
|
[
"BSD-3-Clause"
] | 45
|
2015-10-14T13:44:16.000Z
|
2022-03-22T14:45:56.000Z
|
import os
import pickle
def test_spot_counts_per_image_plot(dials_regression):
from dials.util import ascii_art
data_dir = os.path.join(dials_regression, "indexing_test_data", "i04_weak_data")
pickle_path = os.path.join(data_dir, "full.pickle")
with open(pickle_path, "rb") as fh:
refl = pickle.load(fh, encoding="bytes")
output = ascii_art.spot_counts_per_image_plot(refl)
expected_output = """\
116082 spots found on 540 images (max 2075 / bin)
* * * * * * * * ** *
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
************************************************************
1 image 540"""
output = "\n".join(line.rstrip() for line in output.splitlines())
assert output == expected_output
output = ascii_art.spot_counts_per_image_plot(refl, char="o", width=80, height=15)
expected_output = """\
116082 spots found on 540 images (max 1627 / bin)
o
o oo o o o o o o o o o o o o o o o oo oo o o o o o o oo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
1 image 540"""
output = "\n".join(line.rstrip() for line in output.splitlines())
assert output == expected_output
output = ascii_art.spot_counts_per_image_plot(refl, char="#", width=7, height=10)
expected_output = """\
116082 spots found on 540 images (max 16752 / bin)
#######
#######
#######
#######
#######
#######
#######
#######
#######
#######
1 540"""
output = "\n".join(line.rstrip() for line in output.splitlines())
assert output == expected_output
output = ascii_art.spot_counts_per_image_plot(
refl.select(refl["xyzobs.px.value"].parts()[2] <= 9.5),
char="#",
width=10,
height=15,
)
expected_output = """\
2065 spots found on 10 images (max 361 / bin)
#
#
#
#
#
# #
# # #
## ## ##
##########
##########
##########
##########
##########
##########
##########
1 image 10"""
output = "\n".join(line.rstrip() for line in output.splitlines())
assert output == expected_output
# If we do spotfinding on the first 3 images, then the spot centroids will be in the
# range z=0.5 to z=2.5
output = ascii_art.spot_counts_per_image_plot(
refl.select(refl["xyzobs.px.value"].parts()[2] <= 2.5),
char="#",
width=10,
height=15,
)
expected_output = """\
624 spots found on 3 images (max 294 / bin)
#
#
#
#
#
#
##
###
###
###
###
###
###
###
###
1 3"""
output = "\n".join(line.rstrip() for line in output.splitlines())
assert output == expected_output
| 33.031496
| 88
| 0.575924
| 341
| 4,195
| 6.935484
| 0.266862
| 0.016913
| 0.021564
| 0.02537
| 0.81945
| 0.810148
| 0.810148
| 0.804228
| 0.775476
| 0.702748
| 0
| 0.029524
| 0.184505
| 4,195
| 126
| 89
| 33.293651
| 0.661795
| 0.024553
| 0
| 0.663717
| 0
| 0.00885
| 0.624603
| 0.386403
| 0
| 1
| 0
| 0
| 0.044248
| 1
| 0.00885
| false
| 0
| 0.026549
| 0
| 0.035398
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
ce402f410850974618fa7fc7ea5af82c7b86ae3e
| 8,650
|
py
|
Python
|
tests/test_events.py
|
Phill240/chrome-remote-interface-py
|
285172f369c2210d986545aa99450a672ed847e6
|
[
"Apache-2.0"
] | 5
|
2018-11-10T01:02:23.000Z
|
2020-08-13T19:02:08.000Z
|
tests/test_events.py
|
Phill240/chrome-remote-interface-py
|
285172f369c2210d986545aa99450a672ed847e6
|
[
"Apache-2.0"
] | 2
|
2018-11-10T01:01:42.000Z
|
2018-11-10T01:02:53.000Z
|
tests/test_events.py
|
Phill240/chrome-remote-interface-py
|
285172f369c2210d986545aa99450a672ed847e6
|
[
"Apache-2.0"
] | 3
|
2019-11-01T21:17:51.000Z
|
2021-07-16T02:58:53.000Z
|
from asyncio import AbstractEventLoop
import pytest
from cripy.cdp import connect, CDP
from cripy.client import Client
from .helpers import Cleaner
@pytest.mark.usefixtures("chrome")
class TestEventsLocal:
@pytest.mark.asyncio
async def test_event_client_on_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(url=self.wsurl)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.on("Network.requestWillBeSent", listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb(self, mr_clean: Cleaner, event_loop: AbstractEventLoop):
future = event_loop.create_future()
client = await connect(url=self.wsurl)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.Network.requestWillBeSent(listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb_removable(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client: Client = await connect(url=self.wsurl)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
remove = client.Network.requestWillBeSent(listener)
assert remove is not None and callable(remove)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
remove()
assert len(client.listeners("Network.requestWillBeSent")) == 0
@pytest.mark.asyncio
async def test_event_client_once_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(url=self.wsurl)
mr_clean.add_disposable(client)
client.once("Network.requestWillBeSent", lambda x: future.set_result(x))
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_once_promise(self, mr_clean: Cleaner):
client = await connect(url=self.wsurl)
mr_clean.add_disposable(client)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await client.Network.requestWillBeSent() is not None
@pytest.mark.usefixtures("chrome")
class TestEventsRemote:
@pytest.mark.asyncio
async def test_event_client_on_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(url=self.wsurl, remote=True)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.on("Network.requestWillBeSent", listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb(self, mr_clean: Cleaner, event_loop: AbstractEventLoop):
future = event_loop.create_future()
client = await connect(url=self.wsurl, remote=True)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.Network.requestWillBeSent(listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb_removable(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(url=self.wsurl, remote=True)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
remove = client.Network.requestWillBeSent(listener)
assert remove is not None and callable(remove)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
remove()
assert len(client.listeners("Network.requestWillBeSent")) == 0
@pytest.mark.asyncio
async def test_event_client_once_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(url=self.wsurl, remote=True)
mr_clean.add_disposable(client)
client.once("Network.requestWillBeSent", lambda x: future.set_result(x))
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_once_promise(self, mr_clean: Cleaner):
client = await connect(url=self.wsurl, remote=True)
mr_clean.add_disposable(client)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await client.Network.requestWillBeSent() is not None
@pytest.mark.usefixtures("chrome")
class TestEventsSuppliedProto:
@pytest.mark.asyncio
async def test_event_client_on_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(
url=self.wsurl, protocol=await CDP.Protocol(loop=event_loop)
)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.on("Network.requestWillBeSent", listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb(self, mr_clean: Cleaner, event_loop: AbstractEventLoop):
future = event_loop.create_future()
client = await connect(
url=self.wsurl, protocol=await CDP.Protocol(loop=event_loop)
)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
client.Network.requestWillBeSent(listener)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_on_cb_removable(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client: Client = await connect(
url=self.wsurl, protocol=await CDP.Protocol(loop=event_loop)
)
mr_clean.add_disposable(client)
def listener(x):
if not future.done():
future.set_result(x)
remove = client.Network.requestWillBeSent(listener)
assert remove is not None and callable(remove)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
remove()
assert len(client.listeners("Network.requestWillBeSent")) == 0
@pytest.mark.asyncio
async def test_event_client_once_cb(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
future = event_loop.create_future()
client = await connect(
url=self.wsurl, protocol=await CDP.Protocol(loop=event_loop)
)
mr_clean.add_disposable(client)
client.once("Network.requestWillBeSent", lambda x: future.set_result(x))
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await future is not None
@pytest.mark.asyncio
async def test_event_once_promise(
self, mr_clean: Cleaner, event_loop: AbstractEventLoop
):
client = await connect(
url=self.wsurl, protocol=await CDP.Protocol(loop=event_loop)
)
mr_clean.add_disposable(client)
await client.Network.enable()
await client.Page.navigate("https://google.com")
assert await client.Network.requestWillBeSent() is not None
| 34.462151
| 87
| 0.657457
| 1,034
| 8,650
| 5.352031
| 0.06383
| 0.065595
| 0.058547
| 0.059631
| 0.967655
| 0.961872
| 0.961872
| 0.957174
| 0.957174
| 0.957174
| 0
| 0.000461
| 0.247861
| 8,650
| 250
| 88
| 34.6
| 0.850138
| 0
| 0
| 0.92233
| 0
| 0
| 0.059306
| 0.026012
| 0
| 0
| 0
| 0
| 0.101942
| 1
| 0.043689
| false
| 0
| 0.024272
| 0
| 0.082524
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ce43eec18d773e09810f6cae3cb9bed3f3cf5367
| 115
|
py
|
Python
|
symbolic_dynamics/__init__.py
|
jzc/symbolic-dynamics
|
6396ea6393056286a93ecebe93238b5f502a6f9c
|
[
"MIT"
] | null | null | null |
symbolic_dynamics/__init__.py
|
jzc/symbolic-dynamics
|
6396ea6393056286a93ecebe93238b5f502a6f9c
|
[
"MIT"
] | null | null | null |
symbolic_dynamics/__init__.py
|
jzc/symbolic-dynamics
|
6396ea6393056286a93ecebe93238b5f502a6f9c
|
[
"MIT"
] | null | null | null |
from symbolic_dynamics.sofic import *
from symbolic_dynamics.utils import *
from symbolic_dynamics.graphs import *
| 28.75
| 38
| 0.843478
| 15
| 115
| 6.266667
| 0.466667
| 0.382979
| 0.638298
| 0.553191
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104348
| 115
| 3
| 39
| 38.333333
| 0.912621
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
023217338e6852ec0c89c9e70cee99b3fee9f6a3
| 1,376
|
py
|
Python
|
python/re/logs1.py
|
jtraver/dev
|
c7cd2181594510a8fa27e7325566ed2d79371624
|
[
"MIT"
] | null | null | null |
python/re/logs1.py
|
jtraver/dev
|
c7cd2181594510a8fa27e7325566ed2d79371624
|
[
"MIT"
] | null | null | null |
python/re/logs1.py
|
jtraver/dev
|
c7cd2181594510a8fa27e7325566ed2d79371624
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
import re
def grep_file_match(filename):
# accept = ['INFO']
# accept = ['config']
accept = ['config', '\(partition\)']
apat = '.*' + accept[0] + '.*'
for pat in accept[1:]:
apat += '|' + '.*' + pat + '.*'
print "apat = %s" % str(apat)
accept_regex = re.compile(r'%s' % apat)
print "accept_regex = %s" % str(accept_regex)
file1 = open(filename, 'r')
for line in file1.xreadlines():
line = line.strip()
accept_res = accept_regex.match(line)
# if accept_res != None:
# print "accept_res = %s" % str(accept_res)
if accept_res:
print "%s" % str(line)
def grep_file_search(filename):
# accept = ['INFO']
# accept = ['config']
accept = ['config', '\(partition\)']
apat = accept[0]
for pat in accept[1:]:
apat += '|' + pat
print "apat = %s" % str(apat)
accept_regex = re.compile(r'%s' % apat)
print "accept_regex = %s" % str(accept_regex)
file1 = open(filename, 'r')
for line in file1.xreadlines():
line = line.strip()
accept_res = accept_regex.search(line)
# if accept_res != None:
# print "accept_res = %s" % str(accept_res)
if accept_res:
print "%s" % str(line)
def main():
# grep_file_match('data.txt')
grep_file_search('data.txt')
main()
| 28.081633
| 55
| 0.543605
| 172
| 1,376
| 4.197674
| 0.22093
| 0.124654
| 0.055402
| 0.066482
| 0.847645
| 0.847645
| 0.847645
| 0.847645
| 0.847645
| 0.847645
| 0
| 0.008105
| 0.282703
| 1,376
| 48
| 56
| 28.666667
| 0.723404
| 0.181686
| 0
| 0.625
| 0
| 0
| 0.105735
| 0
| 0.03125
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.03125
| null | null | 0.1875
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0260400042109a4368f9ab1e80cb852cae4a96bc
| 9,109
|
py
|
Python
|
pyqtpp/tests/test_pyqtparser.py
|
mugwort-rc/pyqtpp
|
80343ed83b11e4f491cc6d4f504af5da17353ded
|
[
"Apache-2.0"
] | null | null | null |
pyqtpp/tests/test_pyqtparser.py
|
mugwort-rc/pyqtpp
|
80343ed83b11e4f491cc6d4f504af5da17353ded
|
[
"Apache-2.0"
] | null | null | null |
pyqtpp/tests/test_pyqtparser.py
|
mugwort-rc/pyqtpp
|
80343ed83b11e4f491cc6d4f504af5da17353ded
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
import ast
from ..pyqtparser import (
BasicType, PyQtType, UnknownType,
TypeParser,
PyQtClass, PyQtSignal,
)
class TestBase(object):
def parse_body(self, source):
return ast.parse(source).body[0]
def parse_expr(self, source):
return self.parse_body(source).value
class TestBasicType(TestBase):
def test_bool(self):
node = self.parse_expr('bool')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'bool'
assert type.toStr() == 'bool'
def test_int(self):
node = self.parse_expr('int')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'int'
assert type.toStr() == 'int'
def test_long(self):
node = self.parse_expr('long')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'long'
assert type.toStr() == 'long'
def test_float(self):
node = self.parse_expr('float')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'float'
assert type.toStr() == 'float'
def test_complex(self):
node = self.parse_expr('complex')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'complex'
assert type.toStr() == 'std::complex<double>'
def test_str(self):
node = self.parse_expr('str')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'str'
assert type.toStr() == 'QString'
def test_unicode(self):
node = self.parse_expr('unicode')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'unicode'
assert type.toStr() == 'QString'
def test_tuple(self):
node = self.parse_expr('tuple')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'tuple'
assert type.toStr() == 'QVariant'
def test_list(self):
node = self.parse_expr('list')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'list'
assert type.toStr() == 'QVariant'
def test_dict(self):
node = self.parse_expr('dict')
type = BasicType.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'dict'
assert type.toStr() == 'QVariant'
class TestPyQtType(TestBase):
def test_qobject(self):
node = self.parse_expr('QObject')
type = PyQtType.parse(node)
assert isinstance(type, PyQtType)
assert type.name == 'QObject'
assert type.toStr() == 'QObject'
class TestUnknownType(TestBase):
def test_knowntype(self):
node = self.parse_expr('Qt.QObject')
type = UnknownType.parse(node)
assert isinstance(type, UnknownType)
assert type.name == 'Qt::QObject'
assert type.toStr() == 'Qt::QObject'
def test_unknowntype(self):
node = self.parse_expr('hoge.fuga')
type = UnknownType.parse(node)
assert isinstance(type, UnknownType)
assert type.name == 'hoge::fuga'
assert type.toStr() == 'hoge::fuga'
class TestTypeParser(TestBase):
def test_bool(self):
node = self.parse_expr('bool')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'bool'
assert type.toStr() == 'bool'
def test_int(self):
node = self.parse_expr('int')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'int'
assert type.toStr() == 'int'
def test_long(self):
node = self.parse_expr('long')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'long'
assert type.toStr() == 'long'
def test_float(self):
node = self.parse_expr('float')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'float'
assert type.toStr() == 'float'
def test_complex(self):
node = self.parse_expr('complex')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'complex'
assert type.toStr() == 'std::complex<double>'
def test_str(self):
node = self.parse_expr('str')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'str'
assert type.toStr() == 'QString'
def test_unicode(self):
node = self.parse_expr('unicode')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'unicode'
assert type.toStr() == 'QString'
def test_tuple(self):
node = self.parse_expr('tuple')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'tuple'
assert type.toStr() == 'QVariant'
def test_list(self):
node = self.parse_expr('list')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'list'
assert type.toStr() == 'QVariant'
def test_dict(self):
node = self.parse_expr('dict')
type = TypeParser.parse(node)
assert isinstance(type, BasicType)
assert type.name == 'dict'
assert type.toStr() == 'QVariant'
def test_qobject(self):
node = self.parse_expr('QObject')
type = TypeParser.parse(node)
assert isinstance(type, PyQtType)
assert type.name == 'QObject'
assert type.toStr() == 'QObject'
def test_unknowntype(self):
node = self.parse_expr('hoge.fuga')
type = TypeParser.parse(node)
assert isinstance(type, UnknownType)
assert type.name == 'hoge::fuga'
assert type.toStr() == 'hoge::fuga'
class TestPyQtSignal(TestBase):
def test_signal(self):
node = self.parse_body('signal = pyqtSignal()')
signals = PyQtSignal.parse(node)
assert len(signals) == 1
signal = signals[0]
assert isinstance(signal, PyQtSignal)
assert signal.name == 'signal'
assert len(signal.params) == 0
assert signal.toCppDefinition() == 'void signal();'
def test_signal_with_param(self):
node = self.parse_body('signal = pyqtSignal(int)')
signals = PyQtSignal.parse(node)
assert len(signals) == 1
signal = signals[0]
assert isinstance(signal, PyQtSignal)
assert signal.name == 'signal'
assert len(signal.params) == 1
assert signal.params[0].name == 'int'
assert signal.toCppDefinition() == 'void signal(int);'
def test_signal_with_pyqt_param(self):
node = self.parse_body('signal = pyqtSignal(QObject)')
signals = PyQtSignal.parse(node)
assert len(signals) == 1
signal = signals[0]
assert isinstance(signal, PyQtSignal)
assert signal.name == 'signal'
assert len(signal.params) == 1
assert signal.params[0].name == 'QObject'
assert signal.toCppDefinition() == 'void signal(QObject);'
SIMPLE_CLASS_EXAMPLE = """
class Test:
pass
"""
QOBJECT_BASED_EXAMPLE = """
class Test(QObject): # [0]
signal = QtCore.pyqtSignal(int) # [1]
test = QtCore.pyqtSignal(str) # [2]
"""
class TestPyQtClass(TestBase):
def test_simple_class(self):
node = self.parse_body(SIMPLE_CLASS_EXAMPLE)
cls = PyQtClass.parse(node)
assert len(cls.bases) == 0
assert len(cls.slots) == 0
assert len(cls.signals) == 0
assert len(cls.members) == 0
# header
hpp = cls.toCppHeader()
# name
assert 'class Test {\n' in hpp
assert '\n Test();\n' in hpp
assert '\n ~Test();\n' in hpp
def test_qobject_based(self):
node = self.parse_body(QOBJECT_BASED_EXAMPLE)
cls = PyQtClass.parse(node)
# 0
assert len(cls.bases) == 1
assert cls.bases[0].name == 'QObject'
# 1, 2
assert len(cls.signals) == 2
# 1
assert cls.signals[0].name == 'signal'
assert len(cls.signals[0].params) == 1
assert cls.signals[0].params[0].name == 'int'
# 2
assert cls.signals[1].name == 'test'
assert len(cls.signals[1].params) == 1
assert cls.signals[1].params[0].name == 'str'
# header
hpp = cls.toCppHeader()
# name
assert 'class Test :\n' in hpp
assert '\n Test();\n' in hpp
assert '\n ~Test();\n' in hpp
# inherit
assert '\n public QObject\n{' in hpp
# signals
assert '\nsignals:\n' in hpp
assert '\n void signal(int);\n' in hpp
assert '\n void test(QString);\n' in hpp
| 31.088737
| 66
| 0.589746
| 1,047
| 9,109
| 5.056351
| 0.081184
| 0.094447
| 0.068002
| 0.096335
| 0.819985
| 0.756706
| 0.750283
| 0.739516
| 0.723649
| 0.723649
| 0
| 0.005813
| 0.282358
| 9,109
| 292
| 67
| 31.195205
| 0.804039
| 0.007904
| 0
| 0.728814
| 0
| 0
| 0.107368
| 0.004875
| 0
| 0
| 0
| 0
| 0.487288
| 1
| 0.135593
| false
| 0.004237
| 0.008475
| 0.008475
| 0.182203
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
026db128e319a7e46c662fad6bdce0c8e13d747a
| 2,726
|
py
|
Python
|
tests/test_linked_list.py
|
exterkamps/Python-Data-Structures
|
8594ed934edeaded4866999932384d12fb4519c3
|
[
"Apache-2.0"
] | 3
|
2018-10-15T17:38:29.000Z
|
2021-03-24T02:55:46.000Z
|
tests/test_linked_list.py
|
exterkamp/Python-Data-Structures
|
8594ed934edeaded4866999932384d12fb4519c3
|
[
"Apache-2.0"
] | null | null | null |
tests/test_linked_list.py
|
exterkamp/Python-Data-Structures
|
8594ed934edeaded4866999932384d12fb4519c3
|
[
"Apache-2.0"
] | null | null | null |
import unittest
from structures.linked_list import ListNode
class TestLinkedList(unittest.TestCase):
def test_ll_contains_cycle(self):
head = ListNode(3)
head.next = ListNode(4)
head.next.next = ListNode(5)
cycle_start = ListNode(6)
head.next.next.next = cycle_start
cycle_start.next = ListNode(7)
cycle_start.next.next = ListNode(8)
cycle_start.next.next.next = cycle_start
self.assertTrue(head.contains_cycle())
def test_ll_no_cycle(self):
head = ListNode(3)
head.next = ListNode(4)
head.next.next = ListNode(5)
cycle_start = ListNode(6)
head.next.next.next = cycle_start
cycle_start.next = ListNode(7)
cycle_start.next.next = ListNode(8)
self.assertFalse(head.contains_cycle())
def test_ll_cycle_on_single_node(self):
self.assertFalse(ListNode(1).contains_cycle())
def test_ll_get_cycle_start(self):
head = ListNode(3)
head.next = ListNode(4)
head.next.next = ListNode(5)
cycle_start = ListNode(6)
head.next.next.next = cycle_start
cycle_start.next = ListNode(7)
cycle_start.next.next = ListNode(8)
cycle_start.next.next.next = cycle_start
self.assertEqual(cycle_start, head.get_beginning_of_cycle_if_exists())
def test_ll_get_cycle_start_no_cycle(self):
head = ListNode(3)
head.next = ListNode(4)
head.next.next = ListNode(5)
cycle_start = ListNode(6)
head.next.next.next = cycle_start
cycle_start.next = ListNode(7)
cycle_start.next.next = ListNode(8)
self.assertEqual(None, head.get_beginning_of_cycle_if_exists())
def test_ll_get_cycle_start_on_single_node(self):
self.assertEqual(None, ListNode(1).get_beginning_of_cycle_if_exists())
def test_reverse(self):
head = ListNode(1)
head.next = ListNode(2)
head.next.next = ListNode(3)
self.assertEqual(1, head.val)
self.assertEqual(2, head.next.val)
self.assertEqual(3, head.next.next.val)
head = head.reverse()
self.assertEqual(3, head.val)
self.assertEqual(2, head.next.val)
self.assertEqual(1, head.next.next.val)
def test_reverse_recursive(self):
head = ListNode(1)
head.next = ListNode(2)
head.next.next = ListNode(3)
self.assertEqual(1, head.val)
self.assertEqual(2, head.next.val)
self.assertEqual(3, head.next.next.val)
head = head.reverse_recursive()
self.assertEqual(3, head.val)
self.assertEqual(2, head.next.val)
self.assertEqual(1, head.next.next.val)
| 34.075
| 78
| 0.642333
| 364
| 2,726
| 4.612637
| 0.118132
| 0.123883
| 0.10006
| 0.071471
| 0.851697
| 0.820131
| 0.776057
| 0.776057
| 0.755807
| 0.755807
| 0
| 0.021495
| 0.249083
| 2,726
| 80
| 79
| 34.075
| 0.79873
| 0
| 0
| 0.716418
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.268657
| 1
| 0.119403
| false
| 0
| 0.029851
| 0
| 0.164179
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
5a336f4c6ca439f75d46a4dcef31c72d329fb43b
| 9,953
|
py
|
Python
|
test/old_tests/_test_zserializers.py
|
syaiful6/aerospike-client-python
|
59fa0d36aa899a164282643fe49b27d12aaf323f
|
[
"Apache-2.0"
] | 105
|
2015-01-07T09:51:13.000Z
|
2022-03-24T04:23:54.000Z
|
test/old_tests/_test_zserializers.py
|
syaiful6/aerospike-client-python
|
59fa0d36aa899a164282643fe49b27d12aaf323f
|
[
"Apache-2.0"
] | 180
|
2015-01-01T19:29:50.000Z
|
2022-03-19T14:14:06.000Z
|
test/old_tests/_test_zserializers.py
|
syaiful6/aerospike-client-python
|
59fa0d36aa899a164282643fe49b27d12aaf323f
|
[
"Apache-2.0"
] | 94
|
2015-01-21T19:17:48.000Z
|
2022-01-31T07:17:47.000Z
|
# -*- coding: utf-8 -*-
import pytest
import sys
import marshal
import json
from .test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys.exit(1)
from aerospike import exception as e
class SomeClass(object):
pass
class TestPythonSerializer(object):
def setup_class(cls):
"""
Setup class
"""
hostlist, user, password = TestBaseClass.get_hosts()
config = {'hosts': hostlist}
if user is None and password is None:
TestPythonSerializer.client = aerospike.client(config).connect()
else:
TestPythonSerializer.client = aerospike.client(config).connect(user, password)
# Unset previously set class serializers if set
aerospike.unset_serializers()
def teardown_class(cls):
TestPythonSerializer.client.close()
def setup_method(self, method):
"""
Setup method
"""
self.delete_keys = []
def teardown_method(self, method):
"""
Teardown method
"""
for key in self.delete_keys:
try:
TestPythonSerializer.client.remove(key)
except:
pass
def test_instance_serializer_and_no_class_serializer(self):
"""
Invoke put() for record with no class serializer. There is an
instance serializer
"""
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist,
'serialization': ((lambda v: json.dumps(v)),
(lambda v: json.loads(v)))}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 11)
try:
client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER)
assert res == 0
_, _, bins = client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': [1, 2, 3]}
client.remove(key)
client.close()
def test_builtin_with_instance_serializer_and_no_class_serializer(self):
"""
Invoke put() for data record with builtin serializer and an
instance serializer set
"""
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist,
'serialization': ((lambda v: json.dumps(v)),
(lambda v: json.loads(v)))}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 12)
try:
client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)
assert res == 0
_, _, bins = client.get(key)
assert bins == {'normal': 1234, 'tuple': (1, 2, 3)}
client.remove(key)
client.close()
def test_builtin_with_class_serializer(self):
"""
Invoke put() for mixed data record with builtin serializer
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
key = ('test', 'demo', 13)
try:
TestPythonSerializer.client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = TestPythonSerializer.client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)
assert res == 0
_, _, bins = TestPythonSerializer.client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': (1, 2, 3)}
self.delete_keys.append(key)
def test_with_class_serializer(self):
"""
Invoke put() for mixed data record with class serializer.
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
key = ('test', 'demo', 14)
try:
TestPythonSerializer.client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = TestPythonSerializer.client.put(key, rec, serializer=aerospike.SERIALIZER_USER)
assert res == 0
_, _, bins = TestPythonSerializer.client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': [1, 2, 3]}
self.delete_keys.append(key)
def test_builtin_with_class_serializer_and_instance_serializer(self):
"""
Invoke put() for mixed data record with python serializer.
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist,
'serialization': ((lambda v: marshal.dumps(v)),
(lambda v: marshal.loads(v)))}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 15)
try:
client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)
assert res == 0
_, _, bins = TestPythonSerializer.client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': (1, 2, 3)}
client.remove(key)
def test_with_class_serializer_and_instance_serializer(self):
pytest.xfail(reason="Serialization of Bytes not functional")
"""
Invoke put() for mixed data record with class and instance serializer.
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist,
'serialization': ((lambda v: marshal.dumps(v)),
(lambda v: marshal.loads(v)))}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 16)
try:
TestPythonSerializer.client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER)
assert res == 0
_, _, bins = client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': (1, 2, 3)}
client.remove(key)
def test_with_class_serializer_and_instance_serializer_with_unset_serializer(self):
"""
Invoke put() for mixed data record with python serializer.
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist
}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 16)
try:
TestPythonSerializer.client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
aerospike.unset_serializers()
try:
client.put(key, rec, serializer=aerospike.SERIALIZER_USER)
except e.ClientError as exception:
assert exception.code == -1
assert exception.msg == "No serializer callback registered"
def test_with_unset_serializer_python_serializer(self):
"""
Invoke put() for mixed data record with python serializer and
calling unset_serializers
"""
aerospike.set_serializer((lambda v: json.dumps(v)))
aerospike.set_deserializer((lambda v: json.loads(v)))
hostlist, user, password = TestBaseClass.get_hosts()
method_config = {
'hosts': hostlist
}
if user is None and password is None:
client = aerospike.client(method_config).connect()
else:
client = aerospike.client(method_config).connect(user, password)
key = ('test', 'demo', 16)
try:
client.remove(key)
except:
pass
rec = {'normal': 1234, 'tuple': (1, 2, 3)}
aerospike.unset_serializers()
res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)
assert res == 0
_, _, bins = client.get(key)
# tuples JSON-encode to a list, and we use this fact to check which
# serializer ran:
assert bins == {'normal': 1234, 'tuple': (1, 2, 3)}
client.remove(key)
| 32.848185
| 95
| 0.581835
| 1,105
| 9,953
| 5.131222
| 0.108597
| 0.024691
| 0.031041
| 0.042328
| 0.845503
| 0.838801
| 0.811287
| 0.796825
| 0.781129
| 0.781129
| 0
| 0.018994
| 0.307043
| 9,953
| 302
| 96
| 32.956954
| 0.803103
| 0.109515
| 0
| 0.777778
| 0
| 0
| 0.051125
| 0
| 0
| 0
| 0
| 0
| 0.080808
| 1
| 0.060606
| false
| 0.156566
| 0.040404
| 0
| 0.111111
| 0.005051
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
5a4e3eca3aaa4d96723c9a6d2696754b25cde641
| 218
|
py
|
Python
|
src/lesson_modules_and_packages/extension/pkgutil_os_specific.py
|
jasonwee/asus-rt-n14uhp-mrtg
|
4fa96c3406e32ea6631ce447db6d19d70b2cd061
|
[
"Apache-2.0"
] | 3
|
2018-08-14T09:33:52.000Z
|
2022-03-21T12:31:58.000Z
|
src/lesson_modules_and_packages/extension/pkgutil_os_specific.py
|
jasonwee/asus-rt-n14uhp-mrtg
|
4fa96c3406e32ea6631ce447db6d19d70b2cd061
|
[
"Apache-2.0"
] | null | null | null |
src/lesson_modules_and_packages/extension/pkgutil_os_specific.py
|
jasonwee/asus-rt-n14uhp-mrtg
|
4fa96c3406e32ea6631ce447db6d19d70b2cd061
|
[
"Apache-2.0"
] | null | null | null |
import demopkg1
print('demopkg1:', demopkg1.__file__)
import demopkg1.shared
print('demopkg1.shared:', demopkg1.shared.__file__)
import demopkg1.not_shared
print('demopkg1.not_shared:', demopkg1.not_shared.__file__)
| 24.222222
| 59
| 0.811927
| 27
| 218
| 6
| 0.222222
| 0.259259
| 0.314815
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.044118
| 0.06422
| 218
| 8
| 60
| 27.25
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.206422
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 7
|
5a7193a549b4cf4736f2c45e5f85b808d452c005
| 40,143
|
py
|
Python
|
operators/resource-locker-operator/python/pulumi_pulumi_kubernetes_crds_operators_resource_locker_operator/redhatcop/v1alpha1/_inputs.py
|
pulumi/pulumi-kubernetes-crds
|
372c4c0182f6b899af82d6edaad521aa14f22150
|
[
"Apache-2.0"
] | null | null | null |
operators/resource-locker-operator/python/pulumi_pulumi_kubernetes_crds_operators_resource_locker_operator/redhatcop/v1alpha1/_inputs.py
|
pulumi/pulumi-kubernetes-crds
|
372c4c0182f6b899af82d6edaad521aa14f22150
|
[
"Apache-2.0"
] | 2
|
2020-09-18T17:12:23.000Z
|
2020-12-30T19:40:56.000Z
|
operators/resource-locker-operator/python/pulumi_pulumi_kubernetes_crds_operators_resource_locker_operator/redhatcop/v1alpha1/_inputs.py
|
pulumi/pulumi-kubernetes-crds
|
372c4c0182f6b899af82d6edaad521aa14f22150
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = [
'ResourceLockerSpecArgs',
'ResourceLockerSpecPatchesArgs',
'ResourceLockerSpecPatchesSourceObjectRefsArgs',
'ResourceLockerSpecPatchesTargetObjectRefArgs',
'ResourceLockerSpecResourcesArgs',
'ResourceLockerSpecServiceAccountRefArgs',
'ResourceLockerStatusArgs',
'ResourceLockerStatusConditionsArgs',
'ResourceLockerStatusLockedPatchStatusesArgs',
'ResourceLockerStatusLockedResourceStatusesArgs',
]
@pulumi.input_type
class ResourceLockerSpecArgs:
def __init__(__self__, *,
patches: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesArgs']]]] = None,
resources: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecResourcesArgs']]]] = None,
service_account_ref: Optional[pulumi.Input['ResourceLockerSpecServiceAccountRefArgs']] = None):
"""
ResourceLockerSpec defines the desired state of ResourceLocker
:param pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesArgs']]] patches: Patches is a list of patches that should be enforced at runtime.
:param pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecResourcesArgs']]] resources: Resources is a list of resource manifests that should be locked into the specified configuration
:param pulumi.Input['ResourceLockerSpecServiceAccountRefArgs'] service_account_ref: ServiceAccountRef is the service account to be used to run the controllers associated with this configuration kubebuilder:default:="{Name: "default"}"
"""
if patches is not None:
pulumi.set(__self__, "patches", patches)
if resources is not None:
pulumi.set(__self__, "resources", resources)
if service_account_ref is not None:
pulumi.set(__self__, "service_account_ref", service_account_ref)
@property
@pulumi.getter
def patches(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesArgs']]]]:
"""
Patches is a list of patches that should be enforced at runtime.
"""
return pulumi.get(self, "patches")
@patches.setter
def patches(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesArgs']]]]):
pulumi.set(self, "patches", value)
@property
@pulumi.getter
def resources(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecResourcesArgs']]]]:
"""
Resources is a list of resource manifests that should be locked into the specified configuration
"""
return pulumi.get(self, "resources")
@resources.setter
def resources(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecResourcesArgs']]]]):
pulumi.set(self, "resources", value)
@property
@pulumi.getter(name="serviceAccountRef")
def service_account_ref(self) -> Optional[pulumi.Input['ResourceLockerSpecServiceAccountRefArgs']]:
"""
ServiceAccountRef is the service account to be used to run the controllers associated with this configuration kubebuilder:default:="{Name: "default"}"
"""
return pulumi.get(self, "service_account_ref")
@service_account_ref.setter
def service_account_ref(self, value: Optional[pulumi.Input['ResourceLockerSpecServiceAccountRefArgs']]):
pulumi.set(self, "service_account_ref", value)
@pulumi.input_type
class ResourceLockerSpecPatchesArgs:
def __init__(__self__, *,
id: pulumi.Input[str],
patch_template: pulumi.Input[str],
target_object_ref: pulumi.Input['ResourceLockerSpecPatchesTargetObjectRefArgs'],
patch_type: Optional[pulumi.Input[str]] = None,
source_object_refs: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesSourceObjectRefsArgs']]]] = None):
"""
Patch describe a patch to be enforced at runtime
:param pulumi.Input[str] id: ID represent a unique identifier for the patch in the array of patches oc this CR
:param pulumi.Input[str] patch_template: PatchTemplate is a go template that will be resolved using the SourceObjectRefs as parameters. The result must be a valid patch based on the patch type and the target object.
:param pulumi.Input['ResourceLockerSpecPatchesTargetObjectRefArgs'] target_object_ref: TargetObjectRef is a reference to the object to which the patch should be applied.
:param pulumi.Input[str] patch_type: PatchType is the type of patch to be applied, one of "application/json-patch+json"'"application/merge-patch+json","application/strategic-merge-patch+json","application/apply-patch+yaml" kubebuilder:default:="application/strategic-merge-patch+json"
:param pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesSourceObjectRefsArgs']]] source_object_refs: SourceObject refs is an array of references to source objects that will be used as input for the template processing
"""
pulumi.set(__self__, "id", id)
pulumi.set(__self__, "patch_template", patch_template)
pulumi.set(__self__, "target_object_ref", target_object_ref)
if patch_type is not None:
pulumi.set(__self__, "patch_type", patch_type)
if source_object_refs is not None:
pulumi.set(__self__, "source_object_refs", source_object_refs)
@property
@pulumi.getter
def id(self) -> pulumi.Input[str]:
"""
ID represent a unique identifier for the patch in the array of patches oc this CR
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: pulumi.Input[str]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="patchTemplate")
def patch_template(self) -> pulumi.Input[str]:
"""
PatchTemplate is a go template that will be resolved using the SourceObjectRefs as parameters. The result must be a valid patch based on the patch type and the target object.
"""
return pulumi.get(self, "patch_template")
@patch_template.setter
def patch_template(self, value: pulumi.Input[str]):
pulumi.set(self, "patch_template", value)
@property
@pulumi.getter(name="targetObjectRef")
def target_object_ref(self) -> pulumi.Input['ResourceLockerSpecPatchesTargetObjectRefArgs']:
"""
TargetObjectRef is a reference to the object to which the patch should be applied.
"""
return pulumi.get(self, "target_object_ref")
@target_object_ref.setter
def target_object_ref(self, value: pulumi.Input['ResourceLockerSpecPatchesTargetObjectRefArgs']):
pulumi.set(self, "target_object_ref", value)
@property
@pulumi.getter(name="patchType")
def patch_type(self) -> Optional[pulumi.Input[str]]:
"""
PatchType is the type of patch to be applied, one of "application/json-patch+json"'"application/merge-patch+json","application/strategic-merge-patch+json","application/apply-patch+yaml" kubebuilder:default:="application/strategic-merge-patch+json"
"""
return pulumi.get(self, "patch_type")
@patch_type.setter
def patch_type(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "patch_type", value)
@property
@pulumi.getter(name="sourceObjectRefs")
def source_object_refs(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesSourceObjectRefsArgs']]]]:
"""
SourceObject refs is an array of references to source objects that will be used as input for the template processing
"""
return pulumi.get(self, "source_object_refs")
@source_object_refs.setter
def source_object_refs(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerSpecPatchesSourceObjectRefsArgs']]]]):
pulumi.set(self, "source_object_refs", value)
@pulumi.input_type
class ResourceLockerSpecPatchesSourceObjectRefsArgs:
def __init__(__self__, *,
api_version: Optional[pulumi.Input[str]] = None,
field_path: Optional[pulumi.Input[str]] = None,
kind: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
resource_version: Optional[pulumi.Input[str]] = None,
uid: Optional[pulumi.Input[str]] = None):
"""
ObjectReference contains enough information to let you inspect or modify the referred object. --- New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. 1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage. 2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". Those cannot be well described when embedded. 3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. 4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple and the version of the actual struct is irrelevant. 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. Instead of using this type, create a locally provided and used type that is well-focused on your reference. For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .
:param pulumi.Input[str] api_version: API version of the referent.
:param pulumi.Input[str] field_path: If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.
:param pulumi.Input[str] kind: Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
:param pulumi.Input[str] name: Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
:param pulumi.Input[str] namespace: Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
:param pulumi.Input[str] resource_version: Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
:param pulumi.Input[str] uid: UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
"""
if api_version is not None:
pulumi.set(__self__, "api_version", api_version)
if field_path is not None:
pulumi.set(__self__, "field_path", field_path)
if kind is not None:
pulumi.set(__self__, "kind", kind)
if name is not None:
pulumi.set(__self__, "name", name)
if namespace is not None:
pulumi.set(__self__, "namespace", namespace)
if resource_version is not None:
pulumi.set(__self__, "resource_version", resource_version)
if uid is not None:
pulumi.set(__self__, "uid", uid)
@property
@pulumi.getter(name="apiVersion")
def api_version(self) -> Optional[pulumi.Input[str]]:
"""
API version of the referent.
"""
return pulumi.get(self, "api_version")
@api_version.setter
def api_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "api_version", value)
@property
@pulumi.getter(name="fieldPath")
def field_path(self) -> Optional[pulumi.Input[str]]:
"""
If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.
"""
return pulumi.get(self, "field_path")
@field_path.setter
def field_path(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "field_path", value)
@property
@pulumi.getter
def kind(self) -> Optional[pulumi.Input[str]]:
"""
Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
"""
return pulumi.get(self, "kind")
@kind.setter
def kind(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "kind", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def namespace(self) -> Optional[pulumi.Input[str]]:
"""
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
"""
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "namespace", value)
@property
@pulumi.getter(name="resourceVersion")
def resource_version(self) -> Optional[pulumi.Input[str]]:
"""
Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
"""
return pulumi.get(self, "resource_version")
@resource_version.setter
def resource_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_version", value)
@property
@pulumi.getter
def uid(self) -> Optional[pulumi.Input[str]]:
"""
UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
"""
return pulumi.get(self, "uid")
@uid.setter
def uid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "uid", value)
@pulumi.input_type
class ResourceLockerSpecPatchesTargetObjectRefArgs:
def __init__(__self__, *,
api_version: Optional[pulumi.Input[str]] = None,
field_path: Optional[pulumi.Input[str]] = None,
kind: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
resource_version: Optional[pulumi.Input[str]] = None,
uid: Optional[pulumi.Input[str]] = None):
"""
TargetObjectRef is a reference to the object to which the patch should be applied.
:param pulumi.Input[str] api_version: API version of the referent.
:param pulumi.Input[str] field_path: If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.
:param pulumi.Input[str] kind: Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
:param pulumi.Input[str] name: Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
:param pulumi.Input[str] namespace: Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
:param pulumi.Input[str] resource_version: Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
:param pulumi.Input[str] uid: UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
"""
if api_version is not None:
pulumi.set(__self__, "api_version", api_version)
if field_path is not None:
pulumi.set(__self__, "field_path", field_path)
if kind is not None:
pulumi.set(__self__, "kind", kind)
if name is not None:
pulumi.set(__self__, "name", name)
if namespace is not None:
pulumi.set(__self__, "namespace", namespace)
if resource_version is not None:
pulumi.set(__self__, "resource_version", resource_version)
if uid is not None:
pulumi.set(__self__, "uid", uid)
@property
@pulumi.getter(name="apiVersion")
def api_version(self) -> Optional[pulumi.Input[str]]:
"""
API version of the referent.
"""
return pulumi.get(self, "api_version")
@api_version.setter
def api_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "api_version", value)
@property
@pulumi.getter(name="fieldPath")
def field_path(self) -> Optional[pulumi.Input[str]]:
"""
If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.
"""
return pulumi.get(self, "field_path")
@field_path.setter
def field_path(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "field_path", value)
@property
@pulumi.getter
def kind(self) -> Optional[pulumi.Input[str]]:
"""
Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
"""
return pulumi.get(self, "kind")
@kind.setter
def kind(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "kind", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def namespace(self) -> Optional[pulumi.Input[str]]:
"""
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
"""
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "namespace", value)
@property
@pulumi.getter(name="resourceVersion")
def resource_version(self) -> Optional[pulumi.Input[str]]:
"""
Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
"""
return pulumi.get(self, "resource_version")
@resource_version.setter
def resource_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_version", value)
@property
@pulumi.getter
def uid(self) -> Optional[pulumi.Input[str]]:
"""
UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
"""
return pulumi.get(self, "uid")
@uid.setter
def uid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "uid", value)
@pulumi.input_type
class ResourceLockerSpecResourcesArgs:
def __init__(__self__, *,
object: pulumi.Input[Mapping[str, Any]],
excluded_paths: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
Resource represent a resource to be enforced
"""
pulumi.set(__self__, "object", object)
if excluded_paths is not None:
pulumi.set(__self__, "excluded_paths", excluded_paths)
@property
@pulumi.getter
def object(self) -> pulumi.Input[Mapping[str, Any]]:
return pulumi.get(self, "object")
@object.setter
def object(self, value: pulumi.Input[Mapping[str, Any]]):
pulumi.set(self, "object", value)
@property
@pulumi.getter(name="excludedPaths")
def excluded_paths(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "excluded_paths")
@excluded_paths.setter
def excluded_paths(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "excluded_paths", value)
@pulumi.input_type
class ResourceLockerSpecServiceAccountRefArgs:
def __init__(__self__, *,
name: Optional[pulumi.Input[str]] = None):
"""
ServiceAccountRef is the service account to be used to run the controllers associated with this configuration kubebuilder:default:="{Name: "default"}"
:param pulumi.Input[str] name: Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
"""
if name is not None:
pulumi.set(__self__, "name", name)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@pulumi.input_type
class ResourceLockerStatusArgs:
def __init__(__self__, *,
conditions: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusConditionsArgs']]]] = None,
locked_patch_statuses: Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedPatchStatusesArgs']]]]]] = None,
locked_resource_statuses: Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedResourceStatusesArgs']]]]]] = None):
"""
ResourceLockerStatus defines the observed state of ResourceLocker
:param pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusConditionsArgs']]] conditions: ReconcileStatus this is the general status of the main reconciler
:param pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedPatchStatusesArgs']]]]] locked_patch_statuses: LockedResourceStatuses contains the reconcile status for each of the managed resources
:param pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedResourceStatusesArgs']]]]] locked_resource_statuses: LockedResourceStatuses contains the reconcile status for each of the managed resources
"""
if conditions is not None:
pulumi.set(__self__, "conditions", conditions)
if locked_patch_statuses is not None:
pulumi.set(__self__, "locked_patch_statuses", locked_patch_statuses)
if locked_resource_statuses is not None:
pulumi.set(__self__, "locked_resource_statuses", locked_resource_statuses)
@property
@pulumi.getter
def conditions(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusConditionsArgs']]]]:
"""
ReconcileStatus this is the general status of the main reconciler
"""
return pulumi.get(self, "conditions")
@conditions.setter
def conditions(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusConditionsArgs']]]]):
pulumi.set(self, "conditions", value)
@property
@pulumi.getter(name="lockedPatchStatuses")
def locked_patch_statuses(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedPatchStatusesArgs']]]]]]:
"""
LockedResourceStatuses contains the reconcile status for each of the managed resources
"""
return pulumi.get(self, "locked_patch_statuses")
@locked_patch_statuses.setter
def locked_patch_statuses(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedPatchStatusesArgs']]]]]]):
pulumi.set(self, "locked_patch_statuses", value)
@property
@pulumi.getter(name="lockedResourceStatuses")
def locked_resource_statuses(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedResourceStatusesArgs']]]]]]:
"""
LockedResourceStatuses contains the reconcile status for each of the managed resources
"""
return pulumi.get(self, "locked_resource_statuses")
@locked_resource_statuses.setter
def locked_resource_statuses(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['ResourceLockerStatusLockedResourceStatusesArgs']]]]]]):
pulumi.set(self, "locked_resource_statuses", value)
@pulumi.input_type
class ResourceLockerStatusConditionsArgs:
def __init__(__self__, *,
status: pulumi.Input[str],
type: pulumi.Input[str],
last_transition_time: Optional[pulumi.Input[str]] = None,
message: Optional[pulumi.Input[str]] = None,
reason: Optional[pulumi.Input[str]] = None):
"""
Condition represents an observation of an object's state. Conditions are an extension mechanism intended to be used when the details of an observation are not a priori known or would not apply to all instances of a given Kind.
Conditions should be added to explicitly convey properties that users and components care about rather than requiring those properties to be inferred from other observations. Once defined, the meaning of a Condition can not be changed arbitrarily - it becomes part of the API, and has the same backwards- and forwards-compatibility concerns of any other part of the API.
:param pulumi.Input[str] type: ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
:param pulumi.Input[str] reason: ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
pulumi.set(__self__, "status", status)
pulumi.set(__self__, "type", type)
if last_transition_time is not None:
pulumi.set(__self__, "last_transition_time", last_transition_time)
if message is not None:
pulumi.set(__self__, "message", message)
if reason is not None:
pulumi.set(__self__, "reason", reason)
@property
@pulumi.getter
def status(self) -> pulumi.Input[str]:
return pulumi.get(self, "status")
@status.setter
def status(self, value: pulumi.Input[str]):
pulumi.set(self, "status", value)
@property
@pulumi.getter
def type(self) -> pulumi.Input[str]:
"""
ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
"""
return pulumi.get(self, "type")
@type.setter
def type(self, value: pulumi.Input[str]):
pulumi.set(self, "type", value)
@property
@pulumi.getter(name="lastTransitionTime")
def last_transition_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "last_transition_time")
@last_transition_time.setter
def last_transition_time(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "last_transition_time", value)
@property
@pulumi.getter
def message(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "message")
@message.setter
def message(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "message", value)
@property
@pulumi.getter
def reason(self) -> Optional[pulumi.Input[str]]:
"""
ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
return pulumi.get(self, "reason")
@reason.setter
def reason(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "reason", value)
@pulumi.input_type
class ResourceLockerStatusLockedPatchStatusesArgs:
def __init__(__self__, *,
status: pulumi.Input[str],
type: pulumi.Input[str],
last_transition_time: Optional[pulumi.Input[str]] = None,
message: Optional[pulumi.Input[str]] = None,
reason: Optional[pulumi.Input[str]] = None):
"""
Condition represents an observation of an object's state. Conditions are an extension mechanism intended to be used when the details of an observation are not a priori known or would not apply to all instances of a given Kind.
Conditions should be added to explicitly convey properties that users and components care about rather than requiring those properties to be inferred from other observations. Once defined, the meaning of a Condition can not be changed arbitrarily - it becomes part of the API, and has the same backwards- and forwards-compatibility concerns of any other part of the API.
:param pulumi.Input[str] type: ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
:param pulumi.Input[str] reason: ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
pulumi.set(__self__, "status", status)
pulumi.set(__self__, "type", type)
if last_transition_time is not None:
pulumi.set(__self__, "last_transition_time", last_transition_time)
if message is not None:
pulumi.set(__self__, "message", message)
if reason is not None:
pulumi.set(__self__, "reason", reason)
@property
@pulumi.getter
def status(self) -> pulumi.Input[str]:
return pulumi.get(self, "status")
@status.setter
def status(self, value: pulumi.Input[str]):
pulumi.set(self, "status", value)
@property
@pulumi.getter
def type(self) -> pulumi.Input[str]:
"""
ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
"""
return pulumi.get(self, "type")
@type.setter
def type(self, value: pulumi.Input[str]):
pulumi.set(self, "type", value)
@property
@pulumi.getter(name="lastTransitionTime")
def last_transition_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "last_transition_time")
@last_transition_time.setter
def last_transition_time(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "last_transition_time", value)
@property
@pulumi.getter
def message(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "message")
@message.setter
def message(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "message", value)
@property
@pulumi.getter
def reason(self) -> Optional[pulumi.Input[str]]:
"""
ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
return pulumi.get(self, "reason")
@reason.setter
def reason(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "reason", value)
@pulumi.input_type
class ResourceLockerStatusLockedResourceStatusesArgs:
def __init__(__self__, *,
status: pulumi.Input[str],
type: pulumi.Input[str],
last_transition_time: Optional[pulumi.Input[str]] = None,
message: Optional[pulumi.Input[str]] = None,
reason: Optional[pulumi.Input[str]] = None):
"""
Condition represents an observation of an object's state. Conditions are an extension mechanism intended to be used when the details of an observation are not a priori known or would not apply to all instances of a given Kind.
Conditions should be added to explicitly convey properties that users and components care about rather than requiring those properties to be inferred from other observations. Once defined, the meaning of a Condition can not be changed arbitrarily - it becomes part of the API, and has the same backwards- and forwards-compatibility concerns of any other part of the API.
:param pulumi.Input[str] type: ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
:param pulumi.Input[str] reason: ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
pulumi.set(__self__, "status", status)
pulumi.set(__self__, "type", type)
if last_transition_time is not None:
pulumi.set(__self__, "last_transition_time", last_transition_time)
if message is not None:
pulumi.set(__self__, "message", message)
if reason is not None:
pulumi.set(__self__, "reason", reason)
@property
@pulumi.getter
def status(self) -> pulumi.Input[str]:
return pulumi.get(self, "status")
@status.setter
def status(self, value: pulumi.Input[str]):
pulumi.set(self, "status", value)
@property
@pulumi.getter
def type(self) -> pulumi.Input[str]:
"""
ConditionType is the type of the condition and is typically a CamelCased word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".
"""
return pulumi.get(self, "type")
@type.setter
def type(self, value: pulumi.Input[str]):
pulumi.set(self, "type", value)
@property
@pulumi.getter(name="lastTransitionTime")
def last_transition_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "last_transition_time")
@last_transition_time.setter
def last_transition_time(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "last_transition_time", value)
@property
@pulumi.getter
def message(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "message")
@message.setter
def message(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "message", value)
@property
@pulumi.getter
def reason(self) -> Optional[pulumi.Input[str]]:
"""
ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.
"""
return pulumi.get(self, "reason")
@reason.setter
def reason(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "reason", value)
| 53.738956
| 1,601
| 0.696286
| 5,071
| 40,143
| 5.411753
| 0.084007
| 0.082571
| 0.064279
| 0.060125
| 0.849652
| 0.813978
| 0.795795
| 0.746347
| 0.732537
| 0.726852
| 0
| 0.001441
| 0.204942
| 40,143
| 746
| 1,602
| 53.810992
| 0.85841
| 0.431408
| 0
| 0.708779
| 1
| 0
| 0.129611
| 0.067221
| 0
| 0
| 0
| 0.008043
| 0
| 1
| 0.205567
| false
| 0
| 0.010707
| 0.023555
| 0.329764
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
5a813dd58362f7a7bd6f293991c803bd79ba2e11
| 2,305
|
py
|
Python
|
mundo3-EstruturasCompostas/095-aprimorandoOsDicionarios.py
|
jonasht/CursoEmVideo-CursoDePython3
|
a1bbf1fe4226b1828213742ee5a440278d903fd1
|
[
"MIT"
] | null | null | null |
mundo3-EstruturasCompostas/095-aprimorandoOsDicionarios.py
|
jonasht/CursoEmVideo-CursoDePython3
|
a1bbf1fe4226b1828213742ee5a440278d903fd1
|
[
"MIT"
] | null | null | null |
mundo3-EstruturasCompostas/095-aprimorandoOsDicionarios.py
|
jonasht/CursoEmVideo-CursoDePython3
|
a1bbf1fe4226b1828213742ee5a440278d903fd1
|
[
"MIT"
] | null | null | null |
dados = dict()
time = list()
qtd_gols = list()
def l(): print('\n'+'=-'*25+'=')
l()
while True:
dados.clear()
dados['nome'] = input('nome do jogador: ')
qtd_partida = int(input('quantas partidas:'))
qtd_gols.clear()
for i in range(qtd_partida):
qtd_gols.append(int(input(f'quantos gols na {1+i}º partida: ')))
dados['gols'] = qtd_gols[:]
dados['total'] = sum(qtd_gols)
time.append(dados.copy())
while True:
sair = str(input('escreva s para sair e n para não: S/N').lower().strip()[0])
if sair in 'sn':
break
print('"erro", responda apenas s para sair e n para não')
if sair == 's':
break
l()
print('dados ', end='')
for i in dados.keys():
print(f'{(i+":"):<15}', end='')
l()
for key, v in enumerate(time):
print(f'{key:>3} ', end='')
for i in v.values():
print(f' {str(i):<15}', end='')
print()
l()
while True:
l()
busca = int(input('(999 p parar)mostrar dados de qual jogador: '))
if busca == 999:
break
if busca >= len(time):
print(f'erro! nao há jogador com o codigo de busca')
else:
print(f' -- levantamento do jogador {time[busca]["nome"]}:')
for i, g in enumerate(time[busca]['gols']):
print(f' no jogo {i+1} fez {g} gols')
l()
print('volte sempre')
dados = dict()
time = list()
qtd_gols = list()
while True:
dados.clear()
dados['nome'] = input('nome do jogador: ')
def l(): print('\n'+'=-'*25+'=')
qtd_partida = int(input('quantas partidas:'))
qtd_gols.clear()
for i in range(qtd_partida):
qtd_gols.append(int(input(f'quantos gols na {1+i}º partida: ')))
dados['gols'] = qtd_gols[:]
dados['total'] = sum(qtd_gols)
time.append(dados.copy())
while True:
sair = str(input('escreva s para sair e n para não: S/N').lower().strip()[0])
if sair in 'sn':
break
print('"erro", responda apenas s para sair e n para não')
if sair == 's':
break
l()
print('dados ', end='')
for i in dados.keys():
print(f'{i:<15}', end='')
l()
for key, v in enumerate(time):
print(f'{key:>3} ', end='')
for i in v.values():
print(f' {str(i):<15}', end='')
print()
l()
| 23.05
| 85
| 0.53449
| 344
| 2,305
| 3.540698
| 0.229651
| 0.057471
| 0.029557
| 0.032841
| 0.804598
| 0.784893
| 0.784893
| 0.738916
| 0.738916
| 0.738916
| 0
| 0.014854
| 0.269848
| 2,305
| 100
| 86
| 23.05
| 0.708853
| 0
| 0
| 0.858974
| 0
| 0
| 0.261058
| 0.00954
| 0
| 0
| 0
| 0
| 0
| 1
| 0.025641
| false
| 0
| 0
| 0
| 0.025641
| 0.230769
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ce5a9e208ae39de145dcc0cfae9ef4fc9430fa2a
| 87,705
|
py
|
Python
|
Games/Python/Poker_With_Bot.py
|
SupremeSimon05/Console-Mini-Games
|
96f8556f4b4d2e3f86f608b90ac6968da3cccf43
|
[
"MIT"
] | null | null | null |
Games/Python/Poker_With_Bot.py
|
SupremeSimon05/Console-Mini-Games
|
96f8556f4b4d2e3f86f608b90ac6968da3cccf43
|
[
"MIT"
] | null | null | null |
Games/Python/Poker_With_Bot.py
|
SupremeSimon05/Console-Mini-Games
|
96f8556f4b4d2e3f86f608b90ac6968da3cccf43
|
[
"MIT"
] | null | null | null |
import math
import random
playerChips = 20
playerCards = []
botChips = 20
botCards = []
allCards = [[1, "diamonds"],[1, "hearts"],[1, "clubs"],[1, "spades"],[2, "diamonds"],[2, "hearts"],[2, "clubs"],[2, "spades"],[3, "diamonds"],[3, "hearts"],[3, "clubs"],[3, "spades"],[4, "diamonds"],[4, "hearts"],[4, "clubs"],[4, "spades"],[5, "diamonds"],[5, "hearts"],[5, "clubs"],[5, "spades"],[6, "diamonds"],[6, "hearts"],[6, "clubs"],[6, "spades"],[7, "diamonds"],[7, "hearts"],[7, "clubs"],[7, "spades"],[8, "diamonds"],[8, "hearts"],[8, "clubs"],[8, "spades"],[9, "diamonds"],[9, "hearts"],[9, "clubs"],[9, "spades"],[10, "diamonds"],[10, "hearts"],[10, "clubs"],[10, "spades"],[11, "diamonds"],[11, "hearts"],[11, "clubs"],[11, "spades"],[12, "diamonds"],[12, "hearts"],[12, "clubs"],[12, "spades"],[13, "diamonds"],[13, "hearts"],[13, "clubs"],[13, "spades"]]
round = 0
pot = 0
highestBet = 0
playerBet = 0
botBet = 0
PlayerEnded = False
botEnded = False
playerTotalBet = 0
botTotalBet = 0
'''
to do list
'''
def main():
#a ton of initialization
global playerChips
global playerCards
global botChips
global botCards
global allCards
global round
global pot
global PlayerEnded
global botEnded
anteNum = 0
#some important stuffs
print("5 Card Poker!")
onlyForYNRN = str(input("Would you like to play? ")).lower()
while((onlyForYNRN + "yes")[0] != "n"):
while(True):
try:
startTotal = int(input("How many chips do you want to start the game with? "))
if(startTotal>0):
break
print("You have to start with more than 0 chips ")
except:
print("Please enter a real integer ")
playerChips = startTotal
botChips = startTotal
round = 0
print("Time to play!")
while(True):
if(playerChips<1 or botChips<1):
break
PlayerEnded = False
botEnded = False
playerCards = []
botCards = []
allCards = [['A', "diamonds"],['A', "hearts"],['A', "clubs"],['A', "spades"],[2, "diamonds"],[2, "hearts"],[2, "clubs"],[2, "spades"],[3, "diamonds"],[3, "hearts"],[3, "clubs"],[3, "spades"],[4, "diamonds"],[4, "hearts"],[4, "clubs"],[4, "spades"],[5, "diamonds"],[5, "hearts"],[5, "clubs"],[5, "spades"],[6, "diamonds"],[6, "hearts"],[6, "clubs"],[6, "spades"],[7, "diamonds"],[7, "hearts"],[7, "clubs"],[7, "spades"],[8, "diamonds"],[8, "hearts"],[8, "clubs"],[8, "spades"],[9, "diamonds"],[9, "hearts"],[9, "clubs"],[9, "spades"],[10, "diamonds"],[10, "hearts"],[10, "clubs"],[10, "spades"],['J', "diamonds"],['J', "hearts"],['J', "clubs"],['J', "spades"],['Q', "diamonds"],['Q', "hearts"],['Q', "clubs"],['Q', "spades"],['K', "diamonds"],['K', "hearts"],['K', "clubs"],['K', "spades"]]
round = round + 1
if(botChips - int(math.sqrt(round))>=0 and playerChips - int(math.sqrt(round))>=0):
pot = int(math.sqrt(round)) + int(math.sqrt(round))
botChips = int(botChips - int(math.sqrt(round)))
playerChips = int(playerChips - int(math.sqrt(round)))
elif(botChips - int(math.sqrt(round))<=0):
pot = botChips * 2
botChips = 0
playerChips = playerChips - botChips
elif(playerChips - int(math.sqrt(round))<=0):
pot = playerChipsChips * 2
botChips = botChips - playerChips
playerChips = 0
cardToAdd = []
#the actual game
dealCards(1)
print("Your hand: " + str(playerCards))
bets()
if((not PlayerEnded) and (not botEnded)):
dealCards(2, "player")
dealCards(2, "bot")
bets(2)
if(not(PlayerEnded) and not(botEnded)):
print("Your cards: " + str(playerCards))
print("Their cards: " + str(botCards))
if(compareCards() == "player"):
playerChips = pot + playerChips
print("You won this hand! You now have " + str(playerChips) + " chips.")
elif(compareCards() == "bot"):
botChips = pot + botChips
print("You didn't win this one, but you'll get em next time. ")
else:
print("You and the bot tied. You had the hand: " + str(playerCards) + " and the bot had the hand: " + str(botCards))
botChips = int(botChips + pot/2)
playerChips = int(playerChips + pot/2)
elif(botEnded):
playerChips = pot + playerChips
elif(PlayerEnded):
botChips = pot + botChips
if(playerChips>1 and botChips>1):
print("New hand starting. ")
if(botChips>playerChips):
print("Sorry but the bot won the overall game. You can try again if you would like though... ")
elif(playerChips>botChips):
print("You won the overall game. Great work! If you want you can test you luck again... ")
onlyForYNRN = str(input("Would you like to play again? ")).lower()
print("Thanks for playing! I hope you had fun. ")
def CTPCTTIC(players, inputed):
inputed = str(inputed)
if(str(str(players[0]) + str(players[1][0])).lower() == inputed.lower()):
return True
else:
return False
def dealCards(time, a = "bot"):
global playerCards
global botCards
cardToTrade = []
numCardsToTrade = 0
num = 0
aced = False
if(time == 1):
for i in range (5):
cardToAdd = allCards[random.randrange(0, len(allCards)-1)]
playerCards.append(cardToAdd)
allCards.remove(cardToAdd)
for i in range (5):
cardToAdd = allCards[random.randrange(0, len(allCards)-1)]
allCards.remove(cardToAdd)
botCards.append(cardToAdd)
else:
if(a == "player"):
while(True):
try:
while(True):
numCardsToTrade = input("How many cards do you want to trade in? ")
if(int(numCardsToTrade) >= 0 and (int(numCardsToTrade) < 4 or (hasCard("player", 'A') and int(numCardsToTrade) == 4))):
break
print("You can't trade in that many cards ")
except:
print("Please enter a real integer ")
continue
break
numCardsToTrade = int(numCardsToTrade)
if(numCardsToTrade == 4):
cardToTrade = []
for i in range(5):
if('A' in playerCards[i]):
playerCards = [playerCards[i]]
break
else:
i = 0
while(True and numCardsToTrade != 0):
num = 0
cardToTrade = input("What card do you want to trade? " + str(playerCards) + " are your current cards. Enter 'cancel' to cancel. Please type it like '3C' for 3 of clubs or 'AS' for ace of spades. ")
for p in range(len(playerCards)):
if(CTPCTTIC(playerCards[p], cardToTrade)):
playerCards.pop(p)
break
else:
num = num + 1
if(num == 5 and not(str(cardToTrade + " ")[0] == 'C' or str(cardToTrade + " ")[0] == 'c' or cardToTrade == None)):
print("You don't have that card, please try again or cancel the trade. \n(Problems to check for: Make sure you only input one card at a time and make sure you don't actually put the quotes around the card)")
i = i - 1
if(str(cardToTrade + " ")[0] == 'C' or cardToTrade + " "[0] == 'c' or cardToTrade == None):
print("Card trade cancelled ")
numCardsToTrade = numCardsToTrade - 1
i = i + 1
if(i>=numCardsToTrade):
break
for i in range(numCardsToTrade):
cardToAdd = allCards[random.randrange(0, len(allCards)-1)]
playerCards.append(cardToAdd)
allCards.remove(cardToAdd)
print("Your cards now: " + str(playerCards))
else:
if(hasAlmostFlush("bot")):
if(hasMultipleSuits("hearts", 4)):
for i in range(5):
if(botCards[i][1] != "hearts"):
cardToTrade.append(botCards[i])
if(hasMultipleSuits("diamonds", 4)):
for i in range(5):
if(botCards[i][1] != "diamonds"):
cardToTrade.append(botCards[i])
if(hasMultipleSuits("clubs", 4)):
for i in range(5):
if(botCards[i][1] != "clubs"):
cardToTrade.append(botCards[i])
if(hasMultipleSuits("spades", 4)):
for i in range(5):
if(botCards[i][1] != "spades"):
cardToTrade.append(botCards[i])
if(hasFourOfKind("bot")):
for c in range(9):
if(hasMultipleCards(c+1, 4)):
for i in range(5):
if(botCards[i][0] != c+1):
cardToTrade.append(botCards[i])
if(hasMultipleCards('A', 4)):
for i in range(5):
if(botCards[i][0] != 'A'):
cardToTrade.append(botCards[i])
if(hasMultipleCards('J', 4)):
for i in range(5):
if(botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
if(hasMultipleCards('Q', 4)):
for i in range(5):
if(botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
if(hasMultipleCards('K', 4)):
for i in range(5):
if(botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
if(hasTwoPair("bot")):
if(hasMultipleCards('A', 2) and hasMultipleCards(2, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 2):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(3, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 3):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(4, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 4):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(5, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('A', 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 'A' and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(3, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 3):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(4, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 4):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(5, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 2 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(4, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 4):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(5, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 3 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(5, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 4 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 5 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 6 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 7 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2) and hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 8 and botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 8 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 8 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 8 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 8 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 2) and hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 9 and botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 9 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 9 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 9 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(10, 2) and hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 10 and botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(10, 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 10 and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(10, 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 10 and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('J', 2) and hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 'J' and botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('J', 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 'J' and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('Q', 2) and hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 'Q' and botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasThreeOfKind("bot")):
if(hasMultipleCards('A', 3)):
for i in range(5):
if(botCards[i][0] != 'A'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 3)):
for i in range(5):
if(botCards[i][0] != 2):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 3)):
for i in range(5):
if(botCards[i][0] != 3):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 3)):
for i in range(5):
if(botCards[i][0] != 4):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 3)):
for i in range(5):
if(botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 3)):
for i in range(5):
if(botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 3)):
for i in range(5):
if(botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 3)):
for i in range(5):
if(botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 3)):
for i in range(5):
if(botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(10, 3)):
for i in range(5):
if(botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('J', 3)):
for i in range(5):
if(botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('Q', 3)):
for i in range(5):
if(botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('K', 3)):
for i in range(5):
if(botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasPair("bot")):
if(hasMultipleCards('A', 2)):
for i in range(5):
if(botCards[i][0] != 'A'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(2, 2)):
for i in range(5):
if(botCards[i][0] != 2):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(3, 2)):
for i in range(5):
if(botCards[i][0] != 3):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(4, 2)):
for i in range(5):
if(botCards[i][0] != 4):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(5, 2)):
for i in range(5):
if(botCards[i][0] != 5):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(6, 2)):
for i in range(5):
if(botCards[i][0] != 6):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(7, 2)):
for i in range(5):
if(botCards[i][0] != 7):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(8, 2)):
for i in range(5):
if(botCards[i][0] != 8):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(9, 2)):
for i in range(5):
if(botCards[i][0] != 9):
cardToTrade.append(botCards[i])
elif(hasMultipleCards(10, 2)):
for i in range(5):
if(botCards[i][0] != 10):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('J', 2)):
for i in range(5):
if(botCards[i][0] != 'J'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('Q', 2)):
for i in range(5):
if(botCards[i][0] != 'Q'):
cardToTrade.append(botCards[i])
elif(hasMultipleCards('K', 2)):
for i in range(5):
if(botCards[i][0] != 'K'):
cardToTrade.append(botCards[i])
elif(hasCard("bot", 'A')):
for i in range(5):
if(botCards[i][0] != 'A'):
cardToTrade.append(botCards[i])
else:
for i in range(3):
nextCardNum = highestCardNum("bot", 5-i)
for d in range(5):
if(nextCardNum == botCards[d][0]):
cardToTrade.append(botCards[d])
zzz = botsTradeAmount()
if(zzz!=1):
print("The bot traded in " + str(zzz) + " cards. ")
else:
print("The bot traded in 1 card. ")
for i in range(zzz):
botCards.remove(cardToTrade[zzz-(i+1)])
for i in range(zzz):
cardToAdd = allCards[random.randrange(0, len(allCards)-1)]
botCards.append(cardToAdd)
allCards.remove(cardToAdd)
def hasMultipleCards(card, amount, a = "bot"):
global botCards
num = 0
if(a == "player"):
for i in range (5):
if(playerCards[i][0] == card):
num = num+1
if(num == amount):
return True
else:
return False
else:
for i in range (5):
if(botCards[i][0] == card):
num = num+1
if(num == amount):
return True
else:
return False
def hasSuit(suit):
global botCards
num = 0
for i in range(5):
if(botCards[i][1] == suit):
return True
else:
num = num +1
if(num == 5):
return False
def hasMultipleSuits(suit, amount):
global botCards
num = 0
for i in range(5):
if(botCards[i][1] == suit):
num = num + 1
if(num == amount):
return True
else:
return False
def hasCardWSuit(card):
global botCards
num = 0
for i in range(5):
if(botCards[i] == card):
return True
else:
num = num + 1
if(num == 5):
return False
def bets(time = 0):
global pot
global playerTotalBet
global botTotalBet
botTotalBet = 0
playerTotalBet = 0
rk = False
while(True):
oneBet("player", time)
if((rk and botTotalBet == playerTotalBet) or PlayerEnded or botEnded):
break
rk=True
oneBet("bot", time)
if(botTotalBet == playerTotalBet or PlayerEnded or botEnded):
break
pot = pot + playerTotalBet + botTotalBet
def oneBet(a, time = 1):
global PlayerEnded
global botEnded
global playerChips
global pot
global botCards
global botChips
global highestBet
global botBet
global playerBet
global playerTotalBet
global botTotalBet
if(a == "player"):
playerBet = int(playerChips+1)
while(True):
try:
while(True):
playerBet = input("How much do you want to bet? You have " + str(playerChips) + " chips, the pot so far is " + str(pot + playerTotalBet + botTotalBet) + " chips, and the least you can bet to stay in is " + str(botTotalBet - playerTotalBet) + " chips. The bot has " + str(botChips) + " chips. Enter 'f' or 'fold' to fold. ")
playerBet = int(playerBet)
if((playerBet <= playerChips and playerTotalBet + playerBet >= botTotalBet) or PlayerEnded or botEnded):
break
print("You can't bet that much ")
break
except:
try:
if(playerBet[0] == 'f'):
PlayerEnded = True
print("You folded, which means the bot won with the cards " + str(botCards))
break
else:
print("Please enter a valid response ")
except:
print("Please enter a valid response ")
try:
if(playerBet>botChips + (botTotalBet - playerTotalBet)):
print("You bet more than the bot has. Your bet has been set back to an amount that the bot can match")
playerBet = botChips
if((not botEnded)):
playerTotalBet = playerTotalBet + playerBet
playerChips = playerChips - playerBet
print("You now have " + str(playerChips) + " chips")
except:
pass
else:
try:
botBet = int(botChips+1)
if(hasRoyalFlush("bot")):
botBet = int(botChips - random.randrange(0, int(botChips/10)))
elif(hasStraight("bot") and hasFlush("bot")):
botBet = int(botChips - random.randrange(int(botChips/20), int(botChips/9)))
elif(hasFourOfKind("bot")):
botBet = int(botChips - random.randrange(int(botChips/19), int(botChips/8)))
elif(hasFullHouse("bot")):
botBet = int(botChips - random.randrange(int(botChips/18), int(botChips/7)))
elif(hasFlush("bot")):
botBet = int(botChips - random.randrange(int(botChips/17), int(botChips/6)))
elif(hasStraight("bot")):
botBet = int(botChips - random.randrange(int(botChips/16), int(botChips/5)))
elif(hasThreeOfKind("bot")):
botBet = int(botChips - random.randrange(int(botChips/15), int(botChips/4)))
elif(hasTwoPair("bot")):
botBet = int(botChips - random.randrange(int(botChips/2), int(botChips)))
elif(hasPair("bot")):
botBet = int(botChips - random.randrange(int(botChips/2), int(botChips-botChips/10)))
elif(hasCard("bot", 'A')):
if(time == 1):
botBet = int(botChips/10 + random.randrange(0, int(botChips/11 + botChips/12)))
else:
botBet = int(botChips/10 + random.randrange(0, int(botChips/11)))
else:
if(time == 1):
botBet = int(random.randrange(0, int(botChips/11 + botChips/12)))
else:
botBet = int(random.randrange(0, int(botChips/11)))
if(botBet+botTotalBet<playerTotalBet):
if(hasRoyalFlush("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/2)))
elif(hasStraight("bot") and hasFlush("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/3)))
elif(hasFourOfKind("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/4)))
elif(hasFullHouse("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/5)))
elif(hasFlush("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/6)))
elif(hasStraight("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/7)))
elif(hasThreeOfKind("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/8)))
elif(hasTwoPair("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/9)))
elif(hasPair("bot")):
botBet = botBet + int(random.randrange(0, int(botChips/10)))
elif(hasCard("bot", 'A')):
if(time == 1):
botBet = botBet + int(random.randrange(0, int(botChips/11 + botChips/12)))
else:
botBet = botBet + int(random.randrange(0, int(botChips/11)))
else:
if(time == 1):
botBet = botBet + int(random.randrange(0, int(botChips/11 + botChips/12)))
else:
botBet = botBet + int(random.randrange(0, int(botChips/11)))
except:
botBet = 0
if(playerTotalBet >= botChips and (hasPair("bot") or hasFlush("bot") or hasStraight("bot")) and random.randrange(0, 2) == 1):
botBet = botChips
if(botBet > botChips):
botBet = botChips
elif(botBet > playerChips - (botTotalBet - playerTotalBet)):
botBet = playerChips
if(playerTotalBet + playerBet == 0 and botBet <= 0):
botBet = playerBet
if(botBet + botTotalBet < playerTotalBet):
print("The bot has folded. You won this hand with a pot of " + str(pot + playerTotalBet + botTotalBet) + " chips!")
botEnded = True
botBet = 0
else:
if(botBet + botTotalBet >playerTotalBet):
print("The bot raised... ")
botTotalBet = botTotalBet + botBet
botChips = botChips - botBet
def hasPair(a):
global playerCards
global botCards
if(a == "player"):
if(playerCards[0][0] == playerCards[1][0] or playerCards[0][0] == playerCards[2][0] or playerCards[0][0] == playerCards[3][0] or playerCards[0][0] == playerCards[4][0] or playerCards[1][0] == playerCards[2][0] or playerCards[1][0] == playerCards[3][0] or playerCards[1][0] == playerCards[4][0] or playerCards[2][0] == playerCards[3][0] or playerCards[2][0] == playerCards[4][0] or playerCards[3][0] == playerCards[4][0]):
return True
else:
return False
else:
if(botCards[0][0] == botCards[1][0] or botCards[0][0] == botCards[2][0] or botCards[0][0] == botCards[3][0] or botCards[0][0] == botCards[4][0] or botCards[1][0] == botCards[2][0] or botCards[1][0] == botCards[3][0] or botCards[1][0] == botCards[4][0] or botCards[2][0] == botCards[3][0] or botCards[2][0] == botCards[4][0] or botCards[3][0] == botCards[4][0]):
return True
else:
return False
def hasTwoPair(a):
global playerCards
global botCards
if(a == "player"):
if((playerCards[0][0] == playerCards[1][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[1][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[1][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[3][0] and playerCards[1][0] == playerCards[2][0]) or (playerCards[0][0] == playerCards[3][0] and playerCards[1][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[3][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[4][0] and playerCards[1][0] == playerCards[2][0]) or (playerCards[0][0] == playerCards[4][0] and playerCards[1][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[4][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[3][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[4][0] and playerCards[2][0] == playerCards[3][0])):
return True
else:
return False
else:
if((botCards[0][0] == botCards[1][0] and botCards[2][0] == botCards[3][0]) or (botCards[0][0] == botCards[1][0] and botCards[2][0] == botCards[4][0]) or (botCards[0][0] == botCards[1][0] and botCards[3][0] == botCards[4][0]) or (botCards[0][0] == botCards[2][0] and botCards[1][0] == botCards[3][0]) or (botCards[0][0] == botCards[2][0] and botCards[1][0] == botCards[4][0]) or (botCards[0][0] == botCards[2][0] and botCards[3][0] == botCards[4][0]) or (botCards[0][0] == botCards[3][0] and botCards[1][0] == botCards[2][0]) or (botCards[0][0] == botCards[3][0] and botCards[1][0] == botCards[4][0]) or (botCards[0][0] == botCards[3][0] and botCards[2][0] == botCards[4][0]) or (botCards[0][0] == botCards[4][0] and botCards[1][0] == botCards[2][0]) or (botCards[0][0] == botCards[4][0] and botCards[1][0] == botCards[3][0]) or (botCards[0][0] == botCards[4][0] and botCards[2][0] == botCards[3][0]) or (botCards[1][0] == botCards[2][0] and botCards[3][0] == botCards[4][0]) or (botCards[1][0] == botCards[3][0] and botCards[2][0] == botCards[4][0]) or (botCards[1][0] == botCards[4][0] and botCards[2][0] == botCards[3][0])):
return True
else:
return False
def hasFourOfKind(a):
global playerCards
global botCards
if(a == "player"):
if((playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0])):
return True
else:
return False
else:
if((botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[3][0]) or (botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[4][0]) or (botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[0][0] == botCards[2][0] and botCards[2][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[3][0] and botCards[3][0] == botCards[4][0])):
return True
else:
return False
def hasThreeOfKind(a):
global playerCards
global botCards
if(a == "player"):
if((playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[2][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[2][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0])):
return True
else:
return False
else:
if((botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[2][0]) or (botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[3][0]) or (botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[4][0]) or (botCards[0][0] == botCards[2][0] and botCards[2][0] == botCards[3][0]) or (botCards[0][0] == botCards[2][0] and botCards[2][0] == botCards[4][0]) or (botCards[0][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[3][0]) or (botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[4][0]) or (botCards[1][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[2][0] == botCards[3][0] and botCards[3][0] == botCards[4][0])):
return True
else:
return False
def hasFlush(a):
global playerCards
global botCards
if(a == "player"):
if(playerCards[0][1] == playerCards[1][1] and playerCards[0][1] == playerCards[2][1] and playerCards[0][1] == playerCards[3][1] and playerCards[0][1] == playerCards[4][1]):
return True
else:
return False
else:
if(botCards[0][1] == botCards[1][1] and botCards[0][1] == botCards[2][1] and botCards[0][1] == botCards[3][1] and botCards[0][1] == botCards[4][1] and botCards[0][1] == botCards[5][1]):
return True
else:
return False
def hasFullHouse(a):
global playerCards
global botCards
if(a == "player"):
if((playerCards[0][0] == playerCards[1][0] and playerCards[2][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[2][0] and playerCards[1][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[3][0] and playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[0][0] == playerCards[4][0] and playerCards[1][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[0][0] == playerCards[3][0] and playerCards[3][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[2][0] and playerCards[0][0] == playerCards[2][0] and playerCards[2][0] == playerCards[4][0]) or (playerCards[1][0] == playerCards[4][0] and playerCards[0][0] == playerCards[2][0] and playerCards[2][0] == playerCards[3][0]) or (playerCards[2][0] == playerCards[3][0] and playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[4][0]) or (playerCards[2][0] == playerCards[4][0] and playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[3][0]) or (playerCards[3][0] == playerCards[4][0] and playerCards[0][0] == playerCards[1][0] and playerCards[1][0] == playerCards[2][0])):
return True
else:
return False
else:
if((botCards[0][0] == botCards[1][0] and botCards[2][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[0][0] == botCards[2][0] and botCards[1][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[0][0] == botCards[3][0] and botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[4][0]) or (botCards[0][0] == botCards[4][0] and botCards[1][0] == botCards[2][0] and botCards[2][0] == botCards[3][0]) or (botCards[1][0] == botCards[2][0] and botCards[0][0] == botCards[3][0] and botCards[3][0] == botCards[4][0]) or (botCards[1][0] == botCards[2][0] and botCards[0][0] == botCards[2][0] and botCards[2][0] == botCards[4][0]) or (botCards[1][0] == botCards[4][0] and botCards[0][0] == botCards[2][0] and botCards[2][0] == botCards[3][0]) or (botCards[2][0] == botCards[3][0] and botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[4][0]) or (botCards[2][0] == botCards[4][0] and botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[3][0]) or (botCards[3][0] == botCards[4][0] and botCards[0][0] == botCards[1][0] and botCards[1][0] == botCards[2][0])):
return True
else:
return False
def hasStraight(a):
global playerCards
global botCards
nums = []
if(a == "player"):
for i in range(len(playerCards)):
if(playerCards[i][0] == "J"):
nums.append(11)
elif(playerCards[i][0] == "Q"):
nums.append(12)
elif(playerCards[i][0] == "K"):
nums.append(13)
elif(playerCards[i][0] == "A"):
nums.append(1)
elif(type(playerCards[i][0]) != int):
print("problem with program. For some reason " + str(playerCards[i]) + " exists")
else:
nums.append(playerCards[i][0])
if((not hasPair("player")) and max(nums) - min(nums) == 4):
return True
elif((not hasPair("player")) and hasCard("player", 'A') and hasCard("player", 'K') and hasCard("player", 'Q') and hasCard("player", 'J') and hasCard("player", 10)):
return True
else:
return False
else:
for i in range(len(botCards)):
if(botCards[i][0] == "J"):
nums.append(11)
elif(botCards[i][0] == "Q"):
nums.append(12)
elif(botCards[i][0] == "K"):
nums.append(13)
elif(botCards[i][0] == "A"):
nums.append(1)
else:
nums.append(botCards[i][0])
if(not hasPair("bot") and max(nums) - min(nums) == 4):
return True
elif((not hasPair("player")) and hasCard("player", 'A') and hasCard("player", 'K') and hasCard("player", 'Q') and hasCard("player", 'J') and hasCard("player", 10)):
return True
else:
return False
def hasCard(a, cardToCheck):
global playerCards
global botCards
num = 0
if(a == "player"):
for i in range(5):
if(cardToCheck == playerCards[i][0]):
return True
else:
num = num+1
if(num==5):
return False
else:
for i in range(5):
if(cardToCheck == botCards[i][0]):
return True
else:
num = num+1
if(num==5):
return False
def hasRoyalFlush(a):
global playerCards
global botCards
if(a == "player"):
if(hasCard("player", 'A') and hasCard("player", 'J') and hasCard("player", 'Q') and hasCard("player", 'K') and hasCard("player", '10') and hasFlush("player")):
return True
else:
return False
else:
if(hasCard("bot", 'A') and hasCard("bot", 'J') and hasCard("bot", 'Q') and hasCard("bot", 'K') and hasCard("bot", '10') and hasFlush("bot")):
return True
else:
return False
def compareCards():
global playerCards
global botCards
if(hasRoyalFlush("player") and (not(hasRoyalFlush("bot")))):
return "player"
elif((not hasRoyalFlush("player")) and hasRoyalFlush("bot")):
return "bot"
elif(hasRoyalFlush("player") and hasRoyalFlush("bot")):
if(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif((hasStraight("player") and hasFlush("player")) and not (hasFlush("bot") and hasStraight("bot"))):
return "player"
elif((not(hasStraight("player") and hasFlush("player"))) and (hasFlush("bot") and hasStraight("bot"))):
return "bot"
elif(hasStraight("player") and hasStraight("bot")):
if(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasFourOfKind("player") and not hasFourOfKind("bot")):
return "player"
elif((not hasFourOfKind("player")) and hasFourOfKind("bot")):
return "bot"
elif(hasFourOfKind("player") and hasFourOfKind("bot")):
if(hasMultipleCards("A", 4, "player")):
return "player"
elif(hasMultipleCards("A", 4, "bot")):
return "bot"
elif(hasMultipleCards("K", 4, "player")):
return "player"
elif(hasMultipleCards("K", 4, "bot")):
return "bot"
elif(hasMultipleCards("Q", 4, "player")):
return "player"
elif(hasMultipleCards("Q", 4, "bot")):
return "bot"
elif(hasMultipleCards("J", 4, "player")):
return "player"
elif(hasMultipleCards("J", 4, "bot")):
return "bot"
elif(hasMultipleCards(10, 4, "player")):
return "player"
elif(hasMultipleCards(10, 4, "bot")):
return "bot"
elif(hasMultipleCards(9, 4, "player")):
return "player"
elif(hasMultipleCards(9, 4, "bot")):
return "bot"
elif(hasMultipleCards(8, 4, "player")):
return "player"
elif(hasMultipleCards(8, 4, "bot")):
return "bot"
elif(hasMultipleCards(7, 4, "player")):
return "player"
elif(hasMultipleCards(7, 4, "bot")):
return "bot"
elif(hasMultipleCards(6, 4, "player")):
return "player"
elif(hasMultipleCards(6, 4, "bot")):
return "bot"
elif(hasMultipleCards(5, 4, "player")):
return "player"
elif(hasMultipleCards(5, 4, "bot")):
return "bot"
elif(hasMultipleCards(4, 4, "player")):
return "player"
elif(hasMultipleCards(4, 4, "bot")):
return "bot"
elif(hasMultipleCards(3, 4, "player")):
return "player"
elif(hasMultipleCards(3, 4, "bot")):
return "bot"
elif(hasMultipleCards(2, 4, "player")):
return "player"
elif(hasMultipleCards(1, 4, "bot")):
return "bot"
elif(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasFullHouse("player") and not hasFullHouse("bot")):
return "player"
elif((not hasFullHouse("player")) and hasFullHouse("bot")):
return "bot"
elif(hasFullHouse("player") and hasFullHouse("bot")):
if(hasMultipleCards('A', 3, "player")):
return "player"
elif(hasMultipleCards('A', 3, "bot")):
return "bot"
elif(hasMultipleCards('K', 3, "player")):
return "player"
elif(hasMultipleCards('K', 3, "bot")):
return "bot"
elif(hasMultipleCards('Q', 3, "player")):
return "player"
elif(hasMultipleCards('Q', 3, "bot")):
return "bot"
elif(hasMultipleCards('J', 3, "player")):
return "player"
elif(hasMultipleCards('J', 3, "bot")):
return "bot"
elif(hasMultipleCards(10, 3, "player")):
return "player"
elif(hasMultipleCards(10, 3, "bot")):
return "bot"
elif(hasMultipleCards(9, 3, "player")):
return "player"
elif(hasMultipleCards(9, 3, "bot")):
return "bot"
elif(hasMultipleCards(8, 3, "player")):
return "player"
elif(hasMultipleCards(8, 3, "bot")):
return "bot"
elif(hasMultipleCards(7, 3, "player")):
return "player"
elif(hasMultipleCards(7, 3, "bot")):
return "bot"
elif(hasMultipleCards(6, 3, "player")):
return "player"
elif(hasMultipleCards(6, 3, "bot")):
return "bot"
elif(hasMultipleCards(5, 3, "player")):
return "player"
elif(hasMultipleCards(5, 3, "bot")):
return "bot"
elif(hasMultipleCards(4, 3, "player")):
return "player"
elif(hasMultipleCards(4, 3, "bot")):
return "bot"
elif(hasMultipleCards(3, 3, "player")):
return "player"
elif(hasMultipleCards(3, 3, "bot")):
return "bot"
elif(hasMultipleCards(2, 3, "player")):
return "player"
elif(hasMultipleCards(2, 3, "bot")):
return "bot"
elif(hasMultipleCards('A', 2, "player")):
return "player"
elif(hasMultipleCards('A', 2, "bot")):
return "bot"
elif(hasMultipleCards('K', 2, "player")):
return "player"
elif(hasMultipleCards('K', 2, "bot")):
return "bot"
elif(hasMultipleCards('Q', 2, "player")):
return "player"
elif(hasMultipleCards('Q', 2, "bot")):
return "bot"
elif(hasMultipleCards('J', 2, "player")):
return "player"
elif(hasMultipleCards('J', 2, "bot")):
return "bot"
elif(hasMultipleCards(10, 2, "player")):
return "player"
elif(hasMultipleCards(10, 2, "bot")):
return "bot"
elif(hasMultipleCards(9, 2, "player")):
return "player"
elif(hasMultipleCards(9, 2, "bot")):
return "bot"
elif(hasMultipleCards(8, 2, "player")):
return "player"
elif(hasMultipleCards(8, 2, "bot")):
return "bot"
elif(hasMultipleCards(7, 2, "player")):
return "player"
elif(hasMultipleCards(7, 2, "bot")):
return "bot"
elif(hasMultipleCards(6, 2, "player")):
return "player"
elif(hasMultipleCards(6, 2, "bot")):
return "bot"
elif(hasMultipleCards(5, 2, "player")):
return "player"
elif(hasMultipleCards(5, 2, "bot")):
return "bot"
elif(hasMultipleCards(4, 2, "player")):
return "player"
elif(hasMultipleCards(4, 2, "bot")):
return "bot"
elif(hasMultipleCards(3, 2, "player")):
return "player"
elif(hasMultipleCards(3, 2, "bot")):
return "bot"
elif(hasMultipleCards(2, 2, "player")):
return "player"
elif(hasMultipleCards(2, 2, "bot")):
return "bot"
elif(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasFlush("player") and not hasFlush("bot")):
return "player"
elif((not hasFlush("player")) and hasFlush("bot")):
return "bot"
elif(hasFlush("player") and hasFlush("bot")):
if(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasStraight("player") and not hasStraight("bot")):
return "player"
elif((not hasStraight("player")) and hasStraight("bot")):
return "bot"
elif(hasStraight("player") and hasStraight("bot")):
if(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasThreeOfKind("player") and not hasThreeOfKind("bot")):
return "player"
elif((not hasThreeOfKind("player")) and hasThreeOfKind("bot")):
return "bot"
elif(hasThreeOfKind("player") and hasThreeOfKind("bot")):
if(hasMultipleCards('A', 3, "player")):
return "player"
elif(hasMultipleCards('A', 3, "bot")):
return "bot"
elif(hasMultipleCards('K', 3, "player")):
return "player"
elif(hasMultipleCards('K', 3, "bot")):
return "bot"
elif(hasMultipleCards('Q', 3, "player")):
return "player"
elif(hasMultipleCards('Q', 3, "bot")):
return "bot"
elif(hasMultipleCards('J', 3, "player")):
return "player"
elif(hasMultipleCards('J', 3, "bot")):
return "bot"
elif(hasMultipleCards(10, 3, "player")):
return "player"
elif(hasMultipleCards(10, 3, "bot")):
return "bot"
elif(hasMultipleCards(9, 3, "player")):
return "player"
elif(hasMultipleCards(9, 3, "bot")):
return "bot"
elif(hasMultipleCards(8, 3, "player")):
return "player"
elif(hasMultipleCards(8, 3, "bot")):
return "bot"
elif(hasMultipleCards(7, 3, "player")):
return "player"
elif(hasMultipleCards(7, 3, "bot")):
return "bot"
elif(hasMultipleCards(6, 3, "player")):
return "player"
elif(hasMultipleCards(6, 3, "bot")):
return "bot"
elif(hasMultipleCards(5, 3, "player")):
return "player"
elif(hasMultipleCards(5, 3, "bot")):
return "bot"
elif(hasMultipleCards(4, 3, "player")):
return "player"
elif(hasMultipleCards(4, 3, "bot")):
return "bot"
elif(hasMultipleCards(3, 3, "player")):
return "player"
elif(hasMultipleCards(3, 3, "bot")):
return "bot"
elif(hasMultipleCards(2, 3, "player")):
return "player"
elif(hasMultipleCards(2, 3, "bot")):
return "bot"
elif(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasTwoPair("player") and not hasTwoPair("bot")):
return "player"
elif((not hasTwoPair("player")) and hasTwoPair("bot")):
return "bot"
elif(hasTwoPair("player") and hasPair("bot")):
if(hasMultipleCards('A', 2, "player") and not(hasMultipleCards('A', 2, "bot"))):
return "player"
elif((not hasMultipleCards('A', 2, "player")) and hasMultipleCards('A', 2, "bot")):
return "bot"
elif(hasMultipleCards('K', 2, "player") and not(hasMultipleCards('K', 2, "bot"))):
return "player"
elif((not hasMultipleCards('K', 2, "player")) and hasMultipleCards('K', 2, "bot")):
return "bot"
elif(hasMultipleCards('Q', 2, "player") and not(hasMultipleCards('Q', 2, "bot"))):
return "player"
elif((not hasMultipleCards('Q', 2, "player")) and hasMultipleCards('Q', 2, "bot")):
return "bot"
elif(hasMultipleCards('J', 2, "player") and not(hasMultipleCards('J', 2, "bot"))):
return "player"
elif((not hasMultipleCards('J', 2, "player")) and hasMultipleCards('J', 2, "bot")):
return "bot"
elif(hasMultipleCards(10, 2, "player") and not(hasMultipleCards(10, 2, "bot"))):
return "player"
elif((not hasMultipleCards(10, 2, "player")) and hasMultipleCards(10, 2, "bot")):
return "bot"
elif(hasMultipleCards(9, 2, "player") and not(hasMultipleCards(9, 2, "bot"))):
return "player"
elif((not hasMultipleCards(9, 2, "player")) and hasMultipleCards(9, 2, "bot")):
return "bot"
elif(hasMultipleCards(8, 2, "player") and not(hasMultipleCards(8, 2, "bot"))):
return "player"
elif((not hasMultipleCards(8, 2, "player")) and hasMultipleCards(8, 2, "bot")):
return "bot"
elif(hasMultipleCards(7, 2, "player") and not(hasMultipleCards(7, 2, "bot"))):
return "player"
elif((not hasMultipleCards(7, 2, "player")) and hasMultipleCards(7, 2, "bot")):
return "bot"
elif(hasMultipleCards(6, 2, "player") and not(hasMultipleCards(6, 2, "bot"))):
return "player"
elif((not hasMultipleCards(6, 2, "player")) and hasMultipleCards(6, 2, "bot")):
return "bot"
elif(hasMultipleCards(5, 2, "player") and not(hasMultipleCards(5, 2, "bot"))):
return "player"
elif((not hasMultipleCards(5, 2, "player")) and hasMultipleCards(5, 2, "bot")):
return "bot"
elif(hasMultipleCards(4, 2, "player") and not(hasMultipleCards(4, 2, "bot"))):
return "player"
elif((not hasMultipleCards(4, 2, "player")) and hasMultipleCards(4, 2, "bot")):
return "bot"
elif(hasMultipleCards(3, 2, "player") and not(hasMultipleCards(3, 2, "bot"))):
return "player"
elif((not hasMultipleCards(3, 2, "player")) and hasMultipleCards(3, 2, "bot")):
return "bot"
elif(hasMultipleCards(2, 2, "player") and not(hasMultipleCards(2, 2, "bot"))):
return "player"
elif((not hasMultipleCards(2, 2, "player")) and hasMultipleCards(2, 2, "bot")):
return "bot"
elif(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
elif(hasPair("player") and not hasPair("bot")):
return "player"
elif((not hasPair("player")) and hasPair("bot")):
return("bot")
elif(hasPair("player") and hasPair("bot")):
if(hasMultipleCards('A', 2, "player")):
return "player"
elif(hasMultipleCards('A', 2, "bot")):
return "bot"
elif(hasMultipleCards('K', 2, "player")):
return "player"
elif(hasMultipleCards('K', 2, "bot")):
return "bot"
elif(hasMultipleCards('Q', 2, "player")):
return "player"
elif(hasMultipleCards('Q', 2, "bot")):
return "bot"
elif(hasMultipleCards('J', 2, "player")):
return "player"
elif(hasMultipleCards('J', 2, "bot")):
return "bot"
elif(hasMultipleCards(10, 2, "player")):
return "player"
elif(hasMultipleCards(10, 2, "bot")):
return "bot"
elif(hasMultipleCards(9, 2, "player")):
return "player"
elif(hasMultipleCards(9, 2, "bot")):
return "bot"
elif(hasMultipleCards(8, 2, "player")):
return "player"
elif(hasMultipleCards(8, 2, "bot")):
return "bot"
elif(hasMultipleCards(7, 2, "player")):
return "player"
elif(hasMultipleCards(7, 2, "bot")):
return "bot"
elif(hasMultipleCards(6, 2, "player")):
return "player"
elif(hasMultipleCards(6, 2, "bot")):
return "bot"
elif(hasMultipleCards(5, 2, "player")):
return "player"
elif(hasMultipleCards(5, 2, "bot")):
return "bot"
elif(hasMultipleCards(4, 2, "player")):
return "player"
elif(hasMultipleCards(4, 2, "bot")):
return "bot"
elif(hasMultipleCards(3, 2, "player")):
return "player"
elif(hasMultipleCards(3, 2, "bot")):
return "bot"
elif(hasMultipleCards(2, 2, "player")):
return "player"
elif(hasMultipleCards(2, 2, "bot")):
return "bot"
elif(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
else:
if(highestCardNum("player") > highestCardNum("bot")):
return "player"
elif(highestCardNum("player") < highestCardNum("bot")):
return "bot"
else:
if(highestCardNum("player", 2) > highestCardNum("bot", 2)):
return "player"
elif(highestCardNum("player", 2) < highestCardNum("bot", 2)):
return "bot"
else:
if(highestCardNum("player", 3) > highestCardNum("bot", 3)):
return "player"
elif(highestCardNum("player", 3) < highestCardNum("bot", 3)):
return "bot"
else:
if(highestCardNum("player", 4) > highestCardNum("bot", 4)):
return "player"
elif(highestCardNum("player", 4) < highestCardNum("bot", 4)):
return "bot"
else:
if(highestCardNum("player", 5) > highestCardNum("bot", 5)):
return "player"
elif(highestCardNum("player", 5) < highestCardNum("bot", 5)):
return "bot"
else:
return "tie"
def highestCardNum(a, _higestNum = 1):
global playerCards
global botCards
numsToSort = []
if(a == "player"):
for i in range(5):
if(playerCards[i][0] == 'A'):
numsToSort.append(14)
elif(playerCards[i][0] == 'K'):
numsToSort.append(13)
elif(playerCards[i][0] == 'Q'):
numsToSort.append(12)
elif(playerCards[i][0] == 'J'):
numsToSort.append(11)
else:
numsToSort.append(playerCards[i][0])
return (sort(numsToSort))[5-_higestNum]
else:
for i in range(5):
if(botCards[i][0] == 'A'):
numsToSort.append(14)
elif(botCards[i][0] == 'K'):
numsToSort.append(13)
elif(botCards[i][0] == 'Q'):
numsToSort.append(12)
elif(botCards[i][0] == 'J'):
numsToSort.append(11)
else:
numsToSort.append(botCards[i][0])
return (sort(numsToSort))[5-_higestNum]
def botsTradeAmount():
global botCards
if(hasStraight("bot") or hasFlush("bot") or (hasFourOfKind("bot") and hasCard("bot", 'A')) or hasFullHouse("bot")):
return 0
elif(hasFourOfKind("bot") or hasTwoPair("bot")):
return 1
elif(hasThreeOfKind("bot")):
return 2
elif(hasPair("bot")):
return 3
elif(hasCard("bot", 'A')):
return 4
elif(hasAlmostFlush("bot")):
return 1
else:
return 3
def hasAlmostFlush(a):
global botCards
global playerCards
if(a == "player"):
if((playerCards[0][1] == playerCards[1][1] and playerCards[1][1] == playerCards[2][1] and playerCards[2][1] == playerCards[3][1]) or (playerCards[0][1] == playerCards[1][1] and playerCards[1][1] == playerCards[2][1] and playerCards[2][1] == playerCards[4][1]) or (playerCards[0][1] == playerCards[1][1] and playerCards[1][1] == playerCards[3][1] and playerCards[3][1] == playerCards[4][1]) or (playerCards[0][1] == playerCards[2][1] and playerCards[2][1] == playerCards[3][1] and playerCards[3][1] == playerCards[4][1]) or (playerCards[1][1] == playerCards[2][1] and playerCards[2][1] == playerCards[3][1] and playerCards[3][1] == playerCards[4][1])):
return True
else:
return False
else:
if((botCards[0][1] == botCards[1][1] and botCards[1][1] == botCards[2][1] and botCards[2][1] == botCards[3][1]) or (botCards[0][1] == botCards[1][1] and botCards[1][1] == botCards[2][1] and botCards[2][1] == botCards[4][1]) or (botCards[0][1] == botCards[1][1] and botCards[1][1] == botCards[3][1] and botCards[3][1] == botCards[4][1]) or (botCards[0][1] == botCards[2][1] and botCards[2][1] == botCards[3][1] and botCards[3][1] == botCards[4][1]) or (botCards[1][1] == botCards[2][1] and botCards[2][1] == botCards[3][1] and botCards[3][1] == botCards[4][1])):
return True
else:
return False
def sort(array):
newArray = []
array = arrayDestroyer(array)
while(True):
if(array[0]<array[1] and array[1]<array[2] and array[2]<array[3] and array[3]<array[4]):
break
else:
array = arrayDestroyer(array)
return array
def arrayDestroyer(array):
newArray = []
rk = False
for i in range(5):
theNum = random.randrange(0, len(array))
newArray.append(array[theNum])
array.remove(array[theNum])
rk = True
return newArray
main()
| 49.917473
| 1,309
| 0.489049
| 9,475
| 87,705
| 4.526544
| 0.026385
| 0.06736
| 0.046632
| 0.034111
| 0.849658
| 0.81121
| 0.7674
| 0.729907
| 0.719532
| 0.701812
| 0
| 0.046987
| 0.355977
| 87,705
| 1,756
| 1,310
| 49.9459
| 0.712326
| 0.000684
| 0
| 0.687277
| 0
| 0.001784
| 0.071671
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.014269
| false
| 0.000595
| 0.001189
| 0
| 0.222354
| 0.017836
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ce9e38f0d7b4f8d379ecddea5a300ecaba403cb0
| 26,824
|
py
|
Python
|
tests/ope/test_regression_models.py
|
nmasahiro/zr-obp
|
dde815dfe75fc6cc3c9ee6479d97db1e5567de6d
|
[
"Apache-2.0"
] | null | null | null |
tests/ope/test_regression_models.py
|
nmasahiro/zr-obp
|
dde815dfe75fc6cc3c9ee6479d97db1e5567de6d
|
[
"Apache-2.0"
] | null | null | null |
tests/ope/test_regression_models.py
|
nmasahiro/zr-obp
|
dde815dfe75fc6cc3c9ee6479d97db1e5567de6d
|
[
"Apache-2.0"
] | null | null | null |
from typing import Dict
from pathlib import Path
import yaml
import numpy as np
from sklearn.experimental import enable_hist_gradient_boosting # noqa
from sklearn.ensemble import HistGradientBoostingClassifier, RandomForestClassifier
from sklearn.linear_model import LogisticRegression, Ridge
from sklearn.metrics import roc_auc_score
from sklearn.base import BaseEstimator
import pytest
from obp.ope import RegressionModel
from obp.types import BanditFeedback
from conftest import generate_action_dist
np.random.seed(1)
binary_model_dict = dict(
logistic_regression=LogisticRegression,
lightgbm=HistGradientBoostingClassifier,
random_forest=RandomForestClassifier,
)
# hyperparameter settings for the base ML model in regression model
cd_path = Path(__file__).parent.resolve()
with open(cd_path / "hyperparams.yaml", "rb") as f:
hyperparams = yaml.safe_load(f)
# action_context, n_actions, len_list, fitting_method, base_model, description
n_rounds = 1000
n_actions = 3
len_list = 3
invalid_input_of_initializing_regression_models = [
(
np.random.uniform(size=(n_actions, 8)),
"a", #
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
"n_actions must be an integer larger than 1",
),
(
np.random.uniform(size=(n_actions, 8)),
1, #
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
"n_actions must be an integer larger than 1",
),
(
np.random.uniform(size=(n_actions, 8)),
n_actions,
"a", #
"normal",
Ridge(**hyperparams["ridge"]),
"len_list must be a positive integer",
),
(
np.random.uniform(size=(n_actions, 8)),
n_actions,
0, #
"normal",
Ridge(**hyperparams["ridge"]),
"len_list must be a positive integer",
),
(
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
1, #
Ridge(**hyperparams["ridge"]),
"fitting_method must be one of",
),
(
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"awesome", #
Ridge(**hyperparams["ridge"]),
"fitting_method must be one of",
),
(
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
"RandomForest", #
"base_model must be BaseEstimator or a child class of BaseEstimator",
),
]
# context, action, reward, pscore, position, action_context, n_actions, len_list, fitting_method, base_model, action_dist, description
invalid_input_of_fitting_regression_models = [
(
None, #
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"context must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
None, #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
None, #
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"reward must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7, 3)), #
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"context must be 2-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=(n_rounds, 3)), #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action must be 1-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=(n_rounds, 3)), #
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"reward must be 1-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(["1", "a"], size=n_rounds), #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action elements must be non-negative integers",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice([-1, -3], size=n_rounds), #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action elements must be non-negative integers",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
"3", #
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"pscore must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones((n_rounds, 2)) * 2, #
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"pscore must be 1-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds - 1) * 2, #
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"context, action, reward, and pscore must be the same size.",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.arange(n_rounds), #
np.random.choice(len_list, size=n_rounds),
None,
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"pscore must be positive",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
"3", #
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"position must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=(n_rounds, 3)), #
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"position must be 1-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds - 1), #
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"context, action, reward, and position must be the same size.",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(["a", "1"], size=n_rounds), #
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"position elements must be non-negative integers",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds),
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice([-1, -3], size=n_rounds), #
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"position elements must be non-negative integers",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds - 1), #
np.random.uniform(size=n_rounds),
None,
None,
None,
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"context, action, and reward must be the same size",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.random.choice(n_actions, size=n_rounds - 1), #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
None,
None,
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"context, action, reward, and pscore must be the same size",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
"3", #
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action_context must be ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8, 3)), #
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action_context must be 2-dimensional",
),
(
np.random.uniform(size=(n_rounds, 7)),
(np.arange(n_rounds) % n_actions) + 1, #
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"action elements must be smaller than the size of the first dimension of action_context",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
None, #
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"when len_list > 1, position must be a 1-dimensional ndarray",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.ones(n_rounds, dtype=int) * len_list, #
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
3,
1,
"position elements must be smaller than len_list",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
None, #
3,
1,
"when fitting_method is either",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"mrdr",
Ridge(**hyperparams["ridge"]),
None, #
3,
1,
"when fitting_method is either",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
np.zeros((n_rounds, n_actions, len_list - 1)), #
3,
1,
"shape of action_dist must be (n_rounds, n_actions, len_list)",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
np.zeros((n_rounds, n_actions, len_list)), #
3,
1,
"action_dist must be a probability distribution",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
0, #
None,
"n_folds must be a positive integer",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
"a", #
None,
"n_folds must be a positive integer",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
"a", #
"random_state must be an integer",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.zeros(n_rounds, dtype=int), #
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
3,
1,
"No training data at position",
),
]
valid_input_of_regression_models = [
(
np.random.uniform(size=(n_rounds * 100, 7)),
np.arange(n_rounds * 100) % n_actions,
np.random.uniform(size=n_rounds * 100),
np.ones(n_rounds * 100) * 2,
np.random.choice(len_list, size=n_rounds * 100),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds * 100, n_actions, len_list),
3,
1,
"valid input with cross fitting",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
1,
1,
"valid input without cross fitting",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
None,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"normal",
Ridge(**hyperparams["ridge"]),
None,
1,
1,
"valid input without pscore and action_dist",
),
(
np.random.uniform(size=(n_rounds, 7)),
np.arange(n_rounds) % n_actions,
np.random.uniform(size=n_rounds),
np.ones(n_rounds) * 2,
np.random.choice(len_list, size=n_rounds),
np.random.uniform(size=(n_actions, 8)),
n_actions,
len_list,
"iw",
Ridge(**hyperparams["ridge"]),
generate_action_dist(n_rounds, n_actions, len_list),
1,
1,
"valid input when fitting_method is iw",
),
]
@pytest.mark.parametrize(
"action_context, n_actions, len_list, fitting_method, base_model, description",
invalid_input_of_initializing_regression_models,
)
def test_initializing_regression_models_using_invalid_input_data(
action_context: np.ndarray,
n_actions: int,
len_list: int,
fitting_method: str,
base_model: BaseEstimator,
description: str,
) -> None:
# initialization raises ValueError
with pytest.raises(ValueError, match=f"{description}*"):
_ = RegressionModel(
n_actions=n_actions,
len_list=len_list,
action_context=action_context,
base_model=base_model,
fitting_method=fitting_method,
)
@pytest.mark.parametrize(
"context, action, reward, pscore, position, action_context, n_actions, len_list, fitting_method, base_model, action_dist, n_folds, random_state, description",
invalid_input_of_fitting_regression_models,
)
def test_fitting_regression_models_using_invalid_input_data(
context: np.ndarray,
action: np.ndarray,
reward: np.ndarray,
pscore: np.ndarray,
position: np.ndarray,
action_context: np.ndarray,
n_actions: int,
len_list: int,
fitting_method: str,
base_model: BaseEstimator,
action_dist: np.ndarray,
n_folds: int,
random_state: int,
description: str,
) -> None:
# fit_predict function raises ValueError
with pytest.raises(ValueError, match=f"{description}*"):
regression_model = RegressionModel(
n_actions=n_actions,
len_list=len_list,
action_context=action_context,
base_model=base_model,
fitting_method=fitting_method,
)
if fitting_method == "normal":
# train regression model on logged bandit feedback data
_ = regression_model.fit_predict(
context=context,
action=action,
reward=reward,
position=position,
n_folds=n_folds,
random_state=random_state,
)
else:
# train regression model on logged bandit feedback data
_ = regression_model.fit_predict(
context=context,
action=action,
reward=reward,
pscore=pscore,
position=position,
action_dist=action_dist,
n_folds=n_folds,
random_state=random_state,
)
@pytest.mark.parametrize(
"context, action, reward, pscore, position, action_context, n_actions, len_list, fitting_method, base_model, action_dist, n_folds, random_state, description",
valid_input_of_regression_models,
)
def test_regression_models_using_valid_input_data(
context: np.ndarray,
action: np.ndarray,
reward: np.ndarray,
pscore: np.ndarray,
position: np.ndarray,
action_context: np.ndarray,
n_actions: int,
len_list: int,
fitting_method: str,
base_model: BaseEstimator,
action_dist: np.ndarray,
n_folds: int,
random_state: int,
description: str,
) -> None:
# fit_predict
regression_model = RegressionModel(
n_actions=n_actions,
len_list=len_list,
action_context=action_context,
base_model=base_model,
fitting_method=fitting_method,
)
if fitting_method == "normal":
# train regression model on logged bandit feedback data
_ = regression_model.fit_predict(
context=context,
action=action,
reward=reward,
position=position,
n_folds=n_folds,
random_state=random_state,
)
else:
# train regression model on logged bandit feedback data
_ = regression_model.fit_predict(
context=context,
action=action,
reward=reward,
pscore=pscore,
position=position,
action_dist=action_dist,
n_folds=n_folds,
random_state=random_state,
)
def test_performance_of_binary_outcome_models(
fixed_synthetic_bandit_feedback: BanditFeedback, random_action_dist: np.ndarray
) -> None:
"""
Test the performance of ope estimators using synthetic bandit data and random evaluation policy
when the regression model is estimated by a logistic regression
"""
bandit_feedback = fixed_synthetic_bandit_feedback.copy()
expected_reward = np.expand_dims(bandit_feedback["expected_reward"], axis=-1)
action_dist = random_action_dist
# compute ground truth policy value using expected reward
q_pi_e = np.average(expected_reward[:, :, 0], weights=action_dist[:, :, 0], axis=1)
# compute statistics of ground truth policy value
gt_mean = q_pi_e.mean()
random_state = 12345
auc_scores: Dict[str, float] = {}
# check ground truth
print(f"gt_mean: {gt_mean}")
# check the performance of regression models using doubly robust criteria (|\hat{q} - q| <= |q| is satisfied with a high probability)
dr_criteria_pass_rate = 0.8
fit_methods = ["normal", "iw", "mrdr"]
for fit_method in fit_methods:
for model_name, model in binary_model_dict.items():
regression_model = RegressionModel(
n_actions=bandit_feedback["n_actions"],
len_list=int(bandit_feedback["position"].max() + 1),
action_context=bandit_feedback["action_context"],
base_model=model(**hyperparams[model_name]),
fitting_method=fit_method,
)
if fit_method == "normal":
# train regression model on logged bandit feedback data
estimated_rewards_by_reg_model = regression_model.fit_predict(
context=bandit_feedback["context"],
action=bandit_feedback["action"],
reward=bandit_feedback["reward"],
n_folds=3, # 3-fold cross-fitting
random_state=random_state,
)
else:
# train regression model on logged bandit feedback data
estimated_rewards_by_reg_model = regression_model.fit_predict(
context=bandit_feedback["context"],
action=bandit_feedback["action"],
reward=bandit_feedback["reward"],
pscore=bandit_feedback["pscore"],
position=bandit_feedback["position"],
action_dist=action_dist,
n_folds=3, # 3-fold cross-fitting
random_state=random_state,
)
auc_scores[model_name + "_" + fit_method] = roc_auc_score(
y_true=bandit_feedback["reward"],
y_score=estimated_rewards_by_reg_model[
np.arange(bandit_feedback["reward"].shape[0]),
bandit_feedback["action"],
bandit_feedback["position"],
],
)
# compare dr criteria
dr_criteria = np.abs((gt_mean - estimated_rewards_by_reg_model)) - np.abs(
gt_mean
)
print(
f"Dr criteria is satisfied with probability {np.mean(dr_criteria <= 0)} ------ model: {model_name} ({fit_method}),"
)
assert (
np.mean(dr_criteria <= 0) >= dr_criteria_pass_rate
), f" should be satisfied with a probability at least {dr_criteria_pass_rate}"
for model_name in auc_scores:
print(f"AUC of {model_name} is {auc_scores[model_name]}")
assert (
auc_scores[model_name] > 0.5
), f"AUC of {model_name} should be greater than 0.5"
| 30.275395
| 162
| 0.566247
| 3,205
| 26,824
| 4.507332
| 0.067707
| 0.090129
| 0.089852
| 0.122318
| 0.810328
| 0.794961
| 0.778416
| 0.762841
| 0.760141
| 0.749135
| 0
| 0.013026
| 0.313115
| 26,824
| 885
| 163
| 30.309605
| 0.771018
| 0.043469
| 0
| 0.772889
| 0
| 0.003567
| 0.116732
| 0.001837
| 0
| 0
| 0
| 0
| 0.002378
| 1
| 0.004756
| false
| 0.003567
| 0.015458
| 0
| 0.020214
| 0.003567
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ced8384efa038f49627a939147e1901ce63abe25
| 3,840
|
py
|
Python
|
data_facility_admin/migrations/0008_auto_20181010_1428.py
|
NYU-CI/dfadmin
|
071f38c62aea8ef8bf4ae82dbd672694e719b9bf
|
[
"CC0-1.0"
] | 1
|
2021-04-08T05:22:35.000Z
|
2021-04-08T05:22:35.000Z
|
data_facility_admin/migrations/0008_auto_20181010_1428.py
|
NYU-CI/dfadmin
|
071f38c62aea8ef8bf4ae82dbd672694e719b9bf
|
[
"CC0-1.0"
] | 8
|
2019-08-05T18:16:07.000Z
|
2019-10-29T18:42:53.000Z
|
data_facility_admin/migrations/0008_auto_20181010_1428.py
|
NYU-CI/dfadmin
|
071f38c62aea8ef8bf4ae82dbd672694e719b9bf
|
[
"CC0-1.0"
] | 2
|
2019-09-11T15:24:32.000Z
|
2020-01-08T20:34:05.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-10 18:28
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_facility_admin', '0007_auto_20180403_1914'),
]
operations = [
migrations.AlterField(
model_name='historicaldataset',
name='ldap_name',
field=models.CharField(blank=True, db_index=True, error_messages={b'invalid': b'LDAP_NAME should contain at least 5 of the following: letters, numbers or "_" (underline).'}, help_text=b'Ldap_name should not have spaces or any special characters. It should have at least 5 characters consisting of: letters, numbers and "_" (underline). <br/> If left blank, it will be automatically generated.<br/><b>DO NOT CHANGE THIS VALUE AFTER THE OBJECT IS CREATED ON LDAP.</b>', max_length=256, null=True, validators=[django.core.validators.RegexValidator(regex=b'^[a-z0-9_-]{5,}$')]),
),
migrations.AlterField(
model_name='historicaldfrole',
name='ldap_name',
field=models.CharField(blank=True, db_index=True, error_messages={b'invalid': b'LDAP_NAME should contain at least 5 of the following: letters, numbers or "_" (underline).'}, help_text=b'Ldap_name should not have spaces or any special characters. It should have at least 5 characters consisting of: letters, numbers and "_" (underline). <br/> If left blank, it will be automatically generated.<br/><b>DO NOT CHANGE THIS VALUE AFTER THE OBJECT IS CREATED ON LDAP.</b>', max_length=256, null=True, validators=[django.core.validators.RegexValidator(regex=b'^[a-z0-9_-]{5,}$')]),
),
migrations.AlterField(
model_name='historicalproject',
name='ldap_name',
field=models.CharField(blank=True, db_index=True, error_messages={b'invalid': b'LDAP_NAME should contain at least 5 of the following: letters, numbers or "_" (underline).'}, help_text=b'Ldap_name should not have spaces or any special characters. It should have at least 5 characters consisting of: letters, numbers and "_" (underline). <br/> If left blank, it will be automatically generated.<br/><b>DO NOT CHANGE THIS VALUE AFTER THE OBJECT IS CREATED ON LDAP.</b>', max_length=256, null=True, validators=[django.core.validators.RegexValidator(regex=b'^[a-z0-9_-]{5,}$')]),
),
migrations.AlterField(
model_name='historicaluser',
name='ldap_name',
field=models.CharField(blank=True, db_index=True, error_messages={b'invalid': b'LDAP_NAME should contain at least 5 of the following: letters, numbers or "_" (underline).'}, help_text=b'Ldap_name should not have spaces or any special characters. It should have at least 5 characters consisting of: letters, numbers and "_" (underline). <br/> If left blank, it will be automatically generated.<br/><b>DO NOT CHANGE THIS VALUE AFTER THE OBJECT IS CREATED ON LDAP.</b>', max_length=256, null=True, validators=[django.core.validators.RegexValidator(regex=b'^[a-z0-9_-]{5,}$')]),
),
migrations.AlterField(
model_name='ldapobject',
name='ldap_name',
field=models.CharField(blank=True, error_messages={b'invalid': b'LDAP_NAME should contain at least 5 of the following: letters, numbers or "_" (underline).'}, help_text=b'Ldap_name should not have spaces or any special characters. It should have at least 5 characters consisting of: letters, numbers and "_" (underline). <br/> If left blank, it will be automatically generated.<br/><b>DO NOT CHANGE THIS VALUE AFTER THE OBJECT IS CREATED ON LDAP.</b>', max_length=256, null=True, unique=True, validators=[django.core.validators.RegexValidator(regex=b'^[a-z0-9_-]{5,}$')]),
),
]
| 91.428571
| 586
| 0.704167
| 546
| 3,840
| 4.835165
| 0.181319
| 0.045455
| 0.034091
| 0.056818
| 0.872727
| 0.872727
| 0.872727
| 0.872727
| 0.858712
| 0.858712
| 0
| 0.022642
| 0.171875
| 3,840
| 41
| 587
| 93.658537
| 0.807547
| 0.017188
| 0
| 0.558824
| 1
| 0.147059
| 0.56245
| 0.006099
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.088235
| 0
| 0.176471
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0c6d995fb2bb5a7fee2b51cd3c158c2b93f1907d
| 47,117
|
py
|
Python
|
kameleo/local_api_client/kameleo_local_api_client.py
|
kameleo-io/local-api-client-python
|
e2dcb17898075b76dc2a49d36f9c50af8c9b2b8a
|
[
"MIT"
] | 29
|
2021-10-01T10:12:31.000Z
|
2022-02-26T21:13:51.000Z
|
kameleo/local_api_client/kameleo_local_api_client.py
|
kameleo-io/local-api-client-python
|
e2dcb17898075b76dc2a49d36f9c50af8c9b2b8a
|
[
"MIT"
] | 2
|
2021-10-01T10:16:02.000Z
|
2021-10-05T14:04:57.000Z
|
kameleo/local_api_client/kameleo_local_api_client.py
|
kameleo-io/local-api-client-python
|
e2dcb17898075b76dc2a49d36f9c50af8c9b2b8a
|
[
"MIT"
] | 2
|
2021-11-22T01:19:10.000Z
|
2021-12-07T03:21:32.000Z
|
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from . import models
class KameleoLocalApiClientConfiguration(Configuration):
"""Configuration for KameleoLocalApiClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param str base_url: Service URL
"""
def __init__(
self, base_url=None):
if not base_url:
base_url = 'http://localhost:5050'
super(KameleoLocalApiClientConfiguration, self).__init__(base_url)
self.add_user_agent('kameleo.local_api_client/{}'.format(VERSION))
class KameleoLocalApiClient(SDKClient):
"""You can use the following API endpoints to communicate with the local running Kameleo programmatically.
:ivar config: Configuration for client.
:vartype config: KameleoLocalApiClientConfiguration
:param str base_url: Service URL
"""
def __init__(
self, base_url=None):
self.config = KameleoLocalApiClientConfiguration(base_url)
super(KameleoLocalApiClient, self).__init__(None, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = 'v1'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
def get_base_profile_search_parameters(
self, device_type=None, os_family=None, browser_product=None, language=None, custom_headers=None, raw=False, **operation_config):
"""Get the possible values for base profile filtering. We can filter the
available values. With this we can see for example that what languages
of profiles do we have for Windows profiles with Chrome.
:param device_type: Filter option for the Device Type. Possible values
are 'desktop', 'mobile'. For example set it to mobile if you only want
to see what os families we have for mobile profiles.
:type device_type: str
:param os_family: Filter option for os family. Possible values are
'windows', 'macos', 'linux', 'android', 'ios'. For example set it to
windows if you only want to see what languages we have for windows
profiles.
:type os_family: str
:param browser_product: Filter option for browser product. Possible
values are 'chrome', 'firefox', 'edge', 'safari'. For example set it
to safari if you only want to see what os families we have for chrome
profiles.
:type browser_product: str
:param language: Filter option for os language. Use ISO 639-1 language
code format. For example set it to en-gb if you only want to see what
browser products we have for English profiles.
:type language: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: BaseProfileSearchParameters or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.BaseProfileSearchParameters
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.get_base_profile_search_parameters.metadata['url']
# Construct parameters
query_parameters = {}
if device_type is not None:
query_parameters['deviceType'] = self._serialize.query("device_type", device_type, 'str')
if os_family is not None:
query_parameters['osFamily'] = self._serialize.query("os_family", os_family, 'str')
if browser_product is not None:
query_parameters['browserProduct'] = self._serialize.query("browser_product", browser_product, 'str')
if language is not None:
query_parameters['language'] = self._serialize.query("language", language, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('BaseProfileSearchParameters', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_base_profile_search_parameters.metadata = {'url': '/base-profile-search-parameters'}
def search_base_profiles(
self, device_type=None, os_family=None, browser_product=None, language=None, custom_headers=None, raw=False, **operation_config):
"""Filtering base profiles with some criteria. It will return X base
profiles. It is not an idempotent method. This means if you are calling
it twice after each other it may return a different set of base
profiles.
:param device_type: Filter option for the Device Type. Possible values
are 'desktop', 'mobile'. For example set it to mobile if you only want
to get mobile profiles.
:type device_type: str
:param os_family: Filter option for os family. Possible values are
'windows', 'macos', 'linux', 'android', 'ios'. For example set it to
windows if you only want to get Windows profiles.
:type os_family: str
:param browser_product: Filter option for browser product. Possible
values are 'chrome', 'firefox', 'edge', 'safari'. For example set it
to safari if you only want to get profiles with Safari browser.
:type browser_product: str
:param language: Filter option for os language. Use ISO 639-1 language
code format. For example set it to en-gb if you only want to get
English profiles.
:type language: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~kameleo.local_api_client.models.BaseProfilePreview] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.search_base_profiles.metadata['url']
# Construct parameters
query_parameters = {}
if device_type is not None:
query_parameters['deviceType'] = self._serialize.query("device_type", device_type, 'str')
if os_family is not None:
query_parameters['osFamily'] = self._serialize.query("os_family", os_family, 'str')
if browser_product is not None:
query_parameters['browserProduct'] = self._serialize.query("browser_product", browser_product, 'str')
if language is not None:
query_parameters['language'] = self._serialize.query("language", language, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[BaseProfilePreview]', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
search_base_profiles.metadata = {'url': '/base-profiles'}
def list_cookies(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Gets the list of the cookies of the profile.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~kameleo.local_api_client.models.BrowserCookie] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.list_cookies.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[BrowserCookie]', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list_cookies.metadata = {'url': '/profiles/{guid}/cookies'}
def add_cookies(
self, guid, body=None, custom_headers=None, raw=False, **operation_config):
"""Adds a list of cookies to the profile. If cookies are already present
for a domain, they will be overwritten.
:param guid: The unique identifier of the profile
:type guid: str
:param body:
:type body: list[~kameleo.local_api_client.models.CookieRequest]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~kameleo.local_api_client.models.BrowserCookie] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.add_cookies.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, '[CookieRequest]')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[BrowserCookie]', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
add_cookies.metadata = {'url': '/profiles/{guid}/cookies'}
def delete_cookies(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Deletes the cookies of the profile.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.delete_cookies.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete_cookies.metadata = {'url': '/profiles/{guid}/cookies'}
def healthcheck(
self, custom_headers=None, raw=False, **operation_config):
"""Health check request to test if Kameleo has been started and accepting
connections.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.healthcheck.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
healthcheck.metadata = {'url': '/general/healthcheck'}
def get_user_info(
self, custom_headers=None, raw=False, **operation_config):
"""Provides information about the user.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: UserInfoResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.UserInfoResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.get_user_info.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('UserInfoResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_user_info.metadata = {'url': '/general/user-info'}
def terminate_application(
self, custom_headers=None, raw=False, **operation_config):
"""Terminates the Kameleo session by deauthenticating and exiting the CLI.
It is important to call it after operating with Kameleo, so other users
of the team account won't be logged out.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.terminate_application.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
terminate_application.metadata = {'url': '/general/terminate'}
def test_proxy(
self, body=None, custom_headers=None, raw=False, **operation_config):
"""Tests a provided proxy connection.
:param body:
:type body: ~kameleo.local_api_client.models.TestProxyRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: TestProxyResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.TestProxyResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`TestProxyResponseException<kameleo.local_api_client.models.TestProxyResponseException>`
"""
# Construct URL
url = self.test_proxy.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'TestProxyRequest')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.TestProxyResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('TestProxyResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
test_proxy.metadata = {'url': '/general/test-proxy'}
def list_profiles(
self, custom_headers=None, raw=False, **operation_config):
"""Gets a preview list about profiles that are currently in the system.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: list or ClientRawResponse if raw=true
:rtype: list[~kameleo.local_api_client.models.ProfilePreview] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.list_profiles.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[ProfilePreview]', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list_profiles.metadata = {'url': '/profiles'}
def create_profile(
self, body=None, custom_headers=None, raw=False, **operation_config):
"""Creates a new profile based on a selected BaseProfile and inputs.
:param body:
:type body: ~kameleo.local_api_client.models.CreateProfileRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProfileResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.ProfileResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.create_profile.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'CreateProfileRequest')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ProfileResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
create_profile.metadata = {'url': '/profiles/new'}
def update_profile(
self, guid, body=None, custom_headers=None, raw=False, **operation_config):
"""Updates profile settings.
:param guid: The unique identifier of the profile
:type guid: str
:param body:
:type body: ~kameleo.local_api_client.models.UpdateProfileRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProfileResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.ProfileResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.update_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'UpdateProfileRequest')
else:
body_content = None
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ProfileResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
update_profile.metadata = {'url': '/profiles/{guid}'}
def read_profile(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Returns a profile from the system.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProfileResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.ProfileResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.read_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ProfileResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
read_profile.metadata = {'url': '/profiles/{guid}'}
def delete_profile(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Removes profile from the system. When you are launching and stopping a
big number of profiles for example for scraping it is recommended to
call this after you have stopped the profile. This will free up disk
space.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.delete_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete_profile.metadata = {'url': '/profiles/{guid}'}
def get_profile_status(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Returns the current status of the profile.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: StatusResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.StatusResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.get_profile_status.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('StatusResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_profile_status.metadata = {'url': '/profiles/{guid}/status'}
def start_profile(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Starts a profile. The browser will be launched. In case of mobile
profiles and external launcher types the external spoofing engine will
be launched.
If successful, the profile's lifetime state will be 'running'.
Otherwise the profile's lifetime state will be 'terminated'. During the
api call the lifetime state can be 'starting' for a temporarily.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: StatusResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.StatusResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.start_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('StatusResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
start_profile.metadata = {'url': '/profiles/{guid}/start'}
def start_profile_with_web_driver_settings(
self, guid, body=None, custom_headers=None, raw=False, **operation_config):
"""Starts a profile, for desktop profiles additional WebDriver settings
can be provided. The browser will be launched. In case of mobile
profiles and external launcher types the external spoofing engine will
be launched.
If successful, the profile's lifetime state will be 'running'.
Otherwise the profile's lifetime state will be 'terminated'. During the
api call the lifetime state can be 'starting' for a temporarily.
:param guid: The unique identifier of the profile
:type guid: str
:param body:
:type body: ~kameleo.local_api_client.models.WebDriverSettings
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: StatusResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.StatusResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.start_profile_with_web_driver_settings.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'WebDriverSettings')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('StatusResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
start_profile_with_web_driver_settings.metadata = {'url': '/profiles/{guid}/start'}
def stop_profile(
self, guid, custom_headers=None, raw=False, **operation_config):
"""Stops a profile. The browsers will be stopped. In case of mobile
profiles and external launcher types the external spoofing engine will
be stopped.
If successful, the profile's lifetime state will be 'terminated'.
Otherwise the profile's lifetime state will be 'running'. During the
api call the lifetime state can be 'terminating' for a temporarily.
:param guid: The unique identifier of the profile
:type guid: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: StatusResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.StatusResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.stop_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('StatusResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
stop_profile.metadata = {'url': '/profiles/{guid}/stop'}
def save_profile(
self, guid, body=None, custom_headers=None, raw=False, **operation_config):
"""Saves a profile to a file. It will create a .kameleo file to the
required location. It will store all the profile settings, browsing
data, cookies, history, bookmarks, installed extension / addons. Later
it can be reloaded.
:param guid: The unique identifier of the profile
:type guid: str
:param body:
:type body: ~kameleo.local_api_client.models.SaveProfileRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProfileResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.ProfileResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.save_profile.metadata['url']
path_format_arguments = {
'guid': self._serialize.url("guid", guid, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'SaveProfileRequest')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ProfileResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
save_profile.metadata = {'url': '/profiles/{guid}/save'}
def load_profile(
self, body=None, custom_headers=None, raw=False, **operation_config):
"""Loads a profile from a file. It will load the profile from a .kameleo
file. It will load all the profile settings, browsing data, cookies,
history, bookmarks, installed extension / addons.
:param body:
:type body: ~kameleo.local_api_client.models.LoadProfileRequest
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProfileResponse or ClientRawResponse if raw=true
:rtype: ~kameleo.local_api_client.models.ProfileResponse or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ProblemResponseException<kameleo.local_api_client.models.ProblemResponseException>`
"""
# Construct URL
url = self.load_profile.metadata['url']
# Construct parameters
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
if body is not None:
body_content = self._serialize.body(body, 'LoadProfileRequest')
else:
body_content = None
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ProblemResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ProfileResponse', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
load_profile.metadata = {'url': '/profiles/load'}
| 40.971304
| 141
| 0.666596
| 5,001
| 47,117
| 6.115577
| 0.067387
| 0.043421
| 0.02158
| 0.030212
| 0.882651
| 0.874379
| 0.865551
| 0.858521
| 0.848941
| 0.842042
| 0
| 0.003657
| 0.251353
| 47,117
| 1,149
| 142
| 41.006963
| 0.863384
| 0.386612
| 0
| 0.794355
| 1
| 0
| 0.072819
| 0.010195
| 0
| 0
| 0
| 0
| 0
| 1
| 0.044355
| false
| 0
| 0.010081
| 0
| 0.131048
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
0c7c77b305b4648d24373297177b2b30b2ad9445
| 14,372
|
py
|
Python
|
full_conv/Exp5_small_datasets/action_recognition/model.py
|
oskyhn/CNNs-Without-Borders
|
4fae1d8fd64c3c917f5c78c3513a60572af961b1
|
[
"BSD-3-Clause"
] | 74
|
2020-03-17T02:14:37.000Z
|
2022-01-16T20:30:09.000Z
|
full_conv/Exp5_small_datasets/action_recognition/model.py
|
oskyhn/CNNs-Without-Borders
|
4fae1d8fd64c3c917f5c78c3513a60572af961b1
|
[
"BSD-3-Clause"
] | 5
|
2020-03-31T14:27:16.000Z
|
2021-10-05T19:45:46.000Z
|
full_conv/Exp5_small_datasets/action_recognition/model.py
|
oskyhn/CNNs-Without-Borders
|
4fae1d8fd64c3c917f5c78c3513a60572af961b1
|
[
"BSD-3-Clause"
] | 4
|
2020-04-04T01:15:26.000Z
|
2021-12-23T01:48:01.000Z
|
# This code is built from Kensho Hara's repository: https://github.com/kenshohara/3D-ResNets-PyTorch.
# Copyright (c) 2017 Kensho Hara.
# The repository is available under the MIT License.
#
# ==========================================================================================
# This implementation includes Same-Conv and Full-Conv versions all together.
# For more details see the paper:
# O. S. Kayhan and J. van Gemert,
# "On Translation Invariance in CNNs: Convolutional Layers can Exploit Absolute Spatial Location"
# In CVPR, 2020.
# https://arxiv.org/abs/2003.07064
# ==========================================================================================
import torch
from torch import nn
from models import resnet_fconv_tem, resnet_fconv, resnet, pre_act_resnet, wide_resnet, resnext, densenet
def generate_model(opt):
assert opt.model in [
'resnet', 'preresnet', 'wideresnet', 'resnext', 'densenet'
]
if opt.model == 'resnet':
assert opt.model_depth in [10, 18, 34, 50, 101, 152, 200]
if opt.f_conv: # using Full-Conv
if opt.temporal: # with temporal Full-Conv
print("Full-Conv-Temporal")
from models.resnet_fconv_tem import get_fine_tuning_parameters
if opt.model_depth == 10:
model = resnet_fconv_tem.resnet10(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 18:
model = resnet_fconv_tem.resnet18(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 34:
model = resnet_fconv_tem.resnet34(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 50:
model = resnet_fconv_tem.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 101:
model = resnet_fconv_tem.resnet101(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 152:
model = resnet_fconv_tem.resnet152(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 200:
model = resnet_fconv_tem.resnet200(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
else: # spatial Full-Conv
from models.resnet_fconv import get_fine_tuning_parameters
if opt.model_depth == 10:
model = resnet_fconv.resnet10(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 18:
model = resnet_fconv.resnet18(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 34:
model = resnet_fconv.resnet34(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 50:
model = resnet_fconv.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 101:
model = resnet_fconv.resnet101(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 152:
model = resnet_fconv.resnet152(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 200:
model = resnet_fconv.resnet200(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
else: # using same convolution
print("Same-Conv")
from models.resnet import get_fine_tuning_parameters
if opt.model_depth == 10:
model = resnet.resnet10(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 18:
model = resnet.resnet18(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 34:
model = resnet.resnet34(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 50:
model = resnet.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 101:
model = resnet.resnet101(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 152:
model = resnet.resnet152(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 200:
model = resnet.resnet200(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model == 'wideresnet':
assert opt.model_depth in [50]
from models.wide_resnet import get_fine_tuning_parameters
if opt.model_depth == 50:
model = wide_resnet.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
k=opt.wide_resnet_k,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model == 'resnext':
assert opt.model_depth in [50, 101, 152]
from models.resnext import get_fine_tuning_parameters
if opt.model_depth == 50:
model = resnext.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
cardinality=opt.resnext_cardinality,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 101:
model = resnext.resnet101(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
cardinality=opt.resnext_cardinality,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 152:
model = resnext.resnet152(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
cardinality=opt.resnext_cardinality,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model == 'preresnet':
assert opt.model_depth in [18, 34, 50, 101, 152, 200]
from models.pre_act_resnet import get_fine_tuning_parameters
if opt.model_depth == 18:
model = pre_act_resnet.resnet18(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 34:
model = pre_act_resnet.resnet34(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 50:
model = pre_act_resnet.resnet50(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 101:
model = pre_act_resnet.resnet101(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 152:
model = pre_act_resnet.resnet152(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 200:
model = pre_act_resnet.resnet200(
num_classes=opt.n_classes,
shortcut_type=opt.resnet_shortcut,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model == 'densenet':
assert opt.model_depth in [121, 169, 201, 264]
from models.densenet import get_fine_tuning_parameters
if opt.model_depth == 121:
model = densenet.densenet121(
num_classes=opt.n_classes,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 169:
model = densenet.densenet169(
num_classes=opt.n_classes,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 201:
model = densenet.densenet201(
num_classes=opt.n_classes,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
elif opt.model_depth == 264:
model = densenet.densenet264(
num_classes=opt.n_classes,
sample_size=opt.sample_size,
sample_duration=opt.sample_duration)
if not opt.no_cuda:
model = model.cuda()
model = nn.DataParallel(model, device_ids=None)
if opt.pretrain_path:
print('loading pretrained model {}'.format(opt.pretrain_path))
pretrain = torch.load(opt.pretrain_path)
assert opt.arch == pretrain['arch']
model.load_state_dict(pretrain['state_dict'])
if opt.model == 'densenet':
model.module.classifier = nn.Linear(
model.module.classifier.in_features, opt.n_finetune_classes)
model.module.classifier = model.module.classifier.cuda()
else:
model.module.fc = nn.Linear(model.module.fc.in_features,
opt.n_finetune_classes)
model.module.fc = model.module.fc.cuda()
parameters = get_fine_tuning_parameters(model, opt.ft_begin_index)
return model, parameters
else:
if opt.pretrain_path:
print('loading pretrained model {}'.format(opt.pretrain_path))
pretrain = torch.load(opt.pretrain_path)
assert opt.arch == pretrain['arch']
model.load_state_dict(pretrain['state_dict'])
if opt.model == 'densenet':
model.classifier = nn.Linear(
model.classifier.in_features, opt.n_finetune_classes)
else:
model.fc = nn.Linear(model.fc.in_features,
opt.n_finetune_classes)
parameters = get_fine_tuning_parameters(model, opt.ft_begin_index)
return model, parameters
return model, model.parameters()
| 45.481013
| 105
| 0.541748
| 1,459
| 14,372
| 5.047293
| 0.104866
| 0.095057
| 0.070614
| 0.06654
| 0.817219
| 0.807713
| 0.797393
| 0.786257
| 0.775394
| 0.769419
| 0
| 0.027688
| 0.376774
| 14,372
| 315
| 106
| 45.625397
| 0.794462
| 0.050932
| 0
| 0.703297
| 0
| 0
| 0.015048
| 0
| 0
| 0
| 0
| 0
| 0.029304
| 1
| 0.003663
| false
| 0
| 0.03663
| 0
| 0.051282
| 0.014652
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0cf2940de590201fd44a25563d93e13bb5fcaa04
| 167
|
py
|
Python
|
drf_braces/fields/__init__.py
|
wlongo/django-rest-framework-braces
|
f1b6fcb20414280e19a7810c81ce68406ad2a305
|
[
"MIT"
] | 80
|
2015-07-01T12:55:35.000Z
|
2021-09-23T19:40:37.000Z
|
drf_braces/fields/__init__.py
|
wlongo/django-rest-framework-braces
|
f1b6fcb20414280e19a7810c81ce68406ad2a305
|
[
"MIT"
] | 28
|
2015-07-03T11:37:38.000Z
|
2022-02-28T02:56:08.000Z
|
drf_braces/fields/__init__.py
|
wlongo/django-rest-framework-braces
|
f1b6fcb20414280e19a7810c81ce68406ad2a305
|
[
"MIT"
] | 16
|
2015-07-09T01:03:39.000Z
|
2022-01-20T19:25:24.000Z
|
from __future__ import absolute_import, print_function, unicode_literals
from ._fields import * # noqa
from .custom import * # noqa
from .modified import * # noqa
| 27.833333
| 72
| 0.766467
| 21
| 167
| 5.714286
| 0.571429
| 0.25
| 0.233333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.167665
| 167
| 5
| 73
| 33.4
| 0.863309
| 0.083832
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0.25
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
0b4a3564a0bdae4d001b2680bfc0c548246be970
| 4,467
|
py
|
Python
|
python/qrs/database_details/cybhi_database_details.py
|
ufopcsilab/ECGClassification
|
e45044e98be45becc04b032713a727eec7fb029a
|
[
"MIT"
] | null | null | null |
python/qrs/database_details/cybhi_database_details.py
|
ufopcsilab/ECGClassification
|
e45044e98be45becc04b032713a727eec7fb029a
|
[
"MIT"
] | null | null | null |
python/qrs/database_details/cybhi_database_details.py
|
ufopcsilab/ECGClassification
|
e45044e98be45becc04b032713a727eec7fb029a
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
"""
@ide: PyCharm
@author: Pedro Silva
@contact: pedroh21.silva@gmail.com
@created: out-15 of 2019
"""
from .base_database_details import BaseDatabaseDetails
from ..paths import DataPaths
class CYBHiDetails(BaseDatabaseDetails):
@classmethod
def get_base_data_path(cls):
return DataPaths.get_cybhi_base_data_path()
@classmethod
def get_test_records(cls):
return ['20120416-AL-A0-35.txt.mat', '20120416-FO-A0-35.txt.mat', '20120416-JP-A0-35.txt.mat', '20120416-JS-A0-35.txt.mat',
'20120416-RAA-A0-35.txt.mat', '20120416-RL-A0-35.txt.mat', '20120419-AC-A0-35.txt.mat', '20120419-CB-A0-35.txt.mat',
'20120419-FP-A0-35.txt.mat', '20120419-JCA-A0-35.txt.mat', '20120419-MQ-A0-35.txt.mat', '20120419-RR-A0-35.txt.mat',
'20120423-AFS-A0-35.txt.mat', '20120423-JSA-A0-35.txt.mat', '20120423-RD-A0-35.txt.mat', '20120423-SR-A0-35.txt.mat',
'20120424-AG-A0-35.txt.mat', '20120424-AR-A0-35.txt.mat', '20120424-MGA-A0-35.txt.mat', '20120427-MMJ-A0-35.txt.mat',
'20120430-ACA-A0-35.txt.mat', '20120430-ARL-A0-35.txt.mat', '20120430-CSR-A0-35.txt.mat', '20120430-DS-A0-35.txt.mat',
'20120430-FM-A0-35.txt.mat', '20120430-IC-A0-35.txt.mat', '20120430-JB-A0-35.txt.mat', '20120430-JCC-A0-35.txt.mat',
'20120430-JM-A0-35.txt.mat', '20120430-JPA-A0-35.txt.mat', '20120430-MC-A0-35.txt.mat', '20120430-MJR-A0-35.txt.mat',
'20120430-MP-A0-35.txt.mat', '20120430-PES-A0-35.txt.mat', '20120430-RA-A0-35.txt.mat', '20120430-RRA-A0-35.txt.mat',
'20120430-TC-A0-35.txt.mat', '20120430-TV-A0-35.txt.mat', '20120502-ABD-A0-35.txt.mat', '20120502-ARA-A0-35.txt.mat',
'20120502-DB-A0-35.txt.mat', '20120502-DC-A0-35.txt.mat', '20120502-GF-A0-35.txt.mat', '20120502-HF-A0-35.txt.mat',
'20120502-IB-A0-35.txt.mat', '20120502-JL-A0-35.txt.mat', '20120502-JN-A0-35.txt.mat', '20120502-JV-A0-35.txt.mat',
'20120502-MA-A0-35.txt.mat', '20120502-MB-A0-35.txt.mat', '20120502-MBA-A0-35.txt.mat', '20120502-PMA-A0-35.txt.mat',
'20120502-SF-A0-35.txt.mat', '20120502-TF-A0-35.txt.mat', '20120502-VM-A0-35.txt.mat', '20120502-VO-A0-35.txt.mat',
'20120504-CF-A0-35.txt.mat']
@classmethod
def get_train_records(cls):
return ['20120106-AA-A0-35.txt.mat', '20120106-AL-A0-35.txt.mat', '20120106-FO-A0-35.txt.mat', '20120106-FP-A0-35.txt.mat',
'20120106-JP-A0-35.txt.mat', '20120106-JS-A0-35.txt.mat', '20120106-MB-A0-35.txt.mat', '20120106-MQ-A0-35.txt.mat',
'20120106-RAA-A0-35.txt.mat', '20120106-RF-A0-35.txt.mat', '20120111-AG-A0-35.txt.mat', '20120111-DC-A0-35.txt.mat',
'20120111-DS-A0-35.txt.mat', '20120111-FM-A0-35.txt.mat', '20120111-JCC-A0-35.txt.mat', '20120111-JPA-A0-35.txt.mat',
'20120111-MGA-A0-35.txt.mat', '20120111-MP-A0-35.txt.mat', '20120111-RA-A0-35.txt.mat', '20120111-RD-A0-35.txt.mat',
'20120111-TC-A0-35.txt.mat', '20120111-TV-A0-35.txt.mat', '20120112-ABD-A0-35.txt.mat', '20120112-ARL-A0-35.txt.mat',
'20120112-CSR-A0-35.txt.mat', '20120112-IC-A0-35.txt.mat', '20120112-JB-A0-35.txt.mat', '20120112-MC-A0-35.txt.mat',
'20120112-MJR-A0-35.txt.mat', '20120112-RR-A0-35.txt.mat', '20120112-RRA-A0-35.txt.mat', '20120113-AR-A0-35.txt.mat',
'20120113-JA-A0-35.txt.mat', '20120113-MMJ-A0-35.txt.mat', '20120113-PM-A0-35.txt.mat', '20120113-PMA-A0-35.txt.mat',
'20120113-SF-A0-35.txt.mat', '20120113-VO-A0-35.txt.mat', '20120118-AC-A0-35.txt.mat', '20120118-ACA-A0-35.txt.mat',
'20120118-AFS-A0-35.txt.mat', '20120118-CB-A0-35.txt.mat', '20120118-JCA-A0-35.txt.mat', '20120118-JL-A0-35.txt.mat',
'20120118-JM-A0-35.txt.mat', '20120118-JN-A0-35.txt.mat', '20120118-JSA-A0-35.txt.mat', '20120118-MA-A0-35.txt.mat',
'20120120-ARA-A0-35.txt.mat', '20120120-DB-A0-35.txt.mat', '20120120-GF-A0-35.txt.mat', '20120120-HF-A0-35.txt.mat',
'20120120-MBA-A0-35.txt.mat', '20120120-SR-A0-35.txt.mat', '20120120-TF-A0-35.txt.mat', '20120120-VM-A0-35.txt.mat',
'20120416-AA-A0-35.txt.mat']
# return ['20120106-RF-A0-35.txt.mat']
@classmethod
def get_data_frequency(cls):
return 1000
| 73.229508
| 135
| 0.614506
| 761
| 4,467
| 3.587385
| 0.160315
| 0.168498
| 0.294872
| 0.421245
| 0.850549
| 0.030769
| 0.01978
| 0
| 0
| 0
| 0
| 0.342995
| 0.165883
| 4,467
| 60
| 136
| 74.45
| 0.389694
| 0.038505
| 0
| 0.093023
| 0
| 0
| 0.673279
| 0.673279
| 0
| 0
| 0
| 0
| 0
| 1
| 0.093023
| false
| 0
| 0.046512
| 0.093023
| 0.255814
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0b78f3d3a8473650025a42b5c240d03f26528292
| 4,250
|
py
|
Python
|
test/calls/call8.py
|
abjugard/MagicPython
|
2802ded681e0ab1a1057821c1da287147d639505
|
[
"MIT"
] | 1,482
|
2015-10-16T21:59:32.000Z
|
2022-03-30T11:44:40.000Z
|
test/calls/call8.py
|
abjugard/MagicPython
|
2802ded681e0ab1a1057821c1da287147d639505
|
[
"MIT"
] | 226
|
2015-10-15T15:53:44.000Z
|
2022-03-25T03:08:27.000Z
|
test/calls/call8.py
|
abjugard/MagicPython
|
2802ded681e0ab1a1057821c1da287147d639505
|
[
"MIT"
] | 129
|
2015-10-20T02:41:49.000Z
|
2022-03-22T01:44:36.000Z
|
foo. __class__(foo=bar)
foo. __class__ (foo=bar)
foo. __add__ (foo=bar)
foo. __add__(foo=bar)
foo : source.python
. : meta.member.access.python, punctuation.separator.period.python, source.python
: meta.member.access.python, source.python
__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python
( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python
foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python
= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python
foo : source.python
. : meta.member.access.python, punctuation.separator.period.python, source.python
: meta.member.access.python, source.python
__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python
: meta.function-call.python, meta.member.access.python, source.python
( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python
foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python
= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python
foo : source.python
. : meta.member.access.python, punctuation.separator.period.python, source.python
: meta.member.access.python, source.python
__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python
: meta.function-call.python, meta.member.access.python, source.python
( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python
foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python
= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python
foo : source.python
. : meta.member.access.python, punctuation.separator.period.python, source.python
: meta.member.access.python, source.python
__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python
( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python
foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python
= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python
) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python
| 90.425532
| 161
| 0.729412
| 516
| 4,250
| 5.945736
| 0.04845
| 0.195567
| 0.198175
| 0.243807
| 1
| 0.992829
| 0.992829
| 0.983051
| 0.983051
| 0.983051
| 0
| 0
| 0.149176
| 4,250
| 46
| 162
| 92.391304
| 0.848451
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
0b968de1f8a7e82fbd176331540a2c65a8f2c0f3
| 39,764
|
py
|
Python
|
post_optimization_studies/mad_analyses/vbf_eff_flow_chart/Output/Histos/MadAnalysis5job_0/selection_14.py
|
sheride/axion_pheno
|
7d3fc08f5ae5b17a3500eba19a2e43f87f076ce5
|
[
"MIT"
] | null | null | null |
post_optimization_studies/mad_analyses/vbf_eff_flow_chart/Output/Histos/MadAnalysis5job_0/selection_14.py
|
sheride/axion_pheno
|
7d3fc08f5ae5b17a3500eba19a2e43f87f076ce5
|
[
"MIT"
] | null | null | null |
post_optimization_studies/mad_analyses/vbf_eff_flow_chart/Output/Histos/MadAnalysis5job_0/selection_14.py
|
sheride/axion_pheno
|
7d3fc08f5ae5b17a3500eba19a2e43f87f076ce5
|
[
"MIT"
] | null | null | null |
def selection_14():
# Library import
import numpy
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Library version
matplotlib_version = matplotlib.__version__
numpy_version = numpy.__version__
# Histo binning
xBinning = numpy.linspace(0.0,1000.0,201,endpoint=True)
# Creating data sequence: middle of each bin
xData = numpy.array([2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,102.5,107.5,112.5,117.5,122.5,127.5,132.5,137.5,142.5,147.5,152.5,157.5,162.5,167.5,172.5,177.5,182.5,187.5,192.5,197.5,202.5,207.5,212.5,217.5,222.5,227.5,232.5,237.5,242.5,247.5,252.5,257.5,262.5,267.5,272.5,277.5,282.5,287.5,292.5,297.5,302.5,307.5,312.5,317.5,322.5,327.5,332.5,337.5,342.5,347.5,352.5,357.5,362.5,367.5,372.5,377.5,382.5,387.5,392.5,397.5,402.5,407.5,412.5,417.5,422.5,427.5,432.5,437.5,442.5,447.5,452.5,457.5,462.5,467.5,472.5,477.5,482.5,487.5,492.5,497.5,502.5,507.5,512.5,517.5,522.5,527.5,532.5,537.5,542.5,547.5,552.5,557.5,562.5,567.5,572.5,577.5,582.5,587.5,592.5,597.5,602.5,607.5,612.5,617.5,622.5,627.5,632.5,637.5,642.5,647.5,652.5,657.5,662.5,667.5,672.5,677.5,682.5,687.5,692.5,697.5,702.5,707.5,712.5,717.5,722.5,727.5,732.5,737.5,742.5,747.5,752.5,757.5,762.5,767.5,772.5,777.5,782.5,787.5,792.5,797.5,802.5,807.5,812.5,817.5,822.5,827.5,832.5,837.5,842.5,847.5,852.5,857.5,862.5,867.5,872.5,877.5,882.5,887.5,892.5,897.5,902.5,907.5,912.5,917.5,922.5,927.5,932.5,937.5,942.5,947.5,952.5,957.5,962.5,967.5,972.5,977.5,982.5,987.5,992.5,997.5])
# Creating weights for histo: y15_TET_0
y15_TET_0_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.00409408389757,0.0,0.0,0.0,0.0245644993854,0.00409408389757,0.0204704154879,0.0409408389757,0.0368467510782,0.0245644993854,0.0450349148733,0.0859757538491,0.114634325132,0.102352097439,0.106446173337,0.15148108821,0.143292936415,0.180139659493,0.188327851288,0.233362766162,0.241550917957,0.28658583283,0.221080498469,0.327526671806,0.290679908728,0.237456842059,0.327526671806,0.425784773348,0.360279318987,0.393032006167,0.42169077745,0.438066761041,0.474913524119,0.483101915914,0.503572295402,0.487195911811,0.597736201046,0.646865351817,0.765593632846,0.790158008232,0.65914733951,0.806534391822,0.683712114895,0.716464482076,0.847475150798,0.953921444135,0.974391823623,0.908886689261,0.908886689261,0.966203831828,1.10130849645,1.11768488004,1.26507193235,1.11359048414,1.1831900144,1.19137840619,1.29373030363,1.28554231184,1.28963630774,1.49024650672,1.54346925339,1.47796411902,1.44930534774,1.57212802467,1.59669240005,1.6949507016,1.73589146057,1.73179746467,1.81777297852,1.78502021134,1.80958498673,1.71132668519,1.92012527596,1.77273822365,1.82596137032,2.10845308725,2.0306651652,2.20671098879,2.1862406093,2.00610078981,2.1944286011,2.15348784212,2.198522597,2.3704744247,2.44416795085,2.38685080829,2.37866241649,2.3622860329,2.41960317547,2.35409804111,2.59974299496,2.59155460317,2.48510870983,2.6939069006,2.65296614163,2.72256527189,2.63658975804,2.82491756933,2.77169442266,2.75941203497,2.66524812932,2.89042270369,3.06237453139,2.80444718984,2.67753051701,2.95592823805,2.84538794881,2.88632870779,3.0459981478,3.12787966575,3.18519680831,2.98049261343,3.26707872626,3.10331529036,3.32848986473,3.0419037519,3.13197366164,3.23841995498,3.25889033447,3.30392508934,3.36124263191,3.25479633857,3.32030147293,3.24251395088,3.31620747704,3.15244404113,3.30801948524,3.33667785652,3.29164310165,3.23023196319,3.2138555796,3.35714823601,3.27117272216,3.55366443909,3.57413481858,3.46768852525,3.58641720628,3.2138555796,3.55775843499,3.44312414986,3.31211348114,3.47587691704,3.46768852525,3.5495704432,3.41037138268,3.49225330063,3.62735796525,3.51681767602,3.68467510782,3.53319405961,3.32439586883,3.49225330063,3.44721814576,3.72970986269,3.3694306237,3.44312414986,3.46768852525,3.38580700729,3.83615615603,3.65192234064,3.57413481858,3.68058111192,3.47997091294,3.65192234064,3.56594642679,3.64373434884,3.41446537858,3.39808939499,3.49634729653,3.36124263191,3.63145196115,3.51272368012,3.38990100319,3.45131214166,3.34486624832,3.61507557756,3.52091167191,3.30801948524,3.60688758576,3.35714823601,3.59869919397,3.33258386063,3.5413820514])
# Creating weights for histo: y15_TET_1
y15_TET_1_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0971287865481,1.17885023274,3.75564312873,7.53258479088,11.797502554,16.912883646,22.7097425052,28.1661388562,33.572799643,32.6116980152,30.8987750607,27.0349061104,23.7284944492,20.084544252,17.3257004453,14.2510996922,12.695738781,9.73187646277,8.59042183083,7.07163059842,6.33055186515,5.07917190294,3.96138942892,3.32872797728,2.46550691732,2.33258234327,1.56762877675,1.38520135456,1.36047176015,0.960315359661,0.838428980665,0.54711523967,0.473870138394,0.437450663628,0.42495568958,0.267148593365,0.315863330877,0.170084815128,0.27935561624,0.133806051514,0.218507796298,0.0850696846193,0.085056266391,0.10949017913,0.0849258492232,0.133762071769,0.109376024054,0.0850327544507,0.0728760799725,0.0607998347549,0.0728451579658,0.0365040376421,0.0364837981473,0.0608099685214,0.0607675909527,0.0121443978008,0.0121718551007,0.0121166280764,0.0121476462136,0.0121718551007,0.0364504568542,0.0485320493358,0.0,0.0243416473991,0.0121712983443,0.0,0.0121535422232,0.0121535422232,0.0121144571273,0.0120935367075,0.0121500494784,0.0,0.0243488692097,0.0243329756188,0.0,0.0,0.024283544468,0.0121443978008,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0121300022448,0.0121443978008,0.0364671795715,0.0,0.0,0.0,0.0,0.0,0.0242444553666,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0121166280764,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0121678496594,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_2
y15_TET_2_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.52611369862,8.61457548505,18.4444350172,29.0362886258,36.7962906196,47.0780682694,55.1687777337,62.5790150708,68.4044729874,72.4688766418,77.9918244513,79.7688698912,85.0413305721,85.3924340251,86.093112059,88.7750019635,90.4496542815,89.487787013,89.7098453814,89.0740824381,88.1726262851,85.5123471969,77.8310449367,73.5432193251,64.6896439139,60.7926724346,54.1042694181,50.4017126436,45.9207532743,40.9535050856,36.1244834794,33.7445499823,29.5379033567,27.4484060078,23.3637716543,22.1074766413,19.38708808,18.2128976406,15.7134972371,13.9560048341,11.8778252721,10.5321160233,9.71933033045,8.34374195877,7.32884348257,6.49562875037,5.69194191361,4.98940444049,4.6180289674,3.92623244186,3.72448121616,3.18272697655,3.07222174098,2.48986933101,2.13829151432,1.97779835332,1.82707179374,1.54610721595,1.22494651988,1.28489401519,0.94382822845,1.0341135083,0.953882009922,0.843315206254,0.76302379261,0.722912795321,0.702932913873,0.371422578883,0.451818121125,0.421519591413,0.331116009904,0.452002412216,0.371506914783,0.331366125145,0.301243333103,0.251063389582,0.230883225865,0.170691896087,0.24105741636,0.200834315544,0.230896365903,0.160588075039,0.180829724214,0.210732647893,0.150577680483,0.180778816899,0.090399614705,0.160589025419,0.1205476538,0.190866770732,0.120540050759,0.130567800082,0.100435297635,0.0903516824929,0.120657897887,0.11042623006,0.0803638078125,0.0502278757333,0.100362448937,0.020073138525,0.0703046959481,0.0300851652554,0.0802602163853,0.0602044284947,0.0501915546864,0.0401175218549,0.0602409974668,0.0501681670726,0.0502324623501,0.030084628084,0.0401587559535,0.0301147757925,0.040100332372,0.0502722543503,0.0301060157676,0.0,0.0200480526234,0.0301319652755,0.0100408521709,0.0301049538212,0.0301303124406,0.0200527549387,0.0502356027364,0.0200878239631,0.0401267942587,0.0200896957986,0.0401747719237,0.0301540058288,0.0200725104478,0.0502077937893,0.0100586036177,0.0100586036177,0.0300965037028,0.010046066865,0.0100300798195,0.0,0.0200343093012,0.0301211350748,0.0100330425261,0.0100368233859,0.0100188281459,0.0301578693304,0.0,0.0100272823964,0.0100188281459,0.0,0.0,0.010032567336,0.010060413472,0.0,0.0,0.0200779524067,0.010031096313,0.0,0.0100154852874,0.0,0.0100300798195,0.0200646057649,0.0,0.0100264063939,0.0,0.0,0.0201162692517,0.0,0.0,0.0100300798195,0.0100611076626,0.0,0.0200941501887,0.0,0.0100533723953,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_3
y15_TET_3_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.95169761125,5.00559431594,9.76884164228,15.5554884472,20.8903925659,26.0009427017,30.4659221226,35.1816701865,38.1725393289,40.7958213805,43.809050764,46.4901265641,47.0560389195,49.3603137795,49.0370165415,50.6859624564,50.6473276646,49.9567764645,50.097624859,49.678289085,49.4753650207,48.0409620455,48.385912642,46.8029830644,46.6438125972,44.904271955,44.5597682382,44.2776245693,41.0199519235,41.1362625533,40.6747169489,39.4980539418,37.7763275543,36.3466777554,35.8128026206,35.0708155531,33.4154711317,32.6723343643,30.7200098639,30.1315422651,28.9210545182,27.5945770823,25.9453955399,24.6418105385,23.5416614819,21.7590172497,20.3518739436,18.9811879057,18.233752967,17.5570306661,16.2312276125,15.3953145316,14.0584126083,13.8158746792,12.2389414162,12.2110479903,12.0225297065,11.1047969929,10.1149419387,9.5814974336,9.18543597314,8.44812083103,8.15115293966,7.33789260321,7.02962677744,7.01269003222,6.43543505444,5.77560481078,5.59400097653,5.39614696696,5.39578133801,4.97215145513,4.57028461955,4.37816692186,3.94949704711,3.87778258591,3.93252495775,3.74576372411,3.21236187569,3.29446263644,2.90406273707,3.09089019018,2.82165119171,2.77195043676,2.43678041449,2.53545188527,2.18956446612,2.07353943312,2.10682263595,1.93020923054,1.75965632801,1.78780691296,1.56731194038,1.50174410799,1.46312191006,1.46292162665,1.16615279992,1.03399946792,1.04496752375,1.12199010472,1.0452547456,0.97356506592,0.913215977337,0.797363196195,0.770017807426,0.720333302649,0.737178234383,0.704062408359,0.610502430226,0.566470955188,0.461975421575,0.511520581099,0.412434324596,0.423670914573,0.434565032105,0.494980340153,0.324529041844,0.280504066876,0.368365677281,0.297074330021,0.23100647974,0.302494129118,0.187045449212,0.220023636251,0.17047595795,0.219962698093,0.187063161903,0.159577209117,0.175970223475,0.159643387956,0.13200167724,0.109936214185,0.120944326697,0.110024127633,0.0770242059846,0.11008738144,0.126493070935,0.0440170936335,0.0825744939895,0.137526371219,0.0660079683846,0.0770125058584,0.0550310562089,0.0384610977545,0.0604600366551,0.0659934244777,0.099012602584,0.0495532033605,0.0495035184495,0.0550047309249,0.0550280905519,0.0274748620407,0.032992925948,0.0219849028117,0.0880241934092,0.0550212248529])
# Creating weights for histo: y15_TET_4
y15_TET_4_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0700533005111,0.444088635147,0.949271413817,1.43792635859,1.92443124999,2.4197351667,2.84408531778,3.25656488146,3.57349573631,3.99676404658,4.08554634022,4.31241224468,4.40448294956,4.6718006413,4.8197831556,4.88786817925,5.05946360267,5.00119891977,5.30628684451,5.11477015843,5.11671819337,5.09321350842,5.00044936723,5.07536052977,4.98560261534,4.97858006963,5.00123499449,4.89883489447,4.77035277108,4.81296102501,4.7852636558,4.62340039048,4.56126368751,4.54747512744,4.52183000904,4.37966754974,4.26122622373,4.15941935245,4.09444477142,4.02818352535,3.95823383945,3.76884516109,3.76963199084,3.5130673718,3.40766705747,3.27040995859,3.2349493094,3.16766474373,2.92009315184,2.91029405509,2.77499260692,2.63391760005,2.48006973693,2.41190735305,2.44536705771,2.2945234172,2.25203821814,2.01026263144,2.09906095829,2.03492170747,1.90367305381,1.87006383947,1.79207750737,1.80195396435,1.68757665608,1.69444087385,1.62340293387,1.60460559919,1.54140629527,1.4497785078,1.38364272159,1.43878012699,1.36683510819,1.28876901088,1.3125582853,1.17333310996,1.15444959678,1.15753959706,1.18620296713,1.10421554763,1.19904556785,1.08845730779,0.990827087556,0.984869547779,0.925659306358,0.93246299876,0.942363104724,0.900925675904,0.805340892356,0.800364985825,0.749028252702,0.717411966289,0.690783611316,0.734203145646,0.665148513664,0.632576647972,0.642425046836,0.585212142474,0.550673001991,0.589151101189,0.553625116669,0.5269875426,0.558566150971,0.489466626003,0.495403723437,0.419405910132,0.41051669802,0.456954484016,0.392701677995,0.430276025263,0.392781723793,0.358234807204,0.347349781188,0.349368242,0.344364237269,0.314838801609])
# Creating weights for histo: y15_TET_5
y15_TET_5_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.00731301971771,0.0577245027232,0.124030948055,0.191077134626,0.267435242654,0.312587105032,0.389973945103,0.432309917578,0.487258980308,0.527834921568,0.586345656921,0.615053890548,0.656666485793,0.670785945114,0.649364696826,0.699772646966,0.717917092425,0.742381886392,0.763040547843,0.748193310213,0.746370863707,0.78091572733,0.728516089219,0.747911641204,0.754744115186,0.720923829087,0.778425517219,0.749438415269,0.752174685666,0.74440278152,0.752465957028,0.733075606318,0.708846470088,0.729749591432,0.691926324587,0.71919060444,0.68363389291,0.712618194174,0.656928149901,0.678843919348,0.653593732956,0.628937692132,0.604210033762,0.586831776022,0.578524940816,0.550029959437,0.510967989105,0.492832745902,0.483235594563,0.468853270839,0.463309112499,0.443401435042,0.398500154057,0.391485475434,0.406856081291,0.384146237293,0.35390130717,0.343593341679,0.333994709977,0.308307016394,0.323915480528,0.300264285895,0.297714741247,0.290886268245,0.296700172673,0.286870204294,0.265166846888,0.263408656125,0.24578237762,0.242501453781,0.238726328861,0.232418223351,0.234679097274,0.241496407541,0.216030048185,0.223598782554])
# Creating weights for histo: y15_TET_6
y15_TET_6_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.00171807552028,0.0120201637369,0.022620604755,0.0323575199901,0.0429440655817,0.0558325635189,0.0735860002319,0.0870184191454,0.0915954026974,0.09190709011,0.100223912748,0.116244939659,0.112243256755,0.131136438337,0.125695929002,0.12367789321,0.140301221881,0.139464097409,0.150330021047,0.152865286601,0.144325497349,0.137429067209,0.148574998687,0.152042357456,0.145161422217,0.13969652091,0.140540743046,0.132832580077,0.151441855103,0.149166104133,0.139157998157,0.134285901737,0.145441729957,0.134289500552,0.146600448582,0.132281761371])
# Creating weights for histo: y15_TET_7
y15_TET_7_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_8
y15_TET_8_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_9
y15_TET_9_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.60494935826,39.0884491817,36.4910099185,78.2278501094,88.6371187968,117.265424453,164.26481478,200.709848919,135.534759448,119.919798928,125.125606123,114.728219768,75.5552868227,57.3295203776,72.9256768193,65.1536320567,49.5291733621,33.8947704248,33.8894252982,20.8505735254,20.8399524897,5.22006214785,23.4517966767,18.2547724089,5.22192332861,15.6217246047,5.21353647893,5.20265395504,5.21195985886,2.6097026755,2.61806068457,5.22019673737,5.21188679598,2.60403068867,2.60304280161,0.0,0.0,0.0,2.60878785132,0.0,0.0,2.61049213916,0.0,2.60840753979,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.60494935826,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_10
y15_TET_10_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,3.16212146952,47.3924726008,81.0972877695,130.580779024,182.213079937,205.348181728,223.294982443,264.366342515,252.846617332,271.771825167,322.307712958,305.446667503,301.207185475,325.420116463,295.912652063,284.411395378,317.045961128,282.269434453,331.783244823,331.743268222,279.071614147,282.26878036,256.988985845,233.825103979,226.443591898,190.652798437,191.670489589,157.974947145,105.307140675,124.274903005,97.9303611457,109.540004825,99.0012646561,86.3908592804,65.3052604997,77.9417141518,62.1439924286,50.5593966491,56.8749686287,51.6042903592,43.1901584233,24.2317534648,35.8115166542,33.700017207,27.3934794007,26.3298594039,22.1155483984,32.6508411142,18.9588551281,16.8503914401,17.9037344876,17.8970011813,14.7433013466,22.1113737485,13.6966415865,11.586600381,8.4204573962,5.26311003323,9.47298090419,4.20757769922,6.32171275491,8.42313532831,7.37141212186,2.10844868233,4.21286430657,6.32072776839,0.0,5.26610731643,1.0527689851,1.05537188894,3.15758860772,1.0531456655,2.10768223969,1.05264586179,1.05342115391,0.0,0.0,2.10333867999,2.10891732045,0.0,0.0,1.05084903091,0.0,0.0,1.05370048994,0.0,1.05606176427,0.0,0.0,0.0,1.05194829126,0.0,1.0531456655,0.0,0.0,1.0527689851,1.05084903091,0.0,1.05098254275,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.05285555618,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.05463237953,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.05370048994,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_11
y15_TET_11_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,4.37802063065,23.2672742585,47.2291569863,70.9430031356,101.347032065,119.314727578,148.339537419,155.258879209,164.687596685,191.611474882,202.00189941,189.326224699,195.31286934,190.032183533,202.259491965,198.776997386,190.26752876,185.201400952,179.20657206,196.007570027,169.047381423,181.508382863,166.542616582,157.086695118,160.541217236,146.256664919,140.966181065,138.884000192,123.919309775,133.365087379,105.940240844,115.395624376,110.097302085,105.716269036,98.8129115094,99.5001579957,95.6043011388,97.893124727,93.294728747,80.8568968049,84.9894052948,75.3190026791,67.0285107792,59.8940346339,67.0208260371,60.8164342286,54.3546419833,55.284342083,47.4454440528,48.3686505454,42.8378263823,45.8316097874,36.1618795865,40.0778896795,42.1549986227,35.0075198938,29.2557248139,28.7914395926,27.4038133957,24.6432926525,27.8674646258,24.6428623069,21.8822800858,21.8805164375,21.1875640301,17.9631230909,21.1930701479,14.7443265947,14.7422440296,16.8142656735,16.3555403631,14.2834303447,10.8264875331,12.8993813952,12.6724586456,12.8965610949,12.4400528326,11.9811315613,5.98923439906,8.75406244021,9.44670361549,8.75335160157,7.37112777836,6.90597033883,11.051343087,8.29259751926,5.29735017088,7.3679501375,7.6008554588,4.83853648595,6.91039290791,5.06635066561,5.52712395977,4.14562250232,5.5303592362,5.07022377563,3.45551229685,5.07001244523,2.76340866928,4.14488476708,2.99602273886,3.45486639428,2.76110247818,3.45599105629,2.3051329163,3.22441288994,3.45820195659,1.15205888094,1.38276828719,2.76594501841,1.84319461524,1.61267502212,1.38139041293,1.84289721572,1.15139415074,1.15232899962,2.07330499584,1.8430347726,0.921530834601,0.691141497861,1.38271449399,1.3835648107,0.460112790577,2.07361776485,0.690602413202,1.15172651584,0.229932824636,0.460671855565,0.460671855565,0.461077609948,0.229962871977,0.461444556384,0.229962871977,0.230408587019,0.0,0.691131891933,0.230445627476,0.229962871977,0.0,0.230345072626,0.921644953021,0.922297771863,0.0,0.0,0.460734486214,0.460512397167,0.0,0.461444556384,0.229912383222,0.0,0.230340500204,0.459925667107,0.460586170691,0.229683685297,0.0,0.230408587019])
# Creating weights for histo: y15_TET_12
y15_TET_12_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.24930371485,1.41223135915,3.48940632606,4.87361192273,6.70093026153,8.55625589645,8.94489560175,10.051314602,10.4118469851,12.3226909292,13.1537458872,11.4362446182,14.1233754066,12.6280089285,13.4575211769,13.0436941409,12.9872371257,12.6538387343,13.9018600077,13.9542621204,12.9606494302,12.6260161017,12.2395154151,12.4342623021,11.7408239635,11.657167555,10.7995018185,12.2675688771,10.3008565328,11.6009836879,10.7164186362,10.1890581776,9.63622185164,9.35974982845,9.63587945475,9.94053959039,9.41357154175,9.11016557898,8.80657110557,8.86288962315,7.97400421521,7.28356281122,6.72884522591,6.47913017313,6.06342572494,6.78491367834,5.78720761406,5.20584847302,4.73511045738,4.98346746406,5.06820877062,3.93236287364,4.56895178709,3.93170885711,3.98817356662,3.21262037494,3.40596882069,3.34973724884,3.32325650424,3.46217269302,3.1834785525,3.01835130475,2.74211511224,2.71364615738,2.63103848358,2.85222110342,2.46495329397,2.43684751065,2.40871210423,2.46469130265,2.10445130339,2.35400746862,2.71419206883,2.76914523072,2.57487923826,2.04892953183,2.24306048912,1.9111436375,2.18770722299,2.52018999127,2.2706969194,2.43648280026,2.18759065416,1.63334473019,2.13211004717,2.15977456169,1.99373976984,1.85535102615,1.46772389232,1.68893998243,1.52297828654,1.88320828319,1.74518694291,1.77260831716,1.49571195267,1.63378407541,1.52350534692,1.46786315937,1.41255644384,1.24531326026,1.41198821889,1.38465956109,0.8585013388,0.941311373018,1.19055168674,1.10741964556,1.19124956085,1.05237915322,1.19032970583,0.996802367329,1.0243399257,1.21757988164,0.748195680214,0.858484411314,0.803330812589,0.830676397872])
# Creating weights for histo: y15_TET_13
y15_TET_13_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0302069107572,0.141133302177,0.24203506508,0.484042884325,0.806653288072,0.735958539084,0.947695689891,1.28029026603,1.19998605073,1.41182393224,1.43143486508,1.55238998706,1.48219100304,1.52237102402,1.59304635504,1.68380471822,1.69393179471,1.40129150569,1.72394408283,1.79452111039,1.55258477354,1.68359961594,1.74400466296,1.43152649361,1.70405098266,1.905461416,1.52233218808,1.44155648027,1.62313934908,1.3207075503,1.58301940243,1.29047013513,1.44154434404,1.34093439677,1.49251529326,1.21989614162,1.35097166517,1.31075341507,1.18967693079,1.38097667155,1.22968036964,0.998304979475,1.11915572988,1.05872701722,1.08873141678,0.897425607915,0.968165260951,0.756104679634,0.907525984706,0.705966882557,0.81632100829,0.534427532305,0.615382674267,0.735681833057,0.655258075893,0.715459234262,0.594816862909,0.513999831236,0.564278833341,0.362908692281,0.51409849878,0.554729380677,0.383217579666,0.352797150159,0.433447915492,0.463892496094,0.322454574564,0.342726082362,0.242076935071,0.393314983081,0.251909040514,0.211736179909,0.272286497594,0.201628946149,0.282268303425,0.211732478359])
# Creating weights for histo: y15_TET_14
y15_TET_14_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.00848159009514,0.0282742536013,0.0452805281313,0.0622285958703,0.0820416042447,0.155593150343,0.147072236326,0.189541032885,0.254682122827,0.240440638164,0.232019755647,0.246137701408,0.229161894165,0.240475072084,0.316923030267,0.302692433648,0.319672626888,0.356489028115,0.277252230185,0.331066637954,0.314088560765,0.311174566221,0.28290624141,0.353604773706,0.396122047069,0.316864396418,0.240499541328,0.294226460009,0.319726720845,0.28579976797,0.237623481807,0.339477055637,0.362131266403,0.234830063694,0.319729529422,0.339488097576])
# Creating weights for histo: y15_TET_15
y15_TET_15_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating weights for histo: y15_TET_16
y15_TET_16_weights = numpy.array([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])
# Creating a new Canvas
fig = plt.figure(figsize=(12,6),dpi=80)
frame = gridspec.GridSpec(1,1,right=0.7)
pad = fig.add_subplot(frame[0])
# Creating a new Stack
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights+y15_TET_14_weights+y15_TET_15_weights+y15_TET_16_weights,\
label="$bg\_dip\_1600\_inf$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#e5e5e5", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights+y15_TET_14_weights+y15_TET_15_weights,\
label="$bg\_dip\_1200\_1600$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#f2f2f2", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights+y15_TET_14_weights,\
label="$bg\_dip\_800\_1200$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#ccc6aa", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights,\
label="$bg\_dip\_600\_800$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#ccc6aa", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights,\
label="$bg\_dip\_400\_600$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#c1bfa8", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights,\
label="$bg\_dip\_200\_400$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#bab5a3", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights,\
label="$bg\_dip\_100\_200$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#b2a596", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights,\
label="$bg\_dip\_0\_100$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#b7a39b", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights,\
label="$bg\_vbf\_1600\_inf$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#ad998c", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights,\
label="$bg\_vbf\_1200\_1600$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#9b8e82", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights,\
label="$bg\_vbf\_800\_1200$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#876656", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights,\
label="$bg\_vbf\_600\_800$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#afcec6", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights,\
label="$bg\_vbf\_400\_600$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#84c1a3", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights,\
label="$bg\_vbf\_200\_400$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#89a8a0", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights,\
label="$bg\_vbf\_100\_200$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#829e8c", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights+y15_TET_1_weights,\
label="$bg\_vbf\_0\_100$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#adbcc6", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
pad.hist(x=xData, bins=xBinning, weights=y15_TET_0_weights,\
label="$signal$", histtype="step", rwidth=1.0,\
color=None, edgecolor="#7a8e99", linewidth=1, linestyle="solid",\
bottom=None, cumulative=False, normed=False, align="mid", orientation="vertical")
# Axis
plt.rc('text',usetex=False)
plt.xlabel(r"MET",\
fontsize=16,color="black")
plt.ylabel(r"$\mathrm{Events}$ $(\mathcal{L}_{\mathrm{int}} = 40.0\ \mathrm{fb}^{-1})$ ",\
fontsize=16,color="black")
# Boundary of y-axis
ymax=(y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights+y15_TET_14_weights+y15_TET_15_weights+y15_TET_16_weights).max()*1.1
ymin=0 # linear scale
#ymin=min([x for x in (y15_TET_0_weights+y15_TET_1_weights+y15_TET_2_weights+y15_TET_3_weights+y15_TET_4_weights+y15_TET_5_weights+y15_TET_6_weights+y15_TET_7_weights+y15_TET_8_weights+y15_TET_9_weights+y15_TET_10_weights+y15_TET_11_weights+y15_TET_12_weights+y15_TET_13_weights+y15_TET_14_weights+y15_TET_15_weights+y15_TET_16_weights) if x])/100. # log scale
plt.gca().set_ylim(ymin,ymax)
# Log/Linear scale for X-axis
plt.gca().set_xscale("linear")
#plt.gca().set_xscale("log",nonposx="clip")
# Log/Linear scale for Y-axis
plt.gca().set_yscale("linear")
#plt.gca().set_yscale("log",nonposy="clip")
# Legend
plt.legend(bbox_to_anchor=(1.05,1), loc=2, borderaxespad=0.)
# Saving the image
plt.savefig('../../HTML/MadAnalysis5job_0/selection_14.png')
plt.savefig('../../PDF/MadAnalysis5job_0/selection_14.png')
plt.savefig('../../DVI/MadAnalysis5job_0/selection_14.eps')
# Running!
if __name__ == '__main__':
selection_14()
| 204.969072
| 2,675
| 0.740821
| 8,985
| 39,764
| 3.19744
| 0.192209
| 0.290369
| 0.428765
| 0.563472
| 0.368165
| 0.365345
| 0.355251
| 0.351735
| 0.349403
| 0.349403
| 0
| 0.579175
| 0.041394
| 39,764
| 193
| 2,676
| 206.031088
| 0.174511
| 0.033975
| 0
| 0.185841
| 0
| 0.00885
| 0.026552
| 0.00529
| 0
| 0
| 0
| 0
| 0
| 1
| 0.00885
| false
| 0
| 0.035398
| 0
| 0.044248
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f00a446284aa54520eff554d2dade6fb04e2b474
| 6,083
|
py
|
Python
|
integration-testing/test/test_contract_hash.py
|
gurinderu/CasperLabs
|
b043158c25eb83a13596e93befef76e2ac5bff9d
|
[
"Apache-2.0"
] | null | null | null |
integration-testing/test/test_contract_hash.py
|
gurinderu/CasperLabs
|
b043158c25eb83a13596e93befef76e2ac5bff9d
|
[
"Apache-2.0"
] | null | null | null |
integration-testing/test/test_contract_hash.py
|
gurinderu/CasperLabs
|
b043158c25eb83a13596e93befef76e2ac5bff9d
|
[
"Apache-2.0"
] | null | null | null |
from test import contract_hash
# TODO: At the moment it seems EE generates function pointer hash as if nonce was 0.
# This is a bug: https://github.com/CasperLabs/CasperLabs/pull/665#discussion_r294411087
TABLE_FROM_MICHAL = """
nonce=0 counter=0 hash=[164, 102, 153, 51, 236, 214, 169, 167, 126, 44, 250, 247, 179, 214, 203, 229, 239, 69, 145, 25, 5, 153, 113, 55, 255, 188, 176, 201, 7, 4, 42, 100]
nonce=0 counter=1 hash=[201, 123, 219, 72, 220, 218, 196, 8, 153, 155, 66, 213, 0, 56, 26, 117, 58, 115, 205, 209, 96, 73, 89, 3, 7, 155, 124, 250, 90, 64, 33, 161]
nonce=0 counter=2 hash=[19, 139, 15, 184, 252, 148, 79, 127, 8, 247, 7, 237, 133, 28, 224, 206, 228, 83, 133, 177, 214, 61, 225, 167, 164, 83, 34, 159, 204, 21, 112, 65]
nonce=1 counter=0 hash=[40, 187, 84, 61, 149, 153, 87, 11, 8, 127, 115, 154, 177, 24, 64, 119, 110, 49, 39, 103, 248, 25, 47, 60, 132, 200, 80, 11, 5, 132, 64, 160]
nonce=1 counter=1 hash=[25, 163, 109, 131, 31, 124, 41, 185, 236, 114, 217, 3, 151, 135, 34, 41, 131, 156, 136, 140, 248, 77, 118, 167, 226, 213, 63, 106, 29, 164, 56, 197]
nonce=1 counter=2 hash=[67, 232, 122, 169, 14, 106, 54, 34, 212, 177, 47, 78, 119, 93, 170, 83, 253, 198, 239, 179, 90, 172, 18, 205, 87, 44, 42, 226, 77, 179, 219, 69]
nonce=2 counter=0 hash=[141, 28, 213, 149, 230, 231, 61, 223, 143, 211, 37, 248, 146, 126, 101, 96, 197, 73, 164, 185, 147, 226, 1, 127, 25, 96, 126, 228, 231, 147, 193, 252]
nonce=2 counter=1 hash=[123, 239, 52, 63, 17, 49, 159, 62, 82, 97, 231, 200, 170, 137, 232, 141, 102, 206, 226, 242, 197, 37, 172, 13, 25, 215, 70, 50, 119, 31, 98, 112]
nonce=2 counter=2 hash=[6, 24, 237, 214, 52, 141, 39, 226, 219, 18, 0, 191, 251, 243, 228, 142, 54, 202, 96, 215, 28, 40, 156, 38, 190, 212, 183, 221, 157, 53, 89, 185]
nonce=3 counter=0 hash=[112, 228, 46, 108, 216, 57, 71, 94, 33, 246, 154, 133, 28, 166, 176, 34, 191, 39, 176, 42, 121, 192, 209, 54, 188, 193, 20, 24, 17, 224, 208, 105]
nonce=3 counter=1 hash=[241, 252, 76, 111, 116, 47, 151, 4, 47, 200, 15, 190, 44, 183, 5, 72, 3, 223, 199, 77, 72, 248, 137, 76, 70, 22, 154, 31, 223, 57, 124, 147]
nonce=3 counter=2 hash=[82, 23, 194, 214, 199, 60, 39, 85, 191, 105, 2, 248, 151, 167, 55, 57, 144, 97, 131, 178, 135, 159, 136, 152, 57, 219, 72, 21, 250, 63, 20, 182]
nonce=4 counter=0 hash=[245, 250, 252, 78, 217, 1, 125, 208, 254, 74, 122, 141, 168, 215, 37, 40, 30, 168, 234, 6, 133, 205, 117, 189, 86, 86, 186, 31, 59, 216, 223, 123]
nonce=4 counter=1 hash=[178, 239, 206, 73, 93, 163, 63, 156, 20, 68, 97, 252, 205, 21, 15, 2, 141, 176, 1, 86, 128, 109, 45, 218, 103, 232, 87, 193, 133, 240, 222, 73]
nonce=4 counter=2 hash=[159, 137, 16, 182, 32, 183, 81, 20, 198, 44, 200, 186, 187, 107, 246, 193, 12, 170, 214, 184, 127, 236, 206, 225, 193, 152, 197, 89, 161, 254, 3, 193]
nonce=5 counter=0 hash=[223, 85, 213, 143, 244, 83, 244, 44, 108, 163, 104, 146, 59, 43, 245, 170, 253, 71, 159, 191, 171, 213, 144, 68, 112, 70, 17, 18, 130, 7, 192, 144]
nonce=5 counter=1 hash=[242, 79, 174, 147, 186, 252, 22, 160, 8, 106, 166, 105, 230, 105, 127, 157, 219, 192, 20, 123, 255, 74, 156, 96, 16, 232, 158, 58, 98, 74, 113, 39]
nonce=5 counter=2 hash=[189, 74, 157, 9, 100, 227, 142, 31, 206, 154, 198, 95, 228, 28, 191, 202, 143, 187, 187, 237, 155, 121, 92, 245, 243, 60, 229, 63, 48, 64, 105, 69]
nonce=6 counter=0 hash=[121, 148, 145, 135, 145, 34, 219, 134, 226, 94, 28, 75, 44, 155, 223, 193, 174, 154, 179, 10, 68, 209, 73, 167, 38, 211, 250, 52, 235, 255, 17, 237]
nonce=6 counter=1 hash=[241, 175, 9, 109, 240, 26, 105, 46, 28, 16, 132, 193, 127, 42, 7, 238, 159, 252, 151, 144, 170, 0, 149, 253, 46, 176, 108, 227, 128, 57, 57, 227]
nonce=6 counter=2 hash=[111, 189, 216, 108, 85, 80, 132, 149, 116, 14, 113, 253, 163, 187, 178, 242, 0, 203, 182, 189, 81, 181, 253, 50, 241, 242, 170, 135, 242, 214, 93, 128]
nonce=7 counter=0 hash=[27, 253, 55, 43, 146, 182, 212, 248, 237, 146, 97, 171, 153, 232, 67, 73, 181, 175, 135, 172, 193, 58, 189, 117, 208, 42, 46, 174, 97, 168, 190, 161]
nonce=7 counter=1 hash=[7, 72, 94, 163, 232, 210, 111, 22, 158, 104, 70, 49, 35, 141, 236, 36, 133, 29, 6, 155, 27, 101, 2, 249, 163, 182, 79, 175, 184, 107, 173, 255]
nonce=7 counter=2 hash=[139, 145, 177, 161, 17, 56, 207, 206, 114, 40, 92, 247, 215, 253, 144, 253, 181, 68, 226, 33, 171, 146, 69, 90, 53, 181, 47, 89, 96, 171, 229, 201]
nonce=8 counter=0 hash=[1, 118, 179, 41, 58, 160, 72, 216, 122, 87, 21, 220, 178, 200, 208, 225, 8, 223, 76, 41, 61, 171, 38, 167, 99, 124, 43, 220, 49, 1, 70, 155]
nonce=8 counter=1 hash=[131, 222, 91, 180, 171, 163, 34, 151, 155, 254, 122, 34, 230, 69, 23, 74, 177, 120, 224, 200, 205, 105, 86, 137, 90, 57, 10, 36, 213, 179, 17, 46]
nonce=8 counter=2 hash=[127, 228, 130, 73, 95, 123, 181, 129, 232, 182, 106, 169, 224, 215, 193, 155, 229, 16, 13, 26, 92, 58, 88, 92, 219, 226, 111, 2, 5, 177, 115, 207]
nonce=9 counter=0 hash=[105, 4, 214, 201, 122, 32, 80, 4, 101, 134, 177, 49, 252, 189, 18, 153, 34, 52, 110, 236, 225, 167, 32, 67, 203, 164, 89, 223, 144, 215, 16, 141]
nonce=9 counter=1 hash=[145, 130, 187, 81, 162, 22, 236, 123, 185, 83, 193, 18, 229, 101, 166, 156, 190, 169, 181, 118, 205, 177, 126, 242, 140, 156, 163, 221, 19, 135, 215, 127]
nonce=9 counter=2 hash=[105, 12, 118, 161, 38, 130, 56, 203, 24, 145, 213, 69, 126, 146, 148, 222, 246, 214, 96, 116, 126, 207, 81, 32, 230, 184, 36, 227, 121, 249, 84, 144]
"""
def test_contract_hash():
# Check that the old hash values can be calculated correctly.
# This is what we see in lib.rs when we call a contract:
hash_in_rust = [164, 102, 153, 51, 236, 214, 169, 167, 126, 44, 250, 247, 179, 214, 203, 229, 239, 69, 145, 25, 5, 153, 113, 55, 255, 188, 176, 201, 7, 4, 42, 100]
# This is what the error prints if it can't find a key:
hash_in_hex = 'a4669933ecd6a9a77e2cfaf7b3d6cbe5ef45911905997137ffbcb0c907042a64'
# This is how it's supposed to be calculated:
hash_in_bytes = contract_hash('30' * 32, 0, 0)
assert bytes(hash_in_rust).hex() == hash_in_hex
assert bytes(hash_in_bytes).hex() == hash_in_hex
assert list(hash_in_bytes) == hash_in_rust
| 116.980769
| 178
| 0.609074
| 1,270
| 6,083
| 2.897638
| 0.249606
| 0.021739
| 0.032609
| 0.005978
| 0.055435
| 0.045652
| 0.045652
| 0.045652
| 0.045652
| 0.045652
| 0
| 0.550481
| 0.197271
| 6,083
| 51
| 179
| 119.27451
| 0.203154
| 0.062634
| 0
| 0
| 1
| 0.75
| 0.912013
| 0.01124
| 0
| 0
| 0
| 0.019608
| 0.075
| 1
| 0.025
| false
| 0
| 0.025
| 0
| 0.05
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f04713a7f5acd31bf39d70a682c83c8cfcd188b1
| 35,369
|
py
|
Python
|
venv/lib/python3.8/site-packages/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py
|
amcclead7336/Enterprise_Data_Science_Final
|
ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28
|
[
"Unlicense",
"MIT"
] | null | null | null |
venv/lib/python3.8/site-packages/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py
|
amcclead7336/Enterprise_Data_Science_Final
|
ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28
|
[
"Unlicense",
"MIT"
] | null | null | null |
venv/lib/python3.8/site-packages/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py
|
amcclead7336/Enterprise_Data_Science_Final
|
ccdc0aa08d4726bf82d71c11a1cc0c63eb301a28
|
[
"Unlicense",
"MIT"
] | 2
|
2021-05-23T16:46:31.000Z
|
2021-05-26T23:51:09.000Z
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class PolicyExemptionsOperations(object):
"""PolicyExemptionsOperations operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: The API version to use for the operation. Constant value: "2020-07-01-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2020-07-01-preview"
self.config = config
def delete(
self, scope, policy_exemption_name, custom_headers=None, raw=False, **operation_config):
"""Deletes a policy exemption.
This operation deletes a policy exemption, given its name and the scope
it was created in. The scope of a policy exemption is the part of its
ID preceding
'/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'.
:param scope: The scope of the policy exemption. Valid scopes are:
management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'),
subscription (format: '/subscriptions/{subscriptionId}'), resource
group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}',
or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
:type scope: str
:param policy_exemption_name: The name of the policy exemption to
delete.
:type policy_exemption_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'scope': self._serialize.url("scope", scope, 'str', skip_quote=True),
'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'}
def create_or_update(
self, scope, policy_exemption_name, parameters, custom_headers=None, raw=False, **operation_config):
"""Creates or updates a policy exemption.
This operation creates or updates a policy exemption with the given
scope and name. Policy exemptions apply to all resources contained
within their scope. For example, when you create a policy exemption at
resource group scope for a policy assignment at the same or above
level, the exemption exempts to all applicable resources in the
resource group.
:param scope: The scope of the policy exemption. Valid scopes are:
management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'),
subscription (format: '/subscriptions/{subscriptionId}'), resource
group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}',
or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
:type scope: str
:param policy_exemption_name: The name of the policy exemption to
delete.
:type policy_exemption_name: str
:param parameters: Parameters for the policy exemption.
:type parameters:
~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: PolicyExemption or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption
or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.create_or_update.metadata['url']
path_format_arguments = {
'scope': self._serialize.url("scope", scope, 'str', skip_quote=True),
'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'PolicyExemption')
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('PolicyExemption', response)
if response.status_code == 201:
deserialized = self._deserialize('PolicyExemption', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'}
def get(
self, scope, policy_exemption_name, custom_headers=None, raw=False, **operation_config):
"""Retrieves a policy exemption.
This operation retrieves a single policy exemption, given its name and
the scope it was created at.
:param scope: The scope of the policy exemption. Valid scopes are:
management group (format:
'/providers/Microsoft.Management/managementGroups/{managementGroup}'),
subscription (format: '/subscriptions/{subscriptionId}'), resource
group (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}',
or resource (format:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
:type scope: str
:param policy_exemption_name: The name of the policy exemption to
delete.
:type policy_exemption_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: PolicyExemption or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption
or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'scope': self._serialize.url("scope", scope, 'str', skip_quote=True),
'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('PolicyExemption', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'}
def list(
self, filter=None, custom_headers=None, raw=False, **operation_config):
"""Retrieves all policy exemptions that apply to a subscription.
This operation retrieves the list of all policy exemptions associated
with the given subscription that match the optional given $filter.
Valid values for $filter are: 'atScope()', 'atExactScope()',
'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is
not provided, the unfiltered list includes all policy exemptions
associated with the subscription, including those that apply directly
or from management groups that contain the given subscription, as well
as any applied to objects contained within the subscription.
:param filter: The filter to apply on the operation. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, no
filtering is performed. If $filter is not provided, the unfiltered
list includes all policy exemptions associated with the scope,
including those that apply directly or apply from containing scopes.
If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the
unfiltered list except those applied to sub scopes contained within
the given scope. If $filter=atExactScope() is provided, the returned
list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes
all policy exemptions that either haven't expired or didn't set
expiration date. If $filter=policyAssignmentId eq '{value}' is
provided. the returned list only includes all policy exemptions that
are associated with the give policyAssignmentId.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of PolicyExemption
:rtype:
~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request
def internal_paging(next_link=None):
request = prepare_request(next_link)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions'}
def list_for_resource_group(
self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config):
"""Retrieves all policy exemptions that apply to a resource group.
This operation retrieves the list of all policy exemptions associated
with the given resource group in the given subscription that match the
optional given $filter. Valid values for $filter are: 'atScope()',
'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq
'{value}''. If $filter is not provided, the unfiltered list includes
all policy exemptions associated with the resource group, including
those that apply directly or apply from containing scopes, as well as
any applied to resources contained within the resource group.
:param resource_group_name: The name of the resource group containing
the resource.
:type resource_group_name: str
:param filter: The filter to apply on the operation. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, no
filtering is performed. If $filter is not provided, the unfiltered
list includes all policy exemptions associated with the scope,
including those that apply directly or apply from containing scopes.
If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the
unfiltered list except those applied to sub scopes contained within
the given scope. If $filter=atExactScope() is provided, the returned
list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes
all policy exemptions that either haven't expired or didn't set
expiration date. If $filter=policyAssignmentId eq '{value}' is
provided. the returned list only includes all policy exemptions that
are associated with the give policyAssignmentId.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of PolicyExemption
:rtype:
~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_for_resource_group.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request
def internal_paging(next_link=None):
request = prepare_request(next_link)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions'}
def list_for_resource(
self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config):
"""Retrieves all policy exemptions that apply to a resource.
This operation retrieves the list of all policy exemptions associated
with the specified resource in the given resource group and
subscription that match the optional given $filter. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, the
unfiltered list includes all policy exemptions associated with the
resource, including those that apply directly or from all containing
scopes, as well as any applied to resources contained within the
resource. Three parameters plus the resource name are used to identify
a specific resource. If the resource is not part of a parent resource
(the more common case), the parent resource path should not be provided
(or provided as ''). For example a web app could be specified as
({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath}
== '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the
resource is part of a parent resource, then all parameters should be
provided. For example a virtual machine DNS name could be specified as
({resourceProviderNamespace} == 'Microsoft.Compute',
{parentResourcePath} == 'virtualMachines/MyVirtualMachine',
{resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A
convenient alternative to providing the namespace and type name
separately is to provide both in the {resourceType} parameter, format:
({resourceProviderNamespace} == '', {parentResourcePath} == '',
{resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp').
:param resource_group_name: The name of the resource group containing
the resource.
:type resource_group_name: str
:param resource_provider_namespace: The namespace of the resource
provider. For example, the namespace of a virtual machine is
Microsoft.Compute (from Microsoft.Compute/virtualMachines)
:type resource_provider_namespace: str
:param parent_resource_path: The parent resource path. Use empty
string if there is none.
:type parent_resource_path: str
:param resource_type: The resource type name. For example the type
name of a web app is 'sites' (from Microsoft.Web/sites).
:type resource_type: str
:param resource_name: The name of the resource.
:type resource_name: str
:param filter: The filter to apply on the operation. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, no
filtering is performed. If $filter is not provided, the unfiltered
list includes all policy exemptions associated with the scope,
including those that apply directly or apply from containing scopes.
If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the
unfiltered list except those applied to sub scopes contained within
the given scope. If $filter=atExactScope() is provided, the returned
list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes
all policy exemptions that either haven't expired or didn't set
expiration date. If $filter=policyAssignmentId eq '{value}' is
provided. the returned list only includes all policy exemptions that
are associated with the give policyAssignmentId.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of PolicyExemption
:rtype:
~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_for_resource.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'),
'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True),
'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request
def internal_paging(next_link=None):
request = prepare_request(next_link)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions'}
def list_for_management_group(
self, management_group_id, filter=None, custom_headers=None, raw=False, **operation_config):
"""Retrieves all policy exemptions that apply to a management group.
This operation retrieves the list of all policy exemptions applicable
to the management group that match the given $filter. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter=atScope() is provided,
the returned list includes all policy exemptions that are assigned to
the management group or the management group's ancestors.
:param management_group_id: The ID of the management group.
:type management_group_id: str
:param filter: The filter to apply on the operation. Valid values for
$filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or
'policyAssignmentId eq '{value}''. If $filter is not provided, no
filtering is performed. If $filter is not provided, the unfiltered
list includes all policy exemptions associated with the scope,
including those that apply directly or apply from containing scopes.
If $filter=atScope() is provided, the returned list only includes all
policy exemptions that apply to the scope, which is everything in the
unfiltered list except those applied to sub scopes contained within
the given scope. If $filter=atExactScope() is provided, the returned
list only includes all policy exemptions that at the given scope. If
$filter=excludeExpired() is provided, the returned list only includes
all policy exemptions that either haven't expired or didn't set
expiration date. If $filter=policyAssignmentId eq '{value}' is
provided. the returned list only includes all policy exemptions that
are associated with the give policyAssignmentId.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of PolicyExemption
:rtype:
~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_for_management_group.metadata['url']
path_format_arguments = {
'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request
def internal_paging(next_link=None):
request = prepare_request(next_link)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions'}
| 52.321006
| 250
| 0.668863
| 3,885
| 35,369
| 5.952124
| 0.080309
| 0.029061
| 0.026293
| 0.028023
| 0.844491
| 0.831517
| 0.814262
| 0.801678
| 0.794283
| 0.775169
| 0
| 0.005798
| 0.244169
| 35,369
| 675
| 251
| 52.398519
| 0.8592
| 0.463598
| 0
| 0.776557
| 0
| 0.003663
| 0.149088
| 0.077604
| 0
| 0
| 0
| 0
| 0
| 1
| 0.058608
| false
| 0
| 0.014652
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b2b28986fb1f0fbc43720302d56f11dc1e03615c
| 11,335
|
py
|
Python
|
tests/test_head.py
|
radomd92/wiktextract
|
0d69a88f6e6d5c3c9b7e9fbdbbf50f6eb778fd62
|
[
"MIT"
] | null | null | null |
tests/test_head.py
|
radomd92/wiktextract
|
0d69a88f6e6d5c3c9b7e9fbdbbf50f6eb778fd62
|
[
"MIT"
] | null | null | null |
tests/test_head.py
|
radomd92/wiktextract
|
0d69a88f6e6d5c3c9b7e9fbdbbf50f6eb778fd62
|
[
"MIT"
] | null | null | null |
# Tests for parse_word_head()
#
# Copyright (c) 2021 Tatu Ylonen. See file LICENSE and https://ylonen.org
import unittest
import json
from wikitextprocessor import Wtp
from wiktextract import WiktionaryConfig
from wiktextract.form_descriptions import parse_word_head
class HeadTests(unittest.TestCase):
def setUp(self):
self.ctx = Wtp()
self.config = WiktionaryConfig()
self.ctx.start_page("testpage")
self.ctx.start_section("English")
def test_head1(self):
data = {}
parse_word_head(self.ctx, "noun", "", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {})
def test_head2(self):
data = {}
parse_word_head(self.ctx, "noun", "testpage", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {})
def test_head3(self):
data = {}
parse_word_head(self.ctx, "noun", "testpAge", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [{"form": "testpAge",
"tags": ["canonical"]}]})
def test_head4(self):
data = {}
parse_word_head(self.ctx, "noun", "testpage f", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine"]})
def test_head5(self):
data = {}
parse_word_head(self.ctx, "noun", "testpAge m", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"form": "testpAge", "tags": ["canonical", "masculine"]},
]})
def test_head6(self):
data = {}
parse_word_head(self.ctx, "noun", "testpage n", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["neuter"]})
def test_head7(self):
data = {}
parse_word_head(self.ctx, "noun", "testpage c", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["common"]})
def test_head8(self):
data = {}
self.ctx.start_section("Zulu")
parse_word_head(self.ctx, "noun", "testpage 1", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["class-1"]})
def test_head8b(self):
# Trying to parse suffix 1 in English - should not get parsed
data = {}
parse_word_head(self.ctx, "noun", "testpage 1", data)
self.assertEqual(self.ctx.errors, [])
self.assertEqual(self.ctx.warnings, [])
self.assertNotEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [{"form": "testpage 1",
"tags": ["canonical"]}]})
def test_head9(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f (plurale tantum, inanimate)", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "inanimate",
"plural-only"]})
def test_head10(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f (plurale tantum, stem testpag, inanimate)",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "inanimate",
"plural-only"],
"forms": [{"tags": ["stem"],
"form": "testpag"}]})
def test_head11(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f (plurale tantum, stem testpag, inanimate) "
"(+ dative)",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
print(data)
self.assertEqual(data, {"tags": ["feminine", "inanimate", "plural-only",
"with-dative"],
"forms": [{"tags": ["stem"],
"form": "testpag"}]})
def test_head12(self):
# McCune-Reischauer is used in Korean characters; we're really testing
# the hyphen in keyword names
data = {}
parse_word_head(self.ctx, "noun",
"foo (McCune-Reischauer bar)", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"form": "foo", "tags": ["canonical"]},
{"form": "bar", "tags": ["McCune-Reischauer"]}]})
def test_head13(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f or m",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine"]})
def test_head14(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f, m",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine"]})
def test_head15(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f, m, n",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine", "neuter"]})
def test_head16(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f or m or n",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine", "neuter"]})
def test_head17(self):
data = {}
self.ctx.start_page("index")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun",
"index n",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["neuter"]})
def test_head18(self):
data = {}
self.ctx.start_page("index")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun",
"index m or f (genitive indicis); third declension",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine",
"third-declension"],
"forms": [
{"tags": ["genitive"],
"form": "indicis"},
]})
def test_head19(self):
data = {}
self.ctx.start_page("index")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun", "foo f or bar m", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"form": "foo", "tags": ["canonical", "feminine"]},
{"form": "bar", "tags": ["canonical", "masculine"]},
]})
def test_head20(self):
data = {}
self.ctx.start_page("index")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun", "foo or bar", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"form": "foo", "tags": ["canonical"]},
{"form": "bar", "tags": ["canonical"]},
]})
def test_head21(self):
data = {}
self.ctx.start_page("index")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun", "foo f or n or bar m or c", data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"form": "foo", "tags": ["canonical", "feminine", "neuter"]},
{"form": "bar", "tags": ["canonical", "common", "masculine"]},
]})
def test_head22(self):
data = {}
parse_word_head(self.ctx, "noun",
"testpage f or testpage2 m; person",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["person"],
"forms": [
{"tags": ["canonical", "feminine"],
"form": "testpage"},
{"tags": ["canonical", "masculine"],
"form": "testpage2"},
]})
def test_head23(self):
data = {}
self.ctx.start_page("indubitables")
self.ctx.start_section("Adjective")
parse_word_head(self.ctx, "adj", "indubitables m pl or f pl", data)
# print(json.dumps(data, indent=2))
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["feminine", "masculine", "plural"]})
def test_head24(self):
data = {}
self.ctx.start_page("foo")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun",
"foo (12 strokes)",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"forms": [
{"tags": ["strokes"],
"form": "12"},
]})
def test_head25(self):
data = {}
self.ctx.start_page("smiley")
self.ctx.start_section("Noun")
parse_word_head(self.ctx, "noun",
"smiley m (plural smileys, diminutive smileytje n)",
data)
self.assertEqual(self.ctx.warnings, [])
self.assertEqual(self.ctx.debugs, [])
self.assertEqual(data, {"tags": ["masculine"],
"forms": [
{"tags": ["plural"],
"form": "smileys"},
{"tags": ["diminutive", "neuter"],
"form": "smileytje"},
]})
| 38.423729
| 80
| 0.509043
| 1,120
| 11,335
| 5.060714
| 0.125
| 0.12844
| 0.191073
| 0.221242
| 0.773465
| 0.75247
| 0.739591
| 0.723183
| 0.70801
| 0.678193
| 0
| 0.007667
| 0.332598
| 11,335
| 294
| 81
| 38.554422
| 0.741573
| 0.025673
| 0
| 0.604651
| 0
| 0
| 0.150417
| 0
| 0
| 0
| 0
| 0
| 0.325581
| 1
| 0.104651
| false
| 0
| 0.01938
| 0
| 0.127907
| 0.003876
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b2c55625938c2fcfae9dad238c95b4c7e18a9ca2
| 68
|
py
|
Python
|
3D Pose by GAN/GAN/pose/dataset/__init__.py
|
kyapp69/OpenMMD
|
795d4dd660cf7e537ceb599fdb038c5388b33390
|
[
"MIT"
] | 717
|
2018-10-31T16:52:42.000Z
|
2022-03-31T16:13:47.000Z
|
3D Pose by GAN/GAN/pose/dataset/__init__.py
|
Pixis5566/OpenMMD
|
795d4dd660cf7e537ceb599fdb038c5388b33390
|
[
"MIT"
] | 48
|
2018-11-08T12:16:43.000Z
|
2020-08-10T00:24:50.000Z
|
3D Pose by GAN/GAN/pose/dataset/__init__.py
|
Pixis5566/OpenMMD
|
795d4dd660cf7e537ceb599fdb038c5388b33390
|
[
"MIT"
] | 180
|
2018-10-31T18:41:33.000Z
|
2022-03-27T23:49:06.000Z
|
from . import mpii_inf_3dhp_dataset, pose_dataset, pose_dataset_base
| 68
| 68
| 0.882353
| 11
| 68
| 4.909091
| 0.727273
| 0.407407
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.073529
| 68
| 1
| 68
| 68
| 0.84127
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
331ba1d96deb6b2f7a59994fe92ab741ede10d61
| 4,323
|
py
|
Python
|
tests/test_observable/test_last.py
|
Affirm/RxPY
|
7c23939ea497761c85b382257f9f0954998ab91e
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
tests/test_observable/test_last.py
|
Affirm/RxPY
|
7c23939ea497761c85b382257f9f0954998ab91e
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
tests/test_observable/test_last.py
|
Affirm/RxPY
|
7c23939ea497761c85b382257f9f0954998ab91e
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
import unittest
from rx.testing import TestScheduler, ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscribed
disposed = ReactiveTest.disposed
created = ReactiveTest.created
class RxException(Exception):
pass
# Helper function for raising exceptions within lambdas
def _raise(ex):
raise RxException(ex)
class TestLast(unittest.TestCase):
def test_last_async_empty(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))
def create():
return xs.last()
res = scheduler.start(create=create)
def predicate(e):
return e is not None
res.messages.assert_equal(on_error(250, predicate))
xs.subscriptions.assert_equal(subscribe(200, 250))
def test_last_async_one(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))
def create():
return xs.last()
res = scheduler.start(create=create)
res.messages.assert_equal(on_next(250, 2), on_completed(250))
xs.subscriptions.assert_equal(subscribe(200, 250))
def test_last_async_many(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_completed(250))
def create():
return xs.last()
res = scheduler.start(create=create)
res.messages.assert_equal(on_next(250, 3), on_completed(250))
xs.subscriptions.assert_equal(subscribe(200, 250))
def test_last_async_error(self):
ex = 'ex'
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))
def create():
return xs.last()
res = scheduler.start(create=create)
res.messages.assert_equal(on_error(210, ex))
xs.subscriptions.assert_equal(subscribe(200, 210))
def test_last_async_predicate(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))
def create():
def predicate(x):
return x % 2 == 1
return xs.last(predicate)
res = scheduler.start(create=create)
res.messages.assert_equal(on_next(250, 5), on_completed(250))
xs.subscriptions.assert_equal(subscribe(200, 250))
def test_last_async_predicate_none(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))
def create():
def predicate(x):
return x > 10
return xs.last(predicate)
res = scheduler.start(create=create)
def predicate(e):
return not e is None
res.messages.assert_equal(on_error(250, predicate))
xs.subscriptions.assert_equal(subscribe(200, 250))
def test_last_async_predicate_throw(self):
ex = 'ex'
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))
def create():
def predicate(x):
return x % 2 == 1
return xs.last(predicate)
res = scheduler.start(create=create)
res.messages.assert_equal(on_error(210, ex))
xs.subscriptions.assert_equal(subscribe(200, 210))
def test_last_async_predicate_throws(self):
ex = 'ex'
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))
def create():
def predicate(x):
if x < 4:
return x % 2 == 1
else:
raise Exception(ex)
return xs.last(predicate)
res = scheduler.start(create=create)
res.messages.assert_equal(on_error(230, ex))
xs.subscriptions.assert_equal(subscribe(200, 230))
| 30.443662
| 148
| 0.635901
| 550
| 4,323
| 4.801818
| 0.132727
| 0.063612
| 0.047709
| 0.048466
| 0.812571
| 0.812571
| 0.812571
| 0.797425
| 0.797425
| 0.764105
| 0
| 0.064927
| 0.255378
| 4,323
| 141
| 149
| 30.659574
| 0.755514
| 0.01226
| 0
| 0.625
| 0
| 0
| 0.001406
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 1
| 0.239583
| false
| 0.010417
| 0.020833
| 0.09375
| 0.427083
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
335627b697b37ae62a954db3676991e01d78a3d0
| 12,303
|
py
|
Python
|
train_util.py
|
InnocentK/DNN-Compression-Practice
|
2a439ce0593f9cb429ecea71929a2434eb0e4f97
|
[
"MIT"
] | null | null | null |
train_util.py
|
InnocentK/DNN-Compression-Practice
|
2a439ce0593f9cb429ecea71929a2434eb0e4f97
|
[
"MIT"
] | null | null | null |
train_util.py
|
InnocentK/DNN-Compression-Practice
|
2a439ce0593f9cb429ecea71929a2434eb0e4f97
|
[
"MIT"
] | null | null | null |
import time
import torch
import torchvision.transforms as transforms
import torchvision
import torch.nn as nn
import torch.optim as optim
from pruned_layers import *
device = 'cuda' if torch.cuda.is_available() else 'cpu'
def train(net, epochs=100, batch_size=128, lr=0.01, reg=5e-4):
"""
Training a network
:param net:
:param epochs:
:param batch_size:
"""
print('==> Preparing data..')
transform_train = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
transform_test = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
best_acc = 0 # best test accuracy
start_epoch = 0 # start from epoch 0 or last checkpoint epoch
trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform_train)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True, num_workers=16)
testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform_test)
testloader = torch.utils.data.DataLoader(testset, batch_size=100, shuffle=False, num_workers=2)
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=lr, momentum=0.9, weight_decay=reg, nesterov=False)
scheduler = optim.lr_scheduler.MultiStepLR(optimizer, milestones=[int(epochs*0.5), int(epochs*0.75)], gamma=0.1)
global_steps = 0
start = time.time()
for epoch in range(start_epoch, epochs):
"""
Start the training code.
"""
print('\nEpoch: %d' % epoch)
net.train()
train_loss = 0
correct = 0
total = 0
for batch_idx, (inputs, targets) in enumerate(trainloader):
inputs, targets = inputs.to(device), targets.to(device)
optimizer.zero_grad()
outputs = net(inputs)
loss = criterion(outputs, targets)
loss.backward()
optimizer.step()
train_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
global_steps += 1
if global_steps % 16 == 0:
end = time.time()
num_examples_per_second = 16 * batch_size / (end - start)
print("[Step=%d]\tLoss=%.4f\tacc=%.4f\t%.1f examples/second"
% (global_steps, train_loss / (batch_idx + 1), (correct / total), num_examples_per_second))
start = time.time()
scheduler.step()
"""
Start the testing code.
"""
net.eval()
test_loss = 0
correct = 0
total = 0
with torch.no_grad():
for batch_idx, (inputs, targets) in enumerate(testloader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
num_val_steps = len(testloader)
val_acc = correct / total
print("Test Loss=%.4f, Test acc=%.4f" % (test_loss / (num_val_steps), val_acc))
if val_acc > best_acc:
best_acc = val_acc
print("Saving...")
torch.save(net.state_dict(), "net_before_pruning.pt")
def finetune_after_prune(net, epochs=100, batch_size=128, lr=0.01, reg=5e-4):
print('==> Preparing data..')
transform_train = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
transform_test = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
best_acc = 0 # best test accuracy
start_epoch = 0 # start from epoch 0 or last checkpoint epoch
trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform_train)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True, num_workers=16)
testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform_test)
testloader = torch.utils.data.DataLoader(testset, batch_size=100, shuffle=False, num_workers=2)
net = net.to(device)
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=lr, momentum=0.9, weight_decay=reg, nesterov=False)
global_steps = 0
start = time.time()
for epoch in range(start_epoch, epochs):
"""
Start the training code.
"""
print('\nEpoch: %d' % epoch)
net.train()
train_loss = 0
correct = 0
total = 0
for batch_idx, (inputs, targets) in enumerate(trainloader):
inputs, targets = inputs.to(device), targets.to(device)
optimizer.zero_grad()
outputs = net(inputs)
loss = criterion(outputs, targets)
loss.backward()
# before optimizer.step(), manipulate the gradient
"""
Zero the gradients of the pruned variables.
-----------------------Your Code-------------------------
"""
for i,param in enumerate(net.parameters()):
mask = param.data != 0
mask = mask.float()
param.grad.data *= mask
optimizer.step()
train_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
global_steps += 1
if global_steps % 16 == 0:
end = time.time()
num_examples_per_second = 16 * batch_size / (end - start)
print("[Step=%d]\tLoss=%.4f\tacc=%.4f\t%.1f examples/second"
% (global_steps, train_loss / (batch_idx + 1), (correct / total), num_examples_per_second))
start = time.time()
"""
Start the testing code.
"""
net.eval()
test_loss = 0
correct = 0
total = 0
with torch.no_grad():
for batch_idx, (inputs, targets) in enumerate(testloader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
num_val_steps = len(testloader)
val_acc = correct / total
print("Test Loss=%.4f, Test acc=%.4f" % (test_loss / (num_val_steps), val_acc))
if val_acc > best_acc:
best_acc = val_acc
print("Saving...")
torch.save(net.state_dict(), "net_after_pruning.pt")
def finetune_after_quantize(net, epochs=100, batch_size=128, lr=0.01, reg=5e-4):
print('==> Preparing data..')
transform_train = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
transform_test = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
best_acc = 0 # best test accuracy
start_epoch = 0 # start from epoch 0 or last checkpoint epoch
trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform_train)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True, num_workers=16)
testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform_test)
testloader = torch.utils.data.DataLoader(testset, batch_size=100, shuffle=False, num_workers=2)
net = net.to(device)
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=lr, momentum=0.9, weight_decay=reg, nesterov=False)
global_steps = 0
start = time.time()
for epoch in range(start_epoch, epochs):
"""
Start the training code.
"""
print('\nEpoch: %d' % epoch)
net.train()
train_loss = 0
correct = 0
total = 0
for batch_idx, (inputs, targets) in enumerate(trainloader):
inputs, targets = inputs.to(device), targets.to(device)
optimizer.zero_grad()
outputs = net(inputs)
loss = criterion(outputs, targets)
loss.backward()
# before optimizer.step(), manipulate the gradient
"""
Zero the gradients of the pruned variables.
-----------------------Your Code-------------------------
"""
for i,param in enumerate(net.parameters()):
mask = param.data != 0
mask = mask.float()
param.grad.data *= mask
optimizer.step()
train_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
global_steps += 1
if global_steps % 16 == 0:
end = time.time()
num_examples_per_second = 16 * batch_size / (end - start)
print("[Step=%d]\tLoss=%.4f\tacc=%.4f\t%.1f examples/second"
% (global_steps, train_loss / (batch_idx + 1), (correct / total), num_examples_per_second))
start = time.time()
"""
Start the testing code.
"""
net.eval()
test_loss = 0
correct = 0
total = 0
with torch.no_grad():
for batch_idx, (inputs, targets) in enumerate(testloader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
num_val_steps = len(testloader)
val_acc = correct / total
print("Test Loss=%.4f, Test acc=%.4f" % (test_loss / (num_val_steps), val_acc))
if val_acc > best_acc:
best_acc = val_acc
print("Saving...")
torch.save(net.state_dict(), "net_after_quantization.pt")
def test(net):
transform_test = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)),
])
testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform_test)
testloader = torch.utils.data.DataLoader(testset, batch_size=100, shuffle=False, num_workers=2)
classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
criterion = nn.CrossEntropyLoss()
net.eval()
test_loss = 0
correct = 0
total = 0
with torch.no_grad():
for batch_idx, (inputs, targets) in enumerate(testloader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
_, predicted = outputs.max(1)
total += targets.size(0)
correct += predicted.eq(targets).sum().item()
num_val_steps = len(testloader)
val_acc = correct / total
print("Test Loss=%.4f, Test accuracy=%.4f" % (test_loss / (num_val_steps), val_acc))
| 36.399408
| 116
| 0.577258
| 1,423
| 12,303
| 4.866479
| 0.120169
| 0.022094
| 0.012708
| 0.037401
| 0.933863
| 0.926643
| 0.926643
| 0.926643
| 0.922744
| 0.922744
| 0
| 0.044318
| 0.288385
| 12,303
| 337
| 117
| 36.507418
| 0.746659
| 0.028611
| 0
| 0.921811
| 0
| 0
| 0.048686
| 0.013583
| 0
| 0
| 0
| 0
| 0
| 1
| 0.016461
| false
| 0
| 0.028807
| 0
| 0.045267
| 0.065844
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
3359d1aeccf25e422be010d4187124a1902b53cc
| 4,517
|
py
|
Python
|
FaceRecognitionWebsite/codeDesign/myDjango02/app01/models.py
|
ChunjunHu/FaceRecognitionLibraryWebsite
|
d979d410dfab52d8bda7a5328242b66d6a6b752d
|
[
"MIT"
] | 1
|
2021-11-05T21:04:47.000Z
|
2021-11-05T21:04:47.000Z
|
FaceRecognitionWebsite/codeDesign/myDjango02/app01/models.py
|
ChunjunHu/FaceRecognitionLibraryWebsite
|
d979d410dfab52d8bda7a5328242b66d6a6b752d
|
[
"MIT"
] | null | null | null |
FaceRecognitionWebsite/codeDesign/myDjango02/app01/models.py
|
ChunjunHu/FaceRecognitionLibraryWebsite
|
d979d410dfab52d8bda7a5328242b66d6a6b752d
|
[
"MIT"
] | null | null | null |
from django.db import models
# Create your models here.
# 创建一个实体类DevGroup(自动生成一张数据表 app01_devgroup)
class DevGroup(models.Model):
# 定义该类的成员属性
# 属性与表的字段一一对应
# gid是对应的数据表的主键并且需要自增长
gid = models.AutoField(primary_key=True)
# gname是小组名称字符串类型(初始化必须携带一个参数max_length)
gname = models.CharField(max_length=30)
# 重写__str__方法 (Python2 __unicode__)
def __str__(self):
return self.gname
pass
# 创建一个实体类Developer(存在一个外键DevGroup)
class Developer(models.Model):
# did 开发者编号
did = models.AutoField(primary_key=True)
# dname 开发者的姓名
dname = models.CharField(max_length=30)
# dhiredate 入职时间
dhiredate = models.DateField()
# demail 电子邮箱
demail = models.EmailField(max_length=50)
# dsal 薪资
dsal = models.FloatField()
# # 注意:devgroup 开发者所在的小组(外键)
# devgroup = models.ForeignKey(DevGroup,on_delete=models.CASCADE)
pass
#博客的注册表
class Register(models.Model):
# did 开发者编号
did = models.AutoField(primary_key=True)
# dname 开发者的姓名
dname = models.CharField(max_length=30)
# dhiredate 入职时间
dkey = models.CharField(max_length=30)
# demail 电子邮箱
demail = models.EmailField(max_length=50)
# dQrCode 学生二维码
dQrCode = models.CharField(max_length = 200, default = "")
# daccessable 学生卡的可用性
daccessable = models.IntegerField(default = 1)
# borrowTimes 学生借阅次数
borrowTimes = models.IntegerField(default = 0)
# fee 学生欠款金额
fee = models.IntegerField(default = 0)
# # 注意:devgroup 开发者所在的小组(外键)
# devgroup = models.ForeignKey(DevGroup,on_delete=models.CASCADE)
pass
class teacherRegister(models.Model):
# did 开发者编号
did = models.AutoField(primary_key=True)
# dname 开发者的姓名
dname = models.CharField(max_length=30)
# dhiredate 入职时间
dkey = models.CharField(max_length=30)
# demail 电子邮箱
demail = models.EmailField(max_length=50)
# dsal 薪资
dsex = models.CharField(max_length=30)
# daccessable 教师卡的可用性
daccessable = models.IntegerField(default = 1)
# # 注意:devgroup 开发者所在的小组(外键)
# devgroup = models.ForeignKey(DevGroup,on_delete=models.CASCADE)
pass
# 图书库中CSS书籍Moels表单
class GetDataCss(models.Model):
Jsid=models.AutoField(primary_key=True)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
copyBook = models.IntegerField(default= 1)
beBorrowedTimes = models.IntegerField(default = 1)
pass
# 图书库中HTML书籍Moels表单
class GetDataHtml(models.Model):
Jsid=models.AutoField(primary_key=True)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
copyBook = models.IntegerField(default= 1)
beBorrowedTimes = models.IntegerField(default = 1)
pass
# 图书库中JS书籍Moels表单
class GetDataJavaScript(models.Model):
Jsid=models.AutoField(primary_key=True)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
copyBook = models.IntegerField(default= 1)
beBorrowedTimes = models.IntegerField(default = 1)
pass
# 所有被借阅的CSS相关书籍Models表单
class CustomerCss(models.Model):
Sid = models.AutoField(primary_key = True)
Jsid=models.IntegerField(default= 0)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
borrowTime = models.CharField(max_length=100, default = "")
whoBorrow = models.CharField(max_length=100, default = "")
# 所有被借阅的HTML相关书籍Models表单
class CustomerHtml(models.Model):
Sid = models.AutoField(primary_key = True)
Jsid=models.IntegerField(default= 0)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
borrowTime = models.CharField(max_length=100, default = "")
whoBorrow = models.CharField(max_length=100, default = "")
# 所有被借阅的JS相关书籍Models表单
class CustomerJavaScript(models.Model):
Sid = models.AutoField(primary_key = True)
Jsid=models.IntegerField(default= 0)
title=models.CharField(max_length=100)
imgUrl=models.CharField(max_length=100)
details=models.CharField(max_length=200)
borrowTime = models.CharField(max_length=100, default = "")
whoBorrow = models.CharField(max_length=100, default = "")
| 32.970803
| 70
| 0.704007
| 508
| 4,517
| 6.137795
| 0.202756
| 0.101026
| 0.184734
| 0.246312
| 0.761706
| 0.703335
| 0.703335
| 0.703335
| 0.703335
| 0.703335
| 0
| 0.030553
| 0.195705
| 4,517
| 136
| 71
| 33.213235
| 0.827691
| 0.189949
| 0
| 0.7375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.0125
| false
| 0.0875
| 0.0125
| 0.0125
| 0.9125
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 10
|
682848ab28df4707c6042bd3988c03acffb2cd44
| 102,792
|
py
|
Python
|
static/Imagens.py
|
ViniciusRCortez/Flask_test
|
4944090cbf9545744a504754a5d2aeeef2e9fc60
|
[
"MIT"
] | null | null | null |
static/Imagens.py
|
ViniciusRCortez/Flask_test
|
4944090cbf9545744a504754a5d2aeeef2e9fc60
|
[
"MIT"
] | null | null | null |
static/Imagens.py
|
ViniciusRCortez/Flask_test
|
4944090cbf9545744a504754a5d2aeeef2e9fc60
|
[
"MIT"
] | null | null | null |
imagem_RCs = b'iVBORw0KGgoAAAANSUhEUgAAALQAAACWCAIAAAD4yzVYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhdEVYdENyZWF0aW9uIFRpbWUAMjAyMToxMjowOCAxNzowODoyM0J1ihoAAApXSURBVHhe7d1NSFTtGwbw1DKiL0nKiCzSRby7+i9CTaEy1BYtC5NAKAo0WiSUfa3KIEU0ipIWQbRRlKJFFFEaVKQQhRVUiLrIWfRhH2bfX/4v5348HWe8x+N4jjYz128x79zPGc/0nuea5zzPmWEmbmBgYArRSOLNf6NdaWlpnA1Ks4F0sRIOKCkpwTAp6urqqqqqzAZSxFA47CorK1taWkxBihgNB6SlpZl7pIjFcHR3d5eXlxcVFZmaFDEUDswzZ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kFydHdvcmtPck9iamVjdD4KICAgPGlwdGNFeHQ6UmVnaXN0cnlJZD4KICAgIDxyZGY6QmFnLz4KICAgPC9pcHRjRXh0OlJlZ2lzdHJ5SWQ+CiAgIDx4bXBNTTpIaXN0b3J5PgogICAgPHJkZjpTZXE+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjEyNDJmZDgxLWU1MWMtNDlmZC1hMTFiLWJmM2ZjNTc1MTMzYiIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMS0xMi0wOFQyMToyMToyMSIvPgogICAgPC9yZGY6U2VxPgogICA8L3htcE1NOkhpc3Rvcnk+CiAgIDxwbHVzOkltYWdlU3VwcGxpZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpJbWFnZVN1cHBsaWVyPgogICA8cGx1czpJbWFnZUNyZWF0b3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpJbWFnZUNyZWF0b3I+CiAgIDxwbHVzOkNvcHlyaWdodE93bmVyPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6Q29weXJpZ2h0T3duZXI+CiAgIDxwbHVzOkxpY2Vuc29yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6TGljZW5zb3I+CiAgPC9yZGY6RGVzY3JpcHRpb24+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz5GMJF7AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJTUUH5QwJABUVaM2A5QAAE0ZJREFUeNrtndlTU2f/wHOWrEACJCQECCSsA4JG9lV0CJtARbpY7VU7XtSZ/gPt9D/otBedaWec6UWnMx1LXV5ZRRBEUAgEGUEKKA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gICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4M2UyZDVkZi0yZjc5LTQ2MDAtOWMwMy03YWQ0ODBkNmM2ODQiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTItMDhUMjE6MjQ6MDMiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogICA8cGx1czpJbWFnZVN1cHBsaWVyPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VTdXBwbGllcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+pWK2kwAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB+UMCQAYAym3S/kAABe4SURBVHja7Z17UFPZGcBz8yYJCSHJJiE8Q0ggvCG8kkZUFlZEUIq61lprZ51qd+pOO7WzO9udzs7odrodO2VndrYdLbNSdd06VdmtLMpDHgYN4SXImyASHkl4EyDv5PaP20kpL6PEReX8/mIu9wZy7++e833fPfccCIZhFACwGmhwCgBrgd1qX9hsNhsMBovF8t/vj8VSKBQymYxGg/tka8vhdDo1Gs2///3vgYEBPB6PQqEoFEpSUpJUKmUwGMCPLS0HDMOzs7M9PT0CgSArKwuNRjc3N5eWlhKJxPT0dCKRCITY0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gogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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GkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo3YjQ3ZTZmNS1mZDAyLTQ2MGEtYTc4Ny04NTUyYjU3YzE1YmYiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMTItMDhUMjE6MjM6MDQiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogICA8cGx1czpJbWFnZVN1cHBsaWVyPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VTdXBwbGllcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+7MU5BwAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB+UMCQAXBDBLwpUAABTbSURBVHja7Z15UBPn+8B3NwlJQM4gZ5AgMYmES6VehEOiqQee1dqhI61Te1ltq9WpddpObb+1rbU6tdN27OXUetQijB2vIocFEaMSCkRB5CgQEAIJJiQQEpLd3x/bpvkRiNyCPp+/ks2y7Ob97Ps+77Nv3hclCAIBgL7A4CsAQA5g0FAn1uniON7c3KxWqxEEoVAo/v7+Xl5eUIogB4IgiMlkyszMvHz5squrK4VCiY+PT05OZjKZUJAgB4LjuFqtj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XJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvALlGsAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQflDAkAFh1NO1sUAAAYMUlEQVR42u2deVQTWfbHa0lISCAJOxJWQyBAICiLCIMiyq6AYKN4PKOO05vnOIs9+4wzp3tmbOd4PDjbmbHtcWhHxqVBdpBRI6iAkRYUVJaWBlGERMIeslWqfn/U/PLLD5CWrRLs9/0LqAqp9+pT991736v7YIIgICCg2YSALgACcAABOIAAHEAADiAAB5BFirbIz+M4/vLlS4PBALrSAkUQhJubGwzDC/s4vMg8h1qtPnz48OPHj9ls9nw/i2HY5OTk65zJ5XLn1UKCIFQqlcFgMEsWh7xUS0ggjY2NtbS0WFlZmcdyEAQxNjaGomh0dPR8u2NycrKjo+N1viI8PHxecGAYduXKlaGhoaCgoAU/NwtWd3e3Xq8PCAgwLx84jjc2NppzWCEVExPzve99b759QRAEjuOvcyaKovP6zxqNRqFQ2Nra/uhHP6LRaBTflfz8/ImJiUOHDpnXbOh0ulWrVpkfDiaTyeFwLGesZTAYTCaTxWI5OjoiCNVOt62tLUEQ9vb25u0EvV4PopXZbRJpxsxi2I3fbvZOAHAAgTwHEIADCMABBOAAAnAAATiAABxAQAAOIAAHEIADCMABBOAAAnAAATiAABxAAA4gAAcQgAMICMABBOAAAnAAATiAABxAAA4gAAcQgAMIwAE0P8EwrNFoFv8eM4DjzYQDw7A3oNoRgGO5+KC+aAyA4/VahSDmvTevX5cGwEG1nj59Ojo6asYiGSMjIy9fvsQwDMBhQSIIQqlUvvPOO4WFhWa0W48ePZJKpXK5fEV7Hm8UHHq9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Ki4vr6urIIhdvvuUAep3BRSAQ5OTk0On0jz76iMvlMhiMpKSklbWfF4Bj2XqWRgsICIAgCEXRP/zhD+RrcOvWrbOzs7PAFYEADjMoICCARqMplcqKioq///3vBEEEBwevlArGYLvyZZeXl9fOnTuTkpI6OzuPHDlSU1NjulYNwPGNFp1O9/LyioqKWrVq1cDAwP3796kpWALgsHQRBKFWqwcGBurq6kZGRkJCQsLDw19VLAn4HN8sqdXqtra2qqoqmUwmFovT0tKioqIWsJQfwPGm2QytVtve3l5eXl5TU+Pr65uTkxMTE2MsAQvg+EaPJp2dnVeuXKmqqvLw8MjJyYmNjbW3t39DCuMDLVgajaarq6uqqqqsrIzP5+/duzcmJsYy1wICh5RSabXanp6empoasqDP/v37N2zYYJZdKYHlsDi9ePHiypUr58+fJ/2MTZs2mbEIBbAcluVtPHr06G9/+5uzs/OuXbvS09NXKBkAjqUXhmFyudzHx2f79u3JyckrepkggGPpLQdBEElJSVu3bl3ubVYAHCtPOI4bDAbK3iAHcKwYkcsBp9VlBHAAQdBSbLsH4AACcAABOIAAHEAADiAgAAcQgAMIwAEE4AACcAABOIAAHEAADiAABxCAAwjAAQQE4AACcAABOIAAHEAADiAABxCAAwjAAQTgAAJwAAEBOIAAHECWAYelvTeMIAgMw2Cvj0VqacoEjIyM9PX1Wc6d0Gq1Y2Njzs7OZqmDAMOwJTwti9+7Y2n67uHDh8XFxZYDB4ZhX375JYfDefDgAfVX9fTpU5VKZZavNtXMveXnLWJxmpqays3NBRbYYqXRaBZ8c2mLt10xMTGrV6+2zK7BMOwbuPexUTqdbjGDC7x406fT6YDfZ7FaTDnD/wGem3klg/UTsQAAAABJRU5ErkJggg=='
| 14,684.571429
| 21,813
| 0.975922
| 2,235
| 102,792
| 44.881879
| 0.946309
| 0.000718
| 0.001077
| 0.002602
| 0.029907
| 0.029907
| 0.029907
| 0.029907
| 0.029907
| 0.021084
| 0
| 0.131483
| 0.000175
| 102,792
| 6
| 21,814
| 17,132
| 0.844552
| 0
| 0
| 0
| 0
| 1
| 0.998988
| 0.998988
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
68b11660594cca41c7961ee1daa81344c176c2c4
| 312
|
py
|
Python
|
platform/hwconf_data/efr32zg13p/modules/WTIMER0/__init__.py
|
lenloe1/v2.7
|
9ac9c4a7bb37987af382c80647f42d84db5f2e1d
|
[
"Zlib"
] | null | null | null |
platform/hwconf_data/efr32zg13p/modules/WTIMER0/__init__.py
|
lenloe1/v2.7
|
9ac9c4a7bb37987af382c80647f42d84db5f2e1d
|
[
"Zlib"
] | 1
|
2020-08-25T02:36:22.000Z
|
2020-08-25T02:36:22.000Z
|
platform/hwconf_data/efr32zg13p/modules/WTIMER0/__init__.py
|
lenloe1/v2.7
|
9ac9c4a7bb37987af382c80647f42d84db5f2e1d
|
[
"Zlib"
] | 1
|
2020-08-25T01:56:04.000Z
|
2020-08-25T01:56:04.000Z
|
import efr32zg13p.halconfig.halconfig_types as halconfig_types
import efr32zg13p.halconfig.halconfig_dependency as halconfig_dependency
import efr32zg13p.PythonSnippet.ExporterModel as ExporterModel
import efr32zg13p.PythonSnippet.RuntimeModel as RuntimeModel
import efr32zg13p.PythonSnippet.Metadata as Metadata
| 62.4
| 72
| 0.907051
| 34
| 312
| 8.205882
| 0.294118
| 0.286738
| 0.311828
| 0.243728
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068259
| 0.060897
| 312
| 5
| 73
| 62.4
| 0.883959
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.